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, 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 { | 148 { |
149 return adoptRefWillBeNoop(new HTMLLinkElement(document, createdByParser)); | 149 return adoptRefWillBeNoop(new HTMLLinkElement(document, createdByParser)); |
150 } | 150 } |
151 | 151 |
152 HTMLLinkElement::~HTMLLinkElement() | 152 HTMLLinkElement::~HTMLLinkElement() |
153 { | 153 { |
154 #if !ENABLE(OILPAN) | 154 #if !ENABLE(OILPAN) |
155 m_link.clear(); | 155 m_link.clear(); |
156 | 156 |
157 if (inDocument()) | 157 if (inDocument()) |
158 document().styleEngine()->removeStyleSheetCandidateNode(this); | 158 document().styleEngine().removeStyleSheetCandidateNode(this); |
159 #endif | 159 #endif |
160 | 160 |
161 linkLoadEventSender().cancelEvent(this); | 161 linkLoadEventSender().cancelEvent(this); |
162 } | 162 } |
163 | 163 |
164 void HTMLLinkElement::parseAttribute(const QualifiedName& name, const AtomicStri
ng& value) | 164 void HTMLLinkElement::parseAttribute(const QualifiedName& name, const AtomicStri
ng& value) |
165 { | 165 { |
166 if (name == relAttr) { | 166 if (name == relAttr) { |
167 m_relAttribute = LinkRelAttribute(value); | 167 m_relAttribute = LinkRelAttribute(value); |
168 process(); | 168 process(); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 if (!insertionPoint->inDocument()) | 276 if (!insertionPoint->inDocument()) |
277 return InsertionDone; | 277 return InsertionDone; |
278 | 278 |
279 m_isInShadowTree = isInShadowTree(); | 279 m_isInShadowTree = isInShadowTree(); |
280 if (m_isInShadowTree) { | 280 if (m_isInShadowTree) { |
281 String message = "HTML element <link> is ignored in shadow tree."; | 281 String message = "HTML element <link> is ignored in shadow tree."; |
282 document().addConsoleMessage(ConsoleMessage::create(JSMessageSource, War
ningMessageLevel, message)); | 282 document().addConsoleMessage(ConsoleMessage::create(JSMessageSource, War
ningMessageLevel, message)); |
283 return InsertionDone; | 283 return InsertionDone; |
284 } | 284 } |
285 | 285 |
286 document().styleEngine()->addStyleSheetCandidateNode(this, m_createdByParser
); | 286 document().styleEngine().addStyleSheetCandidateNode(this, m_createdByParser)
; |
287 | 287 |
288 process(); | 288 process(); |
289 | 289 |
290 if (m_link) | 290 if (m_link) |
291 m_link->ownerInserted(); | 291 m_link->ownerInserted(); |
292 | 292 |
293 return InsertionDone; | 293 return InsertionDone; |
294 } | 294 } |
295 | 295 |
296 void HTMLLinkElement::removedFrom(ContainerNode* insertionPoint) | 296 void HTMLLinkElement::removedFrom(ContainerNode* insertionPoint) |
297 { | 297 { |
298 HTMLElement::removedFrom(insertionPoint); | 298 HTMLElement::removedFrom(insertionPoint); |
299 if (!insertionPoint->inDocument()) | 299 if (!insertionPoint->inDocument()) |
300 return; | 300 return; |
301 | 301 |
302 m_linkLoader.released(); | 302 m_linkLoader.released(); |
303 | 303 |
304 if (m_isInShadowTree) { | 304 if (m_isInShadowTree) { |
305 ASSERT(!linkStyle() || !linkStyle()->hasSheet()); | 305 ASSERT(!linkStyle() || !linkStyle()->hasSheet()); |
306 return; | 306 return; |
307 } | 307 } |
308 document().styleEngine()->removeStyleSheetCandidateNode(this); | 308 document().styleEngine().removeStyleSheetCandidateNode(this); |
309 | 309 |
310 RefPtrWillBeRawPtr<StyleSheet> removedSheet = sheet(); | 310 RefPtrWillBeRawPtr<StyleSheet> removedSheet = sheet(); |
311 | 311 |
312 if (m_link) | 312 if (m_link) |
313 m_link->ownerRemoved(); | 313 m_link->ownerRemoved(); |
314 | 314 |
315 document().removedStyleSheet(removedSheet.get()); | 315 document().removedStyleSheet(removedSheet.get()); |
316 } | 316 } |
317 | 317 |
318 void HTMLLinkElement::finishParsingChildren() | 318 void HTMLLinkElement::finishParsingChildren() |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 } | 598 } |
599 | 599 |
600 void LinkStyle::addPendingSheet(PendingSheetType type) | 600 void LinkStyle::addPendingSheet(PendingSheetType type) |
601 { | 601 { |
602 if (type <= m_pendingSheetType) | 602 if (type <= m_pendingSheetType) |
603 return; | 603 return; |
604 m_pendingSheetType = type; | 604 m_pendingSheetType = type; |
605 | 605 |
606 if (m_pendingSheetType == NonBlocking) | 606 if (m_pendingSheetType == NonBlocking) |
607 return; | 607 return; |
608 m_owner->document().styleEngine()->addPendingSheet(); | 608 m_owner->document().styleEngine().addPendingSheet(); |
609 } | 609 } |
610 | 610 |
611 void LinkStyle::removePendingSheet() | 611 void LinkStyle::removePendingSheet() |
612 { | 612 { |
613 PendingSheetType type = m_pendingSheetType; | 613 PendingSheetType type = m_pendingSheetType; |
614 m_pendingSheetType = None; | 614 m_pendingSheetType = None; |
615 | 615 |
616 if (type == None) | 616 if (type == None) |
617 return; | 617 return; |
618 if (type == NonBlocking) { | 618 if (type == NonBlocking) { |
619 // Tell StyleEngine to re-compute styleSheets of this m_owner's treescop
e. | 619 // Tell StyleEngine to re-compute styleSheets of this m_owner's treescop
e. |
620 m_owner->document().styleEngine()->modifiedStyleSheetCandidateNode(m_own
er); | 620 m_owner->document().styleEngine().modifiedStyleSheetCandidateNode(m_owne
r); |
621 // Document::removePendingSheet() triggers the style selector recalc for
blocking sheets. | 621 // Document::removePendingSheet() triggers the style selector recalc for
blocking sheets. |
622 // FIXME: We don't have enough knowledge at this point to know if we're
adding or removing a sheet | 622 // FIXME: We don't have enough knowledge at this point to know if we're
adding or removing a sheet |
623 // so we can't call addedStyleSheet() or removedStyleSheet(). | 623 // so we can't call addedStyleSheet() or removedStyleSheet(). |
624 m_owner->document().styleResolverChanged(); | 624 m_owner->document().styleResolverChanged(); |
625 return; | 625 return; |
626 } | 626 } |
627 | 627 |
628 m_owner->document().styleEngine()->removePendingSheet(m_owner); | 628 m_owner->document().styleEngine().removePendingSheet(m_owner); |
629 } | 629 } |
630 | 630 |
631 void LinkStyle::setDisabledState(bool disabled) | 631 void LinkStyle::setDisabledState(bool disabled) |
632 { | 632 { |
633 LinkStyle::DisabledState oldDisabledState = m_disabledState; | 633 LinkStyle::DisabledState oldDisabledState = m_disabledState; |
634 m_disabledState = disabled ? Disabled : EnabledViaScript; | 634 m_disabledState = disabled ? Disabled : EnabledViaScript; |
635 if (oldDisabledState != m_disabledState) { | 635 if (oldDisabledState != m_disabledState) { |
636 // If we change the disabled state while the sheet is still loading, the
n we have to | 636 // If we change the disabled state while the sheet is still loading, the
n we have to |
637 // perform three checks: | 637 // perform three checks: |
638 if (styleSheetIsLoading()) { | 638 if (styleSheetIsLoading()) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 removePendingSheet(); | 752 removePendingSheet(); |
753 } | 753 } |
754 | 754 |
755 DEFINE_TRACE(LinkStyle) | 755 DEFINE_TRACE(LinkStyle) |
756 { | 756 { |
757 visitor->trace(m_sheet); | 757 visitor->trace(m_sheet); |
758 LinkResource::trace(visitor); | 758 LinkResource::trace(visitor); |
759 } | 759 } |
760 | 760 |
761 } // namespace blink | 761 } // namespace blink |
OLD | NEW |