Changeset 88479 in webkit
- Timestamp:
- Jun 9, 2011 1:33:20 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r88474 r88479 1 2011-06-09 Julien Chaffraix <jchaffraix@codeaurora.org> 2 3 Reviewed by Antti Koivisto. 4 5 REGRESSION(84329): Stylesheets on some pages do not load 6 https://bugs.webkit.org/show_bug.cgi?id=61400 7 8 Adding test to cover the regression. The test actually uncovered 9 a bug in the way we handle alternate stylesheet and thus is 10 failing some parts. 11 12 * fast/css/link-disabled-attr-expected.txt: Added. 13 * fast/css/link-disabled-attr.html: Added. 14 1 15 2011-06-09 Julien Chaffraix <jchaffraix@webkit.org> 2 16 -
trunk/Source/WebCore/ChangeLog
r88478 r88479 1 2011-06-09 Julien Chaffraix <jchaffraix@codeaurora.org> 2 3 Reviewed by Antti Koivisto. 4 5 REGRESSION(84329): Stylesheets on some pages do not load 6 https://bugs.webkit.org/show_bug.cgi?id=61400 7 8 Test: fast/css/link-disabled-attr.html 9 10 Fixed r84329: the change did not take into account the fact 11 that HTMLLinkElement did already contain the disabled information 12 and the 2 information were not linked as they should have! 13 14 The new logic pushes the information to the stylesheet as this 15 is what the spec mandates and what FF is doing. Also it keeps 16 one bit of information (that JS enabled the stylesheet) as it 17 is needed for the recalcStyleSelector logic. 18 19 * dom/Document.cpp: 20 (WebCore::Document::recalcStyleSelector): s/isDisabled/disabled. 21 22 * html/HTMLLinkElement.cpp: 23 (WebCore::HTMLLinkElement::HTMLLinkElement): Removed m_disabledState, 24 replaced by m_isEnabledViaScript. 25 (WebCore::HTMLLinkElement::setDisabled): Updated the logic after 26 m_disabledState removal. It also matches the spec by forwarding 27 the disabled state to our stylesheet if we have one. 28 (WebCore::HTMLLinkElement::parseMappedAttribute): Removed harmful 29 handling of the disabledAttr. 30 (WebCore::HTMLLinkElement::process): Updated after m_disabledState removal. 31 * html/HTMLLinkElement.h: 32 (WebCore::HTMLLinkElement::isEnabledViaScript): Ditto. 33 (WebCore::HTMLLinkElement::isAlternate): Ditto. 34 1 35 2011-06-09 Dan Bernstein <mitz@apple.com> 2 36 -
trunk/Source/WebCore/dom/Document.cpp
r88242 r88479 2968 2968 // <LINK> element 2969 2969 HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(n); 2970 if (linkElement-> isDisabled())2970 if (linkElement->disabled()) 2971 2971 continue; 2972 2972 enabledViaScript = linkElement->isEnabledViaScript(); -
trunk/Source/WebCore/html/HTMLLinkElement.cpp
r87867 r88479 56 56 , m_onloadTimer(this, &HTMLLinkElement::onloadTimerFired) 57 57 #endif 58 , m_disabledState(Unset)59 58 , m_loading(false) 59 , m_isEnabledViaScript(false) 60 60 , m_createdByParser(createdByParser) 61 61 , m_isInShadowTree(false) … … 86 86 } 87 87 88 void HTMLLinkElement::setDisabledState(bool _disabled) 89 { 90 DisabledState oldDisabledState = m_disabledState; 91 m_disabledState = _disabled ? Disabled : EnabledViaScript; 92 if (oldDisabledState != m_disabledState) { 93 // If we change the disabled state while the sheet is still loading, then we have to 94 // perform three checks: 95 if (isLoading()) { 96 // Check #1: The sheet becomes disabled while loading. 97 if (m_disabledState == Disabled) 98 removePendingSheet(); 99 100 // Check #2: An alternate sheet becomes enabled while it is still loading. 101 if (m_relAttribute.m_isAlternate && m_disabledState == EnabledViaScript) 102 addPendingSheet(Blocking); 103 104 // Check #3: A main sheet becomes enabled while it was still loading and 105 // after it was disabled via script. It takes really terrible code to make this 106 // happen (a double toggle for no reason essentially). This happens on 107 // virtualplastic.net, which manages to do about 12 enable/disables on only 3 108 // sheets. :) 109 if (!m_relAttribute.m_isAlternate && m_disabledState == EnabledViaScript && oldDisabledState == Disabled) 110 addPendingSheet(Blocking); 111 112 // If the sheet is already loading just bail. 113 return; 114 } 115 116 // Load the sheet, since it's never been loaded before. 117 if (!m_sheet && m_disabledState == EnabledViaScript) 118 process(); 119 else 120 document()->styleSelectorChanged(DeferRecalcStyle); // Update the style selector. 121 } 88 void HTMLLinkElement::setDisabled(bool disabled) 89 { 90 if (!m_sheet) 91 return; 92 93 bool wasDisabled = m_sheet->disabled(); 94 if (wasDisabled == disabled) 95 return; 96 97 m_sheet->setDisabled(disabled); 98 m_isEnabledViaScript = !disabled; 99 100 // If we change the disabled state while the sheet is still loading, then we have to 101 // perform three checks: 102 if (isLoading()) { 103 // Check #1: The sheet becomes disabled while loading. 104 if (disabled) 105 removePendingSheet(); 106 107 // Check #2: An alternate sheet becomes enabled while it is still loading. 108 if (m_relAttribute.m_isAlternate && !disabled) 109 addPendingSheet(Blocking); 110 111 // Check #3: A main sheet becomes enabled while it was still loading and 112 // after it was disabled via script. It takes really terrible code to make this 113 // happen (a double toggle for no reason essentially). This happens on 114 // virtualplastic.net, which manages to do about 12 enable/disables on only 3 115 // sheets. :) 116 if (!m_relAttribute.m_isAlternate && !disabled && wasDisabled) 117 addPendingSheet(Blocking); 118 119 // If the sheet is already loading just bail. 120 return; 121 } 122 123 if (!disabled) 124 process(); 122 125 } 123 126 … … 141 144 m_media = attr->value().string().lower(); 142 145 process(); 143 } else if (attr->name() == disabledAttr) 144 setDisabledState(!attr->isNull()); 145 else if (attr->name() == onbeforeloadAttr) 146 } else if (attr->name() == onbeforeloadAttr) 146 147 setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr)); 147 148 #if ENABLE(LINK_PREFETCH) … … 280 281 bool acceptIfTypeContainsTextCSS = document()->page() && document()->page()->settings() && document()->page()->settings()->treatsAnyTextCSSLinkAsStylesheet(); 281 282 282 if ( m_disabledState != Disabled && (m_relAttribute.m_isStyleSheet || (acceptIfTypeContainsTextCSS && type.contains("text/css")))283 if (!disabled() && (m_relAttribute.m_isStyleSheet || (acceptIfTypeContainsTextCSS && type.contains("text/css"))) 283 284 && document()->frame() && m_url.isValid()) { 284 285 … … 555 556 } 556 557 557 void HTMLLinkElement::setDisabled(bool disabled) 558 { 559 if (!m_sheet) 560 return; 561 m_sheet->setDisabled(disabled); 562 } 563 564 } 558 } -
trunk/Source/WebCore/html/HTMLLinkElement.h
r87867 r88479 76 76 StyleSheet* sheet() const; 77 77 78 // FIXME: This should be remaned isStyleSheetLoading as this is only used for stylesheets. 78 79 bool isLoading() const; 79 80 bool isDisabled() const { return m_disabledState == Disabled; } 81 bool isEnabledViaScript() const { return m_disabledState == EnabledViaScript; } 80 bool isEnabledViaScript() const { return m_isEnabledViaScript; } 82 81 bool disabled() const; 83 82 void setDisabled(bool); … … 104 103 virtual void startLoadingDynamicSheet(); 105 104 106 bool isAlternate() const { return m_ disabledState == Unset && m_relAttribute.m_isAlternate; }105 bool isAlternate() const { return m_relAttribute.m_isAlternate; } 107 106 108 void setDisabledState(bool _disabled);109 110 107 virtual bool isURLAttribute(Attribute*) const; 111 108 … … 125 122 HTMLLinkElement(const QualifiedName&, Document*, bool createdByParser); 126 123 127 enum DisabledState {128 Unset,129 EnabledViaScript,130 Disabled131 };132 133 124 CachedResourceHandle<CachedCSSStyleSheet> m_cachedSheet; 134 125 RefPtr<CSSStyleSheet> m_sheet; … … 140 131 String m_type; 141 132 String m_media; 142 DisabledState m_disabledState;143 133 RelAttribute m_relAttribute; 144 134 bool m_loading; 135 bool m_isEnabledViaScript; 145 136 bool m_createdByParser; 146 137 bool m_isInShadowTree;
Note: See TracChangeset
for help on using the changeset viewer.