Title: [209835] trunk/Source/WebCore
Revision
209835
Author
[email protected]
Date
2016-12-14 14:34:04 -0800 (Wed, 14 Dec 2016)

Log Message

[CSS Parser] Make deferred parsing retain the sheet text. Fix invalidation to avoid deferred parsing.
https://bugs.webkit.org/show_bug.cgi?id=165868

Reviewed by Simon Fraser.

With this new model of token copying, the sheet text needs to be retained. The tokenizer did this,
but we're no longer keeping it around.

StyleInvalidation is also aggressively crawling media rules, even unsupported ones, so fix it
to avoid deferred parsing.

* css/StyleInvalidationAnalysis.cpp:
(WebCore::shouldDirtyAllStyle):
* css/parser/CSSDeferredParser.cpp:
(WebCore::CSSDeferredParser::CSSDeferredParser):
* css/parser/CSSDeferredParser.h:
(WebCore::CSSDeferredParser::create):
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::CSSParserImpl):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (209834 => 209835)


--- trunk/Source/WebCore/ChangeLog	2016-12-14 22:04:25 UTC (rev 209834)
+++ trunk/Source/WebCore/ChangeLog	2016-12-14 22:34:04 UTC (rev 209835)
@@ -1,3 +1,25 @@
+2016-12-14  Dave Hyatt  <[email protected]>
+
+        [CSS Parser] Make deferred parsing retain the sheet text. Fix invalidation to avoid deferred parsing.
+        https://bugs.webkit.org/show_bug.cgi?id=165868
+
+        Reviewed by Simon Fraser.
+
+        With this new model of token copying, the sheet text needs to be retained. The tokenizer did this,
+        but we're no longer keeping it around.
+
+        StyleInvalidation is also aggressively crawling media rules, even unsupported ones, so fix it
+        to avoid deferred parsing.
+
+        * css/StyleInvalidationAnalysis.cpp:
+        (WebCore::shouldDirtyAllStyle):
+        * css/parser/CSSDeferredParser.cpp:
+        (WebCore::CSSDeferredParser::CSSDeferredParser):
+        * css/parser/CSSDeferredParser.h:
+        (WebCore::CSSDeferredParser::create):
+        * css/parser/CSSParserImpl.cpp:
+        (WebCore::CSSParserImpl::CSSParserImpl):
+
 2016-12-14  Ryosuke Niwa  <[email protected]>
 
         iOS: An element with tabindex is not focusable unless there is no mouse event handler

Modified: trunk/Source/WebCore/css/StyleInvalidationAnalysis.cpp (209834 => 209835)


--- trunk/Source/WebCore/css/StyleInvalidationAnalysis.cpp	2016-12-14 22:04:25 UTC (rev 209834)
+++ trunk/Source/WebCore/css/StyleInvalidationAnalysis.cpp	2016-12-14 22:34:04 UTC (rev 209835)
@@ -42,7 +42,8 @@
 {
     for (auto& rule : rules) {
         if (is<StyleRuleMedia>(*rule)) {
-            if (shouldDirtyAllStyle(downcast<StyleRuleMedia>(*rule).childRules()))
+            const auto* childRules = downcast<StyleRuleMedia>(*rule).childRulesWithoutDeferredParsing();
+            if (childRules && shouldDirtyAllStyle(*childRules))
                 return true;
             continue;
         }

Modified: trunk/Source/WebCore/css/parser/CSSDeferredParser.cpp (209834 => 209835)


--- trunk/Source/WebCore/css/parser/CSSDeferredParser.cpp	2016-12-14 22:04:25 UTC (rev 209834)
+++ trunk/Source/WebCore/css/parser/CSSDeferredParser.cpp	2016-12-14 22:34:04 UTC (rev 209835)
@@ -32,8 +32,9 @@
 
 namespace WebCore {
 
-CSSDeferredParser::CSSDeferredParser(const CSSParserContext& context, StyleSheetContents& styleSheet)
+CSSDeferredParser::CSSDeferredParser(const CSSParserContext& context, const String& sheetText, StyleSheetContents& styleSheet)
     : m_context(context)
+    , m_sheetText(sheetText)
     , m_styleSheet(styleSheet.createWeakPtr())
 {
 }

Modified: trunk/Source/WebCore/css/parser/CSSDeferredParser.h (209834 => 209835)


--- trunk/Source/WebCore/css/parser/CSSDeferredParser.h	2016-12-14 22:04:25 UTC (rev 209834)
+++ trunk/Source/WebCore/css/parser/CSSDeferredParser.h	2016-12-14 22:34:04 UTC (rev 209835)
@@ -38,9 +38,9 @@
 
 class CSSDeferredParser : public RefCounted<CSSDeferredParser> {
 public:
-    static Ref<CSSDeferredParser> create(const CSSParserContext& parserContext, StyleSheetContents& styleSheet)
+    static Ref<CSSDeferredParser> create(const CSSParserContext& parserContext, const String& sheetText, StyleSheetContents& styleSheet)
     {
-        return adoptRef(*new CSSDeferredParser(parserContext, styleSheet));
+        return adoptRef(*new CSSDeferredParser(parserContext, sheetText, styleSheet));
     }
 
     CSSParserMode mode() const { return m_context.mode; }
@@ -55,11 +55,13 @@
     void adoptTokenizerEscapedStrings(Vector<String>&& strings) { m_escapedStrings = WTFMove(strings); }
 
 private:
-    CSSDeferredParser(const CSSParserContext&, StyleSheetContents&);
+    CSSDeferredParser(const CSSParserContext&, const String&, StyleSheetContents&);
     
     Vector<String> m_escapedStrings;
     CSSParserContext m_context;
     
+    String m_sheetText;
+
     WeakPtr<StyleSheetContents> m_styleSheet;
 };
 

Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.cpp (209834 => 209835)


--- trunk/Source/WebCore/css/parser/CSSParserImpl.cpp	2016-12-14 22:04:25 UTC (rev 209834)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.cpp	2016-12-14 22:34:04 UTC (rev 209835)
@@ -77,7 +77,7 @@
 {
     m_tokenizer = wrapper ? std::make_unique<CSSTokenizer>(string, *wrapper) : std::make_unique<CSSTokenizer>(string);
     if (context.deferredCSSParserEnabled && !wrapper && styleSheet && ruleParsing == CSSParser::RuleParsing::Deferred)
-        m_deferredParser = CSSDeferredParser::create(context, *styleSheet);
+        m_deferredParser = CSSDeferredParser::create(context, string, *styleSheet);
 }
 
 CSSParser::ParseResult CSSParserImpl::parseValue(MutableStyleProperties* declaration, CSSPropertyID propertyID, const String& string, bool important, const CSSParserContext& context)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to