Title: [224394] trunk
Revision
224394
Author
an...@apple.com
Date
2017-11-03 07:46:17 -0700 (Fri, 03 Nov 2017)

Log Message

Crash in WebCore::RenderStyle::overflowX with display:contents
https://bugs.webkit.org/show_bug.cgi?id=178857
<rdar://problem/35201120>

Reviewed by Zalan Bujtas.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-display-3/display-contents-computed-style-expected.txt:

Source/WebCore:

Crash test by Renata Hodovan.

Tests: fast/css/display-contents-all.html
       fast/css/display-contents-document-element.html

* css/StyleResolver.cpp:
(WebCore::adjustDisplayContentsStyle):

For document element 'display:contents' should adjust to 'display:block' like it does for other display types.

LayoutTests:

* fast/css/display-contents-all-expected.html: Added.
* fast/css/display-contents-all.html: Added.
* fast/css/display-contents-document-element-expected.txt: Added.
* fast/css/display-contents-document-element.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (224393 => 224394)


--- trunk/LayoutTests/ChangeLog	2017-11-03 11:44:34 UTC (rev 224393)
+++ trunk/LayoutTests/ChangeLog	2017-11-03 14:46:17 UTC (rev 224394)
@@ -1,3 +1,16 @@
+2017-11-03  Antti Koivisto  <an...@apple.com>
+
+        Crash in WebCore::RenderStyle::overflowX with display:contents
+        https://bugs.webkit.org/show_bug.cgi?id=178857
+        <rdar://problem/35201120>
+
+        Reviewed by Zalan Bujtas.
+
+        * fast/css/display-contents-all-expected.html: Added.
+        * fast/css/display-contents-all.html: Added.
+        * fast/css/display-contents-document-element-expected.txt: Added.
+        * fast/css/display-contents-document-element.html: Added.
+
 2017-11-03  Ms2ger  <ms2...@igalia.com>
 
         [WPE] Enable the dom/ directory of web-platform-tests.

Added: trunk/LayoutTests/fast/css/display-contents-all-expected.html (0 => 224394)


--- trunk/LayoutTests/fast/css/display-contents-all-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/display-contents-all-expected.html	2017-11-03 14:46:17 UTC (rev 224394)
@@ -0,0 +1,5 @@
+<html>
+<style>
+body { margin: 0px }
+</style>
+* { display:contents; } This should render.

Added: trunk/LayoutTests/fast/css/display-contents-all.html (0 => 224394)


--- trunk/LayoutTests/fast/css/display-contents-all.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/display-contents-all.html	2017-11-03 14:46:17 UTC (rev 224394)
@@ -0,0 +1,5 @@
+<html>
+<style>
+* { display:contents; }
+</style>
+This should render.

Added: trunk/LayoutTests/fast/css/display-contents-document-element-expected.txt (0 => 224394)


--- trunk/LayoutTests/fast/css/display-contents-document-element-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/display-contents-document-element-expected.txt	2017-11-03 14:46:17 UTC (rev 224394)
@@ -0,0 +1 @@
+This shouldn't crash.

Added: trunk/LayoutTests/fast/css/display-contents-document-element.html (0 => 224394)


--- trunk/LayoutTests/fast/css/display-contents-document-element.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/display-contents-document-element.html	2017-11-03 14:46:17 UTC (rev 224394)
@@ -0,0 +1,13 @@
+<html>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+<style>
+html {
+    display:contents;
+    overflow-x:auto;
+    direction: rtl;
+}
+</style>
+This shouldn't crash.

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (224393 => 224394)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2017-11-03 11:44:34 UTC (rev 224393)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2017-11-03 14:46:17 UTC (rev 224394)
@@ -1,3 +1,13 @@
+2017-11-03  Antti Koivisto  <an...@apple.com>
+
+        Crash in WebCore::RenderStyle::overflowX with display:contents
+        https://bugs.webkit.org/show_bug.cgi?id=178857
+        <rdar://problem/35201120>
+
+        Reviewed by Zalan Bujtas.
+
+        * web-platform-tests/css/css-display-3/display-contents-computed-style-expected.txt:
+
 2017-11-02  Youenn Fablet  <you...@apple.com>
 
         Fix WPT service worker tests using www1 URLs

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-display-3/display-contents-computed-style-expected.txt (224393 => 224394)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-display-3/display-contents-computed-style-expected.txt	2017-11-03 11:44:34 UTC (rev 224393)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-display-3/display-contents-computed-style-expected.txt	2017-11-03 14:46:17 UTC (rev 224394)
@@ -1,67 +1,7 @@
 
