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
}
nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt, true,
aIgnoreRootScrollFrame);
nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt,
nsLayoutUtils::IGNORE_PAINT_SUPPRESSION |
(aIgnoreRootScrollFrame ? nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME : 0));
if (!ptFrame) {
return nullptr;
}
@ -3192,7 +3193,8 @@ nsDocument::NodesFromRectHelper(float aX, float aY,
nsAutoTArray<nsIFrame*,8> 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.
nsIContent* lastAdded = nullptr;
@ -9323,8 +9325,8 @@ nsIDocument::CaretPositionFromPoint(float aX, float aY)
return nullptr;
}
nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt, true,
false);
nsIFrame *ptFrame = nsLayoutUtils::GetFrameForPoint(rootFrame, pt,
nsLayoutUtils::IGNORE_PAINT_SUPPRESSION);
if (!ptFrame) {
return nullptr;
}

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

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

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

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

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

@ -526,19 +526,28 @@ public:
nsTArray<ViewID> &aOutIDs,
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
* frame under the point aPt that receives a mouse event at that location,
* or nullptr if there is no such frame.
* @param aPt the point, relative to the frame origin
* @param aShouldIgnoreSuppression a boolean to control if the display
* list builder should ignore paint suppression or not
* @param aIgnoreRootScrollFrame whether or not the display list builder
* should ignore the root scroll frame.
* @param aFlags some combination of FrameForPointFlags
*/
static nsIFrame* GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt,
bool aShouldIgnoreSuppression = false,
bool aIgnoreRootScrollFrame = false);
uint32_t aFlags = 0);
/**
* 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.
* @param aRect the rect, relative to the frame origin
* @param aOutFrames an array to add all the frames found
* @param aShouldIgnoreSuppression a boolean to control if the display
* list builder should ignore paint suppression or not
* @param aIgnoreRootScrollFrame whether or not the display list builder
* should ignore the root scroll frame.
* @param aFlags some combination of FrameForPointFlags
*/
static nsresult GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect,
nsTArray<nsIFrame*> &aOutFrames,
bool aShouldIgnoreSuppression = false,
bool aIgnoreRootScrollFrame = false);
uint32_t aFlags = 0);
/**
* Transform aRect relative to aAncestor down to the coordinate system of