| 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 * Copyright (C) 2003, 2010 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2010 Apple Inc. All rights reserved. |
| 6 * (C) 2007 Rob Buis (buis@kde.org) | 6 * (C) 2007 Rob Buis (buis@kde.org) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 { | 112 { |
| 113 HTMLElement::childrenChanged(change); | 113 HTMLElement::childrenChanged(change); |
| 114 process(); | 114 process(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 const AtomicString& HTMLStyleElement::media() const | 117 const AtomicString& HTMLStyleElement::media() const |
| 118 { | 118 { |
| 119 return getAttribute(HTMLNames::mediaAttr); | 119 return getAttribute(HTMLNames::mediaAttr); |
| 120 } | 120 } |
| 121 | 121 |
| 122 const AtomicString& HTMLStyleElement::type() const | |
| 123 { | |
| 124 return getAttribute(HTMLNames::typeAttr); | |
| 125 } | |
| 126 | |
| 127 ContainerNode* HTMLStyleElement::scopingNode() | 122 ContainerNode* HTMLStyleElement::scopingNode() |
| 128 { | 123 { |
| 129 if (!inDocument()) | 124 if (!inDocument()) |
| 130 return 0; | 125 return 0; |
| 131 | 126 |
| 132 if (isInShadowTree()) | 127 if (isInShadowTree()) |
| 133 return containingShadowRoot(); | 128 return containingShadowRoot(); |
| 134 | 129 |
| 135 return &document(); | 130 return &document(); |
| 136 } | 131 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 148 m_sheet.release()->clearOwnerNode(); | 143 m_sheet.release()->clearOwnerNode(); |
| 149 } | 144 } |
| 150 | 145 |
| 151 void HTMLStyleElement::createSheet() | 146 void HTMLStyleElement::createSheet() |
| 152 { | 147 { |
| 153 ASSERT(inDocument()); | 148 ASSERT(inDocument()); |
| 154 | 149 |
| 155 if (m_sheet) | 150 if (m_sheet) |
| 156 clearSheet(); | 151 clearSheet(); |
| 157 | 152 |
| 158 const AtomicString& type = this->type(); | 153 RefPtr<MediaQuerySet> mediaQueries = MediaQuerySet::create(media()); |
| 159 if (type.isEmpty() || type == "text/css") { | |
| 160 RefPtr<MediaQuerySet> mediaQueries = MediaQuerySet::create(media()); | |
| 161 | 154 |
| 162 MediaQueryEvaluator screenEval("screen", true); | 155 MediaQueryEvaluator screenEval("screen", true); |
| 163 MediaQueryEvaluator printEval("print", true); | 156 MediaQueryEvaluator printEval("print", true); |
| 164 if (screenEval.eval(mediaQueries.get()) || printEval.eval(mediaQueries.g
et())) { | 157 if (screenEval.eval(mediaQueries.get()) || printEval.eval(mediaQueries.get()
)) { |
| 165 m_loading = true; | 158 m_loading = true; |
| 166 const String& text = textFromChildren(); | 159 const String& text = textFromChildren(); |
| 167 m_sheet = document().styleEngine()->createSheet(this, text); | 160 m_sheet = document().styleEngine()->createSheet(this, text); |
| 168 m_sheet->setMediaQueries(mediaQueries.release()); | 161 m_sheet->setMediaQueries(mediaQueries.release()); |
| 169 m_loading = false; | 162 m_loading = false; |
| 170 } | |
| 171 } | 163 } |
| 172 | 164 |
| 173 document().styleResolverChanged(); | 165 document().styleResolverChanged(); |
| 174 } | 166 } |
| 175 | 167 |
| 176 void HTMLStyleElement::clearDocumentData() | 168 void HTMLStyleElement::clearDocumentData() |
| 177 { | 169 { |
| 178 if (m_sheet) | 170 if (m_sheet) |
| 179 m_sheet->clearOwnerNode(); | 171 m_sheet->clearOwnerNode(); |
| 180 | 172 |
| 181 if (inDocument()) { | 173 if (inDocument()) { |
| 182 ContainerNode* scopingNode = this->scopingNode(); | 174 ContainerNode* scopingNode = this->scopingNode(); |
| 183 TreeScope& scope = scopingNode ? scopingNode->treeScope() : treeScope(); | 175 TreeScope& scope = scopingNode ? scopingNode->treeScope() : treeScope(); |
| 184 document().styleEngine()->removeStyleSheetCandidateNode(this, scopingNod
e, scope); | 176 document().styleEngine()->removeStyleSheetCandidateNode(this, scopingNod
e, scope); |
| 185 } | 177 } |
| 186 } | 178 } |
| 187 | 179 |
| 188 void HTMLStyleElement::processStyleSheet() | 180 void HTMLStyleElement::processStyleSheet() |
| 189 { | 181 { |
| 190 TRACE_EVENT0("blink", "StyleElement::processStyleSheet"); | 182 TRACE_EVENT0("blink", "StyleElement::processStyleSheet"); |
| 191 | 183 |
| 192 ASSERT(inDocument()); | 184 ASSERT(inDocument()); |
| 193 | 185 |
| 194 m_registeredAsCandidate = true; | 186 m_registeredAsCandidate = true; |
| 195 document().styleEngine()->addStyleSheetCandidateNode(this, false); | 187 document().styleEngine()->addStyleSheetCandidateNode(this, false); |
| 196 process(); | 188 process(); |
| 197 } | 189 } |
| 198 | 190 |
| 199 } | 191 } |
| OLD | NEW |