Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007 Rob Buis | 2 * Copyright (C) 2006, 2007 Rob Buis |
| 3 * Copyright (C) 2008 Apple, Inc. All rights reserved. | 3 * Copyright (C) 2008 Apple, Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 , m_loading(false) | 49 , m_loading(false) |
| 50 , m_registeredAsCandidate(false) | 50 , m_registeredAsCandidate(false) |
| 51 , m_startPosition(TextPosition::belowRangePosition()) | 51 , m_startPosition(TextPosition::belowRangePosition()) |
| 52 { | 52 { |
| 53 if (createdByParser && document && document->scriptableDocumentParser() && ! document->isInDocumentWrite()) | 53 if (createdByParser && document && document->scriptableDocumentParser() && ! document->isInDocumentWrite()) |
| 54 m_startPosition = document->scriptableDocumentParser()->textPosition(); | 54 m_startPosition = document->scriptableDocumentParser()->textPosition(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 StyleElement::~StyleElement() | 57 StyleElement::~StyleElement() |
| 58 { | 58 { |
| 59 ASSERT(!m_registeredAsCandidate); | |
|
tasak
2015/04/28 10:19:05
I heard that inserted elements might be destroyed
| |
| 59 #if !ENABLE(OILPAN) | 60 #if !ENABLE(OILPAN) |
| 60 if (m_sheet) | 61 if (m_sheet) |
| 61 clearSheet(); | 62 clearSheet(); |
| 62 #endif | 63 #endif |
| 63 } | 64 } |
| 64 | 65 |
| 65 StyleElement::ProcessingResult StyleElement::processStyleSheet(Document& documen t, Element* element) | 66 StyleElement::ProcessingResult StyleElement::processStyleSheet(Document& documen t, Element* element) |
| 66 { | 67 { |
| 67 TRACE_EVENT0("blink", "StyleElement::processStyleSheet"); | 68 TRACE_EVENT0("blink", "StyleElement::processStyleSheet"); |
| 68 ASSERT(element); | 69 ASSERT(element); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 79 void StyleElement::insertedInto(Element* element, ContainerNode* insertionPoint) | 80 void StyleElement::insertedInto(Element* element, ContainerNode* insertionPoint) |
| 80 { | 81 { |
| 81 if (!insertionPoint->inDocument() || !element->isInShadowTree()) | 82 if (!insertionPoint->inDocument() || !element->isInShadowTree()) |
| 82 return; | 83 return; |
| 83 if (ShadowRoot* scope = element->containingShadowRoot()) | 84 if (ShadowRoot* scope = element->containingShadowRoot()) |
| 84 scope->registerScopedHTMLStyleChild(); | 85 scope->registerScopedHTMLStyleChild(); |
| 85 } | 86 } |
| 86 | 87 |
| 87 void StyleElement::removedFrom(Element* element, ContainerNode* insertionPoint) | 88 void StyleElement::removedFrom(Element* element, ContainerNode* insertionPoint) |
| 88 { | 89 { |
| 89 if (!insertionPoint->inDocument()) | 90 if (!insertionPoint->inDocument()) { |
| 91 ASSERT(!m_registeredAsCandidate); | |
| 90 return; | 92 return; |
| 93 } | |
| 91 | 94 |
| 92 ShadowRoot* shadowRoot = element->containingShadowRoot(); | 95 ShadowRoot* shadowRoot = element->containingShadowRoot(); |
| 93 if (!shadowRoot) | 96 if (!shadowRoot) |
| 94 shadowRoot = insertionPoint->containingShadowRoot(); | 97 shadowRoot = insertionPoint->containingShadowRoot(); |
| 95 | 98 |
| 96 if (shadowRoot) | 99 if (shadowRoot) |
| 97 shadowRoot->unregisterScopedHTMLStyleChild(); | 100 shadowRoot->unregisterScopedHTMLStyleChild(); |
| 98 | 101 |
| 99 Document& document = element->document(); | 102 Document& document = element->document(); |
| 100 if (m_registeredAsCandidate) { | 103 if (m_registeredAsCandidate) { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 111 } | 114 } |
| 112 | 115 |
| 113 void StyleElement::clearDocumentData(Document& document, Element* element) | 116 void StyleElement::clearDocumentData(Document& document, Element* element) |
| 114 { | 117 { |
| 115 if (m_sheet) | 118 if (m_sheet) |
| 116 m_sheet->clearOwnerNode(); | 119 m_sheet->clearOwnerNode(); |
| 117 | 120 |
| 118 if (m_registeredAsCandidate) { | 121 if (m_registeredAsCandidate) { |
| 119 ASSERT(element->inDocument()); | 122 ASSERT(element->inDocument()); |
| 120 document.styleEngine().removeStyleSheetCandidateNode(element, element->t reeScope()); | 123 document.styleEngine().removeStyleSheetCandidateNode(element, element->t reeScope()); |
| 124 m_registeredAsCandidate = false; | |
| 121 } | 125 } |
| 122 } | 126 } |
| 123 | 127 |
| 124 StyleElement::ProcessingResult StyleElement::childrenChanged(Element* element) | 128 StyleElement::ProcessingResult StyleElement::childrenChanged(Element* element) |
| 125 { | 129 { |
| 126 ASSERT(element); | 130 ASSERT(element); |
| 127 if (m_createdByParser) | 131 if (m_createdByParser) |
| 128 return ProcessingSuccessful; | 132 return ProcessingSuccessful; |
| 129 | 133 |
| 130 return process(element); | 134 return process(element); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 { | 230 { |
| 227 document.styleEngine().addPendingSheet(); | 231 document.styleEngine().addPendingSheet(); |
| 228 } | 232 } |
| 229 | 233 |
| 230 DEFINE_TRACE(StyleElement) | 234 DEFINE_TRACE(StyleElement) |
| 231 { | 235 { |
| 232 visitor->trace(m_sheet); | 236 visitor->trace(m_sheet); |
| 233 } | 237 } |
| 234 | 238 |
| 235 } | 239 } |
| OLD | NEW |