Bug 1751473 Part 2 - Use CSSIntPoint instead of nsIntPoint in image event handling code. r=emilio

The old code operates in the CSS pixel coordinate, so we should use the type
system to express that. With this patch, nsImageControlFrame, nsImageFrame, and
nsImageMap now have no usage of nsIntPoint.

Differential Revision: https://phabricator.services.mozilla.com/D136647
This commit is contained in:
Ting-Yu Lin
2022-01-22 01:07:19 +00:00
parent a888081a15
commit e2882f10c3
6 changed files with 32 additions and 45 deletions

View File

@@ -1374,8 +1374,8 @@ void HTMLInputElement::AfterClearForm(bool aUnbindOrDelete) {
void HTMLInputElement::ResultForDialogSubmit(nsAString& aResult) {
if (mType == FormControlType::InputImage) {
// Get a property set by the frame to find out where it was clicked.
nsIntPoint* lastClickedPoint =
static_cast<nsIntPoint*>(GetProperty(nsGkAtoms::imageClickedPoint));
const auto* lastClickedPoint =
static_cast<CSSIntPoint*>(GetProperty(nsGkAtoms::imageClickedPoint));
int32_t x, y;
if (lastClickedPoint) {
x = lastClickedPoint->x;
@@ -5669,8 +5669,8 @@ HTMLInputElement::SubmitNamesValues(FormData* aFormData) {
// Submit .x, .y for input type=image
if (mType == FormControlType::InputImage) {
// Get a property set by the frame to find out where it was clicked.
nsIntPoint* lastClickedPoint =
static_cast<nsIntPoint*>(GetProperty(nsGkAtoms::imageClickedPoint));
const auto* lastClickedPoint =
static_cast<CSSIntPoint*>(GetProperty(nsGkAtoms::imageClickedPoint));
int32_t x, y;
if (lastClickedPoint) {
// Convert the values to strings for submission