| Index: third_party/WebKit/Source/modules/canvas2d/EventHitRegion.cpp
|
| diff --git a/third_party/WebKit/Source/modules/canvas2d/EventHitRegion.cpp b/third_party/WebKit/Source/modules/canvas2d/EventHitRegion.cpp
|
| index fe7393ff5208476568d58103af3c2c92aed56df5..07651b8035c36cb88e46d8a5a119b317a64da9da 100644
|
| --- a/third_party/WebKit/Source/modules/canvas2d/EventHitRegion.cpp
|
| +++ b/third_party/WebKit/Source/modules/canvas2d/EventHitRegion.cpp
|
| @@ -6,7 +6,8 @@
|
|
|
| #include "core/dom/Document.h"
|
| #include "core/html/HTMLCanvasElement.h"
|
| -#include "core/layout/LayoutObject.h"
|
| +#include "core/layout/LayoutBox.h"
|
| +#include "core/page/Page.h"
|
| #include "modules/canvas2d/CanvasRenderingContext2D.h"
|
| #include "modules/canvas2d/HitRegion.h"
|
|
|
| @@ -22,14 +23,11 @@ String EventHitRegion::regionIdFromAbsoluteLocation(HTMLCanvasElement& canvas, c
|
| document.updateLayoutTreeForNodeIfNeeded(&canvas);
|
|
|
| // Adjust offsetLocation to be relative to the canvas's position.
|
| - LayoutObject* layoutObject = canvas.layoutObject();
|
| - FloatPoint localPos = layoutObject->absoluteToLocal(FloatPoint(location), UseTransforms);
|
| -
|
| - LocalFrame* frame = document.frame();
|
| - float zoomFactor = frame ? frame->pageZoomFactor() : 1;
|
| - float scaleFactor = 1 / zoomFactor;
|
| - if (scaleFactor != 1.0f)
|
| - localPos.scale(scaleFactor, scaleFactor);
|
| + LayoutBox* box = canvas.layoutBox();
|
| + FloatPoint localPos = box->absoluteToLocal(FloatPoint(location), UseTransforms);
|
| + if (box->hasBorderOrPadding())
|
| + localPos.move(-box->contentBoxOffset());
|
| + localPos.scale(canvas.width() / box->contentWidth(), canvas.height() / box->contentHeight());
|
|
|
| HitRegion* hitRegion = toCanvasRenderingContext2D(context)->hitRegionAtPoint(localPos);
|
| if (!hitRegion || hitRegion->id().isEmpty())
|
|
|