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

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

Issue 325663003: Remove scoped styles (retry) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix layout test (and expectation) Created 6 years, 6 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
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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 if (candidate.isLink() != element().isLink()) 219 if (candidate.isLink() != element().isLink())
220 return false; 220 return false;
221 if (candidate.shadowPseudoId() != element().shadowPseudoId()) 221 if (candidate.shadowPseudoId() != element().shadowPseudoId())
222 return false; 222 return false;
223 if (!sharingCandidateHasIdenticalStyleAffectingAttributes(candidate)) 223 if (!sharingCandidateHasIdenticalStyleAffectingAttributes(candidate))
224 return false; 224 return false;
225 if (candidate.additionalPresentationAttributeStyle() != element().additional PresentationAttributeStyle()) 225 if (candidate.additionalPresentationAttributeStyle() != element().additional PresentationAttributeStyle())
226 return false; 226 return false;
227 if (candidate.hasID() && m_features.hasSelectorForId(candidate.idForStyleRes olution())) 227 if (candidate.hasID() && m_features.hasSelectorForId(candidate.idForStyleRes olution()))
228 return false; 228 return false;
229 if (candidate.hasScopedHTMLStyleChild())
230 return false;
231 if (!sharingCandidateCanShareHostStyles(candidate)) 229 if (!sharingCandidateCanShareHostStyles(candidate))
232 return false; 230 return false;
233 if (!sharingCandidateDistributedToSameInsertionPoint(candidate)) 231 if (!sharingCandidateDistributedToSameInsertionPoint(candidate))
234 return false; 232 return false;
235 if (candidate.isInTopLayer() != element().isInTopLayer()) 233 if (candidate.isInTopLayer() != element().isInTopLayer())
236 return false; 234 return false;
237 235
238 bool isControl = candidate.isFormControlElement(); 236 bool isControl = candidate.isFormControlElement();
239 237
240 if (isControl != element().isFormControlElement()) 238 if (isControl != element().isFormControlElement())
241 return false; 239 return false;
242 240
243 if (isControl && !canShareStyleWithControl(candidate)) 241 if (isControl && !canShareStyleWithControl(candidate))
244 return false; 242 return false;
245 243
246 // FIXME: This line is surprisingly hot, we may wish to inline hasDirectionA uto into StyleResolver. 244 // FIXME: This line is surprisingly hot, we may wish to inline hasDirectionA uto into StyleResolver.
247 if (candidate.isHTMLElement() && toHTMLElement(candidate).hasDirectionAuto() ) 245 if (candidate.isHTMLElement() && toHTMLElement(candidate).hasDirectionAuto() )
248 return false; 246 return false;
249 247
250 if (candidate.isLink() && m_context.elementLinkState() != style->insideLink( )) 248 if (candidate.isLink() && m_context.elementLinkState() != style->insideLink( ))
251 return false; 249 return false;
252 250
253 if (candidate.isUnresolvedCustomElement() != element().isUnresolvedCustomEle ment()) 251 if (candidate.isUnresolvedCustomElement() != element().isUnresolvedCustomEle ment())
254 return false; 252 return false;
255 253
256 if (element().parentOrShadowHostElement() != parent) { 254 if (element().parentOrShadowHostElement() != parent) {
257 if (!parent->isStyledElement()) 255 if (!parent->isStyledElement())
258 return false; 256 return false;
259 if (parent->hasScopedHTMLStyleChild())
260 return false;
261 if (parent->inlineStyle()) 257 if (parent->inlineStyle())
262 return false; 258 return false;
263 if (parent->isSVGElement() && toSVGElement(parent)->animatedSMILStylePro perties()) 259 if (parent->isSVGElement() && toSVGElement(parent)->animatedSMILStylePro perties())
264 return false; 260 return false;
265 if (parent->hasID() && m_features.hasSelectorForId(parent->idForStyleRes olution())) 261 if (parent->hasID() && m_features.hasSelectorForId(parent->idForStyleRes olution()))
266 return false; 262 return false;
267 if (!parent->childrenSupportStyleSharing()) 263 if (!parent->childrenSupportStyleSharing())
268 return false; 264 return false;
269 } 265 }
270 266
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // Tracking child index requires unique style for each node. This may get se t by the sibling rule match above. 335 // Tracking child index requires unique style for each node. This may get se t by the sibling rule match above.
340 if (!element().parentElementOrShadowRoot()->childrenSupportStyleSharing()) { 336 if (!element().parentElementOrShadowRoot()->childrenSupportStyleSharing()) {
341 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByPare nt); 337 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByPare nt);
342 return 0; 338 return 0;
343 } 339 }
344 340
345 return shareElement->renderStyle(); 341 return shareElement->renderStyle();
346 } 342 }
347 343
348 } 344 }
OLDNEW
« no previous file with comments | « Source/core/css/resolver/ScopedStyleTree.cpp ('k') | Source/core/css/resolver/StyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698