Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: Source/core/dom/StyleSheetCollection.cpp

Issue 20856002: applyXSLTransform is too eager (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/ProcessingInstruction.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 { 90 {
91 if (document()->settings() && !document()->settings()->authorAndUserStylesEn abled()) 91 if (document()->settings() && !document()->settings()->authorAndUserStylesEn abled())
92 return; 92 return;
93 93
94 DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin(); 94 DocumentOrderedList::iterator begin = m_styleSheetCandidateNodes.begin();
95 DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end(); 95 DocumentOrderedList::iterator end = m_styleSheetCandidateNodes.end();
96 for (DocumentOrderedList::iterator it = begin; it != end; ++it) { 96 for (DocumentOrderedList::iterator it = begin; it != end; ++it) {
97 Node* n = *it; 97 Node* n = *it;
98 StyleSheet* sheet = 0; 98 StyleSheet* sheet = 0;
99 CSSStyleSheet* activeSheet = 0; 99 CSSStyleSheet* activeSheet = 0;
100 if (n->nodeType() == Node::PROCESSING_INSTRUCTION_NODE) { 100 if (n->nodeType() == Node::PROCESSING_INSTRUCTION_NODE && !document()->i sHTMLDocument()) {
101 // Processing instruction (XML documents only). 101 // Processing instruction (XML documents only).
102 // We don't support linking to embedded CSS stylesheets, see <https: //bugs.webkit.org/show_bug.cgi?id=49281> for discussion. 102 // We don't support linking to embedded CSS stylesheets, see <https: //bugs.webkit.org/show_bug.cgi?id=49281> for discussion.
103 ProcessingInstruction* pi = static_cast<ProcessingInstruction*>(n); 103 ProcessingInstruction* pi = static_cast<ProcessingInstruction*>(n);
104 // Don't apply XSL transforms to already transformed documents -- <r dar://problem/4132806> 104 // Don't apply XSL transforms to already transformed documents -- <r dar://problem/4132806>
105 if (pi->isXSL() && !document()->transformSourceDocument()) { 105 if (pi->isXSL() && !document()->transformSourceDocument()) {
106 // Don't apply XSL transforms until loading is finished. 106 // Don't apply XSL transforms until loading is finished.
107 if (!document()->parsing()) 107 if (!document()->parsing() && !pi->isLoading())
108 document()->applyXSLTransform(pi); 108 document()->applyXSLTransform(pi);
109 return; 109 return;
110 } 110 }
111 sheet = pi->sheet(); 111 sheet = pi->sheet();
112 if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet()) 112 if (sheet && !sheet->disabled() && sheet->isCSSStyleSheet())
113 activeSheet = static_cast<CSSStyleSheet*>(sheet); 113 activeSheet = static_cast<CSSStyleSheet*>(sheet);
114 } else if ((n->isHTMLElement() && (n->hasTagName(linkTag) || n->hasTagNa me(styleTag))) || (n->isSVGElement() && n->hasTagName(SVGNames::styleTag))) { 114 } else if ((n->isHTMLElement() && (n->hasTagName(linkTag) || n->hasTagNa me(styleTag))) || (n->isSVGElement() && n->hasTagName(SVGNames::styleTag))) {
115 Element* e = toElement(n); 115 Element* e = toElement(n);
116 AtomicString title = e->getAttribute(titleAttr); 116 AtomicString title = e->getAttribute(titleAttr);
117 bool enabledViaScript = false; 117 bool enabledViaScript = false;
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 290 }
291 } 291 }
292 m_scopingNodesForStyleScoped.didRemoveScopingNodes(); 292 m_scopingNodesForStyleScoped.didRemoveScopingNodes();
293 m_activeAuthorStyleSheets.swap(activeCSSStyleSheets); 293 m_activeAuthorStyleSheets.swap(activeCSSStyleSheets);
294 m_styleSheetsForStyleSheetList.swap(styleSheets); 294 m_styleSheetsForStyleSheetList.swap(styleSheets);
295 295
296 return requiresFullStyleRecalc; 296 return requiresFullStyleRecalc;
297 } 297 }
298 298
299 } 299 }
OLDNEW
« no previous file with comments | « Source/core/dom/ProcessingInstruction.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698