Title: [155323] trunk
Revision
155323
Author
[email protected]
Date
2013-09-08 23:54:02 -0700 (Sun, 08 Sep 2013)

Log Message

Scrollbar width is not applied when element hidden
https://bugs.webkit.org/show_bug.cgi?id=90546

Patch by Gurpreet Kaur <[email protected]> on 2013-09-08
Reviewed by Simon Fraser.

Source/WebCore:

Webkit has css properties through which custom scroll
bars can be added. Incase the element's visible property
is hidden and custom scrollbar properties are applied
the scrollbar width is not considered when quering the
element.clientWidth. Incase of non-custom scrollbars
whether the element's visible property is hidden or not
correct scrollbar width is considered.

Tests: fast/dom/Element/scroll-width-hidden.html
       fast/dom/Element/scroll-width-visible.html

* rendering/RenderScrollbar.cpp:
(WebCore::RenderScrollbar::updateScrollbarPart):
Incase custom scrollbar is created there is a check whether
the renderer to which scrollbar is added is visible or not.
This check is not required since for non-custom scrollbars same
check is not present. Also whether element's visible property is
hidden or not a placeholder is set for the element. Both behavoiur
i.e custom and non-custom scrollbars should be same.

LayoutTests:

* fast/dom/Element/scroll-width-hidden-expected.txt: Added.
* fast/dom/Element/scroll-width-hidden.html: Added.
* fast/dom/Element/scroll-width-visible-expected.txt: Added.
* fast/dom/Element/scroll-width-visible.html: Added.

Added new test for verifying that scroll width returns proper
values for element which is visible and hidden.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (155322 => 155323)


--- trunk/LayoutTests/ChangeLog	2013-09-09 06:41:34 UTC (rev 155322)
+++ trunk/LayoutTests/ChangeLog	2013-09-09 06:54:02 UTC (rev 155323)
@@ -1,3 +1,18 @@
+2013-09-08  Gurpreet Kaur  <[email protected]>
+
+        Scrollbar width is not applied when element hidden
+        https://bugs.webkit.org/show_bug.cgi?id=90546
+
+        Reviewed by Simon Fraser.
+
+        * fast/dom/Element/scroll-width-hidden-expected.txt: Added.
+        * fast/dom/Element/scroll-width-hidden.html: Added.
+        * fast/dom/Element/scroll-width-visible-expected.txt: Added.
+        * fast/dom/Element/scroll-width-visible.html: Added.
+
+        Added new test for verifying that scroll width returns proper
+        values for element which is visible and hidden.
+
 2013-09-08  Filip Pizlo  <[email protected]>
 
         fast/js/dfg-* tests should wait for the concurrent JIT

Added: trunk/LayoutTests/fast/dom/Element/scroll-width-hidden-expected.txt (0 => 155323)


--- trunk/LayoutTests/fast/dom/Element/scroll-width-hidden-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Element/scroll-width-hidden-expected.txt	2013-09-09 06:54:02 UTC (rev 155323)
@@ -0,0 +1,10 @@
+Tests that element.clientWidth of hidden element with scrollbars returns proper values
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementById('scrollDiv').clientWidth is 190
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/dom/Element/scroll-width-hidden-expected.txt
___________________________________________________________________

Added: svn:executable

Added: trunk/LayoutTests/fast/dom/Element/scroll-width-hidden.html (0 => 155323)


--- trunk/LayoutTests/fast/dom/Element/scroll-width-hidden.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Element/scroll-width-hidden.html	2013-09-09 06:54:02 UTC (rev 155323)
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src=""
+        <style type="text/css">
+            ::-webkit-scrollbar {
+                width: 10px;
+                height: 10px;
+            }
+            ::-webkit-scrollbar-thumb {
+                border-radius: 4px;
+                background-color: #CCCCCC;
+                -webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
+            }
+        </style>
+        <script type="text/_javascript_">
+            function runTest() {
+                description('Tests that element.clientWidth of hidden element with scrollbars returns proper values');
+
+                var inner = document.createElement('p');
+                var style = inner.style;
+                style.width = "100%";
+                style.height = "200px";
+                style.padding = "0px";
+
+                var outer = document.createElement('div');
+                outer.setAttribute("id", "scrollDiv");
+                style = outer.style;
+                style.position = "absolute";
+                style.top = "200px";
+                style.left = "0px";
+                style.visibility = "hidden";
+                style.backgroundColor = "red";
+                style.width = "200px";
+                style.height = "150px";
+                style.padding = "0px";
+                style.overflow = "hidden";
+                outer.appendChild(inner);
+
+                document.body.appendChild(outer);
+                outer.style.overflow = 'scroll';
+                shouldBe("document.getElementById('scrollDiv').clientWidth", "190");
+                isSuccessfullyParsed();
+            }
+        </script>
+    </head>
+    <body id="label" _onload_="runTest()">
+    </body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/fast/dom/Element/scroll-width-hidden.html
___________________________________________________________________

Added: svn:executable

