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

Side by Side Diff: third_party/WebKit/Source/core/css/StyleSheetContents.cpp

Issue 2474483002: [LazyParseCSS] Ensure UseCounting has parity with strict parsing (Closed)
Patch Set: s/!/!!/ Created 4 years 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
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2006, 2007, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2006, 2007, 2012 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 if (root->m_loadingClients.size()) 484 if (root->m_loadingClients.size())
485 return (*root->m_loadingClients.begin())->ownerNode(); 485 return (*root->m_loadingClients.begin())->ownerNode();
486 return (*root->m_completedClients.begin())->ownerNode(); 486 return (*root->m_completedClients.begin())->ownerNode();
487 } 487 }
488 488
489 Document* StyleSheetContents::singleOwnerDocument() const { 489 Document* StyleSheetContents::singleOwnerDocument() const {
490 StyleSheetContents* root = rootStyleSheet(); 490 StyleSheetContents* root = rootStyleSheet();
491 return root->clientSingleOwnerDocument(); 491 return root->clientSingleOwnerDocument();
492 } 492 }
493 493
494 Document* StyleSheetContents::anyOwnerDocument() const {
495 return rootStyleSheet()->clientAnyOwnerDocument();
496 }
497
494 static bool childRulesHaveFailedOrCanceledSubresources( 498 static bool childRulesHaveFailedOrCanceledSubresources(
495 const HeapVector<Member<StyleRuleBase>>& rules) { 499 const HeapVector<Member<StyleRuleBase>>& rules) {
496 for (unsigned i = 0; i < rules.size(); ++i) { 500 for (unsigned i = 0; i < rules.size(); ++i) {
497 const StyleRuleBase* rule = rules[i].get(); 501 const StyleRuleBase* rule = rules[i].get();
498 switch (rule->type()) { 502 switch (rule->type()) {
499 case StyleRuleBase::Style: 503 case StyleRuleBase::Style:
500 if (toStyleRule(rule)->propertiesHaveFailedOrCanceledSubresources()) 504 if (toStyleRule(rule)->propertiesHaveFailedOrCanceledSubresources())
501 return true; 505 return true;
502 break; 506 break;
503 case StyleRuleBase::FontFace: 507 case StyleRuleBase::FontFace:
(...skipping 20 matching lines...) Expand all
524 } 528 }
525 } 529 }
526 return false; 530 return false;
527 } 531 }
528 532
529 bool StyleSheetContents::hasFailedOrCanceledSubresources() const { 533 bool StyleSheetContents::hasFailedOrCanceledSubresources() const {
530 ASSERT(isCacheableForResource()); 534 ASSERT(isCacheableForResource());
531 return childRulesHaveFailedOrCanceledSubresources(m_childRules); 535 return childRulesHaveFailedOrCanceledSubresources(m_childRules);
532 } 536 }
533 537
534 Document* StyleSheetContents::clientSingleOwnerDocument() const { 538 Document* StyleSheetContents::clientAnyOwnerDocument() const {
535 if (!m_hasSingleOwnerDocument || clientSize() <= 0) 539 if (clientSize() <= 0)
536 return nullptr; 540 return nullptr;
537
538 if (m_loadingClients.size()) 541 if (m_loadingClients.size())
539 return (*m_loadingClients.begin())->ownerDocument(); 542 return (*m_loadingClients.begin())->ownerDocument();
540 return (*m_completedClients.begin())->ownerDocument(); 543 return (*m_completedClients.begin())->ownerDocument();
541 } 544 }
542 545
546 Document* StyleSheetContents::clientSingleOwnerDocument() const {
547 return m_hasSingleOwnerDocument ? clientAnyOwnerDocument() : nullptr;
548 }
549
543 StyleSheetContents* StyleSheetContents::parentStyleSheet() const { 550 StyleSheetContents* StyleSheetContents::parentStyleSheet() const {
544 return m_ownerRule ? m_ownerRule->parentStyleSheet() : nullptr; 551 return m_ownerRule ? m_ownerRule->parentStyleSheet() : nullptr;
545 } 552 }
546 553
547 void StyleSheetContents::registerClient(CSSStyleSheet* sheet) { 554 void StyleSheetContents::registerClient(CSSStyleSheet* sheet) {
548 ASSERT(!m_loadingClients.contains(sheet) && 555 ASSERT(!m_loadingClients.contains(sheet) &&
549 !m_completedClients.contains(sheet)); 556 !m_completedClients.contains(sheet));
550 557
551 // InspectorCSSAgent::buildObjectForRule creates CSSStyleSheet without any 558 // InspectorCSSAgent::buildObjectForRule creates CSSStyleSheet without any
552 // owner node. 559 // owner node.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 visitor->trace(m_importRules); 692 visitor->trace(m_importRules);
686 visitor->trace(m_namespaceRules); 693 visitor->trace(m_namespaceRules);
687 visitor->trace(m_childRules); 694 visitor->trace(m_childRules);
688 visitor->trace(m_loadingClients); 695 visitor->trace(m_loadingClients);
689 visitor->trace(m_completedClients); 696 visitor->trace(m_completedClients);
690 visitor->trace(m_ruleSet); 697 visitor->trace(m_ruleSet);
691 visitor->trace(m_referencedFromResource); 698 visitor->trace(m_referencedFromResource);
692 } 699 }
693 700
694 } // namespace blink 701 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698