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

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: no-find-copies Created 7 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 | 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 #include "core/css/MediaQueryEvaluator.h" 57 #include "core/css/MediaQueryEvaluator.h"
58 #include "core/css/PageRuleCollector.h" 58 #include "core/css/PageRuleCollector.h"
59 #include "core/css/StylePropertySet.h" 59 #include "core/css/StylePropertySet.h"
60 #include "core/css/StyleRuleImport.h" 60 #include "core/css/StyleRuleImport.h"
61 #include "core/css/StyleSheetContents.h" 61 #include "core/css/StyleSheetContents.h"
62 #include "core/css/resolver/AnimatedStyleBuilder.h" 62 #include "core/css/resolver/AnimatedStyleBuilder.h"
63 #include "core/css/resolver/MatchResult.h" 63 #include "core/css/resolver/MatchResult.h"
64 #include "core/css/resolver/MediaQueryResult.h" 64 #include "core/css/resolver/MediaQueryResult.h"
65 #include "core/css/resolver/SharedStyleFinder.h" 65 #include "core/css/resolver/SharedStyleFinder.h"
66 #include "core/css/resolver/StyleAdjuster.h" 66 #include "core/css/resolver/StyleAdjuster.h"
67 #include "core/css/resolver/StyleResolverParentScope.h"
67 #include "core/css/resolver/StyleResolverStats.h" 68 #include "core/css/resolver/StyleResolverStats.h"
68 #include "core/css/resolver/ViewportStyleResolver.h" 69 #include "core/css/resolver/ViewportStyleResolver.h"
69 #include "core/dom/CSSSelectorWatch.h" 70 #include "core/dom/CSSSelectorWatch.h"
70 #include "core/dom/NodeRenderStyle.h" 71 #include "core/dom/NodeRenderStyle.h"
71 #include "core/dom/StyleEngine.h" 72 #include "core/dom/StyleEngine.h"
72 #include "core/dom/Text.h" 73 #include "core/dom/Text.h"
73 #include "core/dom/shadow/ElementShadow.h" 74 #include "core/dom/shadow/ElementShadow.h"
74 #include "core/dom/shadow/ShadowRoot.h" 75 #include "core/dom/shadow/ShadowRoot.h"
76 #include "core/frame/Frame.h"
77 #include "core/frame/FrameView.h"
75 #include "core/html/HTMLIFrameElement.h" 78 #include "core/html/HTMLIFrameElement.h"
76 #include "core/inspector/InspectorInstrumentation.h" 79 #include "core/inspector/InspectorInstrumentation.h"
77 #include "core/frame/Frame.h"
78 #include "core/frame/FrameView.h"
79 #include "core/rendering/RenderView.h" 80 #include "core/rendering/RenderView.h"
80 #include "core/rendering/style/KeyframeList.h" 81 #include "core/rendering/style/KeyframeList.h"
81 #include "core/rendering/style/StyleCustomFilterProgramCache.h" 82 #include "core/rendering/style/StyleCustomFilterProgramCache.h"
82 #include "core/svg/SVGDocumentExtensions.h" 83 #include "core/svg/SVGDocumentExtensions.h"
83 #include "core/svg/SVGElement.h" 84 #include "core/svg/SVGElement.h"
84 #include "core/svg/SVGFontFaceElement.h" 85 #include "core/svg/SVGFontFaceElement.h"
85 #include "wtf/StdLibExtras.h" 86 #include "wtf/StdLibExtras.h"
86 87
87 using namespace std; 88 using namespace std;
88 89
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 if (element == document().documentElement()) 676 if (element == document().documentElement())
676 resetDirectionAndWritingModeOnDocument(document()); 677 resetDirectionAndWritingModeOnDocument(document());
677 StyleResolverState state(document(), element, defaultParent, regionForStylin g); 678 StyleResolverState state(document(), element, defaultParent, regionForStylin g);
678 679
679 if (sharingBehavior == AllowStyleSharing && !state.distributedToInsertionPoi nt() && state.parentStyle()) { 680 if (sharingBehavior == AllowStyleSharing && !state.distributedToInsertionPoi nt() && state.parentStyle()) {
680 SharedStyleFinder styleFinder(state.elementContext(), m_features, m_sibl ingRuleSet.get(), m_uncommonAttributeRuleSet.get(), *this); 681 SharedStyleFinder styleFinder(state.elementContext(), m_features, m_sibl ingRuleSet.get(), m_uncommonAttributeRuleSet.get(), *this);
681 if (RefPtr<RenderStyle> sharedStyle = styleFinder.findSharedStyle()) 682 if (RefPtr<RenderStyle> sharedStyle = styleFinder.findSharedStyle())
682 return sharedStyle.release(); 683 return sharedStyle.release();
683 } 684 }
684 685
686 StyleResolverParentScope::pushScopes();
eseidel 2013/12/09 18:18:36 This is really "ensure scopes are pushed" or somet
687
685 if (state.parentStyle()) { 688 if (state.parentStyle()) {
686 state.setStyle(RenderStyle::create()); 689 state.setStyle(RenderStyle::create());
687 state.style()->inheritFrom(state.parentStyle(), isAtShadowBoundary(eleme nt) ? RenderStyle::AtShadowBoundary : RenderStyle::NotAtShadowBoundary); 690 state.style()->inheritFrom(state.parentStyle(), isAtShadowBoundary(eleme nt) ? RenderStyle::AtShadowBoundary : RenderStyle::NotAtShadowBoundary);
688 } else { 691 } else {
689 state.setStyle(defaultStyleForElement()); 692 state.setStyle(defaultStyleForElement());
690 state.setParentStyle(RenderStyle::clone(state.style())); 693 state.setParentStyle(RenderStyle::clone(state.style()));
691 } 694 }
692 // contenteditable attribute (implemented by -webkit-user-modify) should 695 // contenteditable attribute (implemented by -webkit-user-modify) should
693 // be propagated from shadow host to distributed node. 696 // be propagated from shadow host to distributed node.
694 if (state.distributedToInsertionPoint()) { 697 if (state.distributedToInsertionPoint()) {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 } 878 }
876 879
877 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* element, c onst PseudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle) 880 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* element, c onst PseudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle)
878 { 881 {
879 ASSERT(document().frame()); 882 ASSERT(document().frame());
880 ASSERT(documentSettings()); 883 ASSERT(documentSettings());
881 ASSERT(parentStyle); 884 ASSERT(parentStyle);
882 if (!element) 885 if (!element)
883 return 0; 886 return 0;
884 887
888 StyleResolverParentScope::pushScopes();
889
885 StyleResolverState state(document(), element, parentStyle); 890 StyleResolverState state(document(), element, parentStyle);
886 891
887 if (pseudoStyleRequest.allowsInheritance(state.parentStyle())) { 892 if (pseudoStyleRequest.allowsInheritance(state.parentStyle())) {
888 state.setStyle(RenderStyle::create()); 893 state.setStyle(RenderStyle::create());
889 state.style()->inheritFrom(state.parentStyle()); 894 state.style()->inheritFrom(state.parentStyle());
890 } else { 895 } else {
891 state.setStyle(defaultStyleForElement()); 896 state.setStyle(defaultStyleForElement());
892 state.setParentStyle(RenderStyle::clone(state.style())); 897 state.setParentStyle(RenderStyle::clone(state.style()));
893 } 898 }
894 899
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 bool StyleResolver::affectedByViewportChange() const 1447 bool StyleResolver::affectedByViewportChange() const
1443 { 1448 {
1444 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) { 1449 for (unsigned i = 0; i < m_viewportDependentMediaQueryResults.size(); ++i) {
1445 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result) 1450 if (m_medium->eval(&m_viewportDependentMediaQueryResults[i]->m_expressio n) != m_viewportDependentMediaQueryResults[i]->m_result)
1446 return true; 1451 return true;
1447 } 1452 }
1448 return false; 1453 return false;
1449 } 1454 }
1450 1455
1451 } // namespace WebCore 1456 } // 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