Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(646)

Unified Diff: third_party/WebKit/Source/modules/canvas2d/EventHitRegion.cpp

Issue 1654653002: Canvas2d: Implement rerouting event by hit region's control. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bot errors Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
deleted file mode 100644
index 18d9701683c98fb9ecdf0d4e55070dc018b58f4b..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/modules/canvas2d/EventHitRegion.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "modules/canvas2d/EventHitRegion.h"
-
-#include "core/dom/Document.h"
-#include "core/html/HTMLCanvasElement.h"
-#include "core/layout/LayoutBox.h"
-#include "core/page/Page.h"
-#include "modules/canvas2d/CanvasRenderingContext2D.h"
-#include "modules/canvas2d/HitRegion.h"
-
-namespace blink {
-
-String EventHitRegion::regionIdFromAbsoluteLocation(HTMLCanvasElement& canvas, const LayoutPoint& location)
-{
- CanvasRenderingContext* context = canvas.renderingContext();
- if (!context || !context->is2d())
- return String();
-
- Document& document = canvas.document();
- document.updateLayoutTreeForNode(&canvas);
-
- // Adjust offsetLocation to be relative to the canvas's position.
- 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())
- return String();
-
- return hitRegion->id();
-}
-
-} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698