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

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

Issue 315173002: Revert of Remove scoped styles. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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;
229 if (!sharingCandidateCanShareHostStyles(candidate)) 231 if (!sharingCandidateCanShareHostStyles(candidate))
230 return false; 232 return false;
231 if (!sharingCandidateDistributedToSameInsertionPoint(candidate)) 233 if (!sharingCandidateDistributedToSameInsertionPoint(candidate))
232 return false; 234 return false;
233 if (candidate.isInTopLayer() != element().isInTopLayer()) 235 if (candidate.isInTopLayer() != element().isInTopLayer())
234 return false; 236 return false;
235 237
236 bool isControl = candidate.isFormControlElement(); 238 bool isControl = candidate.isFormControlElement();
237 239
238 if (isControl != element().isFormControlElement()) 240 if (isControl != element().isFormControlElement())
239 return false; 241 return false;
240 242
241 if (isControl && !canShareStyleWithControl(candidate)) 243 if (isControl && !canShareStyleWithControl(candidate))
242 return false; 244 return false;
243 245
244 // FIXME: This line is surprisingly hot, we may wish to inline hasDirectionA uto into StyleResolver. 246 // FIXME: This line is surprisingly hot, we may wish to inline hasDirectionA uto into StyleResolver.
245 if (candidate.isHTMLElement() && toHTMLElement(candidate).hasDirectionAuto() ) 247 if (candidate.isHTMLElement() && toHTMLElement(candidate).hasDirectionAuto() )
246 return false; 248 return false;
247 249
248 if (candidate.isLink() && m_context.elementLinkState() != style->insideLink( )) 250 if (candidate.isLink() && m_context.elementLinkState() != style->insideLink( ))
249 return false; 251 return false;
250 252
251 if (candidate.isUnresolvedCustomElement() != element().isUnresolvedCustomEle ment()) 253 if (candidate.isUnresolvedCustomElement() != element().isUnresolvedCustomEle ment())
252 return false; 254 return false;
253 255
254 if (element().parentOrShadowHostElement() != parent) { 256 if (element().parentOrShadowHostElement() != parent) {
255 if (!parent->isStyledElement()) 257 if (!parent->isStyledElement())
256 return false; 258 return false;
259 if (parent->hasScopedHTMLStyleChild())
260 return false;
257 if (parent->inlineStyle()) 261 if (parent->inlineStyle())
258 return false; 262 return false;
259 if (parent->isSVGElement() && toSVGElement(parent)->animatedSMILStylePro perties()) 263 if (parent->isSVGElement() && toSVGElement(parent)->animatedSMILStylePro perties())
260 return false; 264 return false;
261 if (parent->hasID() && m_features.hasSelectorForId(parent->idForStyleRes olution())) 265 if (parent->hasID() && m_features.hasSelectorForId(parent->idForStyleRes olution()))
262 return false; 266 return false;
263 if (!parent->childrenSupportStyleSharing()) 267 if (!parent->childrenSupportStyleSharing())
264 return false; 268 return false;
265 } 269 }
266 270
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 // Tracking child index requires unique style for each node. This may get se t by the sibling rule match above. 339 // Tracking child index requires unique style for each node. This may get se t by the sibling rule match above.
336 if (!element().parentElementOrShadowRoot()->childrenSupportStyleSharing()) { 340 if (!element().parentElementOrShadowRoot()->childrenSupportStyleSharing()) {
337 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByPare nt); 341 INCREMENT_STYLE_STATS_COUNTER(m_styleResolver, sharedStyleRejectedByPare nt);
338 return 0; 342 return 0;
339 } 343 }
340 344
341 return shareElement->renderStyle(); 345 return shareElement->renderStyle();
342 } 346 }
343 347
344 } 348 }
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