Changeset 208356 in webkit
- Timestamp:
- Nov 3, 2016 4:18:01 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 5 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r208351 r208356 1 2016-11-03 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r208302. 4 5 This change causes LayoutTest crashes under GuardMalloc. 6 7 Reverted changeset: 8 9 "Load stylesheets in link elements inside a connected shadow 10 tree" 11 https://bugs.webkit.org/show_bug.cgi?id=160683 12 http://trac.webkit.org/changeset/208302 13 1 14 2016-11-03 Yusuke Suzuki <utatane.tea@gmail.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r208355 r208356 1 2016-11-03 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r208302. 4 5 This change causes LayoutTest crashes under GuardMalloc. 6 7 Reverted changeset: 8 9 "Load stylesheets in link elements inside a connected shadow 10 tree" 11 https://bugs.webkit.org/show_bug.cgi?id=160683 12 http://trac.webkit.org/changeset/208302 13 1 14 2016-11-03 Chris Dumez <cdumez@apple.com> 2 15 -
trunk/Source/WebCore/dom/Document.cpp
r208302 r208356 6981 6981 { 6982 6982 ASSERT(shadowRoot.inDocument()); 6983 ASSERT(!m_inDocumentShadowRoots.contains(&shadowRoot));6984 6983 m_inDocumentShadowRoots.add(&shadowRoot); 6985 6984 } … … 6987 6986 void Document::didRemoveInDocumentShadowRoot(ShadowRoot& shadowRoot) 6988 6987 { 6989 ASSERT(!shadowRoot.inDocument());6990 6988 ASSERT(m_inDocumentShadowRoots.contains(&shadowRoot)); 6991 6989 m_inDocumentShadowRoots.remove(&shadowRoot); -
trunk/Source/WebCore/dom/Element.cpp
r208347 r208356 1785 1785 oldRoot->setHost(nullptr); 1786 1786 oldRoot->setParentTreeScope(&document()); 1787 1788 notifyChildNodeRemoved(*this, *oldRoot); 1787 1789 } 1788 1790 -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r208302 r208356 85 85 Node::InsertionNotificationRequest ShadowRoot::insertedInto(ContainerNode& insertionPoint) 86 86 { 87 bool wasInDocument = inDocument(); 88 DocumentFragment::insertedInto(insertionPoint); 89 if (insertionPoint.inDocument() && !wasInDocument) 87 auto result = DocumentFragment::insertedInto(insertionPoint); 88 if (inDocument()) 90 89 document().didInsertInDocumentShadowRoot(*this); 91 return InsertionDone;90 return result; 92 91 } 93 92 94 93 void ShadowRoot::removedFrom(ContainerNode& insertionPoint) 95 94 { 95 if (inDocument()) 96 document().didRemoveInDocumentShadowRoot(*this); 96 97 DocumentFragment::removedFrom(insertionPoint); 97 if (insertionPoint.inDocument() && !inDocument())98 document().didRemoveInDocumentShadowRoot(*this);99 98 } 100 99 -
trunk/Source/WebCore/html/HTMLLinkElement.cpp
r208302 r208356 81 81 , m_loading(false) 82 82 , m_createdByParser(createdByParser) 83 , m_isInShadowTree(false) 83 84 , m_firedLoad(false) 84 85 , m_loadedResource(false) … … 101 102 m_cachedSheet->removeClient(*this); 102 103 103 if ( m_styleScope)104 m_styleScope->removeStyleSheetCandidateNode(*this);104 if (inDocument()) 105 document().styleScope().removeStyleSheetCandidateNode(*this); 105 106 106 107 linkLoadEventSender().cancelEvent(*this); … … 112 113 DisabledState oldDisabledState = m_disabledState; 113 114 m_disabledState = disabled ? Disabled : EnabledViaScript; 114 if (oldDisabledState == m_disabledState) 115 return; 116 117 ASSERT(inDocument() || !styleSheetIsLoading()); 118 if (!inDocument()) 119 return; 120 121 // If we change the disabled state while the sheet is still loading, then we have to 122 // perform three checks: 123 if (styleSheetIsLoading()) { 124 // Check #1: The sheet becomes disabled while loading. 125 if (m_disabledState == Disabled) 126 removePendingSheet(); 127 128 // Check #2: An alternate sheet becomes enabled while it is still loading. 129 if (m_relAttribute.isAlternate && m_disabledState == EnabledViaScript) 130 addPendingSheet(ActiveSheet); 131 132 // Check #3: A main sheet becomes enabled while it was still loading and 133 // after it was disabled via script. It takes really terrible code to make this 134 // happen (a double toggle for no reason essentially). This happens on 135 // virtualplastic.net, which manages to do about 12 enable/disables on only 3 136 // sheets. :) 137 if (!m_relAttribute.isAlternate && m_disabledState == EnabledViaScript && oldDisabledState == Disabled) 138 addPendingSheet(ActiveSheet); 139 140 // If the sheet is already loading just bail. 141 return; 142 } 143 144 // Load the sheet, since it's never been loaded before. 145 if (!m_sheet && m_disabledState == EnabledViaScript) 146 process(); 147 else { 148 ASSERT(m_styleScope); 149 m_styleScope->didChangeActiveStyleSheetCandidates(); 115 if (oldDisabledState != m_disabledState) { 116 // If we change the disabled state while the sheet is still loading, then we have to 117 // perform three checks: 118 if (styleSheetIsLoading()) { 119 // Check #1: The sheet becomes disabled while loading. 120 if (m_disabledState == Disabled) 121 removePendingSheet(); 122 123 // Check #2: An alternate sheet becomes enabled while it is still loading. 124 if (m_relAttribute.isAlternate && m_disabledState == EnabledViaScript) 125 addPendingSheet(ActiveSheet); 126 127 // Check #3: A main sheet becomes enabled while it was still loading and 128 // after it was disabled via script. It takes really terrible code to make this 129 // happen (a double toggle for no reason essentially). This happens on 130 // virtualplastic.net, which manages to do about 12 enable/disables on only 3 131 // sheets. :) 132 if (!m_relAttribute.isAlternate && m_disabledState == EnabledViaScript && oldDisabledState == Disabled) 133 addPendingSheet(ActiveSheet); 134 135 // If the sheet is already loading just bail. 136 return; 137 } 138 139 // Load the sheet, since it's never been loaded before. 140 if (!m_sheet && m_disabledState == EnabledViaScript) 141 process(); 142 else 143 document().styleScope().didChangeActiveStyleSheetCandidates(); 150 144 } 151 145 } … … 183 177 process(); 184 178 if (m_sheet && !isDisabled()) 185 m_styleScope->didChangeActiveStyleSheetCandidates();179 document().styleScope().didChangeActiveStyleSheetCandidates(); 186 180 return; 187 181 } … … 221 215 void HTMLLinkElement::process() 222 216 { 223 if (!inDocument() ) {217 if (!inDocument() || m_isInShadowTree) { 224 218 ASSERT(!m_sheet); 225 219 return; … … 290 284 // we no longer contain a stylesheet, e.g. perhaps rel or type was changed 291 285 clearSheet(); 292 m_styleScope->didChangeActiveStyleSheetCandidates();286 document().styleScope().didChangeActiveStyleSheetCandidates(); 293 287 } 294 288 } … … 304 298 Node::InsertionNotificationRequest HTMLLinkElement::insertedInto(ContainerNode& insertionPoint) 305 299 { 306 bool wasInDocument = inDocument();307 300 HTMLElement::insertedInto(insertionPoint); 308 if (!insertionPoint.inDocument() || wasInDocument)301 if (!insertionPoint.inDocument()) 309 302 return InsertionDone; 310 303 311 m_styleScope = &Style::Scope::forNode(*this); 312 m_styleScope->addStyleSheetCandidateNode(*this, m_createdByParser); 304 m_isInShadowTree = isInShadowTree(); 305 if (m_isInShadowTree) 306 return InsertionDone; 307 308 document().styleScope().addStyleSheetCandidateNode(*this, m_createdByParser); 313 309 314 310 process(); … … 319 315 { 320 316 HTMLElement::removedFrom(insertionPoint); 321 if (!insertionPoint.inDocument() || inDocument()) 322 return; 317 if (!insertionPoint.inDocument()) 318 return; 319 320 if (m_isInShadowTree) { 321 ASSERT(!m_sheet); 322 return; 323 } 324 document().styleScope().removeStyleSheetCandidateNode(*this); 323 325 324 326 if (m_sheet) … … 327 329 if (styleSheetIsLoading()) 328 330 removePendingSheet(RemovePendingSheetNotifyLater); 329 330 if (m_styleScope) {331 m_styleScope->removeStyleSheetCandidateNode(*this);332 m_styleScope = nullptr;333 }334 335 331 } 336 332 … … 549 545 if (m_pendingSheetType == InactiveSheet) 550 546 return; 551 ASSERT(m_styleScope); 552 m_styleScope->addPendingSheet(); 547 document().styleScope().addPendingSheet(); 553 548 } 554 549 … … 561 556 return; 562 557 563 ASSERT(m_styleScope);564 558 if (type == InactiveSheet) { 565 559 // Document just needs to know about the sheet for exposure through document.styleSheets 566 m_styleScope->didChangeActiveStyleSheetCandidates();567 return; 568 } 569 570 m_styleScope->removePendingSheet(560 document().styleScope().didChangeActiveStyleSheetCandidates(); 561 return; 562 } 563 564 document().styleScope().removePendingSheet( 571 565 notification == RemovePendingSheetNotifyImmediately 572 566 ? Style::Scope::RemovePendingSheetNotifyImmediately -
trunk/Source/WebCore/html/HTMLLinkElement.h
r208302 r208356 120 120 121 121 LinkLoader m_linkLoader; 122 Style::Scope* m_styleScope { nullptr };123 122 CachedResourceHandle<CachedCSSStyleSheet> m_cachedSheet; 124 123 RefPtr<CSSStyleSheet> m_sheet; … … 136 135 bool m_loading; 137 136 bool m_createdByParser; 137 bool m_isInShadowTree; 138 138 bool m_firedLoad; 139 139 bool m_loadedResource; -
trunk/Source/WebCore/html/HTMLStyleElement.cpp
r208302 r208356 95 95 Node::InsertionNotificationRequest HTMLStyleElement::insertedInto(ContainerNode& insertionPoint) 96 96 { 97 bool wasInDocument = inDocument(); 98 auto result = HTMLElement::insertedInto(insertionPoint); 99 if (insertionPoint.inDocument() && !wasInDocument) 97 HTMLElement::insertedInto(insertionPoint); 98 if (insertionPoint.inDocument()) 100 99 m_styleSheetOwner.insertedIntoDocument(*this); 101 return result; 100 101 return InsertionDone; 102 102 } 103 103 … … 105 105 { 106 106 HTMLElement::removedFrom(insertionPoint); 107 if (insertionPoint.inDocument() && !inDocument()) 107 108 if (insertionPoint.inDocument()) 108 109 m_styleSheetOwner.removedFromDocument(*this); 109 110 } -
trunk/Source/WebCore/svg/SVGStyleElement.cpp
r208302 r208356 117 117 Node::InsertionNotificationRequest SVGStyleElement::insertedInto(ContainerNode& rootParent) 118 118 { 119 bool wasInDocument = inDocument(); 120 auto result = SVGElement::insertedInto(rootParent); 121 if (rootParent.inDocument() && !wasInDocument) 119 SVGElement::insertedInto(rootParent); 120 if (rootParent.inDocument()) 122 121 m_styleSheetOwner.insertedIntoDocument(*this); 123 return result;122 return InsertionDone; 124 123 } 125 124 … … 127 126 { 128 127 SVGElement::removedFrom(rootParent); 129 if (rootParent.inDocument() && !inDocument())128 if (rootParent.inDocument()) 130 129 m_styleSheetOwner.removedFromDocument(*this); 131 130 }
Note: See TracChangeset
for help on using the changeset viewer.