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

Unified Diff: cc/surfaces/surface_hittest.cc

Issue 2184033003: Refactor browser process coordinate transformation methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed problematic DCHECK Created 4 years, 5 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 | « cc/surfaces/surface_hittest.h ('k') | content/browser/frame_host/cross_process_frame_connector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_hittest.cc
diff --git a/cc/surfaces/surface_hittest.cc b/cc/surfaces/surface_hittest.cc
index 20fb717c46bfc3022b1e7e4740258ba669cff2da..e4605bdf8eeba6677d39512d2239965c8e879313 100644
--- a/cc/surfaces/surface_hittest.cc
+++ b/cc/surfaces/surface_hittest.cc
@@ -55,6 +55,30 @@ bool SurfaceHittest::GetTransformToTargetSurface(
transform);
}
+bool SurfaceHittest::TransformPointToTargetSurface(
+ const SurfaceId& original_surface_id,
+ const SurfaceId& target_surface_id,
+ gfx::Point* point) {
+ gfx::Transform transform;
+ // Two possibilities need to be considered: original_surface_id can be
+ // embedded in target_surface_id, or vice versa.
+ if (GetTransformToTargetSurface(target_surface_id, original_surface_id,
+ &transform)) {
+ if (transform.GetInverse(&transform))
+ transform.TransformPoint(point);
+ else
+ return false;
+ } else if (GetTransformToTargetSurface(original_surface_id, target_surface_id,
+ &transform)) {
+ // No need to invert the transform matrix in this case.
+ transform.TransformPoint(point);
+ } else {
+ return false;
+ }
+
+ return true;
+}
+
bool SurfaceHittest::GetTargetSurfaceAtPointInternal(
const SurfaceId& surface_id,
const RenderPassId& render_pass_id,
« no previous file with comments | « cc/surfaces/surface_hittest.h ('k') | content/browser/frame_host/cross_process_frame_connector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698