зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1302470 Part 3: Branch IsRangeVisible to delegate to IsRangeRendered when range is in viewport. r=masayuki
MozReview-Commit-ID: LZyvt08I9vz --HG-- extra : rebase_source : 56f44a967a3647a3c6bc326232467eaf69b7f447
This commit is contained in:
Родитель
341fe37811
Коммит
3b8a0f6bc7
|
@ -1210,22 +1210,22 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
|
|||
return false;
|
||||
|
||||
nsIFrame *frame = content->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
if (!frame) {
|
||||
return false; // No frame! Not visible then.
|
||||
}
|
||||
|
||||
if (!frame->StyleVisibility()->IsVisible())
|
||||
if (!frame->StyleVisibility()->IsVisible()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Detect if we are _inside_ a text control, or something else with its own
|
||||
// selection controller.
|
||||
if (aUsesIndependentSelection) {
|
||||
*aUsesIndependentSelection =
|
||||
*aUsesIndependentSelection =
|
||||
(frame->GetStateBits() & NS_FRAME_INDEPENDENT_SELECTION);
|
||||
}
|
||||
|
||||
// ---- We have a frame ----
|
||||
if (!aMustBeInViewPort)
|
||||
return true; // Don't need it to be on screen, just in rendering tree
|
||||
|
||||
// Get the next in flow frame that contains the range start
|
||||
int32_t startRangeOffset, startFrameOffset, endFrameOffset;
|
||||
|
@ -1259,12 +1259,22 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
|
|||
minDistance);
|
||||
|
||||
if (rectVisibility != nsRectVisibility_kAboveViewport) {
|
||||
return true;
|
||||
// This is an early exit case, where we return true iff the range
|
||||
// is actually rendered.
|
||||
return IsRangeRendered(aPresShell, aPresContext, aRange);
|
||||
}
|
||||
}
|
||||
|
||||
// We know that the target range isn't usable because it's not in the
|
||||
// view port. Move range forward to first visible point,
|
||||
// Below this point, we know the range is not in the viewport.
|
||||
|
||||
if (!aMustBeInViewPort) {
|
||||
// This is an early exit case because we don't care that that range
|
||||
// is out of viewport, so we return that the range is "visible".
|
||||
return true;
|
||||
}
|
||||
|
||||
// The range isn't in the viewport, but we could scroll it into view.
|
||||
// Move range forward to first visible point,
|
||||
// this speeds us up a lot in long documents
|
||||
nsCOMPtr<nsIFrameEnumerator> frameTraversal;
|
||||
nsCOMPtr<nsIFrameTraversal> trav(do_CreateInstance(kFrameTraversalCID));
|
||||
|
@ -1278,8 +1288,9 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
|
|||
false // aSkipPopupChecks
|
||||
);
|
||||
|
||||
if (!frameTraversal)
|
||||
if (!frameTraversal) {
|
||||
return false;
|
||||
}
|
||||
|
||||
while (rectVisibility == nsRectVisibility_kAboveViewport) {
|
||||
frameTraversal->Next();
|
||||
|
|
Загрузка…
Ссылка в новой задаче