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

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

Issue 102273004: Defer pushing the parent stack in recalcStyle until StyleResolver::styleForElement() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/resolver/StyleResolverParentScope.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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "core/css/MediaQueryEvaluator.h" 56 #include "core/css/MediaQueryEvaluator.h"
57 #include "core/css/PageRuleCollector.h" 57 #include "core/css/PageRuleCollector.h"
58 #include "core/css/StylePropertySet.h" 58 #include "core/css/StylePropertySet.h"
59 #include "core/css/StyleRuleImport.h" 59 #include "core/css/StyleRuleImport.h"
60 #include "core/css/StyleSheetContents.h" 60 #include "core/css/StyleSheetContents.h"
61 #include "core/css/resolver/AnimatedStyleBuilder.h" 61 #include "core/css/resolver/AnimatedStyleBuilder.h"
62 #include "core/css/resolver/MatchResult.h" 62 #include "core/css/resolver/MatchResult.h"
63 #include "core/css/resolver/MediaQueryResult.h" 63 #include "core/css/resolver/MediaQueryResult.h"
64 #include "core/css/resolver/SharedStyleFinder.h" 64 #include "core/css/resolver/SharedStyleFinder.h"
65 #include "core/css/resolver/StyleAdjuster.h" 65 #include "core/css/resolver/StyleAdjuster.h"
66 #include "core/css/resolver/StyleResolverParentScope.h"
66 #include "core/css/resolver/StyleResolverStats.h" 67 #include "core/css/resolver/StyleResolverStats.h"
67 #include "core/css/resolver/ViewportStyleResolver.h" 68 #include "core/css/resolver/ViewportStyleResolver.h"
68 #include "core/dom/CSSSelectorWatch.h" 69 #include "core/dom/CSSSelectorWatch.h"
69 #include "core/dom/NodeRenderStyle.h" 70 #include "core/dom/NodeRenderStyle.h"
70 #include "core/dom/StyleEngine.h" 71 #include "core/dom/StyleEngine.h"
71 #include "core/dom/Text.h" 72 #include "core/dom/Text.h"
72 #include "core/dom/shadow/ElementShadow.h" 73 #include "core/dom/shadow/ElementShadow.h"
73 #include "core/dom/shadow/ShadowRoot.h" 74 #include "core/dom/shadow/ShadowRoot.h"
74 #include "core/frame/FrameView.h" 75 #include "core/frame/FrameView.h"
75 #include "core/frame/LocalFrame.h" 76 #include "core/frame/LocalFrame.h"
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 s_styleNotYetAvailable = RenderStyle::create().leakRef(); 645 s_styleNotYetAvailable = RenderStyle::create().leakRef();
645 s_styleNotYetAvailable->setDisplay(NONE); 646 s_styleNotYetAvailable->setDisplay(NONE);
646 s_styleNotYetAvailable->font().update(document().styleEngine()->font Selector()); 647 s_styleNotYetAvailable->font().update(document().styleEngine()->font Selector());
647 } 648 }
648 element->document().setHasNodesWithPlaceholderStyle(); 649 element->document().setHasNodesWithPlaceholderStyle();
649 return s_styleNotYetAvailable; 650 return s_styleNotYetAvailable;
650 } 651 }
651 652
652 didAccess(); 653 didAccess();
653 654
655 StyleResolverParentScope::ensureParentStackIsPushed();
656
654 if (element == document().documentElement()) 657 if (element == document().documentElement())
655 resetDirectionAndWritingModeOnDocument(document()); 658 resetDirectionAndWritingModeOnDocument(document());
656 StyleResolverState state(document(), element, defaultParent); 659 StyleResolverState state(document(), element, defaultParent);
657 660
658 if (sharingBehavior == AllowStyleSharing && state.parentStyle()) { 661 if (sharingBehavior == AllowStyleSharing && state.parentStyle()) {
659 SharedStyleFinder styleFinder(state.elementContext(), m_features, m_sibl ingRuleSet.get(), m_uncommonAttributeRuleSet.get(), *this); 662 SharedStyleFinder styleFinder(state.elementContext(), m_features, m_sibl ingRuleSet.get(), m_uncommonAttributeRuleSet.get(), *this);
660 if (RefPtr<RenderStyle> sharedStyle = styleFinder.findSharedStyle()) 663 if (RefPtr<RenderStyle> sharedStyle = styleFinder.findSharedStyle())
661 return sharedStyle.release(); 664 return sharedStyle.release();
662 } 665 }
663 666
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 activeAnimations->cssAnimations().maybeApplyPendingUpdate(pseudo.get()); 853 activeAnimations->cssAnimations().maybeApplyPendingUpdate(pseudo.get());
851 return pseudo.release(); 854 return pseudo.release();
852 } 855 }
853 856
854 bool StyleResolver::pseudoStyleForElementInternal(Element& element, const Pseudo StyleRequest& pseudoStyleRequest, RenderStyle* parentStyle, StyleResolverState& state) 857 bool StyleResolver::pseudoStyleForElementInternal(Element& element, const Pseudo StyleRequest& pseudoStyleRequest, RenderStyle* parentStyle, StyleResolverState& state)
855 { 858 {
856 ASSERT(document().frame()); 859 ASSERT(document().frame());
857 ASSERT(documentSettings()); 860 ASSERT(documentSettings());
858 ASSERT(pseudoStyleRequest.pseudoId != FIRST_LINE_INHERITED); 861 ASSERT(pseudoStyleRequest.pseudoId != FIRST_LINE_INHERITED);
859 862
863 StyleResolverParentScope::ensureParentStackIsPushed();
864
860 if (pseudoStyleRequest.allowsInheritance(state.parentStyle())) { 865 if (pseudoStyleRequest.allowsInheritance(state.parentStyle())) {
861 state.setStyle(RenderStyle::create()); 866 state.setStyle(RenderStyle::create());
862 state.style()->inheritFrom(state.parentStyle()); 867 state.style()->inheritFrom(state.parentStyle());
863 } else { 868 } else {
864 state.setStyle(defaultStyleForElement()); 869 state.setStyle(defaultStyleForElement());
865 state.setParentStyle(RenderStyle::clone(state.style())); 870 state.setParentStyle(RenderStyle::clone(state.style()));
866 } 871 }
867 872
868 state.fontBuilder().initForStyleResolve(state.document(), state.style(), sta te.useSVGZoomRules()); 873 state.fontBuilder().initForStyleResolve(state.document(), state.style(), sta te.useSVGZoomRules());
869 874
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 visitor->trace(m_keyframesRuleMap); 1428 visitor->trace(m_keyframesRuleMap);
1424 visitor->trace(m_viewportDependentMediaQueryResults); 1429 visitor->trace(m_viewportDependentMediaQueryResults);
1425 visitor->trace(m_viewportStyleResolver); 1430 visitor->trace(m_viewportStyleResolver);
1426 visitor->trace(m_siblingRuleSet); 1431 visitor->trace(m_siblingRuleSet);
1427 visitor->trace(m_uncommonAttributeRuleSet); 1432 visitor->trace(m_uncommonAttributeRuleSet);
1428 visitor->trace(m_watchedSelectorsRules); 1433 visitor->trace(m_watchedSelectorsRules);
1429 visitor->trace(m_treeBoundaryCrossingRules); 1434 visitor->trace(m_treeBoundaryCrossingRules);
1430 } 1435 }
1431 1436
1432 } // namespace WebCore 1437 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/resolver/StyleResolverParentScope.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698