From 09ce066d03602df77569f5bfb225ed5859baa1e6 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Wed, 28 May 2014 18:20:09 +0100 Subject: [PATCH] Backed out changeset 827fe00eecc7 (bug 1013392) for reftest failures on Windows; CLOSED TREE --- layout/base/nsDisplayList.h | 35 ----------------------------- layout/generic/nsGfxScrollFrame.cpp | 18 +++++++-------- layout/xul/nsBoxFrame.cpp | 33 +++++++++------------------ 3 files changed, 20 insertions(+), 66 deletions(-) diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index e576f4fedf29..994139cc8510 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -118,7 +118,6 @@ public: typedef mozilla::DisplayListClipState DisplayListClipState; typedef nsIWidget::ThemeGeometry ThemeGeometry; typedef mozilla::layers::Layer Layer; - typedef mozilla::layers::FrameMetrics FrameMetrics; typedef mozilla::layers::FrameMetrics::ViewID ViewID; /** @@ -258,15 +257,6 @@ public: * Get the ViewID of the nearest scrolling ancestor frame. */ ViewID GetCurrentScrollParentId() const { return mCurrentScrollParentId; } - /** - * Get the ViewID and the scrollbar flags corresponding to the scrollbar for - * which we are building display items at the moment. - */ - void GetScrollbarInfo(ViewID* aOutScrollbarTarget, uint32_t* aOutScrollbarFlags) - { - *aOutScrollbarTarget = mCurrentScrollbarTarget; - *aOutScrollbarFlags = mCurrentScrollbarFlags; - } /** * Calling this setter makes us include all out-of-flow descendant * frames in the display list, wherever they may be positioned (even @@ -640,29 +630,6 @@ public: ViewID mOldValue; }; - /** - * A helper class to temporarily set the value of mCurrentScrollbarTarget - * and mCurrentScrollbarFlags. - */ - class AutoCurrentScrollbarInfoSetter; - friend class AutoCurrentScrollbarInfoSetter; - class AutoCurrentScrollbarInfoSetter { - public: - AutoCurrentScrollbarInfoSetter(nsDisplayListBuilder* aBuilder, ViewID aScrollTargetID, - uint32_t aScrollbarFlags) - : mBuilder(aBuilder) { - aBuilder->mCurrentScrollbarTarget = aScrollTargetID; - aBuilder->mCurrentScrollbarFlags = aScrollbarFlags; - } - ~AutoCurrentScrollbarInfoSetter() { - // No need to restore old values because scrollbars cannot be nested. - mBuilder->mCurrentScrollbarTarget = FrameMetrics::NULL_SCROLL_ID; - mBuilder->mCurrentScrollbarFlags = 0; - } - private: - nsDisplayListBuilder* mBuilder; - }; - // Helpers for tables nsDisplayTableItem* GetCurrentTableItem() { return mCurrentTableItem; } void SetCurrentTableItem(nsDisplayTableItem* aTableItem) { mCurrentTableItem = aTableItem; } @@ -774,8 +741,6 @@ private: nsTArray mDisplayItemClipsToDestroy; Mode mMode; ViewID mCurrentScrollParentId; - ViewID mCurrentScrollbarTarget; - uint32_t mCurrentScrollbarFlags; BlendModeSet mContainedBlendModes; bool mBuildCaret; bool mIgnoreSuppression; diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 9056d100a94e..0354471e1706 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -2134,13 +2134,15 @@ MaxZIndexInList(nsDisplayList* aList, nsDisplayListBuilder* aBuilder) static void AppendToTop(nsDisplayListBuilder* aBuilder, const nsDisplayListSet& aLists, nsDisplayList* aSource, nsIFrame* aSourceFrame, bool aOwnLayer, + uint32_t aFlags, mozilla::layers::FrameMetrics::ViewID aScrollTargetId, bool aPositioned) { if (aSource->IsEmpty()) return; nsDisplayWrapList* newItem = aOwnLayer? - new (aBuilder) nsDisplayOwnLayer(aBuilder, aSourceFrame, aSource) : + new (aBuilder) nsDisplayOwnLayer(aBuilder, aSourceFrame, aSource, + aFlags, aScrollTargetId) : new (aBuilder) nsDisplayWrapList(aBuilder, aSourceFrame, aSource); if (aPositioned) { @@ -2209,6 +2211,11 @@ ScrollFrameHelper::AppendScrollPartsTo(nsDisplayListBuilder* aBuilder, scrollParts.Sort(HoveredStateComparator()); for (uint32_t i = 0; i < scrollParts.Length(); ++i) { + nsDisplayListCollection partList; + mOuter->BuildDisplayListForChild( + aBuilder, scrollParts[i], aDirtyRect, partList, + nsIFrame::DISPLAY_CHILD_FORCE_STACKING_CONTEXT); + uint32_t flags = 0; if (scrollParts[i] == mVScrollbarBox) { flags |= nsDisplayOwnLayer::VERTICAL_SCROLLBAR; @@ -2217,18 +2224,11 @@ ScrollFrameHelper::AppendScrollPartsTo(nsDisplayListBuilder* aBuilder, flags |= nsDisplayOwnLayer::HORIZONTAL_SCROLLBAR; } - nsDisplayListBuilder::AutoCurrentScrollbarInfoSetter - infoSetter(aBuilder, scrollTargetId, flags); - nsDisplayListCollection partList; - mOuter->BuildDisplayListForChild( - aBuilder, scrollParts[i], aDirtyRect, partList, - nsIFrame::DISPLAY_CHILD_FORCE_STACKING_CONTEXT); - // DISPLAY_CHILD_FORCE_STACKING_CONTEXT put everything into // partList.PositionedDescendants(). ::AppendToTop(aBuilder, aLists, partList.PositionedDescendants(), scrollParts[i], - aCreateLayer, aPositioned); + aCreateLayer, flags, scrollTargetId, aPositioned); } } diff --git a/layout/xul/nsBoxFrame.cpp b/layout/xul/nsBoxFrame.cpp index f0f4b0e576c3..19c3aaf88795 100644 --- a/layout/xul/nsBoxFrame.cpp +++ b/layout/xul/nsBoxFrame.cpp @@ -1308,29 +1308,19 @@ nsBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, const nsRect& aDirtyRect, const nsDisplayListSet& aLists) { - bool forceLayer = false; - uint32_t flags = 0; - mozilla::layers::FrameMetrics::ViewID scrollTargetId = - mozilla::layers::FrameMetrics::NULL_SCROLL_ID; + // forcelayer is only supported on XUL elements with box layout + bool forceLayer = + GetContent()->HasAttr(kNameSpaceID_None, nsGkAtoms::layer) && + GetContent()->IsXUL(); + // Check for frames that are marked as a part of the region used + // in calculating glass margins on Windows. if (GetContent()->IsXUL()) { - // forcelayer is only supported on XUL elements with box layout - if (GetContent()->HasAttr(kNameSpaceID_None, nsGkAtoms::layer)) { - forceLayer = true; - } else { - nsIFrame* parent = GetParentBox(this); - if (parent && parent->GetType() == nsGkAtoms::sliderFrame) { - forceLayer = true; - aBuilder->GetScrollbarInfo(&scrollTargetId, &flags); + const nsStyleDisplay* styles = StyleDisplay(); + if (styles && styles->mAppearance == NS_THEME_WIN_EXCLUDE_GLASS) { + nsRect rect = nsRect(aBuilder->ToReferenceFrame(this), GetSize()); + aBuilder->AddExcludedGlassRegion(rect); } - } - // Check for frames that are marked as a part of the region used - // in calculating glass margins on Windows. - const nsStyleDisplay* styles = StyleDisplay(); - if (styles && styles->mAppearance == NS_THEME_WIN_EXCLUDE_GLASS) { - nsRect rect = nsRect(aBuilder->ToReferenceFrame(this), GetSize()); - aBuilder->AddExcludedGlassRegion(rect); - } } nsDisplayListCollection tempLists; @@ -1365,10 +1355,9 @@ nsBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, masterList.AppendToTop(tempLists.Content()); masterList.AppendToTop(tempLists.PositionedDescendants()); masterList.AppendToTop(tempLists.Outlines()); - // Wrap the list to make it its own layer aLists.Content()->AppendNewToTop(new (aBuilder) - nsDisplayOwnLayer(aBuilder, this, &masterList, flags, scrollTargetId)); + nsDisplayOwnLayer(aBuilder, this, &masterList)); } }