Bug 1340277. Fix stylo to properly update styles on the anonymous scrolled-content frame inside a scrollframe. r?emilio
MozReview-Commit-ID: DE4C6pIp8SC
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -4577,16 +4577,17 @@ nsCSSFrameConstructor::BeginBuildingScro
}
FrameConstructionItemList items;
AddFCItemsForAnonymousContent(aState, gfxScrollFrame, scrollNAC, items);
ConstructFramesFromItemList(aState, items, gfxScrollFrame, anonymousItems);
}
aNewFrame = gfxScrollFrame;
+ gfxScrollFrame->AddStateBits(NS_FRAME_OWNS_ANON_BOXES);
// we used the style that was passed in. So resolve another one.
StyleSetHandle styleSet = mPresShell->StyleSet();
RefPtr<nsStyleContext> scrolledChildStyle =
styleSet->ResolveAnonymousBoxStyle(aScrolledPseudo, contentStyle);
if (gfxScrollFrame) {
gfxScrollFrame->SetInitialChildList(kPrincipalList, anonymousItems);
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -1032,16 +1032,24 @@ public:
virtual bool DragScroll(mozilla::WidgetEvent* aEvent) override {
return mHelper.DragScroll(aEvent);
}
virtual void AsyncScrollbarDragRejected() override {
return mHelper.AsyncScrollbarDragRejected();
}
+ // Update the style on our scrolled frame.
+ virtual void DoUpdateStyleOfOwnedAnonBoxes(mozilla::ServoStyleSet& aStyleSet,
+ nsStyleChangeList& aChangeList,
+ nsChangeHint aHintForThisFrame) override {
+ UpdateStyleOfChildAnonBox(mHelper.GetScrolledFrame(), aStyleSet,
+ aChangeList, aHintForThisFrame);
+ }
+
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
#ifdef ACCESSIBILITY
virtual mozilla::a11y::AccType AccessibleType() override;
#endif
@@ -1466,16 +1474,23 @@ public:
virtual bool DragScroll(mozilla::WidgetEvent* aEvent) override {
return mHelper.DragScroll(aEvent);
}
virtual void AsyncScrollbarDragRejected() override {
return mHelper.AsyncScrollbarDragRejected();
}
+ virtual void DoUpdateStyleOfOwnedAnonBoxes(mozilla::ServoStyleSet& aStyleSet,
+ nsStyleChangeList& aChangeList,
+ nsChangeHint aHintForThisFrame) override {
+ UpdateStyleOfChildAnonBox(mHelper.GetScrolledFrame(), aStyleSet,
+ aChangeList, aHintForThisFrame);
+ }
+
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
protected:
nsXULScrollFrame(nsStyleContext* aContext, bool aIsRoot,
bool aClipAllDescendants);
new file mode 100644
--- /dev/null
+++ b/layout/reftests/columns/dynamic-change-with-overflow-1-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <div style="overflow: hidden; width: 130px; column-count: 2;">
+ Some long text that cannot possibly fit in 130px.
+ </div>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/columns/dynamic-change-with-overflow-1.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <div style="overflow: hidden; width: 130px">
+ Some long text that cannot possibly fit in 130px.
+ </div>
+
+ <script>
+ onload = function() {
+ var div = document.querySelector("div");
+ // Make sure layout has happened.
+ window.width = div.offsetWidth;
+ div.style.columnCount = "2";
+ document.documentElement.className = "";
+ }
+ </script>
+</html>
--- a/layout/reftests/columns/reftest-stylo.list
+++ b/layout/reftests/columns/reftest-stylo.list
@@ -31,8 +31,9 @@ fails == columnfill-overflow.html column
== margin-collapsing-bug616722-1.html margin-collapsing-bug616722-1.html
== margin-collapsing-bug616722-2.html margin-collapsing-bug616722-2.html
fails == column-balancing-nested-000.html column-balancing-nested-000.html
fails == column-balancing-nested-001.html column-balancing-nested-001.html
== columnrule-overflow.html columnrule-overflow.html
== columns-table-caption-000.html columns-table-caption-000.html
== positioning-transforms-bug1112501.html positioning-transforms-bug1112501.html
== fieldset-columns-001.html fieldset-columns-001.html
+== dynamic-change-with-overflow-1.html dynamic-change-with-overflow-1.html
--- a/layout/reftests/columns/reftest.list
+++ b/layout/reftests/columns/reftest.list
@@ -30,8 +30,9 @@ HTTP(..) == columnfill-auto-3.html colum
== margin-collapsing-bug616722-1.html margin-collapsing-bug616722-1-ref.html
== margin-collapsing-bug616722-2.html margin-collapsing-bug616722-2-ref.html
== column-balancing-nested-000.html column-balancing-nested-000-ref.html
== column-balancing-nested-001.html column-balancing-nested-001-ref.html
== columnrule-overflow.html columnrule-overflow-ref.html
== columns-table-caption-000.html columns-table-caption-000-ref.html
== positioning-transforms-bug1112501.html positioning-transforms-bug1112501-ref.html
fuzzy-if(browserIsRemote&&winWidget,140,276) == fieldset-columns-001.html fieldset-columns-001-ref.html
+== dynamic-change-with-overflow-1.html dynamic-change-with-overflow-1-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/text-indent/dynamic-change-with-overflow-1-ref.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+ <div style="overflow: hidden; text-indent: 50px">
+ Some text.
+ </div>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/text-indent/dynamic-change-with-overflow-1.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <div style="overflow: hidden;">
+ Some text.
+ </div>
+
+ <script>
+ onload = function() {
+ var div = document.querySelector("div");
+ // Make sure layout has happened.
+ window.width = div.offsetWidth;
+ div.style.textIndent = "50px";
+ document.documentElement.className = "";
+ }
+ </script>
+</html>
--- a/layout/reftests/text-indent/reftest-stylo.list
+++ b/layout/reftests/text-indent/reftest-stylo.list
@@ -13,8 +13,9 @@
== text-indent-multiple-line.html text-indent-multiple-line.html
== text-indent-multiple-line.html text-indent-multiple-line.html
== text-indent-multiple-line.html text-indent-multiple-line.html
== text-indent-intrinsic-pref.html text-indent-intrinsic-pref.html
== text-indent-intrinsic-min.html text-indent-intrinsic-min.html
== text-indent-negative-intrinsic-pref.html text-indent-negative-intrinsic-pref.html
== text-indent-negative-intrinsic-min.html text-indent-negative-intrinsic-min.html
== text-indent-parent-dynamic.html text-indent-parent-dynamic.html
+== dynamic-change-with-overflow-1.html dynamic-change-with-overflow-1.html
--- a/layout/reftests/text-indent/reftest.list
+++ b/layout/reftests/text-indent/reftest.list
@@ -12,8 +12,9 @@
== text-indent-multiple-line.html text-indent-multiple-line-ref-inline-margin.html
== text-indent-multiple-line.html text-indent-multiple-line-ref-float.html
!= text-indent-multiple-line.html text-indent-multiple-line-notref-block-margin.html
== text-indent-intrinsic-pref.html text-indent-intrinsic-pref-ref.html
== text-indent-intrinsic-min.html text-indent-intrinsic-min-ref.html
== text-indent-negative-intrinsic-pref.html text-indent-negative-intrinsic-pref-ref.html
== text-indent-negative-intrinsic-min.html text-indent-negative-intrinsic-min-ref.html
== text-indent-parent-dynamic.html text-indent-parent-dynamic-ref.html
+== dynamic-change-with-overflow-1.html dynamic-change-with-overflow-1-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/text-overflow/dynamic-change-1-ref.html
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+ <div style="overflow: hidden; width: 130px; white-space: nowrap;
+ text-overflow: ellipsis">
+ Some long text that cannot possibly fit in 130 px, because it just can't.
+ </div>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/text-overflow/dynamic-change-1.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+ <div style="overflow: hidden; width: 130px; white-space: nowrap">
+ Some long text that cannot possibly fit in 130 px, because it just can't.
+ </div>
+
+ <script>
+ onload = function() {
+ var div = document.querySelector("div");
+ // Make sure layout has happened.
+ window.width = div.offsetWidth;
+ div.style.textOverflow = "ellipsis";
+ document.documentElement.className = "";
+ }
+ </script>
+</html>
--- a/layout/reftests/text-overflow/reftest-stylo.list
+++ b/layout/reftests/text-overflow/reftest-stylo.list
@@ -20,16 +20,17 @@ fails HTTP(..) == marker-shadow.html mar
fails == clipped-elements.html clipped-elements.html
HTTP(..) == theme-overflow.html theme-overflow.html
fails HTTP(..) == table-cell.html table-cell.html
fails == two-value-syntax.html two-value-syntax.html
fails HTTP(..) == single-value.html single-value.html
fails == atomic-under-marker.html atomic-under-marker.html
fuzzy(1,2616) skip-if(Android) fuzzy-if(asyncPan&&!layersGPUAccelerated,102,12352) fails-if(http.oscpu=="Linux\u0020x86_64") HTTP(..) == xulscroll.html xulscroll.html
fails HTTP(..) == combobox-zoom.html combobox-zoom.html
+== dynamic-change-1.html dynamic-change-1.html
# The vertical-text pref setting can be removed after bug 1138384 lands
fails == vertical-decorations-1.html vertical-decorations-1.html # Bug 1341724
fails == vertical-decorations-2.html vertical-decorations-2.html # Bug 1341724
fails == vertical-decorations-1.html vertical-decorations-1.html # Bug 1341724
fails == vertical-decorations-2.html vertical-decorations-2.html # Bug 1341724
== vertical-decorations-3.html vertical-decorations-3.html
== vertical-decorations-4.html vertical-decorations-4.html
--- a/layout/reftests/text-overflow/reftest.list
+++ b/layout/reftests/text-overflow/reftest.list
@@ -19,16 +19,17 @@ HTTP(..) == marker-shadow.html marker-sh
skip-if(Android) fuzzy-if(skiaContent,1,5) == clipped-elements.html clipped-elements-ref.html
HTTP(..) == theme-overflow.html theme-overflow-ref.html
HTTP(..) == table-cell.html table-cell-ref.html
fuzzy-if(gtkWidget,10,32) HTTP(..) == two-value-syntax.html two-value-syntax-ref.html
HTTP(..) == single-value.html single-value-ref.html
fuzzy-if(gtkWidget,10,2) HTTP(..) == atomic-under-marker.html atomic-under-marker-ref.html
fuzzy(1,2616) skip-if(Android) fuzzy-if(asyncPan&&!layersGPUAccelerated,102,12352) fails-if(gtkWidget) HTTP(..) == xulscroll.html xulscroll-ref.html # gtkWidget:bug 1309107, bug 1328771
HTTP(..) == combobox-zoom.html combobox-zoom-ref.html
+== dynamic-change-1.html dynamic-change-1-ref.html
# The vertical-text pref setting can be removed after bug 1138384 lands
== vertical-decorations-1.html vertical-decorations-1-ref.html
== vertical-decorations-2.html vertical-decorations-2-ref.html
!= vertical-decorations-1.html vertical-decorations-1-2-notref.html
!= vertical-decorations-2.html vertical-decorations-1-2-notref.html
== vertical-decorations-3.html vertical-decorations-3-ref.html
== vertical-decorations-4.html vertical-decorations-4-ref.html