| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r
ights reserved. |
| 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. | 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. | 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "core/css/CSSStyleSheet.h" | 33 #include "core/css/CSSStyleSheet.h" |
| 34 #include "core/css/StyleInvalidationAnalysis.h" | 34 #include "core/css/StyleInvalidationAnalysis.h" |
| 35 #include "core/css/StyleSheetContents.h" | 35 #include "core/css/StyleSheetContents.h" |
| 36 #include "core/css/resolver/StyleResolver.h" | 36 #include "core/css/resolver/StyleResolver.h" |
| 37 #include "core/dom/Document.h" | 37 #include "core/dom/Document.h" |
| 38 #include "core/dom/DocumentStyleSheetCollection.h" | 38 #include "core/dom/DocumentStyleSheetCollection.h" |
| 39 #include "core/dom/Element.h" | 39 #include "core/dom/Element.h" |
| 40 #include "core/dom/ProcessingInstruction.h" | 40 #include "core/dom/ProcessingInstruction.h" |
| 41 #include "core/html/HTMLIFrameElement.h" | 41 #include "core/html/HTMLIFrameElement.h" |
| 42 #include "core/html/HTMLLinkElement.h" | 42 #include "core/html/HTMLLinkElement.h" |
| 43 #include "core/html/HTMLMetaElement.h" |
| 43 #include "core/html/HTMLStyleElement.h" | 44 #include "core/html/HTMLStyleElement.h" |
| 44 #include "core/page/Page.h" | 45 #include "core/page/Page.h" |
| 45 #include "core/page/PageGroup.h" | 46 #include "core/page/PageGroup.h" |
| 46 #include "core/page/Settings.h" | 47 #include "core/page/Settings.h" |
| 47 #include "core/page/UserContentURLPattern.h" | 48 #include "core/page/UserContentURLPattern.h" |
| 48 #include "core/svg/SVGStyleElement.h" | 49 #include "core/svg/SVGStyleElement.h" |
| 49 | 50 |
| 50 namespace WebCore { | 51 namespace WebCore { |
| 51 | 52 |
| 52 using namespace HTMLNames; | 53 using namespace HTMLNames; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // Don't apply XSL transforms to already transformed documents -- <r
dar://problem/4132806> | 98 // Don't apply XSL transforms to already transformed documents -- <r
dar://problem/4132806> |
| 98 if (pi->isXSL() && !document()->transformSourceDocument()) { | 99 if (pi->isXSL() && !document()->transformSourceDocument()) { |
| 99 // Don't apply XSL transforms until loading is finished. | 100 // Don't apply XSL transforms until loading is finished. |
| 100 if (!document()->parsing()) | 101 if (!document()->parsing()) |
| 101 document()->applyXSLTransform(pi); | 102 document()->applyXSLTransform(pi); |
| 102 return; | 103 return; |
| 103 } | 104 } |
| 104 sheet = pi->sheet(); | 105 sheet = pi->sheet(); |
| 105 if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet()) | 106 if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet()) |
| 106 activeSheet = static_cast<CSSStyleSheet*>(sheet); | 107 activeSheet = static_cast<CSSStyleSheet*>(sheet); |
| 107 } else if ((n->isHTMLElement() && (n->hasTagName(linkTag) || n->hasTagNa
me(styleTag))) || (n->isSVGElement() && n->hasTagName(SVGNames::styleTag))) { | 108 } else if ((n->isHTMLElement() && (n->hasTagName(linkTag) || n->hasTagNa
me(styleTag) || n->hasTagName(metaTag))) || (n->isSVGElement() && n->hasTagName(
SVGNames::styleTag))) { |
| 108 Element* e = toElement(n); | 109 Element* e = toElement(n); |
| 109 AtomicString title = e->getAttribute(titleAttr); | 110 AtomicString title = e->getAttribute(titleAttr); |
| 110 bool enabledViaScript = false; | 111 bool enabledViaScript = false; |
| 111 if (e->hasLocalName(linkTag)) { | 112 if (e->hasLocalName(linkTag)) { |
| 112 // <LINK> element | 113 // <LINK> element |
| 113 HTMLLinkElement* linkElement = toHTMLLinkElement(n); | 114 HTMLLinkElement* linkElement = toHTMLLinkElement(n); |
| 114 enabledViaScript = linkElement->isEnabledViaScript(); | 115 enabledViaScript = linkElement->isEnabledViaScript(); |
| 115 if (!linkElement->isDisabled() && linkElement->styleSheetIsLoadi
ng()) { | 116 if (!linkElement->isDisabled() && linkElement->styleSheetIsLoadi
ng()) { |
| 116 // it is loading but we should still decide which style shee
t set to use | 117 // it is loading but we should still decide which style shee
t set to use |
| 117 if (!enabledViaScript && !title.isEmpty() && collections->pr
eferredStylesheetSetName().isEmpty()) { | 118 if (!enabledViaScript && !title.isEmpty() && collections->pr
eferredStylesheetSetName().isEmpty()) { |
| 118 const AtomicString& rel = e->getAttribute(relAttr); | 119 const AtomicString& rel = e->getAttribute(relAttr); |
| 119 if (!rel.contains("alternate")) { | 120 if (!rel.contains("alternate")) { |
| 120 collections->setPreferredStylesheetSetName(title); | 121 collections->setPreferredStylesheetSetName(title); |
| 121 collections->setSelectedStylesheetSetName(title); | 122 collections->setSelectedStylesheetSetName(title); |
| 122 } | 123 } |
| 123 } | 124 } |
| 124 | 125 |
| 125 continue; | 126 continue; |
| 126 } | 127 } |
| 127 sheet = linkElement->sheet(); | 128 sheet = linkElement->sheet(); |
| 128 if (!sheet) | 129 if (!sheet) |
| 129 title = nullAtom; | 130 title = nullAtom; |
| 130 } else if (n->isSVGElement() && n->hasTagName(SVGNames::styleTag)) { | 131 } else if (n->isSVGElement() && n->hasTagName(SVGNames::styleTag)) { |
| 131 sheet = static_cast<SVGStyleElement*>(n)->sheet(); | 132 sheet = static_cast<SVGStyleElement*>(n)->sheet(); |
| 133 } else if (n->hasTagName(styleTag)) { |
| 134 sheet = static_cast<HTMLStyleElement*>(n)->sheet(); |
| 132 } else { | 135 } else { |
| 133 sheet = static_cast<HTMLStyleElement*>(n)->sheet(); | 136 sheet = static_cast<HTMLMetaElement*>(n)->sheet(); |
| 134 } | 137 } |
| 135 | 138 |
| 136 if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet()) | 139 if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet()) |
| 137 activeSheet = static_cast<CSSStyleSheet*>(sheet); | 140 activeSheet = static_cast<CSSStyleSheet*>(sheet); |
| 138 | 141 |
| 139 // Check to see if this sheet belongs to a styleset | 142 // Check to see if this sheet belongs to a styleset |
| 140 // (thus making it PREFERRED or ALTERNATE rather than | 143 // (thus making it PREFERRED or ALTERNATE rather than |
| 141 // PERSISTENT). | 144 // PERSISTENT). |
| 142 AtomicString rel = e->getAttribute(relAttr); | 145 AtomicString rel = e->getAttribute(relAttr); |
| 143 if (!enabledViaScript && sheet && !title.isEmpty()) { | 146 if (!enabledViaScript && sheet && !title.isEmpty()) { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 styleResolver->appendAuthorStyleSheets(m_activeAuthorStyleSheets.siz
e(), activeCSSStyleSheets); | 275 styleResolver->appendAuthorStyleSheets(m_activeAuthorStyleSheets.siz
e(), activeCSSStyleSheets); |
| 273 } | 276 } |
| 274 } | 277 } |
| 275 m_activeAuthorStyleSheets.swap(activeCSSStyleSheets); | 278 m_activeAuthorStyleSheets.swap(activeCSSStyleSheets); |
| 276 m_styleSheetsForStyleSheetList.swap(styleSheets); | 279 m_styleSheetsForStyleSheetList.swap(styleSheets); |
| 277 | 280 |
| 278 return requiresFullStyleRecalc; | 281 return requiresFullStyleRecalc; |
| 279 } | 282 } |
| 280 | 283 |
| 281 } | 284 } |
| OLD | NEW |