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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 } | 474 } |
475 | 475 |
476 LinkStyle::LinkStyle(HTMLLinkElement* owner) | 476 LinkStyle::LinkStyle(HTMLLinkElement* owner) |
477 : LinkResource(owner) | 477 : LinkResource(owner) |
478 , m_disabledState(Unset) | 478 , m_disabledState(Unset) |
479 , m_pendingSheetType(None) | 479 , m_pendingSheetType(None) |
480 , m_loading(false) | 480 , m_loading(false) |
481 , m_firedLoad(false) | 481 , m_firedLoad(false) |
482 , m_loadedSheet(false) | 482 , m_loadedSheet(false) |
483 , m_fetchFollowingCORS(false) | 483 , m_fetchFollowingCORS(false) |
| 484 , m_beforeBody(false) |
484 { | 485 { |
485 } | 486 } |
486 | 487 |
487 LinkStyle::~LinkStyle() | 488 LinkStyle::~LinkStyle() |
488 { | 489 { |
489 } | 490 } |
490 | 491 |
491 Document& LinkStyle::document() | 492 Document& LinkStyle::document() |
492 { | 493 { |
493 return m_owner->document(); | 494 return m_owner->document(); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 } | 616 } |
616 | 617 |
617 void LinkStyle::addPendingSheet(PendingSheetType type) | 618 void LinkStyle::addPendingSheet(PendingSheetType type) |
618 { | 619 { |
619 if (type <= m_pendingSheetType) | 620 if (type <= m_pendingSheetType) |
620 return; | 621 return; |
621 m_pendingSheetType = type; | 622 m_pendingSheetType = type; |
622 | 623 |
623 if (m_pendingSheetType == NonBlocking) | 624 if (m_pendingSheetType == NonBlocking) |
624 return; | 625 return; |
625 m_owner->document().styleEngine().addPendingSheet(); | 626 m_beforeBody = m_beforeBody || !m_owner->document().body(); |
| 627 m_owner->document().styleEngine().addPendingSheet(m_beforeBody); |
626 } | 628 } |
627 | 629 |
628 void LinkStyle::removePendingSheet() | 630 void LinkStyle::removePendingSheet() |
629 { | 631 { |
630 PendingSheetType type = m_pendingSheetType; | 632 PendingSheetType type = m_pendingSheetType; |
631 m_pendingSheetType = None; | 633 m_pendingSheetType = None; |
632 | 634 |
633 if (type == None) | 635 if (type == None) |
634 return; | 636 return; |
635 if (type == NonBlocking) { | 637 if (type == NonBlocking) { |
636 // Tell StyleEngine to re-compute styleSheets of this m_owner's treescop
e. | 638 // Tell StyleEngine to re-compute styleSheets of this m_owner's treescop
e. |
637 m_owner->document().styleEngine().modifiedStyleSheetCandidateNode(m_owne
r); | 639 m_owner->document().styleEngine().modifiedStyleSheetCandidateNode(m_owne
r); |
638 return; | 640 return; |
639 } | 641 } |
640 | 642 |
641 m_owner->document().styleEngine().removePendingSheet(m_owner); | 643 m_owner->document().styleEngine().removePendingSheet(m_owner, m_beforeBody); |
642 } | 644 } |
643 | 645 |
644 void LinkStyle::setDisabledState(bool disabled) | 646 void LinkStyle::setDisabledState(bool disabled) |
645 { | 647 { |
646 LinkStyle::DisabledState oldDisabledState = m_disabledState; | 648 LinkStyle::DisabledState oldDisabledState = m_disabledState; |
647 m_disabledState = disabled ? Disabled : EnabledViaScript; | 649 m_disabledState = disabled ? Disabled : EnabledViaScript; |
648 if (oldDisabledState != m_disabledState) { | 650 if (oldDisabledState != m_disabledState) { |
649 // If we change the disabled state while the sheet is still loading, the
n we have to | 651 // If we change the disabled state while the sheet is still loading, the
n we have to |
650 // perform three checks: | 652 // perform three checks: |
651 if (styleSheetIsLoading()) { | 653 if (styleSheetIsLoading()) { |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 } | 781 } |
780 | 782 |
781 DEFINE_TRACE(LinkStyle) | 783 DEFINE_TRACE(LinkStyle) |
782 { | 784 { |
783 visitor->trace(m_sheet); | 785 visitor->trace(m_sheet); |
784 LinkResource::trace(visitor); | 786 LinkResource::trace(visitor); |
785 ResourceOwner<StyleSheetResource>::trace(visitor); | 787 ResourceOwner<StyleSheetResource>::trace(visitor); |
786 } | 788 } |
787 | 789 |
788 } // namespace blink | 790 } // namespace blink |
OLD | NEW |