Changeset 238758 in webkit
- Timestamp:
- Nov 30, 2018 3:33:39 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r238751 r238758 1 2018-11-30 Ryosuke Niwa <rniwa@webkit.org> 2 3 ShadowRoot should have styleSheets property 4 https://bugs.webkit.org/show_bug.cgi?id=191311 5 <rdar://problem/46333290> 6 7 Reviewed by Antti Koivisto. 8 9 Added a regression test for testing that the JS wrapper of a StyleSheetList does not get collected 10 as long as its shadow root is alive. 11 12 * fast/shadow-dom/shadowroot-stylesheets-wrapper-gc-expected.txt: Added. 13 * fast/shadow-dom/shadowroot-stylesheets-wrapper-gc.html: Added. 14 1 15 2018-11-30 Wenson Hsieh <wenson_hsieh@apple.com> 2 16 -
trunk/LayoutTests/imported/w3c/ChangeLog
r238692 r238758 1 2018-11-30 Ryosuke Niwa <rniwa@webkit.org> 2 3 ShadowRoot should have styleSheets property 4 https://bugs.webkit.org/show_bug.cgi?id=191311 5 6 Reviewed by Antti Koivisto. 7 8 Rebaselined the tests. 9 10 * web-platform-tests/css/css-scoping/stylesheet-title-002-expected.txt: Rebaselined. The test now 11 doesn't throw but fails with the actual check the test is intending to check. 12 * web-platform-tests/css/cssom/selectorText-modification-restyle-002-expected.txt: Rebaselined 13 now that all test cases pass. 14 * web-platform-tests/shadow-dom/ShadowRoot-interface-expected.txt: Ditto. 15 1 16 2018-11-28 Ryosuke Niwa <rniwa@webkit.org> 2 17 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-scoping/stylesheet-title-002-expected.txt
r232903 r238758 1 1 2 FAIL Title attribute in stylesheets not in the document tree is ignored undefined is not an object (evaluating 'host.shadowRoot.styleSheets.length')2 FAIL Title attribute in stylesheets not in the document tree is ignored assert_equals: expected 3 but got 2 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/selectorText-modification-restyle-002-expected.txt
r232005 r238758 1 1 2 2 PASS Check initial color. 3 FAIL Check that color changes correctly after shadow stylesheet selector and #container class is changed. undefined is not an object (evaluating 'root.styleSheets[0]') 3 PASS Check that color changes correctly after shadow stylesheet selector and #container class is changed. 4 4 -
trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/ShadowRoot-interface-expected.txt
r206463 r238758 10 10 PASS ShadowRoot.innerHTML must replace all with the result of invoking the fragment parsing algorithm when shadow root is open. 11 11 PASS ShadowRoot.innerHTML must replace all with the result of invoking the fragment parsing algorithm when shadow root is closed. 12 FAIL ShadowRoot.styleSheets must return a StyleSheetList sequence containing the shadow root style sheets when shadow root is open. undefined is not an object (evaluating 'shadowRoot.styleSheets.length') 13 FAIL ShadowRoot.styleSheets must return a StyleSheetList sequence containing the shadow root style sheets when shadow root is closed. undefined is not an object (evaluating 'shadowRoot.styleSheets.length') 12 PASS ShadowRoot.styleSheets must return a StyleSheetList sequence containing the shadow root style sheets when shadow root is open. 13 PASS ShadowRoot.styleSheets must return a StyleSheetList sequence containing the shadow root style sheets when shadow root is closed. 14 14 -
trunk/Source/WebCore/ChangeLog
r238755 r238758 1 2018-11-30 Ryosuke Niwa <rniwa@webkit.org> 2 3 ShadowRoot should have styleSheets property 4 https://bugs.webkit.org/show_bug.cgi?id=191311 5 6 Reviewed by Antti Koivisto. 7 8 Added the support for ShadowRoot.prototype.styleSheets by making StyleSheetList refer to either 9 a document or a shadow root. We don't support the named getter in shadow root since that's not 10 a standard feature: https://drafts.csswg.org/cssom/#the-stylesheetlist-interface 11 12 Tests: fast/shadow-dom/shadowroot-stylesheets-wrapper-gc.html 13 imported/w3c/web-platform-tests/shadow-dom/ShadowRoot-interface.html 14 15 * css/StyleSheetList.cpp: 16 (WebCore::StyleSheetList::StyleSheetList): Added a variant which takes ShadowRoot. 17 (WebCore::StyleSheetList::styleSheets const): 18 (WebCore::StyleSheetList::ownerNode): Added. The replacement for document() since now the opaque 19 root could be either a Document or a ShadowRoot. 20 (WebCore::StyleSheetList::detach): Renamed from detachFromDocument. 21 (WebCore::StyleSheetList::namedItem const): Added a comment that the named getter is only supported 22 for Document since it's not in the standard. 23 * css/StyleSheetList.h: 24 (WebCore::StyleSheetList::create): Added a variant which takes ShadowRoot. 25 (WebCore::StyleSheetList::document): Deleted. Replaced by StyleSheetList::ownerNode in .cpp file. 26 * css/StyleSheetList.idl: 27 * dom/Document.cpp: 28 (WebCore::Document::~Document): 29 (WebCore::Document::styleSheets): 30 * dom/Document.idl: 31 * dom/DocumentOrShadowRoot.idl: Moved the declaration of styleSheets here from Document.idl. 32 * dom/ShadowRoot.cpp: 33 (WebCore::ShadowRoot::~ShadowRoot): Call detach. 34 (WebCore::ShadowRoot::styleSheets): 35 * dom/ShadowRoot.h: 36 1 37 2018-11-30 Chris Dumez <cdumez@apple.com> 2 38 -
trunk/Source/WebCore/css/StyleSheetList.cpp
r223728 r238758 26 26 #include "HTMLNames.h" 27 27 #include "HTMLStyleElement.h" 28 #include "ShadowRoot.h" 28 29 #include "StyleScope.h" 29 30 #include <wtf/text/WTFString.h> … … 33 34 using namespace HTMLNames; 34 35 35 StyleSheetList::StyleSheetList(Document* document) 36 : m_document(document) 36 StyleSheetList::StyleSheetList(Document& document) 37 : m_document(&document) 38 { 39 } 40 41 StyleSheetList::StyleSheetList(ShadowRoot& shadowRoot) 42 : m_shadowRoot(&shadowRoot) 37 43 { 38 44 } … … 42 48 inline const Vector<RefPtr<StyleSheet>>& StyleSheetList::styleSheets() const 43 49 { 44 if (!m_document) 45 return m_detachedStyleSheets; 46 return m_document->styleScope().styleSheetsForStyleSheetList(); 50 if (m_document) 51 return m_document->styleScope().styleSheetsForStyleSheetList(); 52 if (m_shadowRoot) 53 return m_shadowRoot->styleScope().styleSheetsForStyleSheetList(); 54 return m_detachedStyleSheets; 47 55 } 48 56 49 void StyleSheetList::detachFromDocument() 57 Node* StyleSheetList::ownerNode() const 50 58 { 51 m_detachedStyleSheets = m_document->styleScope().styleSheetsForStyleSheetList(); 52 m_document = nullptr; 59 if (m_document) 60 return m_document; 61 return m_shadowRoot; 62 } 63 64 void StyleSheetList::detach() 65 { 66 if (m_document) { 67 ASSERT(!m_shadowRoot); 68 m_detachedStyleSheets = m_document->styleScope().styleSheetsForStyleSheetList(); 69 m_document = nullptr; 70 } else if (m_shadowRoot) { 71 ASSERT(!m_document); 72 m_detachedStyleSheets = m_shadowRoot->styleScope().styleSheetsForStyleSheetList(); 73 m_shadowRoot = nullptr; 74 } else 75 ASSERT_NOT_REACHED(); 53 76 } 54 77 … … 66 89 CSSStyleSheet* StyleSheetList::namedItem(const AtomicString& name) const 67 90 { 91 // Support the named getter on document for backwards compatibility. 68 92 if (!m_document) 69 93 return nullptr; -
trunk/Source/WebCore/css/StyleSheetList.h
r210667 r238758 29 29 class Document; 30 30 class HTMLStyleElement; 31 class Node; 32 class ShadowRoot; 31 33 class StyleSheet; 32 34 class CSSStyleSheet; … … 34 36 class StyleSheetList final : public RefCounted<StyleSheetList> { 35 37 public: 36 static Ref<StyleSheetList> create(Document* document) { return adoptRef(*new StyleSheetList(document)); } 38 static Ref<StyleSheetList> create(Document& document) { return adoptRef(*new StyleSheetList(document)); } 39 static Ref<StyleSheetList> create(ShadowRoot& shadowRoot) { return adoptRef(*new StyleSheetList(shadowRoot)); } 37 40 WEBCORE_EXPORT ~StyleSheetList(); 38 41 … … 43 46 Vector<AtomicString> supportedPropertyNames(); 44 47 45 Document* document() { return m_document; }48 Node* ownerNode() const; 46 49 47 void detach FromDocument();50 void detach(); 48 51 49 52 private: 50 StyleSheetList(Document*); 53 StyleSheetList(Document&); 54 StyleSheetList(ShadowRoot&); 51 55 const Vector<RefPtr<StyleSheet>>& styleSheets() const; 52 56 53 Document* m_document; 57 Document* m_document { nullptr }; 58 ShadowRoot* m_shadowRoot { nullptr }; 54 59 Vector<RefPtr<StyleSheet>> m_detachedStyleSheets; 55 60 }; -
trunk/Source/WebCore/css/StyleSheetList.idl
r210667 r238758 21 21 [ 22 22 ExportToWrappedFunction, 23 GenerateIsReachable=Impl Document,23 GenerateIsReachable=ImplOwnerNodeRoot, 24 24 ImplementationLacksVTable, 25 25 ] interface StyleSheetList { -
trunk/Source/WebCore/dom/Document.cpp
r238754 r238758 638 638 639 639 if (m_styleSheetList) 640 m_styleSheetList->detach FromDocument();640 m_styleSheetList->detach(); 641 641 642 642 extensionStyleSheets().detachFromDocument(); … … 3831 3831 { 3832 3832 if (!m_styleSheetList) 3833 m_styleSheetList = StyleSheetList::create( this);3833 m_styleSheetList = StyleSheetList::create(*this); 3834 3834 return *m_styleSheetList; 3835 3835 } -
trunk/Source/WebCore/dom/Document.idl
r237306 r238758 131 131 [LenientThis] attribute EventHandler onreadystatechange; 132 132 133 // Extensions from the CSSOM specification (https://drafts.csswg.org/cssom/#extensions-to-the-document-interface).134 // FIXME: Should likely be moved to DocumentOrShadowRoot.135 readonly attribute StyleSheetList styleSheets; // FIXME: Should be [SameObject].136 137 133 // Extensions from the CSSOM-View specification (https://drafts.csswg.org/cssom-view/#extensions-to-the-document-interface). 138 134 [ImplementedAs=scrollingElementForAPI] readonly attribute Element? scrollingElement; -
trunk/Source/WebCore/dom/DocumentOrShadowRoot.idl
r219961 r238758 35 35 // CaretPosition? caretPositionFromPoint(double x, double y); // FIXME: Implement this. 36 36 readonly attribute Element? activeElement; 37 // readonly attribute StyleSheetList styleSheets; // FIXME: Implement this. 37 38 // Extensions from the CSSOM specification (https://drafts.csswg.org/cssom/#extensions-to-the-document-interface). 39 readonly attribute StyleSheetList styleSheets; // FIXME: Should be [SameObject]. 38 40 39 41 // Extensions from Pointer Lock API (https://w3c.github.io/pointerlock/#extensions-to-the-documentorshadowroot-mixin). -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r236583 r238758 37 37 #include "StyleResolver.h" 38 38 #include "StyleScope.h" 39 #include "StyleSheetList.h" 39 40 #include "markup.h" 40 41 #include <wtf/IsoMallocInlines.h> … … 47 48 unsigned countersAndFlags[1]; 48 49 void* styleScope; 50 void* styleSheetList; 49 51 void* host; 50 52 void* slotAssignment; … … 76 78 if (isConnected()) 77 79 document().didRemoveInDocumentShadowRoot(*this); 80 81 if (m_styleSheetList) 82 m_styleSheetList->detach(); 78 83 79 84 // We cannot let ContainerNode destructor call willBeDeletedFrom() … … 152 157 } 153 158 159 StyleSheetList& ShadowRoot::styleSheets() 160 { 161 if (!m_styleSheetList) 162 m_styleSheetList = StyleSheetList::create(*this); 163 return *m_styleSheetList; 164 } 165 154 166 String ShadowRoot::innerHTML() const 155 167 { -
trunk/Source/WebCore/dom/ShadowRoot.h
r235917 r238758 36 36 class HTMLSlotElement; 37 37 class SlotAssignment; 38 class StyleSheetList; 38 39 39 40 class ShadowRoot final : public DocumentFragment, public TreeScope { … … 55 56 56 57 Style::Scope& styleScope(); 58 StyleSheetList& styleSheets(); 57 59 58 60 bool resetStyleInheritance() const { return m_resetStyleInheritance; } … … 111 113 112 114 Element* m_host { nullptr }; 115 RefPtr<StyleSheetList> m_styleSheetList; 113 116 114 117 std::unique_ptr<Style::Scope> m_styleScope;
Note: See TracChangeset
for help on using the changeset viewer.