Title: [168230] trunk
Revision
168230
Author
akl...@apple.com
Date
2014-05-03 15:16:53 -0700 (Sat, 03 May 2014)

Log Message

Invalidate scrollbars when custom scrollbar style changes dynamically.
<https://webkit.org/b/132529>

Source/WebCore:
Add a ScrollView::styleDidChange() and call that from RenderView::styleDidChange()
so that the scrollbars are sure to get repainted with potentially different style.

Reviewed by Antti Koivisto.

Test: fast/css/scrollbar-dynamic-style-change.html

* platform/ScrollView.cpp:
(WebCore::ScrollView::styleDidChange):
* platform/ScrollView.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::styleDidChange):

LayoutTests:
Reviewed by Antti Koivisto.

* fast/css/scrollbar-dynamic-style-change-expected.html: Added.
* fast/css/scrollbar-dynamic-style-change.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (168229 => 168230)


--- trunk/LayoutTests/ChangeLog	2014-05-03 20:46:50 UTC (rev 168229)
+++ trunk/LayoutTests/ChangeLog	2014-05-03 22:16:53 UTC (rev 168230)
@@ -1,3 +1,13 @@
+2014-05-03  Andreas Kling  <akl...@apple.com>
+
+        Invalidate scrollbars when custom scrollbar style changes dynamically.
+        <https://webkit.org/b/132529>
+
+        Reviewed by Antti Koivisto.
+
+        * fast/css/scrollbar-dynamic-style-change-expected.html: Added.
+        * fast/css/scrollbar-dynamic-style-change.html: Added.
+
 2014-05-03  Simon Fraser  <simon.fra...@apple.com>
 
         [UI-side compositing] Assertion in PlatformCAFilters::setFiltersOnLayer with animated reference filter

Added: trunk/LayoutTests/fast/css/scrollbar-dynamic-style-change-expected.html (0 => 168230)


--- trunk/LayoutTests/fast/css/scrollbar-dynamic-style-change-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/scrollbar-dynamic-style-change-expected.html	2014-05-03 22:16:53 UTC (rev 168230)
@@ -0,0 +1,15 @@
+<style>
+::-webkit-scrollbar {
+    background: green;
+}
+body {
+    overflow: scroll;
+}
+div {
+    overflow: scroll;
+    width: 200px;
+    height: 200px;
+}
+</style>
+<div></div>
+</script>

Added: trunk/LayoutTests/fast/css/scrollbar-dynamic-style-change.html (0 => 168230)


--- trunk/LayoutTests/fast/css/scrollbar-dynamic-style-change.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/scrollbar-dynamic-style-change.html	2014-05-03 22:16:53 UTC (rev 168230)
@@ -0,0 +1,20 @@
+<style>
+::-webkit-scrollbar {
+    background: red;
+}
+body {
+    overflow: scroll;
+}
+div {
+    overflow: scroll;
+    width: 200px;
+    height: 200px;
+}
+</style>
+<div></div>
+<script>
+window._onload_ = function() {
+    document.body.offsetWidth;
+    document.styleSheets[0].cssRules[0].style.backgroundColor = 'green';
+}
+</script>

Modified: trunk/Source/WebCore/ChangeLog (168229 => 168230)


--- trunk/Source/WebCore/ChangeLog	2014-05-03 20:46:50 UTC (rev 168229)
+++ trunk/Source/WebCore/ChangeLog	2014-05-03 22:16:53 UTC (rev 168230)
@@ -1,3 +1,21 @@
+2014-05-03  Andreas Kling  <akl...@apple.com>
+
+        Invalidate scrollbars when custom scrollbar style changes dynamically.
+        <https://webkit.org/b/132529>
+
+        Add a ScrollView::styleDidChange() and call that from RenderView::styleDidChange()
+        so that the scrollbars are sure to get repainted with potentially different style.
+
+        Reviewed by Antti Koivisto.
+
+        Test: fast/css/scrollbar-dynamic-style-change.html
+
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::styleDidChange):
+        * platform/ScrollView.h:
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::styleDidChange):
+
 2014-05-03  Simon Fraser  <simon.fra...@apple.com>
 
         Very fuzzy layers under non-decompasable matrices

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (168229 => 168230)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2014-05-03 20:46:50 UTC (rev 168229)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2014-05-03 22:16:53 UTC (rev 168230)
@@ -1459,6 +1459,15 @@
         updateScrollbars(scrollOffset());
 }
 
+void ScrollView::styleDidChange()
+{
+    if (m_horizontalScrollbar)
+        m_horizontalScrollbar->styleChanged();
+
+    if (m_verticalScrollbar)
+        m_verticalScrollbar->styleChanged();
+}
+
 #if !PLATFORM(COCOA)
 
 void ScrollView::platformAddChild(Widget*)

Modified: trunk/Source/WebCore/platform/ScrollView.h (168229 => 168230)


--- trunk/Source/WebCore/platform/ScrollView.h	2014-05-03 20:46:50 UTC (rev 168229)
+++ trunk/Source/WebCore/platform/ScrollView.h	2014-05-03 22:16:53 UTC (rev 168230)
@@ -144,6 +144,8 @@
     // Overridden by FrameView to create custom CSS scrollbars if applicable.
     virtual PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
 
+    void styleDidChange();
+
     // If the prohibits scrolling flag is set, then all scrolling in the view (even programmatic scrolling) is turned off.
     void setProhibitsScrolling(bool b) { m_prohibitsScrolling = b; }
     bool prohibitsScrolling() const { return m_prohibitsScrolling; }

Modified: trunk/Source/WebCore/rendering/RenderView.cpp (168229 => 168230)


--- trunk/Source/WebCore/rendering/RenderView.cpp	2014-05-03 20:46:50 UTC (rev 168229)
+++ trunk/Source/WebCore/rendering/RenderView.cpp	2014-05-03 22:16:53 UTC (rev 168230)
@@ -1260,6 +1260,8 @@
     RenderBlockFlow::styleDidChange(diff, oldStyle);
     if (hasRenderNamedFlowThreads())
         flowThreadController().styleDidChange();
+
+    frameView().styleDidChange();
 }
 
 bool RenderView::hasRenderNamedFlowThreads() const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to