From 81b53bd666f807ffe3ac17a9d40eaef03498584c Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Mon, 27 Jan 2014 23:12:54 -0800 Subject: [PATCH] Back out 7bfec63e417b (bug 950225) for test failures CLOSED TREE --- layout/base/PositionedEventTargeting.cpp | 33 +++++-------------- .../base/tests/test_event_target_radius.html | 22 +------------ 2 files changed, 10 insertions(+), 45 deletions(-) diff --git a/layout/base/PositionedEventTargeting.cpp b/layout/base/PositionedEventTargeting.cpp index 42467727c3ba..c7d0c8f93640 100644 --- a/layout/base/PositionedEventTargeting.cpp +++ b/layout/base/PositionedEventTargeting.cpp @@ -227,22 +227,9 @@ AppUnitsFromMM(nsIFrame* aFrame, uint32_t aMM, bool aVertical) return NSToCoordRound(result); } -/** - * Clip aRect with the bounds of aFrame in the coordinate system of - * aRootFrame. aRootFrame is an ancestor of aFrame. - */ -static nsRect -ClipToFrame(nsIFrame* aRootFrame, nsIFrame* aFrame, nsRect& aRect) -{ - nsRegion bound = nsLayoutUtils::TransformFrameRectToAncestor( - aFrame, nsRect(nsPoint(0, 0), aFrame->GetSize()), aRootFrame); - nsRegion result = bound.Intersect(aRect); - return result.GetBounds(); -} - static nsRect GetTargetRect(nsIFrame* aRootFrame, const nsPoint& aPointRelativeToRootFrame, - nsIFrame* aRestrictToDescendants, const EventRadiusPrefs* aPrefs) + const EventRadiusPrefs* aPrefs) { nsMargin m(AppUnitsFromMM(aRootFrame, aPrefs->mSideRadii[0], true), AppUnitsFromMM(aRootFrame, aPrefs->mSideRadii[1], false), @@ -250,7 +237,7 @@ GetTargetRect(nsIFrame* aRootFrame, const nsPoint& aPointRelativeToRootFrame, AppUnitsFromMM(aRootFrame, aPrefs->mSideRadii[3], false)); nsRect r(aPointRelativeToRootFrame, nsSize(0,0)); r.Inflate(m); - return ClipToFrame(aRootFrame, aRestrictToDescendants, r); + return r; } static float @@ -375,6 +362,13 @@ FindFrameTargetedByInputEvent(const WidgetGUIEvent* aEvent, return target; } + nsRect targetRect = GetTargetRect(aRootFrame, aPointRelativeToRootFrame, prefs); + nsAutoTArray candidates; + nsresult rv = nsLayoutUtils::GetFramesForArea(aRootFrame, targetRect, candidates, flags); + if (NS_FAILED(rv)) { + return target; + } + // If the exact target is non-null, only consider candidate targets in the same // document as the exact target. Otherwise, if an ancestor document has // a mouse event handler for example, targets that are !IsElementClickable can @@ -382,15 +376,6 @@ FindFrameTargetedByInputEvent(const WidgetGUIEvent* aEvent, // would be targeted instead. nsIFrame* restrictToDescendants = target ? target->PresContext()->PresShell()->GetRootFrame() : aRootFrame; - - nsRect targetRect = GetTargetRect(aRootFrame, aPointRelativeToRootFrame, - restrictToDescendants, prefs); - nsAutoTArray candidates; - nsresult rv = nsLayoutUtils::GetFramesForArea(aRootFrame, targetRect, candidates, flags); - if (NS_FAILED(rv)) { - return target; - } - nsIFrame* closestClickable = GetClosest(aRootFrame, aPointRelativeToRootFrame, targetRect, prefs, restrictToDescendants, candidates); diff --git a/layout/base/tests/test_event_target_radius.html b/layout/base/tests/test_event_target_radius.html index e5b3a0c29e51..887080c28c6a 100644 --- a/layout/base/tests/test_event_target_radius.html +++ b/layout/base/tests/test_event_target_radius.html @@ -12,7 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=780847 .target { position:absolute; left:100px; top:100px; width:100px; height:100px; background:blue; } - +

@@ -47,11 +47,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=780847 - - - - -