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

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

Issue 18147020: Remove broken sibling selector optimization (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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/css/resolver/StyleResolver.h ('k') | Source/core/css/resolver/StyleResolverState.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 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 991
992 static inline bool isAtShadowBoundary(const Element* element) 992 static inline bool isAtShadowBoundary(const Element* element)
993 { 993 {
994 if (!element) 994 if (!element)
995 return false; 995 return false;
996 ContainerNode* parentNode = element->parentNode(); 996 ContainerNode* parentNode = element->parentNode();
997 return parentNode && parentNode->isShadowRoot(); 997 return parentNode && parentNode->isShadowRoot();
998 } 998 }
999 999
1000 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS tyle* defaultParent, StyleSharingBehavior sharingBehavior, 1000 PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS tyle* defaultParent, StyleSharingBehavior sharingBehavior,
1001 RuleMatchingBehavior matchingBehavior, RenderRegion* regionForStyling, int c hildIndex) 1001 RuleMatchingBehavior matchingBehavior, RenderRegion* regionForStyling)
1002 { 1002 {
1003 // Once an element has a renderer, we don't try to destroy it, since otherwi se the renderer 1003 // Once an element has a renderer, we don't try to destroy it, since otherwi se the renderer
1004 // will vanish if a style recalc happens during loading. 1004 // will vanish if a style recalc happens during loading.
1005 if (sharingBehavior == AllowStyleSharing && !element->document()->haveStyles heetsLoaded() && !element->renderer()) { 1005 if (sharingBehavior == AllowStyleSharing && !element->document()->haveStyles heetsLoaded() && !element->renderer()) {
1006 if (!s_styleNotYetAvailable) { 1006 if (!s_styleNotYetAvailable) {
1007 s_styleNotYetAvailable = RenderStyle::create().leakRef(); 1007 s_styleNotYetAvailable = RenderStyle::create().leakRef();
1008 s_styleNotYetAvailable->setDisplay(NONE); 1008 s_styleNotYetAvailable->setDisplay(NONE);
1009 s_styleNotYetAvailable->font().update(m_fontSelector); 1009 s_styleNotYetAvailable->font().update(m_fontSelector);
1010 } 1010 }
1011 element->document()->setHasNodesWithPlaceholderStyle(); 1011 element->document()->setHasNodesWithPlaceholderStyle();
1012 return s_styleNotYetAvailable; 1012 return s_styleNotYetAvailable;
1013 } 1013 }
1014 1014
1015 StyleResolverState& state = m_state; 1015 StyleResolverState& state = m_state;
1016 state.initForStyleResolve(document(), element, childIndex, defaultParent, re gionForStyling); 1016 state.initForStyleResolve(document(), element, defaultParent, regionForStyli ng);
1017 if (sharingBehavior == AllowStyleSharing && !state.distributedToInsertionPoi nt()) { 1017 if (sharingBehavior == AllowStyleSharing && !state.distributedToInsertionPoi nt()) {
1018 RenderStyle* sharedStyle = locateSharedStyle(); 1018 RenderStyle* sharedStyle = locateSharedStyle();
1019 if (sharedStyle) { 1019 if (sharedStyle) {
1020 state.clear(); 1020 state.clear();
1021 return sharedStyle; 1021 return sharedStyle;
1022 } 1022 }
1023 } 1023 }
1024 1024
1025 if (state.parentStyle()) { 1025 if (state.parentStyle()) {
1026 state.setStyle(RenderStyle::create()); 1026 state.setStyle(RenderStyle::create());
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 } 1200 }
1201 1201
1202 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P seudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle) 1202 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P seudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle)
1203 { 1203 {
1204 ASSERT(parentStyle); 1204 ASSERT(parentStyle);
1205 if (!e) 1205 if (!e)
1206 return 0; 1206 return 0;
1207 1207
1208 StyleResolverState& state = m_state; 1208 StyleResolverState& state = m_state;
1209 1209
1210 state.initForStyleResolve(document(), e, 0, parentStyle); 1210 state.initForStyleResolve(document(), e, parentStyle);
1211 1211
1212 if (pseudoStyleRequest.allowsInheritance(state.parentStyle())) { 1212 if (pseudoStyleRequest.allowsInheritance(state.parentStyle())) {
1213 state.setStyle(RenderStyle::create()); 1213 state.setStyle(RenderStyle::create());
1214 state.style()->inheritFrom(state.parentStyle()); 1214 state.style()->inheritFrom(state.parentStyle());
1215 } else { 1215 } else {
1216 state.setStyle(defaultStyleForElement()); 1216 state.setStyle(defaultStyleForElement());
1217 state.setParentStyle(RenderStyle::clone(state.style())); 1217 state.setParentStyle(RenderStyle::clone(state.style()));
1218 } 1218 }
1219 1219
1220 // Since we don't use pseudo-elements in any of our quirk/print user agent r ules, don't waste time walking 1220 // Since we don't use pseudo-elements in any of our quirk/print user agent r ules, don't waste time walking
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 2053
2054 if (cachedMatchedProperties || !cacheHash) 2054 if (cachedMatchedProperties || !cacheHash)
2055 return; 2055 return;
2056 if (!MatchedPropertiesCache::isCacheable(state.element(), state.style(), sta te.parentStyle())) 2056 if (!MatchedPropertiesCache::isCacheable(state.element(), state.style(), sta te.parentStyle()))
2057 return; 2057 return;
2058 m_matchedPropertiesCache.add(state.style(), state.parentStyle(), cacheHash, matchResult); 2058 m_matchedPropertiesCache.add(state.style(), state.parentStyle(), cacheHash, matchResult);
2059 } 2059 }
2060 2060
2061 void StyleResolver::applyPropertyToStyle(CSSPropertyID id, CSSValue* value, Rend erStyle* style) 2061 void StyleResolver::applyPropertyToStyle(CSSPropertyID id, CSSValue* value, Rend erStyle* style)
2062 { 2062 {
2063 m_state.initForStyleResolve(document(), 0, 0, style); 2063 m_state.initForStyleResolve(document(), 0, style);
2064 m_state.setStyle(style); 2064 m_state.setStyle(style);
2065 applyPropertyToCurrentStyle(id, value); 2065 applyPropertyToCurrentStyle(id, value);
2066 } 2066 }
2067 2067
2068 void StyleResolver::applyPropertyToCurrentStyle(CSSPropertyID id, CSSValue* valu e) 2068 void StyleResolver::applyPropertyToCurrentStyle(CSSPropertyID id, CSSValue* valu e)
2069 { 2069 {
2070 if (value) 2070 if (value)
2071 applyProperty(id, value); 2071 applyProperty(id, value);
2072 } 2072 }
2073 2073
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
2404 void CachedMatchedProperties::reportMemoryUsage(MemoryObjectInfo* memoryObjectIn fo) const 2404 void CachedMatchedProperties::reportMemoryUsage(MemoryObjectInfo* memoryObjectIn fo) const
2405 { 2405 {
2406 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS); 2406 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
2407 info.addMember(matchedProperties, "matchedProperties"); 2407 info.addMember(matchedProperties, "matchedProperties");
2408 info.addMember(ranges, "ranges"); 2408 info.addMember(ranges, "ranges");
2409 info.addMember(renderStyle, "renderStyle"); 2409 info.addMember(renderStyle, "renderStyle");
2410 info.addMember(parentRenderStyle, "parentRenderStyle"); 2410 info.addMember(parentRenderStyle, "parentRenderStyle");
2411 } 2411 }
2412 2412
2413 } // namespace WebCore 2413 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleResolver.h ('k') | Source/core/css/resolver/StyleResolverState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698