OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
(...skipping 13 matching lines...) Expand all Loading... |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 #include "core/dom/StyleSheetCandidate.h" | 28 #include "core/dom/StyleSheetCandidate.h" |
29 | 29 |
30 #include "HTMLNames.h" | 30 #include "HTMLNames.h" |
31 #include "core/dom/Element.h" | 31 #include "core/dom/Element.h" |
32 #include "core/dom/ProcessingInstruction.h" | 32 #include "core/dom/ProcessingInstruction.h" |
33 #include "core/dom/StyleEngine.h" | 33 #include "core/dom/StyleEngine.h" |
| 34 #include "core/html/HTMLImport.h" |
34 #include "core/html/HTMLLinkElement.h" | 35 #include "core/html/HTMLLinkElement.h" |
35 #include "core/html/HTMLStyleElement.h" | 36 #include "core/html/HTMLStyleElement.h" |
36 #include "core/svg/SVGStyleElement.h" | 37 #include "core/svg/SVGStyleElement.h" |
37 | 38 |
38 namespace WebCore { | 39 namespace WebCore { |
39 | 40 |
40 using namespace HTMLNames; | 41 using namespace HTMLNames; |
41 | 42 |
42 AtomicString StyleSheetCandidate::title() const | 43 AtomicString StyleSheetCandidate::title() const |
43 { | 44 { |
44 return isElement() ? toElement(m_node).getAttribute(titleAttr) : nullAtom; | 45 return isElement() ? toElement(m_node).getAttribute(titleAttr) : nullAtom; |
45 } | 46 } |
46 | 47 |
47 bool StyleSheetCandidate::isXSL() const | 48 bool StyleSheetCandidate::isXSL() const |
48 { | 49 { |
49 return !m_node.document().isHTMLDocument() && m_type == Pi && toProcessingIn
struction(m_node).isXSL(); | 50 return !m_node.document().isHTMLDocument() && m_type == Pi && toProcessingIn
struction(m_node).isXSL(); |
50 } | 51 } |
51 | 52 |
52 bool StyleSheetCandidate::isImport() const | 53 bool StyleSheetCandidate::isImport() const |
53 { | 54 { |
54 return m_type == HTMLLink && toHTMLLinkElement(m_node).isImport(); | 55 return m_type == HTMLLink && toHTMLLinkElement(m_node).isImport(); |
55 } | 56 } |
56 | 57 |
57 Document* StyleSheetCandidate::importedDocument() const | 58 Document* StyleSheetCandidate::importedDocument() const |
58 { | 59 { |
59 ASSERT(isImport()); | 60 ASSERT(isImport()); |
60 return toHTMLLinkElement(m_node).import(); | 61 // The stylesheet update traversal shouldn't go into shared import |
| 62 // to prevent it from stepping into cycle. |
| 63 HTMLLinkElement& element = toHTMLLinkElement(m_node); |
| 64 if (!element.importOwnsLoader()) |
| 65 return 0; |
| 66 return element.import(); |
61 } | 67 } |
62 | 68 |
63 bool StyleSheetCandidate::isAlternate() const | 69 bool StyleSheetCandidate::isAlternate() const |
64 { | 70 { |
65 if (!isElement()) | 71 if (!isElement()) |
66 return false; | 72 return false; |
67 return toElement(m_node).getAttribute(relAttr).contains("alternate"); | 73 return toElement(m_node).getAttribute(relAttr).contains("alternate"); |
68 } | 74 } |
69 | 75 |
70 bool StyleSheetCandidate::isEnabledViaScript() const | 76 bool StyleSheetCandidate::isEnabledViaScript() const |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 return toSVGStyleElement(m_node).sheet(); | 136 return toSVGStyleElement(m_node).sheet(); |
131 case Pi: | 137 case Pi: |
132 return toProcessingInstruction(m_node).sheet(); | 138 return toProcessingInstruction(m_node).sheet(); |
133 } | 139 } |
134 | 140 |
135 ASSERT_NOT_REACHED(); | 141 ASSERT_NOT_REACHED(); |
136 return 0; | 142 return 0; |
137 } | 143 } |
138 | 144 |
139 } | 145 } |
OLD | NEW |