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

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

Issue 2229743003: add HitTestCanvasResult Class instend of std::pair<Element*, String> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add HitTestCanvasResult Class instend of std::pair<Element*, String> Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
index 8f264c10c6db9eb4e9ae225cc17d8f9d6d4e17fd..75de18b5922262c6f05804b5852b72ff231cf1b8 100644
--- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
+++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
@@ -46,6 +46,7 @@
#include "core/frame/Settings.h"
#include "core/html/TextMetrics.h"
#include "core/html/canvas/CanvasFontCache.h"
+#include "core/layout/HitTestCanvasResult.h"
#include "core/layout/LayoutBox.h"
#include "core/layout/LayoutTheme.h"
#include "modules/canvas2d/CanvasStyle.h"
@@ -589,10 +590,10 @@ bool CanvasRenderingContext2D::parseColorOrCurrentColor(Color& color, const Stri
return ::blink::parseColorOrCurrentColor(color, colorString, canvas());
}
-std::pair<Element*, String> CanvasRenderingContext2D::getControlAndIdIfHitRegionExists(const LayoutPoint& location)
+HitTestCanvasResult* CanvasRenderingContext2D::getControlAndIdIfHitRegionExists(const LayoutPoint& location)
{
if (hitRegionsCount() <= 0)
- return std::make_pair(nullptr, String());
+ return HitTestCanvasResult::create(String(), nullptr);
LayoutBox* box = canvas()->layoutBox();
FloatPoint localPos = box->absoluteToLocal(FloatPoint(location), UseTransforms);
@@ -604,10 +605,10 @@ std::pair<Element*, String> CanvasRenderingContext2D::getControlAndIdIfHitRegion
if (hitRegion) {
Element* control = hitRegion->control();
if (control && canvas()->isSupportedInteractiveCanvasFallback(*control))
- return std::make_pair(hitRegion->control(), hitRegion->id());
- return std::make_pair(nullptr, hitRegion->id());
+ return HitTestCanvasResult::create(hitRegion->id(), hitRegion->control());
+ return HitTestCanvasResult::create(hitRegion->id(), nullptr);
}
- return std::make_pair(nullptr, String());
+ return HitTestCanvasResult::create(String(), nullptr);
}
String CanvasRenderingContext2D::getIdFromControl(const Element* element)
« no previous file with comments | « third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698