| 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, 2010, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 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) 2010 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 9 * Copyright (C) 2013 Google Inc. All rights reserved. | 9 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "core/css/StyleInvalidationAnalysis.h" | 33 #include "core/css/StyleInvalidationAnalysis.h" |
| 34 #include "core/css/StyleSheetContents.h" | 34 #include "core/css/StyleSheetContents.h" |
| 35 #include "core/css/resolver/StyleResolver.h" | 35 #include "core/css/resolver/StyleResolver.h" |
| 36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 37 #include "core/dom/DocumentStyleSheetCollection.h" | 37 #include "core/dom/DocumentStyleSheetCollection.h" |
| 38 #include "core/dom/Element.h" | 38 #include "core/dom/Element.h" |
| 39 #include "core/dom/ProcessingInstruction.h" | 39 #include "core/dom/ProcessingInstruction.h" |
| 40 #include "core/dom/shadow/ShadowRoot.h" | 40 #include "core/dom/shadow/ShadowRoot.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/Settings.h" | 45 #include "core/page/Settings.h" |
| 45 #include "core/svg/SVGStyleElement.h" | 46 #include "core/svg/SVGStyleElement.h" |
| 46 | 47 |
| 47 namespace WebCore { | 48 namespace WebCore { |
| 48 | 49 |
| 49 using namespace HTMLNames; | 50 using namespace HTMLNames; |
| 50 | 51 |
| 51 StyleSheetCollection::StyleSheetCollection(TreeScope* treeScope) | 52 StyleSheetCollection::StyleSheetCollection(TreeScope* treeScope) |
| 52 : m_treeScope(treeScope) | 53 : m_treeScope(treeScope) |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // Don't apply XSL transforms to already transformed documents -- <r
dar://problem/4132806> | 211 // Don't apply XSL transforms to already transformed documents -- <r
dar://problem/4132806> |
| 211 if (pi->isXSL() && !document()->transformSourceDocument()) { | 212 if (pi->isXSL() && !document()->transformSourceDocument()) { |
| 212 // Don't apply XSL transforms until loading is finished. | 213 // Don't apply XSL transforms until loading is finished. |
| 213 if (!document()->parsing() && !pi->isLoading()) | 214 if (!document()->parsing() && !pi->isLoading()) |
| 214 document()->applyXSLTransform(pi); | 215 document()->applyXSLTransform(pi); |
| 215 return; | 216 return; |
| 216 } | 217 } |
| 217 sheet = pi->sheet(); | 218 sheet = pi->sheet(); |
| 218 if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet()) | 219 if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet()) |
| 219 activeSheet = static_cast<CSSStyleSheet*>(sheet); | 220 activeSheet = static_cast<CSSStyleSheet*>(sheet); |
| 220 } else if ((n->isHTMLElement() && (n->hasTagName(linkTag) || n->hasTagNa
me(styleTag))) || (n->isSVGElement() && n->hasTagName(SVGNames::styleTag))) { | 221 } else if ((n->isHTMLElement() && (n->hasTagName(linkTag) || n->hasTagNa
me(styleTag) || n->hasTagName(metaTag))) || (n->isSVGElement() && n->hasTagName(
SVGNames::styleTag))) { |
| 221 Element* e = toElement(n); | 222 Element* e = toElement(n); |
| 222 AtomicString title = e->getAttribute(titleAttr); | 223 AtomicString title = e->getAttribute(titleAttr); |
| 223 bool enabledViaScript = false; | 224 bool enabledViaScript = false; |
| 224 if (e->hasLocalName(linkTag)) { | 225 if (e->hasLocalName(linkTag)) { |
| 225 // <LINK> element | 226 // <LINK> element |
| 226 HTMLLinkElement* linkElement = toHTMLLinkElement(n); | 227 HTMLLinkElement* linkElement = toHTMLLinkElement(n); |
| 227 enabledViaScript = linkElement->isEnabledViaScript(); | 228 enabledViaScript = linkElement->isEnabledViaScript(); |
| 228 if (!linkElement->isDisabled() && linkElement->styleSheetIsLoadi
ng()) { | 229 if (!linkElement->isDisabled() && linkElement->styleSheetIsLoadi
ng()) { |
| 229 // it is loading but we should still decide which style shee
t set to use | 230 // it is loading but we should still decide which style shee
t set to use |
| 230 if (!enabledViaScript && !title.isEmpty() && collections->pr
eferredStylesheetSetName().isEmpty()) { | 231 if (!enabledViaScript && !title.isEmpty() && collections->pr
eferredStylesheetSetName().isEmpty()) { |
| 231 const AtomicString& rel = e->getAttribute(relAttr); | 232 const AtomicString& rel = e->getAttribute(relAttr); |
| 232 if (!rel.contains("alternate")) { | 233 if (!rel.contains("alternate")) { |
| 233 collections->setPreferredStylesheetSetName(title); | 234 collections->setPreferredStylesheetSetName(title); |
| 234 collections->setSelectedStylesheetSetName(title); | 235 collections->setSelectedStylesheetSetName(title); |
| 235 } | 236 } |
| 236 } | 237 } |
| 237 | 238 |
| 238 continue; | 239 continue; |
| 239 } | 240 } |
| 240 sheet = linkElement->sheet(); | 241 sheet = linkElement->sheet(); |
| 241 if (!sheet) | 242 if (!sheet) |
| 242 title = nullAtom; | 243 title = nullAtom; |
| 243 } else if (n->isSVGElement() && n->hasTagName(SVGNames::styleTag)) { | 244 } else if (n->isSVGElement() && n->hasTagName(SVGNames::styleTag)) { |
| 244 sheet = static_cast<SVGStyleElement*>(n)->sheet(); | 245 sheet = static_cast<SVGStyleElement*>(n)->sheet(); |
| 246 } else if (n->hasTagName(styleTag)) { |
| 247 sheet = static_cast<HTMLStyleElement*>(n)->sheet(); |
| 245 } else { | 248 } else { |
| 246 sheet = static_cast<HTMLStyleElement*>(n)->sheet(); | 249 sheet = static_cast<HTMLMetaElement*>(n)->sheet(); |
| 247 } | 250 } |
| 248 | 251 |
| 249 if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet()) | 252 if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet()) |
| 250 activeSheet = static_cast<CSSStyleSheet*>(sheet); | 253 activeSheet = static_cast<CSSStyleSheet*>(sheet); |
| 251 | 254 |
| 252 // Check to see if this sheet belongs to a styleset | 255 // Check to see if this sheet belongs to a styleset |
| 253 // (thus making it PREFERRED or ALTERNATE rather than | 256 // (thus making it PREFERRED or ALTERNATE rather than |
| 254 // PERSISTENT). | 257 // PERSISTENT). |
| 255 AtomicString rel = e->getAttribute(relAttr); | 258 AtomicString rel = e->getAttribute(relAttr); |
| 256 if (!enabledViaScript && sheet && !title.isEmpty()) { | 259 if (!enabledViaScript && sheet && !title.isEmpty()) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 } | 321 } |
| 319 m_scopingNodesForStyleScoped.didRemoveScopingNodes(); | 322 m_scopingNodesForStyleScoped.didRemoveScopingNodes(); |
| 320 m_activeAuthorStyleSheets.swap(activeCSSStyleSheets); | 323 m_activeAuthorStyleSheets.swap(activeCSSStyleSheets); |
| 321 m_styleSheetsForStyleSheetList.swap(styleSheets); | 324 m_styleSheetsForStyleSheetList.swap(styleSheets); |
| 322 updateUsesRemUnits(); | 325 updateUsesRemUnits(); |
| 323 | 326 |
| 324 return requiresFullStyleRecalc; | 327 return requiresFullStyleRecalc; |
| 325 } | 328 } |
| 326 | 329 |
| 327 } | 330 } |
| OLD | NEW |