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

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

Issue 1851463002: No need to look up Document from Element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | no next file » | 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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 collector.sortAndTransferMatchedRules(); 517 collector.sortAndTransferMatchedRules();
518 collector.finishAddingAuthorRulesForTreeScope(); 518 collector.finishAddingAuthorRulesForTreeScope();
519 } 519 }
520 520
521 if (!matchElementScopeDone) 521 if (!matchElementScopeDone)
522 matchElementScopeRules(element, elementScopeResolver, collector); 522 matchElementScopeRules(element, elementScopeResolver, collector);
523 } 523 }
524 524
525 void StyleResolver::matchAuthorRules(const Element& element, ElementRuleCollecto r& collector) 525 void StyleResolver::matchAuthorRules(const Element& element, ElementRuleCollecto r& collector)
526 { 526 {
527 if (element.document().styleEngine().shadowCascadeOrder() != ShadowCascadeOr der::ShadowCascadeV1) { 527 if (document().styleEngine().shadowCascadeOrder() != ShadowCascadeOrder::Sha dowCascadeV1) {
528 matchAuthorRulesV0(element, collector); 528 matchAuthorRulesV0(element, collector);
529 return; 529 return;
530 } 530 }
531 531
532 ASSERT(RuntimeEnabledFeatures::shadowDOMV1Enabled()); 532 ASSERT(RuntimeEnabledFeatures::shadowDOMV1Enabled());
533 matchHostRules(element, collector); 533 matchHostRules(element, collector);
534 matchScopedRules(element, collector); 534 matchScopedRules(element, collector);
535 } 535 }
536 536
537 void StyleResolver::matchAuthorRulesV0(const Element& element, ElementRuleCollec tor& collector) 537 void StyleResolver::matchAuthorRulesV0(const Element& element, ElementRuleCollec tor& collector)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 state.setHasDirAutoAttribute(true); 602 state.setHasDirAutoAttribute(true);
603 collector.addElementStyleProperties(textDirection == LTR ? leftT oRightDeclaration() : rightToLeftDeclaration()); 603 collector.addElementStyleProperties(textDirection == LTR ? leftT oRightDeclaration() : rightToLeftDeclaration());
604 } 604 }
605 } 605 }
606 } 606 }
607 607
608 matchAuthorRules(*state.element(), collector); 608 matchAuthorRules(*state.element(), collector);
609 609
610 if (state.element()->isStyledElement()) { 610 if (state.element()->isStyledElement()) {
611 // For Shadow DOM V1, inline style is already collected in matchScopedRu les(). 611 // For Shadow DOM V1, inline style is already collected in matchScopedRu les().
612 if (state.element()->document().styleEngine().shadowCascadeOrder() != Sh adowCascadeOrder::ShadowCascadeV1 && state.element()->inlineStyle()) { 612 if (document().styleEngine().shadowCascadeOrder() != ShadowCascadeOrder: :ShadowCascadeV1 && state.element()->inlineStyle()) {
613 // Inline style is immutable as long as there is no CSSOM wrapper. 613 // Inline style is immutable as long as there is no CSSOM wrapper.
614 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut able(); 614 bool isInlineStyleCacheable = !state.element()->inlineStyle()->isMut able();
615 collector.addElementStyleProperties(state.element()->inlineStyle(), isInlineStyleCacheable); 615 collector.addElementStyleProperties(state.element()->inlineStyle(), isInlineStyleCacheable);
616 } 616 }
617 617
618 // Now check SMIL animation override style. 618 // Now check SMIL animation override style.
619 if (includeSMILProperties && state.element()->isSVGElement()) 619 if (includeSMILProperties && state.element()->isSVGElement())
620 collector.addElementStyleProperties(toSVGElement(state.element())->a nimatedSMILStyleProperties(), false /* isCacheable */); 620 collector.addElementStyleProperties(toSVGElement(state.element())->a nimatedSMILStyleProperties(), false /* isCacheable */);
621 } 621 }
622 622
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 visitor->trace(m_uncommonAttributeRuleSet); 1712 visitor->trace(m_uncommonAttributeRuleSet);
1713 visitor->trace(m_watchedSelectorsRules); 1713 visitor->trace(m_watchedSelectorsRules);
1714 visitor->trace(m_treeBoundaryCrossingScopes); 1714 visitor->trace(m_treeBoundaryCrossingScopes);
1715 visitor->trace(m_styleSharingLists); 1715 visitor->trace(m_styleSharingLists);
1716 visitor->trace(m_pendingStyleSheets); 1716 visitor->trace(m_pendingStyleSheets);
1717 visitor->trace(m_document); 1717 visitor->trace(m_document);
1718 #endif 1718 #endif
1719 } 1719 }
1720 1720
1721 } // namespace blink 1721 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698