REGRESSION (r207669): FileMaker Pro Help pages do not render correctly
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Apr 2017 19:08:07 +0000 (19:08 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Apr 2017 19:08:07 +0000 (19:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170402
<rdar://problem/31004344>

Reviewed by Simon Fraser.

Source/WebCore:

If a new stylesheet load is started from the load event the document.styleSheets does not
always reflect the already loaded stylesheets.

Test: fast/css/document-stylesheets-dynamic.html

* style/StyleScope.cpp:
(WebCore::Style::Scope::updateActiveStyleSheets):

    Remove an old optimization where we would not update active stylesheets if there were pending
    (head) stylesheet loads and they had not been updated already.
    This is probably not a valuable optimization anymore with the new lazy stylesheet update strategy.

* style/StyleScope.h:

LayoutTests:

* fast/css/document-stylesheets-dynamic-expected.html: Added.
* fast/css/document-stylesheets-dynamic.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214830 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/css/document-stylesheets-dynamic-expected.html [new file with mode: 0644]
LayoutTests/fast/css/document-stylesheets-dynamic.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/style/StyleScope.cpp
Source/WebCore/style/StyleScope.h

index da02c38..4de9501 100644 (file)
@@ -1,3 +1,14 @@
+2017-04-03  Antti Koivisto  <antti@apple.com>
+
+        REGRESSION (r207669): FileMaker Pro Help pages do not render correctly
+        https://bugs.webkit.org/show_bug.cgi?id=170402
+        <rdar://problem/31004344>
+
+        Reviewed by Simon Fraser.
+
+        * fast/css/document-stylesheets-dynamic-expected.html: Added.
+        * fast/css/document-stylesheets-dynamic.html: Added.
+
 2017-04-03  Jeremy Jones  <jeremyj@apple.com>
 
         LayoutTest pointer-lock/mouse-event-delivery.html is a flaky failure
diff --git a/LayoutTests/fast/css/document-stylesheets-dynamic-expected.html b/LayoutTests/fast/css/document-stylesheets-dynamic-expected.html
new file mode 100644 (file)
index 0000000..7ef22e9
--- /dev/null
@@ -0,0 +1 @@
+PASS
diff --git a/LayoutTests/fast/css/document-stylesheets-dynamic.html b/LayoutTests/fast/css/document-stylesheets-dynamic.html
new file mode 100644 (file)
index 0000000..8c0da68
--- /dev/null
@@ -0,0 +1,15 @@
+<head>
+<script>
+function test()
+{
+    const link = document.createElement("link");
+    link.setAttribute("rel", "stylesheet");
+    link.setAttribute("href", "data:text/css,body { background:white !important; }");
+    document.head.appendChild(link);
+    const count = document.styleSheets.length;
+    document.body.innerHTML = (count == 1) ? `PASS` : `FAIL: document.styleSheets.length == ${count}`
+}
+</script>
+<link rel=stylesheet href="data:text/css,body { color:black !important; }">
+</head>
+<body onload="test()" style="color:blue; background:red">
index 2d2c37c..2875e4d 100644 (file)
@@ -1,3 +1,25 @@
+2017-04-03  Antti Koivisto  <antti@apple.com>
+
+        REGRESSION (r207669): FileMaker Pro Help pages do not render correctly
+        https://bugs.webkit.org/show_bug.cgi?id=170402
+        <rdar://problem/31004344>
+
+        Reviewed by Simon Fraser.
+
+        If a new stylesheet load is started from the load event the document.styleSheets does not
+        always reflect the already loaded stylesheets.
+
+        Test: fast/css/document-stylesheets-dynamic.html
+
+        * style/StyleScope.cpp:
+        (WebCore::Style::Scope::updateActiveStyleSheets):
+
+            Remove an old optimization where we would not update active stylesheets if there were pending
+            (head) stylesheet loads and they had not been updated already.
+            This is probably not a valuable optimization anymore with the new lazy stylesheet update strategy.
+
+        * style/StyleScope.h:
+
 2017-04-03  Anders Carlsson  <andersca@apple.com>
 
         Tweak ApplePaySession API
index 2962bc8..b1f6f55 100644 (file)
@@ -443,15 +443,6 @@ void Scope::updateActiveStyleSheets(UpdateType updateType)
         return;
     }
 
-    // Don't bother updating, since we haven't loaded all our style info yet
-    // and haven't calculated the style resolver for the first time.
-    if (!m_shadowRoot && !m_didUpdateActiveStyleSheets && hasPendingSheetsBeforeBody()) {
-        clearResolver();
-        return;
-    }
-
-    m_didUpdateActiveStyleSheets = true;
-
     Vector<RefPtr<StyleSheet>> activeStyleSheets;
     collectActiveStyleSheets(activeStyleSheets);
 
index a4963c6..2fa62ac 100644 (file)
@@ -163,8 +163,6 @@ private:
     HashSet<const Element*> m_elementsInHeadWithPendingSheets;
     HashSet<const Element*> m_elementsInBodyWithPendingSheets;
 
-    bool m_didUpdateActiveStyleSheets { false };
-
     std::optional<UpdateType> m_pendingUpdate;
     bool m_hasDescendantWithPendingUpdate { false };