mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-18 15:55:36 +00:00
Backed out 3 changesets (bug 1436431) for Linting failures on a CLOSED TREE
Backed out changeset 477ef0f2e047 (bug 1436431) Backed out changeset 6d1b03688ba6 (bug 1436431) Backed out changeset a51257921d04 (bug 1436431)
This commit is contained in:
parent
bd34ea8894
commit
2f1bd2e3cf
@ -3768,37 +3768,13 @@ PresShell::GetRectVisibility(nsIFrame* aFrame,
|
||||
scrollPortRect = nsRect(nsPoint(0,0), rootFrame->GetSize());
|
||||
}
|
||||
|
||||
// scrollPortRect has the viewport visible area relative to rootFrame.
|
||||
nsRect visibleAreaRect(scrollPortRect);
|
||||
// Find the intersection of this and the frame's ancestor scrollable
|
||||
// frames. We walk the whole ancestor chain to find all the scrollable
|
||||
// frames.
|
||||
nsIScrollableFrame* scrollAncestorFrame =
|
||||
nsLayoutUtils::GetNearestScrollableFrame(aFrame,
|
||||
nsLayoutUtils::SCROLLABLE_INCLUDE_HIDDEN);
|
||||
while (scrollAncestorFrame) {
|
||||
nsRect scrollAncestorRect = scrollAncestorFrame->GetScrollPortRect();
|
||||
nsIFrame* f = do_QueryFrame(scrollAncestorFrame);
|
||||
scrollAncestorRect += f->GetOffsetTo(rootFrame);
|
||||
|
||||
visibleAreaRect = visibleAreaRect.Intersect(scrollAncestorRect);
|
||||
|
||||
// Continue up the chain.
|
||||
scrollAncestorFrame =
|
||||
nsLayoutUtils::GetNearestScrollableFrame(f->GetParent(),
|
||||
nsLayoutUtils::SCROLLABLE_INCLUDE_HIDDEN);
|
||||
}
|
||||
|
||||
// aRect is in the aFrame coordinate space, so bring it into rootFrame
|
||||
// coordinate space.
|
||||
nsRect r = aRect + aFrame->GetOffsetTo(rootFrame);
|
||||
// If aRect is entirely visible then we don't need to ensure that
|
||||
// at least aMinTwips of it is visible
|
||||
if (visibleAreaRect.Contains(r)) {
|
||||
if (scrollPortRect.Contains(r))
|
||||
return nsRectVisibility_kVisible;
|
||||
}
|
||||
|
||||
nsRect insetRect = visibleAreaRect;
|
||||
nsRect insetRect = scrollPortRect;
|
||||
insetRect.Deflate(aMinTwips, aMinTwips);
|
||||
if (r.YMost() <= insetRect.y)
|
||||
return nsRectVisibility_kAboveViewport;
|
||||
|
@ -830,23 +830,17 @@ public:
|
||||
|
||||
/**
|
||||
* Determine if a rectangle specified in the frame's coordinate system
|
||||
* intersects "enough" with the viewport to be considered visible. This
|
||||
* is not a strict test against the viewport -- it's a test against
|
||||
* the intersection of the viewport and the frame's ancestor scrollable
|
||||
* frames. If it doesn't intersect enough, return a value indicating
|
||||
* which direction the frame's topmost ancestor scrollable frame would
|
||||
* need to be scrolled to bring the frame into view.
|
||||
* intersects the viewport "enough" to be considered visible.
|
||||
* @param aFrame frame that aRect coordinates are specified relative to
|
||||
* @param aRect rectangle in twips to test for visibility
|
||||
* @param aMinTwips is the minimum distance in from the edge of the
|
||||
* visible area that an object must be to be counted
|
||||
* visible
|
||||
* @param aMinTwips is the minimum distance in from the edge of the viewport
|
||||
* that an object must be to be counted visible
|
||||
* @return nsRectVisibility_kVisible if the rect is visible
|
||||
* nsRectVisibility_kAboveViewport
|
||||
* nsRectVisibility_kBelowViewport
|
||||
* nsRectVisibility_kLeftOfViewport
|
||||
* nsRectVisibility_kRightOfViewport rectangle is outside the
|
||||
* topmost ancestor scrollable frame in the specified direction
|
||||
* nsRectVisibility_kRightOfViewport rectangle is outside the viewport
|
||||
* in the specified direction
|
||||
*/
|
||||
virtual nsRectVisibility GetRectVisibility(nsIFrame *aFrame,
|
||||
const nsRect &aRect,
|
||||
|
@ -1269,46 +1269,13 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
|
||||
if (!aGetTopVisibleLeaf && !frame->GetRect().IsEmpty()) {
|
||||
rectVisibility =
|
||||
aPresShell->GetRectVisibility(frame,
|
||||
frame->GetRectRelativeToSelf(),
|
||||
nsRect(nsPoint(0,0), frame->GetSize()),
|
||||
minDistance);
|
||||
|
||||
if (rectVisibility == nsRectVisibility_kVisible) {
|
||||
// The primary frame of the range is visible, but we don't yet know if
|
||||
// any of the rects of the range itself are visible. Check to see if at
|
||||
// least one of the rects is visible.
|
||||
bool atLeastOneRangeRectVisible = false;
|
||||
|
||||
nsIFrame* containerFrame =
|
||||
nsLayoutUtils::GetContainingBlockForClientRect(frame);
|
||||
RefPtr<DOMRectList> rects = aRange->GetClientRects(true, true);
|
||||
for (uint32_t i = 0; i < rects->Length(); ++i) {
|
||||
RefPtr<DOMRect> rect = rects->Item(i);
|
||||
nsRect r(nsPresContext::CSSPixelsToAppUnits((float)rect->X()),
|
||||
nsPresContext::CSSPixelsToAppUnits((float)rect->Y()),
|
||||
nsPresContext::CSSPixelsToAppUnits((float)rect->Width()),
|
||||
nsPresContext::CSSPixelsToAppUnits((float)rect->Height()));
|
||||
|
||||
// r is relative to containerFrame; transform it back to frame, so we
|
||||
// can do a proper visibility check that is cropped to all of frame's
|
||||
// ancestor scroll frames.
|
||||
nsLayoutUtils::TransformResult res =
|
||||
nsLayoutUtils::TransformRect(containerFrame, frame, r);
|
||||
if (res == nsLayoutUtils::TransformResult::TRANSFORM_SUCCEEDED) {
|
||||
nsRectVisibility rangeRectVisibility =
|
||||
aPresShell->GetRectVisibility(frame, r, minDistance);
|
||||
|
||||
if (rangeRectVisibility == nsRectVisibility_kVisible) {
|
||||
atLeastOneRangeRectVisible = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (atLeastOneRangeRectVisible) {
|
||||
// This is an early exit case, where we return true if and only if
|
||||
// the range is actually rendered.
|
||||
return IsRangeRendered(aPresShell, aPresContext, aRange);
|
||||
}
|
||||
// This is an early exit case, where we return true if and only if
|
||||
// the range is actually rendered.
|
||||
return IsRangeRendered(aPresShell, aPresContext, aRange);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,6 @@ support-files =
|
||||
[browser_Finder.js]
|
||||
[browser_Finder_hidden_textarea.js]
|
||||
[browser_Finder_offscreen_text.js]
|
||||
[browser_Finder_overflowed_onscreen.js]
|
||||
[browser_Finder_overflowed_textarea.js]
|
||||
[browser_Finder_pointer_events_none.js]
|
||||
[browser_Finder_vertical_text.js]
|
||||
|
@ -1,40 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
add_task(async function test_vertical_text() {
|
||||
const URI = '<body><div style="max-height: 100px; max-width: 100px; overflow: scroll;"><div style="padding-left: 100px; max-height: 100px; max-width: 200px; overflow: auto;">d<br/><br/><br/><br/>c----------------b<br/><br/><br/><br/>a</div></div></body>';
|
||||
await BrowserTestUtils.withNewTab({ gBrowser, url: "data:text/html;charset=utf-8," + encodeURIComponent(URI) },
|
||||
async function(browser) {
|
||||
let finder = browser.finder;
|
||||
let listener = {
|
||||
onFindResult() {
|
||||
ok(false, "callback wasn't replaced");
|
||||
}
|
||||
};
|
||||
finder.addResultListener(listener);
|
||||
|
||||
function waitForFind() {
|
||||
return new Promise(resolve => {
|
||||
listener.onFindResult = resolve;
|
||||
});
|
||||
}
|
||||
|
||||
let targets = [
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
"d",
|
||||
];
|
||||
|
||||
for (let i = 0; i < targets.length; ++i) {
|
||||
// Find the target text.
|
||||
let target = targets[i];
|
||||
let promiseFind = waitForFind();
|
||||
finder.fastFind(target, false, false);
|
||||
let findResult = await promiseFind;
|
||||
isnot(findResult.result, Ci.nsITypeAheadFind.FIND_NOTFOUND, "Found target text '" + target + "'.");
|
||||
}
|
||||
|
||||
finder.removeResultListener(listener);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user