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

Side by Side Diff: Source/core/html/HTMLLinkElement.cpp

Issue 23516012: Rename StyleSheetCollections to StyleEngine. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/shadow/ShadowRoot.cpp ('k') | Source/core/html/HTMLQuoteElement.cpp » ('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) 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, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com) 6 * Copyright (C) 2009 Rob Buis (rwlbuis@gmail.com)
7 * Copyright (C) 2011 Google Inc. All rights reserved. 7 * Copyright (C) 2011 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 18 matching lines...) Expand all
29 #include "RuntimeEnabledFeatures.h" 29 #include "RuntimeEnabledFeatures.h"
30 #include "bindings/v8/ScriptEventListener.h" 30 #include "bindings/v8/ScriptEventListener.h"
31 #include "core/css/MediaList.h" 31 #include "core/css/MediaList.h"
32 #include "core/css/MediaQueryEvaluator.h" 32 #include "core/css/MediaQueryEvaluator.h"
33 #include "core/css/StyleSheetContents.h" 33 #include "core/css/StyleSheetContents.h"
34 #include "core/css/resolver/StyleResolver.h" 34 #include "core/css/resolver/StyleResolver.h"
35 #include "core/dom/Attribute.h" 35 #include "core/dom/Attribute.h"
36 #include "core/dom/Document.h" 36 #include "core/dom/Document.h"
37 #include "core/dom/Event.h" 37 #include "core/dom/Event.h"
38 #include "core/dom/EventSender.h" 38 #include "core/dom/EventSender.h"
39 #include "core/dom/StyleSheetCollections.h" 39 #include "core/dom/StyleEngine.h"
40 #include "core/fetch/CSSStyleSheetResource.h" 40 #include "core/fetch/CSSStyleSheetResource.h"
41 #include "core/fetch/FetchRequest.h" 41 #include "core/fetch/FetchRequest.h"
42 #include "core/fetch/ResourceFetcher.h" 42 #include "core/fetch/ResourceFetcher.h"
43 #include "core/html/LinkImport.h" 43 #include "core/html/LinkImport.h"
44 #include "core/loader/FrameLoader.h" 44 #include "core/loader/FrameLoader.h"
45 #include "core/loader/FrameLoaderClient.h" 45 #include "core/loader/FrameLoaderClient.h"
46 #include "core/page/ContentSecurityPolicy.h" 46 #include "core/page/ContentSecurityPolicy.h"
47 #include "core/page/Frame.h" 47 #include "core/page/Frame.h"
48 #include "core/page/FrameView.h" 48 #include "core/page/FrameView.h"
49 #include "wtf/StdLibExtras.h" 49 #include "wtf/StdLibExtras.h"
(...skipping 23 matching lines...) Expand all
73 PassRefPtr<HTMLLinkElement> HTMLLinkElement::create(const QualifiedName& tagName , Document& document, bool createdByParser) 73 PassRefPtr<HTMLLinkElement> HTMLLinkElement::create(const QualifiedName& tagName , Document& document, bool createdByParser)
74 { 74 {
75 return adoptRef(new HTMLLinkElement(tagName, document, createdByParser)); 75 return adoptRef(new HTMLLinkElement(tagName, document, createdByParser));
76 } 76 }
77 77
78 HTMLLinkElement::~HTMLLinkElement() 78 HTMLLinkElement::~HTMLLinkElement()
79 { 79 {
80 m_link.clear(); 80 m_link.clear();
81 81
82 if (inDocument()) 82 if (inDocument())
83 document().styleSheetCollections()->removeStyleSheetCandidateNode(this); 83 document().styleEngine()->removeStyleSheetCandidateNode(this);
84 84
85 linkLoadEventSender().cancelEvent(this); 85 linkLoadEventSender().cancelEvent(this);
86 } 86 }
87 87
88 void HTMLLinkElement::parseAttribute(const QualifiedName& name, const AtomicStri ng& value) 88 void HTMLLinkElement::parseAttribute(const QualifiedName& name, const AtomicStri ng& value)
89 { 89 {
90 if (name == relAttr) { 90 if (name == relAttr) {
91 m_relAttribute = LinkRelAttribute(value); 91 m_relAttribute = LinkRelAttribute(value);
92 process(); 92 process();
93 } else if (name == hrefAttr) { 93 } else if (name == hrefAttr) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 Node::InsertionNotificationRequest HTMLLinkElement::insertedInto(ContainerNode* insertionPoint) 191 Node::InsertionNotificationRequest HTMLLinkElement::insertedInto(ContainerNode* insertionPoint)
192 { 192 {
193 HTMLElement::insertedInto(insertionPoint); 193 HTMLElement::insertedInto(insertionPoint);
194 if (!insertionPoint->inDocument()) 194 if (!insertionPoint->inDocument())
195 return InsertionDone; 195 return InsertionDone;
196 196
197 m_isInShadowTree = isInShadowTree(); 197 m_isInShadowTree = isInShadowTree();
198 if (m_isInShadowTree) 198 if (m_isInShadowTree)
199 return InsertionDone; 199 return InsertionDone;
200 200
201 document().styleSheetCollections()->addStyleSheetCandidateNode(this, m_creat edByParser); 201 document().styleEngine()->addStyleSheetCandidateNode(this, m_createdByParser );
202 202
203 process(); 203 process();
204 return InsertionDone; 204 return InsertionDone;
205 } 205 }
206 206
207 void HTMLLinkElement::removedFrom(ContainerNode* insertionPoint) 207 void HTMLLinkElement::removedFrom(ContainerNode* insertionPoint)
208 { 208 {
209 HTMLElement::removedFrom(insertionPoint); 209 HTMLElement::removedFrom(insertionPoint);
210 if (!insertionPoint->inDocument()) 210 if (!insertionPoint->inDocument())
211 return; 211 return;
212 212
213 m_linkLoader.released(); 213 m_linkLoader.released();
214 214
215 if (m_isInShadowTree) { 215 if (m_isInShadowTree) {
216 ASSERT(!linkStyle() || !linkStyle()->hasSheet()); 216 ASSERT(!linkStyle() || !linkStyle()->hasSheet());
217 return; 217 return;
218 } 218 }
219 document().styleSheetCollections()->removeStyleSheetCandidateNode(this); 219 document().styleEngine()->removeStyleSheetCandidateNode(this);
220 220
221 RefPtr<StyleSheet> removedSheet = sheet(); 221 RefPtr<StyleSheet> removedSheet = sheet();
222 222
223 if (m_link) 223 if (m_link)
224 m_link->ownerRemoved(); 224 m_link->ownerRemoved();
225 225
226 if (document().renderer()) 226 if (document().renderer())
227 document().removedStyleSheet(removedSheet.get()); 227 document().removedStyleSheet(removedSheet.get());
228 } 228 }
229 229
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 } 489 }
490 490
491 void LinkStyle::addPendingSheet(PendingSheetType type) 491 void LinkStyle::addPendingSheet(PendingSheetType type)
492 { 492 {
493 if (type <= m_pendingSheetType) 493 if (type <= m_pendingSheetType)
494 return; 494 return;
495 m_pendingSheetType = type; 495 m_pendingSheetType = type;
496 496
497 if (m_pendingSheetType == NonBlocking) 497 if (m_pendingSheetType == NonBlocking)
498 return; 498 return;
499 m_owner->document().styleSheetCollections()->addPendingSheet(); 499 m_owner->document().styleEngine()->addPendingSheet();
500 } 500 }
501 501
502 void LinkStyle::removePendingSheet(RemovePendingSheetNotificationType notificati on) 502 void LinkStyle::removePendingSheet(RemovePendingSheetNotificationType notificati on)
503 { 503 {
504 PendingSheetType type = m_pendingSheetType; 504 PendingSheetType type = m_pendingSheetType;
505 m_pendingSheetType = None; 505 m_pendingSheetType = None;
506 506
507 if (type == None) 507 if (type == None)
508 return; 508 return;
509 if (type == NonBlocking) { 509 if (type == NonBlocking) {
510 // Tell StyleSheetCollections to re-compute styleSheets of this m_owner' s treescope. 510 // Tell StyleEngine to re-compute styleSheets of this m_owner's treescop e.
511 m_owner->document().styleSheetCollections()->modifiedStyleSheetCandidate Node(m_owner); 511 m_owner->document().styleEngine()->modifiedStyleSheetCandidateNode(m_own er);
512 // Document::removePendingSheet() triggers the style selector recalc for blocking sheets. 512 // Document::removePendingSheet() triggers the style selector recalc for blocking sheets.
513 // FIXME: We don't have enough knowledge at this point to know if we're adding or removing a sheet 513 // FIXME: We don't have enough knowledge at this point to know if we're adding or removing a sheet
514 // so we can't call addedStyleSheet() or removedStyleSheet(). 514 // so we can't call addedStyleSheet() or removedStyleSheet().
515 m_owner->document().styleResolverChanged(RecalcStyleImmediately); 515 m_owner->document().styleResolverChanged(RecalcStyleImmediately);
516 return; 516 return;
517 } 517 }
518 518
519 m_owner->document().styleSheetCollections()->removePendingSheet(m_owner, 519 m_owner->document().styleEngine()->removePendingSheet(m_owner,
520 notification == RemovePendingSheetNotifyImmediately 520 notification == RemovePendingSheetNotifyImmediately
521 ? StyleSheetCollections::RemovePendingSheetNotifyImmediately 521 ? StyleEngine::RemovePendingSheetNotifyImmediately
522 : StyleSheetCollections::RemovePendingSheetNotifyLater); 522 : StyleEngine::RemovePendingSheetNotifyLater);
523 } 523 }
524 524
525 void LinkStyle::setDisabledState(bool disabled) 525 void LinkStyle::setDisabledState(bool disabled)
526 { 526 {
527 LinkStyle::DisabledState oldDisabledState = m_disabledState; 527 LinkStyle::DisabledState oldDisabledState = m_disabledState;
528 m_disabledState = disabled ? Disabled : EnabledViaScript; 528 m_disabledState = disabled ? Disabled : EnabledViaScript;
529 if (oldDisabledState != m_disabledState) { 529 if (oldDisabledState != m_disabledState) {
530 // If we change the disabled state while the sheet is still loading, the n we have to 530 // If we change the disabled state while the sheet is still loading, the n we have to
531 // perform three checks: 531 // perform three checks:
532 if (styleSheetIsLoading()) { 532 if (styleSheetIsLoading()) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 void LinkStyle::ownerRemoved() 639 void LinkStyle::ownerRemoved()
640 { 640 {
641 if (m_sheet) 641 if (m_sheet)
642 clearSheet(); 642 clearSheet();
643 643
644 if (styleSheetIsLoading()) 644 if (styleSheetIsLoading())
645 removePendingSheet(RemovePendingSheetNotifyLater); 645 removePendingSheet(RemovePendingSheetNotifyLater);
646 } 646 }
647 647
648 } // namespace WebCore 648 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/shadow/ShadowRoot.cpp ('k') | Source/core/html/HTMLQuoteElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698