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

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

Issue 1869773004: Move shadowCascadeOrder to Document from StyleEngine (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove ASSERT and insert DCHECK_NE Created 4 years, 8 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 | « no previous file | third_party/WebKit/Source/core/dom/Document.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 void StyleResolver::matchScopedRules(const Element& element, ElementRuleCollecto r& collector) 496 void StyleResolver::matchScopedRules(const Element& element, ElementRuleCollecto r& collector)
497 { 497 {
498 // Match rules from treeScopes in the reverse tree-of-trees order, since the 498 // Match rules from treeScopes in the reverse tree-of-trees order, since the
499 // cascading order for normal rules is such that when comparing rules from 499 // cascading order for normal rules is such that when comparing rules from
500 // different shadow trees, the rule from the tree which comes first in the 500 // different shadow trees, the rule from the tree which comes first in the
501 // tree-of-trees order wins. From other treeScopes than the element's own 501 // tree-of-trees order wins. From other treeScopes than the element's own
502 // scope, only tree-boundary-crossing rules may match. 502 // scope, only tree-boundary-crossing rules may match.
503 503
504 ScopedStyleResolver* elementScopeResolver = scopedResolverFor(element); 504 ScopedStyleResolver* elementScopeResolver = scopedResolverFor(element);
505 505
506 if (!document().styleEngine().mayContainV0Shadow()) { 506 if (!document().mayContainV0Shadow()) {
507 matchSlottedRules(element, collector); 507 matchSlottedRules(element, collector);
508 matchElementScopeRules(element, elementScopeResolver, collector); 508 matchElementScopeRules(element, elementScopeResolver, collector);
509 return; 509 return;
510 } 510 }
511 511
512 bool matchElementScopeDone = !elementScopeResolver && !element.inlineStyle() ; 512 bool matchElementScopeDone = !elementScopeResolver && !element.inlineStyle() ;
513 513
514 for (auto it = m_treeBoundaryCrossingScopes.rbegin(); it != m_treeBoundaryCr ossingScopes.rend(); ++it) { 514 for (auto it = m_treeBoundaryCrossingScopes.rbegin(); it != m_treeBoundaryCr ossingScopes.rend(); ++it) {
515 const TreeScope& scope = (*it)->treeScope(); 515 const TreeScope& scope = (*it)->treeScope();
516 ScopedStyleResolver* resolver = scope.scopedStyleResolver(); 516 ScopedStyleResolver* resolver = scope.scopedStyleResolver();
(...skipping 24 matching lines...) Expand all
541 collector.sortAndTransferMatchedRules(); 541 collector.sortAndTransferMatchedRules();
542 collector.finishAddingAuthorRulesForTreeScope(); 542 collector.finishAddingAuthorRulesForTreeScope();
543 } 543 }
544 544
545 if (!matchElementScopeDone) 545 if (!matchElementScopeDone)
546 matchElementScopeRules(element, elementScopeResolver, collector); 546 matchElementScopeRules(element, elementScopeResolver, collector);
547 } 547 }
548 548
549 void StyleResolver::matchAuthorRules(const Element& element, ElementRuleCollecto r& collector) 549 void StyleResolver::matchAuthorRules(const Element& element, ElementRuleCollecto r& collector)
550 { 550 {
551 if (document().styleEngine().shadowCascadeOrder() != ShadowCascadeOrder::Sha dowCascadeV1) { 551 if (document().shadowCascadeOrder() != ShadowCascadeOrder::ShadowCascadeV1) {
552 matchAuthorRulesV0(element, collector); 552 matchAuthorRulesV0(element, collector);
553 return; 553 return;
554 } 554 }
555 555
556 ASSERT(RuntimeEnabledFeatures::shadowDOMV1Enabled()); 556 ASSERT(RuntimeEnabledFeatures::shadowDOMV1Enabled());
557 matchHostRules(element, collector); 557 matchHostRules(element, collector);
558 matchScopedRules(element, collector); 558 matchScopedRules(element, collector);
559 } 559 }
560 560
561 void StyleResolver::matchAuthorRulesV0(const Element& element, ElementRuleCollec tor& collector) 561 void StyleResolver::matchAuthorRulesV0(const Element& element, ElementRuleCollec tor& collector)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 state.setHasDirAutoAttribute(true); 626 state.setHasDirAutoAttribute(true);
627 collector.addElementStyleProperties(textDirection == LTR ? leftT oRightDeclaration() : rightToLeftDeclaration()); 627 collector.addElementStyleProperties(textDirection == LTR ? leftT oRightDeclaration() : rightToLeftDeclaration());
628 } 628 }
629 } 629 }
630 } 630 }
631 631
632 matchAuthorRules(*state.element(), collector); 632 matchAuthorRules(*state.element(), collector);
633 633
634 if (state.element()->isStyledElement()) { 634 if (state.element()->isStyledElement()) {
635 // For Shadow DOM V1, inline style is already collected in matchScopedRu les(). 635 // For Shadow DOM V1, inline style is already collected in matchScopedRu les().
636 if (document().styleEngine().shadowCascadeOrder() != ShadowCascadeOrder: :ShadowCascadeV1 && state.element()->inlineStyle()) { 636 if (document().shadowCascadeOrder() != ShadowCascadeOrder::ShadowCascade V1 && state.element()->inlineStyle()) {
637 // Inline style is immutable as long as there is no CSSOM wrapper. 637 // Inline style is immutable as long as there is no CSSOM wrapper.
638 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut able(); 638 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut able();
639 collector.addElementStyleProperties(state.element()->inlineStyle(), isInlineStyleCacheable); 639 collector.addElementStyleProperties(state.element()->inlineStyle(), isInlineStyleCacheable);
640 } 640 }
641 641
642 // Now check SMIL animation override style. 642 // Now check SMIL animation override style.
643 if (includeSMILProperties && state.element()->isSVGElement()) 643 if (includeSMILProperties && state.element()->isSVGElement())
644 collector.addElementStyleProperties(toSVGElement(state.element())->a nimatedSMILStyleProperties(), false /* isCacheable */); 644 collector.addElementStyleProperties(toSVGElement(state.element())->a nimatedSMILStyleProperties(), false /* isCacheable */);
645 } 645 }
646 646
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after
1734 visitor->trace(m_siblingRuleSet); 1734 visitor->trace(m_siblingRuleSet);
1735 visitor->trace(m_uncommonAttributeRuleSet); 1735 visitor->trace(m_uncommonAttributeRuleSet);
1736 visitor->trace(m_watchedSelectorsRules); 1736 visitor->trace(m_watchedSelectorsRules);
1737 visitor->trace(m_treeBoundaryCrossingScopes); 1737 visitor->trace(m_treeBoundaryCrossingScopes);
1738 visitor->trace(m_styleSharingLists); 1738 visitor->trace(m_styleSharingLists);
1739 visitor->trace(m_pendingStyleSheets); 1739 visitor->trace(m_pendingStyleSheets);
1740 visitor->trace(m_document); 1740 visitor->trace(m_document);
1741 } 1741 }
1742 1742
1743 } // namespace blink 1743 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698