Backed out 6 changesets (bug 1302470) for mochitest-chrome failures

CLOSED TREE

Backed out changeset 3aab8b1494ef (bug 1302470)
Backed out changeset fdd40abac611 (bug 1302470)
Backed out changeset a67bc2f1b624 (bug 1302470)
Backed out changeset 160522290018 (bug 1302470)
Backed out changeset 6b948c533944 (bug 1302470)
Backed out changeset 399011313b3c (bug 1302470)

MozReview-Commit-ID: 2B3uMAkzNGv
This commit is contained in:
Phil Ringnalda 2017-08-31 20:04:24 -07:00
Родитель 2c559035f7
Коммит b8183bc0b4
8 изменённых файлов: 20 добавлений и 125 удалений

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

@ -3278,8 +3278,6 @@ nsLayoutUtils::GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect,
builder.SetDescendIntoSubdocuments(false);
}
builder.SetHitTestShouldStopAtFirstOpaque(aFlags & ONLY_VISIBLE);
builder.EnterPresShell(aFrame);
builder.SetDirtyRect(aRect);
aFrame->BuildDisplayListForStackingContext(&builder, &list);
@ -3296,6 +3294,7 @@ nsLayoutUtils::GetFramesForArea(nsIFrame* aFrame, const nsRect& aRect,
#endif
nsDisplayItem::HitTestState hitTestState;
builder.SetHitTestShouldStopAtFirstOpaque(aFlags & ONLY_VISIBLE);
list.HitTest(&builder, aRect, &hitTestState, &aOutFrames);
list.DeleteAll(&builder);
return NS_OK;

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

@ -113,7 +113,7 @@ nsHTMLButtonControlFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsDisplayListCollection set;
// Do not allow the child subtree to receive events.
if (!isForEventDelivery || aBuilder->HitTestShouldStopAtFirstOpaque()) {
if (!isForEventDelivery) {
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
if (ShouldClipPaintingToBorderBox()) {

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

@ -5693,20 +5693,12 @@ nsDisplayWrapList::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion
nsDisplayWrapList::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
bool* aSnap) {
*aSnap = false;
nsRegion result;
if (mList.IsOpaque()) {
// Everything within GetBounds that's visible is opaque.
result = GetBounds(aBuilder, aSnap);
} else if (aBuilder->HitTestShouldStopAtFirstOpaque()) {
// If we care about an accurate opaque region, iterate the display list
// and build up a region of opaque bounds.
nsDisplayItem* item = mList.GetBottom();
while (item) {
result.OrWith(item->GetOpaqueRegion(aBuilder, aSnap));
item = item->GetAbove();
}
}
*aSnap = false;
return result;
}

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

@ -57,12 +57,9 @@ interface nsITypeAheadFind : nsISupports
* necessarily happen automatically. */
void collapseSelection();
/* Check if a range is visible using heuristics */
/* Check if a range is visible */
boolean isRangeVisible(in nsIDOMRange aRange, in boolean aMustBeInViewPort);
/* Check if a range is actually rendered (out of viewport always false) */
boolean isRangeRendered(in nsIDOMRange aRange);
/******************************* Attributes ******************************/
readonly attribute AString searchString;

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

@ -1218,13 +1218,11 @@ 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.
@ -1234,6 +1232,8 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
}
// ---- 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 startFrameOffset, endFrameOffset;
@ -1269,22 +1269,12 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
minDistance);
if (rectVisibility != nsRectVisibility_kAboveViewport) {
// This is an early exit case, where we return true iff the range
// is actually rendered.
return IsRangeRendered(aPresShell, aPresContext, aRange);
return true;
}
}
// 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,
// We know that the target range isn't usable because it's not in the
// view port. 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));
@ -1298,9 +1288,8 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
false // aSkipPopupChecks
);
if (!frameTraversal) {
if (!frameTraversal)
return false;
}
while (rectVisibility == nsRectVisibility_kAboveViewport) {
frameTraversal->Next();
@ -1329,86 +1318,6 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
return false;
}
NS_IMETHODIMP
nsTypeAheadFind::IsRangeRendered(nsIDOMRange *aRange,
bool *aResult)
{
// Jump through hoops to extract the docShell from the range.
nsCOMPtr<nsIDOMNode> node;
aRange->GetStartContainer(getter_AddRefs(node));
nsCOMPtr<nsIDOMDocument> document;
node->GetOwnerDocument(getter_AddRefs(document));
nsCOMPtr<mozIDOMWindowProxy> window;
document->GetDefaultView(getter_AddRefs(window));
nsCOMPtr<nsIWebNavigation> navNav (do_GetInterface(window));
nsCOMPtr<nsIDocShell> docShell (do_GetInterface(navNav));
// Set up the arguments needed to check if a range is visible.
nsCOMPtr<nsIPresShell> presShell (docShell->GetPresShell());
RefPtr<nsPresContext> presContext = presShell->GetPresContext();
*aResult = IsRangeRendered(presShell, presContext, aRange);
return NS_OK;
}
bool
nsTypeAheadFind::IsRangeRendered(nsIPresShell *aPresShell,
nsPresContext *aPresContext,
nsIDOMRange *aRange)
{
NS_ASSERTION(aPresShell && aPresContext && aRange,
"params are invalid");
nsCOMPtr<nsIDOMNode> node;
aRange->GetCommonAncestorContainer(getter_AddRefs(node));
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
if (!content) {
return false;
}
nsIFrame *frame = content->GetPrimaryFrame();
if (!frame) {
return false; // No frame! Not visible then.
}
if (!frame->StyleVisibility()->IsVisible()) {
return false;
}
// Having a primary frame doesn't mean that the range is visible inside the
// viewport. Do a hit-test to determine that quickly and properly.
AutoTArray<nsIFrame*,8> frames;
nsIFrame *rootFrame = aPresShell->GetRootFrame();
RefPtr<nsRange> range = static_cast<nsRange*>(aRange);
RefPtr<mozilla::dom::DOMRectList> rects = range->GetClientRects(true, false);
for (uint32_t i = 0; i < rects->Length(); ++i) {
RefPtr<mozilla::dom::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()));
// Append visible frames to frames array.
nsLayoutUtils::GetFramesForArea(rootFrame, r, frames,
nsLayoutUtils::IGNORE_PAINT_SUPPRESSION |
nsLayoutUtils::IGNORE_ROOT_SCROLL_FRAME |
nsLayoutUtils::ONLY_VISIBLE);
// See if any of the frames contain the content. If they do, then the range
// is visible. We search for the content rather than the original frame,
// because nsTextContinuation frames might be returned instead of the
// original frame.
for (const auto &f: frames) {
if (f->GetContent() == content) {
return true;
}
}
frames.ClearAndRetainStorage();
}
return false;
}
already_AddRefed<nsIPresShell>
nsTypeAheadFind::GetPresShell()
{

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

@ -60,8 +60,6 @@ protected:
nsIDOMRange *aRange, bool aMustBeVisible,
bool aGetTopVisibleLeaf, nsIDOMRange **aNewRange,
bool *aUsesIndependentSelection);
bool IsRangeRendered(nsIPresShell *aPresShell, nsPresContext *aPresContext,
nsIDOMRange *aRange);
nsresult FindItNow(nsIPresShell *aPresShell, bool aIsLinksOnly,
bool aIsFirstVisiblePreferred, bool aFindPrev,
uint16_t* aResult);

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

