Bug 837242. Part 1: Convert bool parameters to flags. r=mats

--HG--
extra : rebase_source : e59fe41c41f2be6b4f0c78528cf954093f3011bd
This commit is contained in:
Robert O'Callahan 2013-07-26 14:31:41 +12:00
Родитель 71ed3a62d3
Коммит 669a28a75c
4 изменённых файлов: 34 добавлений и 31 удалений

Просмотреть файл

@ -3137,8 +3137,9 @@ nsDocument::ElementFromPointHelper(float aX, float aY,
return nullptr; // return null to premature XUL callers as a reminder to wait return nullptr; // return null to premature XUL callers as a reminder to wait
} }
nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt, true, nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt,
aIgnoreRootScrollFrame); nsLayoutUtils::IGNORE_PAINT_SUPPRESSION |
(aIgnoreRootScrollFrame ? nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME : 0));
if (!ptFrame) { if (!ptFrame) {
return nullptr; return nullptr;
} }
@ -3192,7 +3193,8 @@ nsDocument::NodesFromRectHelper(float aX, float aY,
nsAutoTArray<nsIFrame*,8> outFrames; nsAutoTArray<nsIFrame*,8> outFrames;
nsLayoutUtils::GetFramesForArea(rootFrame, rect, outFrames, nsLayoutUtils::GetFramesForArea(rootFrame, rect, outFrames,
true, aIgnoreRootScrollFrame); nsLayoutUtils::IGNORE_PAINT_SUPPRESSION |
(aIgnoreRootScrollFrame ? nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME : 0));
// Used to filter out repeated elements in sequence. // Used to filter out repeated elements in sequence.
nsIContent* lastAdded = nullptr; nsIContent* lastAdded = nullptr;
@ -9323,8 +9325,8 @@ nsIDocument::CaretPositionFromPoint(float aX, float aY)
return nullptr; return nullptr;
} }
nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt, true, nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt,
false); nsLayoutUtils::IGNORE_PAINT_SUPPRESSION);
if (!ptFrame) { if (!ptFrame) {
return nullptr; return nullptr;
} }

Просмотреть файл