Added: trunk/LayoutTests/fast/dom/Element/scroll-width-visible-expected.txt (0 => 155323)


--- trunk/LayoutTests/fast/dom/Element/scroll-width-visible-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Element/scroll-width-visible-expected.txt	2013-09-09 06:54:02 UTC (rev 155323)
@@ -0,0 +1,10 @@
+Tests that element.clientWidth of visible element with scrollbars returns proper values
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementById('scrollDiv').clientWidth is 190
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Property changes on: trunk/LayoutTests/fast/dom/Element/scroll-width-visible-expected.txt
___________________________________________________________________

Added: svn:executable

Added: trunk/LayoutTests/fast/dom/Element/scroll-width-visible.html (0 => 155323)


--- trunk/LayoutTests/fast/dom/Element/scroll-width-visible.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Element/scroll-width-visible.html	2013-09-09 06:54:02 UTC (rev 155323)
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src=""
+        <style type="text/css">
+            ::-webkit-scrollbar {
+                width: 10px;
+                height: 10px;
+            }
+            ::-webkit-scrollbar-thumb {
+                border-radius: 4px;
+                background-color: #CCCCCC;
+                -webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
+            }
+        </style>
+        <script type="text/_javascript_">
+            function runTest() {
+                description('Tests that element.clientWidth of visible element with scrollbars returns proper values');
+
+                var inner = document.createElement('p');
+                var style = inner.style;
+                style.width = "100%";
+                style.height = "200px";
+                style.padding = "0px";
+
+                var outer = document.createElement('div');
+                outer.setAttribute("id", "scrollDiv");
+                style = outer.style;
+                style.position = "absolute";
+                style.top = "200px";
+                style.left = "0px";
+                style.backgroundColor = "red";
+                style.width = "200px";
+                style.height = "150px";
+                style.padding = "0px";
+                style.overflow = "hidden";
+                outer.appendChild(inner);
+
+                document.body.appendChild(outer);
+                outer.style.overflow = 'scroll';
+                shouldBe("document.getElementById('scrollDiv').clientWidth", "190");
+                isSuccessfullyParsed();
+            }
+        </script>
+    </head>
+    <body id="label" _onload_="runTest()">
+    </body>
+</html>
\ No newline at end of file
Property changes on: trunk/LayoutTests/fast/dom/Element/scroll-width-visible.html
___________________________________________________________________

Added: svn:executable

Modified: trunk/Source/WebCore/ChangeLog (155322 => 155323)


--- trunk/Source/WebCore/ChangeLog	2013-09-09 06:41:34 UTC (rev 155322)
+++ trunk/Source/WebCore/ChangeLog	2013-09-09 06:54:02 UTC (rev 155323)
@@ -1,3 +1,30 @@
+2013-09-08  Gurpreet Kaur  <[email protected]>
+
+        Scrollbar width is not applied when element hidden
+        https://bugs.webkit.org/show_bug.cgi?id=90546
+
+        Reviewed by Simon Fraser.
+
+        Webkit has css properties through which custom scroll
+        bars can be added. Incase the element's visible property
+        is hidden and custom scrollbar properties are applied
+        the scrollbar width is not considered when quering the 
+        element.clientWidth. Incase of non-custom scrollbars 
+        whether the element's visible property is hidden or not
+        correct scrollbar width is considered.
+
+        Tests: fast/dom/Element/scroll-width-hidden.html
+               fast/dom/Element/scroll-width-visible.html
+
+        * rendering/RenderScrollbar.cpp:
+        (WebCore::RenderScrollbar::updateScrollbarPart):
+        Incase custom scrollbar is created there is a check whether
+        the renderer to which scrollbar is added is visible or not.
+        This check is not required since for non-custom scrollbars same
+        check is not present. Also whether element's visible property is
+        hidden or not a placeholder is set for the element. Both behavoiur
+        i.e custom and non-custom scrollbars should be same.
+
 2013-09-08  Tamas Czene  <[email protected]>
 
         GStreamer 0.10 build fix after r155251.

Modified: trunk/Source/WebCore/rendering/RenderScrollbar.cpp (155322 => 155323)


--- trunk/Source/WebCore/rendering/RenderScrollbar.cpp	2013-09-09 06:41:34 UTC (rev 155322)
+++ trunk/Source/WebCore/rendering/RenderScrollbar.cpp	2013-09-09 06:54:02 UTC (rev 155323)
@@ -226,7 +226,7 @@
 
     RefPtr<RenderStyle> partStyle = !destroy ? getScrollbarPseudoStyle(partType,  pseudoForScrollbarPart(partType)) : PassRefPtr<RenderStyle>(0);
     
-    bool needRenderer = !destroy && partStyle && partStyle->display() != NONE && partStyle->visibility() == VISIBLE;
+    bool needRenderer = !destroy && partStyle && partStyle->display() != NONE;
     
     if (needRenderer && partStyle->display() != BLOCK) {
         // See if we are a button that should not be visible according to OS settings.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to