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

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

Issue 451983002: Remove cascadeScope (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 3 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/ScopedStyleResolver.cpp ('k') | no next file » | 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 static inline bool applyAuthorStylesOf(const Element* element) 377 static inline bool applyAuthorStylesOf(const Element* element)
378 { 378 {
379 return element->treeScope().applyAuthorStyles(); 379 return element->treeScope().applyAuthorStyles();
380 } 380 }
381 381
382 void StyleResolver::matchAuthorRulesForShadowHost(Element* element, ElementRuleC ollector& collector, bool includeEmptyRules, WillBeHeapVector<RawPtrWillBeMember <ScopedStyleResolver>, 8>& resolvers, WillBeHeapVector<RawPtrWillBeMember<Scoped StyleResolver>, 8>& resolversInShadowTree) 382 void StyleResolver::matchAuthorRulesForShadowHost(Element* element, ElementRuleC ollector& collector, bool includeEmptyRules, WillBeHeapVector<RawPtrWillBeMember <ScopedStyleResolver>, 8>& resolvers, WillBeHeapVector<RawPtrWillBeMember<Scoped StyleResolver>, 8>& resolversInShadowTree)
383 { 383 {
384 collector.clearMatchedRules(); 384 collector.clearMatchedRules();
385 collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult(). matchedProperties.size() - 1; 385 collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult(). matchedProperties.size() - 1;
386 386
387 CascadeScope cascadeScope = 0;
388 CascadeOrder cascadeOrder = 0; 387 CascadeOrder cascadeOrder = 0;
389 bool applyAuthorStyles = applyAuthorStylesOf(element); 388 bool applyAuthorStyles = applyAuthorStylesOf(element);
390 389
391 for (int j = resolversInShadowTree.size() - 1; j >= 0; --j) 390 for (int j = resolversInShadowTree.size() - 1; j >= 0; --j)
392 resolversInShadowTree.at(j)->collectMatchingAuthorRules(collector, inclu deEmptyRules, applyAuthorStyles, cascadeScope, cascadeOrder++); 391 resolversInShadowTree.at(j)->collectMatchingAuthorRules(collector, inclu deEmptyRules, applyAuthorStyles, cascadeOrder++);
393 392
394 if (resolvers.isEmpty() || resolvers.first()->treeScope() != element->treeSc ope())
395 ++cascadeScope;
396 cascadeOrder += resolvers.size(); 393 cascadeOrder += resolvers.size();
397 for (unsigned i = 0; i < resolvers.size(); ++i) 394 for (unsigned i = 0; i < resolvers.size(); ++i)
398 resolvers.at(i)->collectMatchingAuthorRules(collector, includeEmptyRules , applyAuthorStyles, cascadeScope++, --cascadeOrder); 395 resolvers.at(i)->collectMatchingAuthorRules(collector, includeEmptyRules , applyAuthorStyles, --cascadeOrder);
399 396
400 m_treeBoundaryCrossingRules.collectTreeBoundaryCrossingRules(element, collec tor, includeEmptyRules); 397 m_treeBoundaryCrossingRules.collectTreeBoundaryCrossingRules(element, collec tor, includeEmptyRules);
401 collector.sortAndTransferMatchedRules(); 398 collector.sortAndTransferMatchedRules();
402 } 399 }
403 400
404 void StyleResolver::matchAuthorRules(Element* element, ElementRuleCollector& col lector, bool includeEmptyRules) 401 void StyleResolver::matchAuthorRules(Element* element, ElementRuleCollector& col lector, bool includeEmptyRules)
405 { 402 {
406 collector.clearMatchedRules(); 403 collector.clearMatchedRules();
407 collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult(). matchedProperties.size() - 1; 404 collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult(). matchedProperties.size() - 1;
408 405
409 bool applyAuthorStyles = applyAuthorStylesOf(element); 406 bool applyAuthorStyles = applyAuthorStylesOf(element);
410 if (document().styleEngine()->hasOnlyScopedResolverForDocument()) { 407 if (document().styleEngine()->hasOnlyScopedResolverForDocument()) {
411 document().scopedStyleResolver()->collectMatchingAuthorRules(collector, includeEmptyRules, applyAuthorStyles, ignoreCascadeScope); 408 document().scopedStyleResolver()->collectMatchingAuthorRules(collector, includeEmptyRules, applyAuthorStyles);
412 m_treeBoundaryCrossingRules.collectTreeBoundaryCrossingRules(element, co llector, includeEmptyRules); 409 m_treeBoundaryCrossingRules.collectTreeBoundaryCrossingRules(element, co llector, includeEmptyRules);
413 collector.sortAndTransferMatchedRules(); 410 collector.sortAndTransferMatchedRules();
414 return; 411 return;
415 } 412 }
416 413
417 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolvers; 414 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolvers;
418 resolveScopedStyles(element, resolvers); 415 resolveScopedStyles(element, resolvers);
419 416
420 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolversInShad owTree; 417 WillBeHeapVector<RawPtrWillBeMember<ScopedStyleResolver>, 8> resolversInShad owTree;
421 collectScopedResolversForHostedShadowTrees(element, resolversInShadowTree); 418 collectScopedResolversForHostedShadowTrees(element, resolversInShadowTree);
422 if (!resolversInShadowTree.isEmpty()) { 419 if (!resolversInShadowTree.isEmpty()) {
423 matchAuthorRulesForShadowHost(element, collector, includeEmptyRules, res olvers, resolversInShadowTree); 420 matchAuthorRulesForShadowHost(element, collector, includeEmptyRules, res olvers, resolversInShadowTree);
424 return; 421 return;
425 } 422 }
426 423
427 if (resolvers.isEmpty()) 424 if (resolvers.isEmpty())
428 return; 425 return;
429 426
430 CascadeScope cascadeScope = 0;
431 CascadeOrder cascadeOrder = resolvers.size(); 427 CascadeOrder cascadeOrder = resolvers.size();
432 for (unsigned i = 0; i < resolvers.size(); ++i, --cascadeOrder) { 428 for (unsigned i = 0; i < resolvers.size(); ++i, --cascadeOrder) {
433 ScopedStyleResolver* resolver = resolvers.at(i); 429 ScopedStyleResolver* resolver = resolvers.at(i);
434 // FIXME: Need to clarify how to treat style scoped. 430 // FIXME: Need to clarify how to treat style scoped.
435 resolver->collectMatchingAuthorRules(collector, includeEmptyRules, apply AuthorStyles, cascadeScope++, resolver->treeScope() == element->treeScope() && r esolver->treeScope().rootNode().isShadowRoot() ? 0 : cascadeOrder); 431 resolver->collectMatchingAuthorRules(collector, includeEmptyRules, apply AuthorStyles, resolver->treeScope() == element->treeScope() && resolver->treeSco pe().rootNode().isShadowRoot() ? 0 : cascadeOrder);
436 } 432 }
437 433
438 m_treeBoundaryCrossingRules.collectTreeBoundaryCrossingRules(element, collec tor, includeEmptyRules); 434 m_treeBoundaryCrossingRules.collectTreeBoundaryCrossingRules(element, collec tor, includeEmptyRules);
439 collector.sortAndTransferMatchedRules(); 435 collector.sortAndTransferMatchedRules();
440 } 436 }
441 437
442 void StyleResolver::matchUARules(ElementRuleCollector& collector) 438 void StyleResolver::matchUARules(ElementRuleCollector& collector)
443 { 439 {
444 collector.setMatchingUARules(true); 440 collector.setMatchingUARules(true);
445 441
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 visitor->trace(m_uncommonAttributeRuleSet); 1588 visitor->trace(m_uncommonAttributeRuleSet);
1593 visitor->trace(m_watchedSelectorsRules); 1589 visitor->trace(m_watchedSelectorsRules);
1594 visitor->trace(m_treeBoundaryCrossingRules); 1590 visitor->trace(m_treeBoundaryCrossingRules);
1595 visitor->trace(m_styleSharingLists); 1591 visitor->trace(m_styleSharingLists);
1596 visitor->trace(m_pendingStyleSheets); 1592 visitor->trace(m_pendingStyleSheets);
1597 visitor->trace(m_document); 1593 visitor->trace(m_document);
1598 #endif 1594 #endif
1599 } 1595 }
1600 1596
1601 } // namespace blink 1597 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/css/resolver/ScopedStyleResolver.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698