| 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 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 #include "sky/engine/config.h" | 24 #include "sky/engine/config.h" |
| 25 #include "sky/engine/core/html/HTMLStyleElement.h" | 25 #include "sky/engine/core/html/HTMLStyleElement.h" |
| 26 | 26 |
| 27 #include "gen/sky/core/HTMLNames.h" | 27 #include "gen/sky/core/HTMLNames.h" |
| 28 #include "sky/engine/core/css/MediaList.h" | 28 #include "sky/engine/core/css/MediaList.h" |
| 29 #include "sky/engine/core/css/MediaQueryEvaluator.h" | 29 #include "sky/engine/core/css/MediaQueryEvaluator.h" |
| 30 #include "sky/engine/core/dom/Document.h" | 30 #include "sky/engine/core/dom/Document.h" |
| 31 #include "sky/engine/core/dom/Element.h" | 31 #include "sky/engine/core/dom/Element.h" |
| 32 #include "sky/engine/core/dom/StyleEngine.h" | 32 #include "sky/engine/core/dom/StyleEngine.h" |
| 33 #include "sky/engine/core/dom/StyleSheetCollection.h" | |
| 34 #include "sky/engine/core/dom/shadow/ShadowRoot.h" | 33 #include "sky/engine/core/dom/shadow/ShadowRoot.h" |
| 35 #include "sky/engine/core/frame/LocalFrame.h" | 34 #include "sky/engine/core/frame/LocalFrame.h" |
| 36 #include "sky/engine/platform/TraceEvent.h" | 35 #include "sky/engine/platform/TraceEvent.h" |
| 37 | 36 |
| 38 namespace blink { | 37 namespace blink { |
| 39 | 38 |
| 40 inline HTMLStyleElement::HTMLStyleElement(Document& document) | 39 inline HTMLStyleElement::HTMLStyleElement(Document& document) |
| 41 : HTMLElement(HTMLNames::styleTag, document) | 40 : HTMLElement(HTMLNames::styleTag, document) |
| 42 { | 41 { |
| 43 } | 42 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 63 } else { | 62 } else { |
| 64 HTMLElement::parseAttribute(name, value); | 63 HTMLElement::parseAttribute(name, value); |
| 65 } | 64 } |
| 66 } | 65 } |
| 67 | 66 |
| 68 void HTMLStyleElement::insertedInto(ContainerNode* insertionPoint) | 67 void HTMLStyleElement::insertedInto(ContainerNode* insertionPoint) |
| 69 { | 68 { |
| 70 HTMLElement::insertedInto(insertionPoint); | 69 HTMLElement::insertedInto(insertionPoint); |
| 71 if (!inActiveDocument()) | 70 if (!inActiveDocument()) |
| 72 return; | 71 return; |
| 73 treeScope().styleSheets().addStyleSheetCandidateNode(*this); | 72 treeScope().scopedStyleResolver().addStyleSheetCandidateNode(*this); |
| 74 process(); | 73 process(); |
| 75 } | 74 } |
| 76 | 75 |
| 77 void HTMLStyleElement::removedFrom(ContainerNode* insertionPoint) | 76 void HTMLStyleElement::removedFrom(ContainerNode* insertionPoint) |
| 78 { | 77 { |
| 79 HTMLElement::removedFrom(insertionPoint); | 78 HTMLElement::removedFrom(insertionPoint); |
| 80 | 79 |
| 81 if (!insertionPoint->inActiveDocument()) | 80 if (!insertionPoint->inActiveDocument()) |
| 82 return; | 81 return; |
| 83 | 82 |
| 84 TreeScope* containingScope = containingShadowRoot(); | 83 TreeScope* containingScope = containingShadowRoot(); |
| 85 TreeScope& scope = containingScope ? *containingScope : insertionPoint->tree
Scope(); | 84 TreeScope& scope = containingScope ? *containingScope : insertionPoint->tree
Scope(); |
| 86 | 85 |
| 87 scope.styleSheets().removeStyleSheetCandidateNode(*this); | 86 scope.scopedStyleResolver().removeStyleSheetCandidateNode(*this); |
| 88 | 87 |
| 89 RefPtr<CSSStyleSheet> removedSheet = m_sheet.get(); | 88 RefPtr<CSSStyleSheet> removedSheet = m_sheet.get(); |
| 90 | 89 |
| 91 if (m_sheet) | 90 if (m_sheet) |
| 92 clearSheet(); | 91 clearSheet(); |
| 93 if (removedSheet) | 92 if (removedSheet) |
| 94 document().styleResolverChanged(); | 93 document().styleResolverChanged(); |
| 95 } | 94 } |
| 96 | 95 |
| 97 void HTMLStyleElement::childrenChanged(const ChildrenChange& change) | 96 void HTMLStyleElement::childrenChanged(const ChildrenChange& change) |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 if (screenEval.eval(mediaQueries.get())) { | 137 if (screenEval.eval(mediaQueries.get())) { |
| 139 const String& text = textFromChildren(); | 138 const String& text = textFromChildren(); |
| 140 m_sheet = document().styleEngine()->createSheet(this, text); | 139 m_sheet = document().styleEngine()->createSheet(this, text); |
| 141 m_sheet->setMediaQueries(mediaQueries.release()); | 140 m_sheet->setMediaQueries(mediaQueries.release()); |
| 142 } | 141 } |
| 143 | 142 |
| 144 document().styleResolverChanged(); | 143 document().styleResolverChanged(); |
| 145 } | 144 } |
| 146 | 145 |
| 147 } | 146 } |
| OLD | NEW |