@ -249,10 +249,10 @@ FindFrameTargetedByInputEvent(const nsGUIEvent *aEvent,
const nsPoint& aPointRelativeToRootFrame, const nsPoint& aPointRelativeToRootFrame,
uint32_t aFlags) uint32_t aFlags)
{ {
bool ignoreRootScrollFrame = (aFlags & INPUT_IGNORE_ROOT_SCROLL_FRAME) != 0; uint32_t flags = (aFlags & INPUT_IGNORE_ROOT_SCROLL_FRAME) ?
nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME : 0;
nsIFrame* target = nsIFrame* target =
nsLayoutUtils::GetFrameForPoint(aRootFrame, aPointRelativeToRootFrame, nsLayoutUtils::GetFrameForPoint(aRootFrame, aPointRelativeToRootFrame, flags);
false, ignoreRootScrollFrame);
const EventRadiusPrefs* prefs = GetPrefsFor(aEvent->eventStructType); const EventRadiusPrefs* prefs = GetPrefsFor(aEvent->eventStructType);
if (!prefs || !prefs->mEnabled || (target && IsElementClickable(target))) { if (!prefs || !prefs->mEnabled || (target && IsElementClickable(target))) {
@ -271,7 +271,7 @@ FindFrameTargetedByInputEvent(const nsGUIEvent *aEvent,
nsRect targetRect = GetTargetRect(aRootFrame, aPointRelativeToRootFrame, prefs); nsRect targetRect = GetTargetRect(aRootFrame, aPointRelativeToRootFrame, prefs);
nsAutoTArray<nsIFrame*,8> candidates; nsAutoTArray<nsIFrame*,8> candidates;
nsresult rv = nsLayoutUtils::GetFramesForArea(aRootFrame, targetRect, candidates, nsresult rv = nsLayoutUtils::GetFramesForArea(aRootFrame, targetRect, candidates,
false, ignoreRootScrollFrame); flags | nsLayoutUtils::EXCLUDE_COVERED_FRAMES);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return target; return target;
} }

Просмотреть файл

@ -1802,15 +1802,12 @@ nsLayoutUtils::GetRemoteContentIds(nsIFrame* aFrame,
} }
nsIFrame* nsIFrame*
nsLayoutUtils::GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt, nsLayoutUtils::GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt, uint32_t aFlags)
bool aShouldIgnoreSuppression,
bool aIgnoreRootScrollFrame)
{ {
PROFILER_LABEL("nsLayoutUtils", "GetFrameForPoint"); PROFILER_LABEL("nsLayoutUtils", "GetFrameForPoint");
nsresult rv; nsresult rv;
nsAutoTArray<nsIFrame*,8> outFrames; nsAutoTArray<nsIFrame*,8> outFrames;
rv = GetFramesForArea(aFrame, nsRect(aPt, nsSize(1, 1)), outFrames, rv = GetFramesForArea(aFrame, nsRect(aPt, nsSize(1, 1)), outFrames, aFlags);
aShouldIgnoreSuppression, aIgnoreRootScrollFrame);
NS_ENSURE_SUCCESS(rv, nullptr); NS_ENSURE_SUCCESS(rv, nullptr);
return outFrames.Length() ? outFrames.ElementAt(0) : nullptr; return outFrames.Length() ? outFrames.ElementAt(0) : nullptr;
} }
@ -1818,20 +1815,19 @@ nsLayoutUtils::GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt,
nsresult nsresult
nsLayoutUtils::GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect, nsLayoutUtils::GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect,
nsTArray<nsIFrame*> &aOutFrames, nsTArray<nsIFrame*> &aOutFrames,
bool aShouldIgnoreSuppression, uint32_t aFlags)
bool aIgnoreRootScrollFrame)
{ {
PROFILER_LABEL("nsLayoutUtils","GetFramesForArea"); PROFILER_LABEL("nsLayoutUtils","GetFramesForArea");
nsDisplayListBuilder builder(aFrame, nsDisplayListBuilder::EVENT_DELIVERY, nsDisplayListBuilder builder(aFrame, nsDisplayListBuilder::EVENT_DELIVERY,
false); false);
nsDisplayList list; nsDisplayList list;
nsRect target(aRect); nsRect target(aRect);
if (aShouldIgnoreSuppression) { if (aFlags & IGNORE_PAINT_SUPPRESSION) {
builder.IgnorePaintSuppression(); builder.IgnorePaintSuppression();
} }
if (aIgnoreRootScrollFrame) { if (aFlags & IGNORE_ROOT_SCROLL_FRAME) {
nsIFrame* rootScrollFrame = nsIFrame* rootScrollFrame =
aFrame->PresContext()->PresShell()->GetRootScrollFrame(); aFrame->PresContext()->PresShell()->GetRootScrollFrame();
if (rootScrollFrame) { if (rootScrollFrame) {

Просмотреть файл

@ -526,19 +526,28 @@ public:
nsTArray<ViewID> &aOutIDs, nsTArray<ViewID> &aOutIDs,
bool aIgnoreRootScrollFrame); bool aIgnoreRootScrollFrame);
enum FrameForPointFlags {
/**
* When set, paint suppression is ignored, so we'll return non-root page
* elements even if paint suppression is stopping them from painting.
*/
IGNORE_PAINT_SUPPRESSION = 0x01,
/**
* When set, clipping due to the root scroll frame (and any other viewport-
* related clipping) is ignored.
*/
IGNORE_ROOT_SCROLL_FRAME = 0x02
};
/** /**
* Given aFrame, the root frame of a stacking context, find its descendant * Given aFrame, the root frame of a stacking context, find its descendant
* frame under the point aPt that receives a mouse event at that location, * frame under the point aPt that receives a mouse event at that location,
* or nullptr if there is no such frame. * or nullptr if there is no such frame.
* @param aPt the point, relative to the frame origin * @param aPt the point, relative to the frame origin
* @param aShouldIgnoreSuppression a boolean to control if the display * @param aFlags some combination of FrameForPointFlags
* list builder should ignore paint suppression or not
* @param aIgnoreRootScrollFrame whether or not the display list builder
* should ignore the root scroll frame.
*/ */
static nsIFrame* GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt, static nsIFrame* GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt,
bool aShouldIgnoreSuppression = false, uint32_t aFlags = 0);
bool aIgnoreRootScrollFrame = false);
/** /**
* Given aFrame, the root frame of a stacking context, find all descendant * Given aFrame, the root frame of a stacking context, find all descendant
@ -546,15 +555,11 @@ public:
* or nullptr if there is no such frame. * or nullptr if there is no such frame.
* @param aRect the rect, relative to the frame origin * @param aRect the rect, relative to the frame origin
* @param aOutFrames an array to add all the frames found * @param aOutFrames an array to add all the frames found
* @param aShouldIgnoreSuppression a boolean to control if the display * @param aFlags some combination of FrameForPointFlags
* list builder should ignore paint suppression or not
* @param aIgnoreRootScrollFrame whether or not the display list builder
* should ignore the root scroll frame.
*/ */
static nsresult GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect, static nsresult GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect,
nsTArray<nsIFrame*> &aOutFrames, nsTArray<nsIFrame*> &aOutFrames,
bool aShouldIgnoreSuppression = false, uint32_t aFlags = 0);
bool aIgnoreRootScrollFrame = false);
/** /**
* Transform aRect relative to aAncestor down to the coordinate system of * Transform aRect relative to aAncestor down to the coordinate system of