Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: Source/WebCore/dom/StyleElement.cpp

Issue 10265007: Merge 113887 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/WebCore/dom/StyleElement.h ('k') | Source/WebCore/html/HTMLLinkElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 process(element); 68 process(element);
69 } 69 }
70 70
71 void StyleElement::removedFromDocument(Document* document, Element* element) 71 void StyleElement::removedFromDocument(Document* document, Element* element)
72 { 72 {
73 ASSERT(document); 73 ASSERT(document);
74 ASSERT(element); 74 ASSERT(element);
75 document->removeStyleSheetCandidateNode(element); 75 document->removeStyleSheetCandidateNode(element);
76 76
77 if (m_sheet) { 77 if (m_sheet)
78 ASSERT(m_sheet->ownerNode() == element); 78 clearSheet();
79 m_sheet->clearOwnerNode();
80 m_sheet = 0;
81 }
82 79
83 // If we're in document teardown, then we don't need to do any notification of our sheet's removal. 80 // If we're in document teardown, then we don't need to do any notification of our sheet's removal.
84 if (document->renderer()) 81 if (document->renderer())
85 document->styleSelectorChanged(DeferRecalcStyle); 82 document->styleSelectorChanged(DeferRecalcStyle);
86 } 83 }
87 84
88 void StyleElement::clearDocumentData(Document* document, Element* element) 85 void StyleElement::clearDocumentData(Document* document, Element* element)
89 { 86 {
90 if (m_sheet) 87 if (m_sheet)
91 m_sheet->clearOwnerNode(); 88 m_sheet->clearOwnerNode();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 for (Node* c = e->firstChild(); c; c = c->nextSibling()) { 129 for (Node* c = e->firstChild(); c; c = c->nextSibling()) {
133 if (isValidStyleChild(c)) { 130 if (isValidStyleChild(c)) {
134 sheetText.append(c->nodeValue()); 131 sheetText.append(c->nodeValue());
135 } 132 }
136 } 133 }
137 ASSERT(sheetText.length() == resultLength); 134 ASSERT(sheetText.length() == resultLength);
138 135
139 createSheet(e, m_startLineNumber, sheetText.toString()); 136 createSheet(e, m_startLineNumber, sheetText.toString());
140 } 137 }
141 138
139 void StyleElement::clearSheet()
140 {
141 ASSERT(m_sheet);
142 m_sheet->clearOwnerNode();
143 m_sheet = 0;
144 }
145
142 void StyleElement::createSheet(Element* e, int startLineNumber, const String& te xt) 146 void StyleElement::createSheet(Element* e, int startLineNumber, const String& te xt)
143 { 147 {
144 ASSERT(e); 148 ASSERT(e);
145 ASSERT(e->inDocument()); 149 ASSERT(e->inDocument());
146 Document* document = e->document(); 150 Document* document = e->document();
147 if (m_sheet) { 151 if (m_sheet) {
148 if (m_sheet->isLoading()) 152 if (m_sheet->isLoading())
149 document->removePendingSheet(); 153 document->removePendingSheet();
150 m_sheet = 0; 154 clearSheet();
151 } 155 }
152 156
153 // If type is empty or CSS, this is a CSS style sheet. 157 // If type is empty or CSS, this is a CSS style sheet.
154 const AtomicString& type = this->type(); 158 const AtomicString& type = this->type();
155 if (document->contentSecurityPolicy()->allowInlineStyle() && isCSS(e, type)) { 159 if (document->contentSecurityPolicy()->allowInlineStyle() && isCSS(e, type)) {
156 RefPtr<MediaQuerySet> mediaQueries; 160 RefPtr<MediaQuerySet> mediaQueries;
157 if (e->isHTMLElement()) 161 if (e->isHTMLElement())
158 mediaQueries = MediaQuerySet::createAllowingDescriptionSyntax(media( )); 162 mediaQueries = MediaQuerySet::createAllowingDescriptionSyntax(media( ));
159 else 163 else
160 mediaQueries = MediaQuerySet::create(media()); 164 mediaQueries = MediaQuerySet::create(media());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 return true; 197 return true;
194 } 198 }
195 199
196 void StyleElement::startLoadingDynamicSheet(Document* document) 200 void StyleElement::startLoadingDynamicSheet(Document* document)
197 { 201 {
198 ASSERT(document); 202 ASSERT(document);
199 document->addPendingSheet(); 203 document->addPendingSheet();
200 } 204 }
201 205
202 } 206 }
OLDNEW
« no previous file with comments | « Source/WebCore/dom/StyleElement.h ('k') | Source/WebCore/html/HTMLLinkElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698