@ -1129,9 +1129,6 @@ FinderHighlighter.prototype = {
let DOMRect = window.DOMRect;
for (let [range, rectsAndTexts] of dict.modalHighlightRectsMap) {
if (!this.finder._fastFind.isRangeVisible(range, false))
continue;
if (dict.updateAllRanges)
rectsAndTexts = this._updateRangeRects(range);

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

@ -13,7 +13,6 @@ Cu.import("resource://gre/modules/Timer.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NLP", "resource://gre/modules/NLP.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Rect", "resource://gre/modules/Geometry.jsm");
const kDebug = false;
const kIterationSizeMax = 100;
@ -580,13 +579,17 @@ this.FinderIterator = {
// Casting `window.frames` to an Iterator doesn't work, so we're stuck with
// a plain, old for-loop.
let dwu = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
for (let i = 0, l = window.frames.length; i < l; ++i) {
let frame = window.frames[i];
// Don't count matches in hidden frames; get the frame element rect and
// check if it's empty. We shan't flush!
// Don't count matches in hidden frames.
let frameEl = frame && frame.frameElement;
if (!frameEl || Rect.fromRect(dwu.getBoundsWithoutFlushing(frameEl)).isEmpty())
if (!frameEl)
continue;
// Construct a range around the frame element to check its visiblity.
let range = window.document.createRange();
range.setStart(frameEl, 0);
range.setEnd(frameEl, 0);
if (!finder._fastFind.isRangeVisible(range, this._getDocShell(range), true))
continue;
// All conditions pass, so push the current frame and its children on the
// stack.