-CSS Display: Computed style for display:contents
-
-
-
-
-
-
-
-    html, .contents { display: contents }
-
-    #t2 .contents { background-color: green }
-    #t2 span { background-color: inherit }
-
-    #t3 .contents { color: green }
-
-    #t4 {
-        width: auto;
-        height: 50%;
-        margin-left: 25%;
-        padding-top: 10%;
-    }
-
-
-
-    
-        
-    
-
-
-    
-        
-    
-
-
-
-    test(function(){
-        assert_equals(getComputedStyle(document.querySelector("#t1")).display, "contents");
-    }, "Serialization of computed style value for display:contents");
-
-    test(function(){
-        assert_equals(getComputedStyle(document.querySelector("#t2 span")).backgroundColor, "rgb(0, 128, 0)");
-    }, "display:contents element as inherit parent - explicit inheritance");
-
-    test(function(){
-        assert_equals(getComputedStyle(document.querySelector("#t3 span")).color, "rgb(0, 128, 0)");
-    }, "display:contents element as inherit parent - implicit inheritance");
-
-    test(function(){
-        var computed = getComputedStyle(document.querySelector("#t4"));
-        assert_equals(computed.width, "auto");
-        assert_equals(computed.height, "50%");
-        assert_equals(computed.marginLeft, "25%");
-        assert_equals(computed.paddingTop, "10%");
-    }, "Resolved value should be computed value, not used value, for display:contents");
-
-    test(function(){
-        assert_equals(getComputedStyle(document.documentElement).display, "block");
-    }, "display:contents is blockified for root elements");
-
-
 PASS Serialization of computed style value for display:contents 
 PASS display:contents element as inherit parent - explicit inheritance 
 PASS display:contents element as inherit parent - implicit inheritance 
 PASS Resolved value should be computed value, not used value, for display:contents 
-FAIL display:contents is blockified for root elements assert_equals: expected "block" but got "contents"
+PASS display:contents is blockified for root elements 
 

Modified: trunk/Source/WebCore/ChangeLog (224393 => 224394)


--- trunk/Source/WebCore/ChangeLog	2017-11-03 11:44:34 UTC (rev 224393)
+++ trunk/Source/WebCore/ChangeLog	2017-11-03 14:46:17 UTC (rev 224394)
@@ -1,3 +1,21 @@
+2017-11-03  Antti Koivisto  <an...@apple.com>
+
+        Crash in WebCore::RenderStyle::overflowX with display:contents
+        https://bugs.webkit.org/show_bug.cgi?id=178857
+        <rdar://problem/35201120>
+
+        Reviewed by Zalan Bujtas.
+
+        Crash test by Renata Hodovan.
+
+        Tests: fast/css/display-contents-all.html
+               fast/css/display-contents-document-element.html
+
+        * css/StyleResolver.cpp:
+        (WebCore::adjustDisplayContentsStyle):
+
+        For document element 'display:contents' should adjust to 'display:block' like it does for other display types.
+
 2017-11-03  Jiewen Tan  <jiewen_...@apple.com>
 
         Replace some auto* with RefPtr within WebCore/html

Modified: trunk/Source/WebCore/css/StyleResolver.cpp (224393 => 224394)


--- trunk/Source/WebCore/css/StyleResolver.cpp	2017-11-03 11:44:34 UTC (rev 224393)
+++ trunk/Source/WebCore/css/StyleResolver.cpp	2017-11-03 14:46:17 UTC (rev 224394)
@@ -801,6 +801,10 @@
             style.setDisplay(NONE);
         return;
     }
+    if (element->document().documentElement() == element) {
+        style.setDisplay(BLOCK);
+        return;
+    }
     if (hasEffectiveDisplayNoneForDisplayContents(*element))
         style.setDisplay(NONE);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to