Title: [207695] trunk/Source/WebCore
Revision
207695
Author
hy...@apple.com
Date
2016-10-21 14:07:44 -0700 (Fri, 21 Oct 2016)

Log Message

[CSS Parser] Make sure shadow user agent sheets parse in UASheetMode
https://bugs.webkit.org/show_bug.cgi?id=163810

Reviewed by Dean Jackson.

* dom/InlineStyleSheetOwner.cpp:
(WebCore::parserContextForElement):
(WebCore::makeInlineStyleSheetCacheKey):
(WebCore::InlineStyleSheetOwner::createSheet):
(WebCore::parserContextForForElement): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (207694 => 207695)


--- trunk/Source/WebCore/ChangeLog	2016-10-21 19:52:25 UTC (rev 207694)
+++ trunk/Source/WebCore/ChangeLog	2016-10-21 21:07:44 UTC (rev 207695)
@@ -1,3 +1,16 @@
+2016-10-21  Dave Hyatt  <hy...@apple.com>
+
+        [CSS Parser] Make sure shadow user agent sheets parse in UASheetMode
+        https://bugs.webkit.org/show_bug.cgi?id=163810
+
+        Reviewed by Dean Jackson.
+
+        * dom/InlineStyleSheetOwner.cpp:
+        (WebCore::parserContextForElement):
+        (WebCore::makeInlineStyleSheetCacheKey):
+        (WebCore::InlineStyleSheetOwner::createSheet):
+        (WebCore::parserContextForForElement): Deleted.
+
 2016-10-21  Jer Noble  <jer.no...@apple.com>
 
         YouTube stalls when seeking beyond buffered range

Modified: trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp (207694 => 207695)


--- trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp	2016-10-21 19:52:25 UTC (rev 207694)
+++ trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp	2016-10-21 21:07:44 UTC (rev 207695)
@@ -44,13 +44,16 @@
     return cache;
 }
 
-static CSSParserContext parserContextForForElement(const Element& element)
+static CSSParserContext parserContextForElement(const Element& element)
 {
     auto* shadowRoot = element.containingShadowRoot();
     // User agent shadow trees can't contain document-relative URLs. Use blank URL as base allowing cross-document sharing.
     auto& baseURL = shadowRoot && shadowRoot->mode() == ShadowRoot::Mode::UserAgent ? blankURL() : element.document().baseURL();
 
-    return CSSParserContext { element.document(), baseURL, element.document().encoding() };
+    CSSParserContext result = CSSParserContext { element.document(), baseURL, element.document().encoding() };
+    if (shadowRoot && shadowRoot->mode() == ShadowRoot::Mode::UserAgent)
+        result.mode = UASheetMode;
+    return result;
 }
 
 static Optional<InlineStyleSheetCacheKey> makeInlineStyleSheetCacheKey(const String& text, const Element& element)
@@ -60,7 +63,7 @@
     if (!element.isInShadowTree())
         return { };
 
-    return std::make_pair(text, parserContextForForElement(element));
+    return std::make_pair(text, parserContextForElement(element));
 }
 
 InlineStyleSheetOwner::InlineStyleSheetOwner(Document& document, bool createdByParser)
@@ -197,7 +200,7 @@
 
     m_loading = true;
 
-    auto contents = StyleSheetContents::create(String(), parserContextForForElement(element));
+    auto contents = StyleSheetContents::create(String(), parserContextForElement(element));
 
     m_sheet = CSSStyleSheet::createInline(contents.get(), element, m_startTextPosition);
     m_sheet->setMediaQueries(mediaQueries.releaseNonNull());
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to