| 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 13 matching lines...) Expand all Loading... |
| 24 #include "config.h" | 24 #include "config.h" |
| 25 #include "core/html/HTMLStyleElement.h" | 25 #include "core/html/HTMLStyleElement.h" |
| 26 | 26 |
| 27 #include "HTMLNames.h" | 27 #include "HTMLNames.h" |
| 28 #include "core/css/MediaList.h" | 28 #include "core/css/MediaList.h" |
| 29 #include "core/css/StyleSheetContents.h" | 29 #include "core/css/StyleSheetContents.h" |
| 30 #include "core/dom/ContextFeatures.h" | 30 #include "core/dom/ContextFeatures.h" |
| 31 #include "core/dom/Document.h" | 31 #include "core/dom/Document.h" |
| 32 #include "core/dom/Event.h" | 32 #include "core/dom/Event.h" |
| 33 #include "core/dom/EventSender.h" | 33 #include "core/dom/EventSender.h" |
| 34 #include "core/dom/StyleSheetCollections.h" | 34 #include "core/dom/StyleEngine.h" |
| 35 #include "core/dom/shadow/ShadowRoot.h" | 35 #include "core/dom/shadow/ShadowRoot.h" |
| 36 | 36 |
| 37 namespace WebCore { | 37 namespace WebCore { |
| 38 | 38 |
| 39 using namespace HTMLNames; | 39 using namespace HTMLNames; |
| 40 | 40 |
| 41 static StyleEventSender& styleLoadEventSender() | 41 static StyleEventSender& styleLoadEventSender() |
| 42 { | 42 { |
| 43 DEFINE_STATIC_LOCAL(StyleEventSender, sharedLoadEventSender, (eventNames().l
oadEvent)); | 43 DEFINE_STATIC_LOCAL(StyleEventSender, sharedLoadEventSender, (eventNames().l
oadEvent)); |
| 44 return sharedLoadEventSender; | 44 return sharedLoadEventSender; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 if (m_scopedStyleRegistrationState == RegisteredAsScoped) | 95 if (m_scopedStyleRegistrationState == RegisteredAsScoped) |
| 96 return; | 96 return; |
| 97 | 97 |
| 98 // As any <style> in a shadow tree is treated as "scoped", | 98 // As any <style> in a shadow tree is treated as "scoped", |
| 99 // need to remove the <style> from its shadow root. | 99 // need to remove the <style> from its shadow root. |
| 100 ContainerNode* scopingNode = 0; | 100 ContainerNode* scopingNode = 0; |
| 101 if (m_scopedStyleRegistrationState == RegisteredInShadowRoot) { | 101 if (m_scopedStyleRegistrationState == RegisteredInShadowRoot) { |
| 102 scopingNode = containingShadowRoot(); | 102 scopingNode = containingShadowRoot(); |
| 103 unregisterWithScopingNode(scopingNode); | 103 unregisterWithScopingNode(scopingNode); |
| 104 } | 104 } |
| 105 document().styleSheetCollections()->removeStyleSheetCandidateNode(this,
scopingNode); | 105 document().styleEngine()->removeStyleSheetCandidateNode(this, scopingNod
e); |
| 106 registerWithScopingNode(true); | 106 registerWithScopingNode(true); |
| 107 | 107 |
| 108 document().styleSheetCollections()->addStyleSheetCandidateNode(this, fal
se); | 108 document().styleEngine()->addStyleSheetCandidateNode(this, false); |
| 109 document().modifiedStyleSheet(sheet()); | 109 document().modifiedStyleSheet(sheet()); |
| 110 return; | 110 return; |
| 111 } | 111 } |
| 112 | 112 |
| 113 // If the <style> was scoped, need to remove the <style> from the scoping | 113 // If the <style> was scoped, need to remove the <style> from the scoping |
| 114 // element, i.e. the parent node. | 114 // element, i.e. the parent node. |
| 115 if (m_scopedStyleRegistrationState != RegisteredAsScoped) | 115 if (m_scopedStyleRegistrationState != RegisteredAsScoped) |
| 116 return; | 116 return; |
| 117 | 117 |
| 118 document().styleSheetCollections()->removeStyleSheetCandidateNode(this, pare
ntNode()); | 118 document().styleEngine()->removeStyleSheetCandidateNode(this, parentNode()); |
| 119 unregisterWithScopingNode(parentNode()); | 119 unregisterWithScopingNode(parentNode()); |
| 120 | 120 |
| 121 // As any <style> in a shadow tree is treated as "scoped", | 121 // As any <style> in a shadow tree is treated as "scoped", |
| 122 // need to add the <style> to its shadow root. | 122 // need to add the <style> to its shadow root. |
| 123 if (isInShadowTree()) | 123 if (isInShadowTree()) |
| 124 registerWithScopingNode(false); | 124 registerWithScopingNode(false); |
| 125 | 125 |
| 126 document().styleSheetCollections()->addStyleSheetCandidateNode(this, false); | 126 document().styleEngine()->addStyleSheetCandidateNode(this, false); |
| 127 document().modifiedStyleSheet(sheet()); | 127 document().modifiedStyleSheet(sheet()); |
| 128 } | 128 } |
| 129 | 129 |
| 130 void HTMLStyleElement::finishParsingChildren() | 130 void HTMLStyleElement::finishParsingChildren() |
| 131 { | 131 { |
| 132 StyleElement::finishParsingChildren(this); | 132 StyleElement::finishParsingChildren(this); |
| 133 HTMLElement::finishParsingChildren(); | 133 HTMLElement::finishParsingChildren(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void HTMLStyleElement::registerWithScopingNode(bool scoped) | 136 void HTMLStyleElement::registerWithScopingNode(bool scoped) |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 return m_sheet->disabled(); | 284 return m_sheet->disabled(); |
| 285 } | 285 } |
| 286 | 286 |
| 287 void HTMLStyleElement::setDisabled(bool setDisabled) | 287 void HTMLStyleElement::setDisabled(bool setDisabled) |
| 288 { | 288 { |
| 289 if (CSSStyleSheet* styleSheet = sheet()) | 289 if (CSSStyleSheet* styleSheet = sheet()) |
| 290 styleSheet->setDisabled(setDisabled); | 290 styleSheet->setDisabled(setDisabled); |
| 291 } | 291 } |
| 292 | 292 |
| 293 } | 293 } |
| OLD | NEW |