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

Side by Side Diff: third_party/WebKit/Source/core/css/RuleFeature.cpp

Issue 1683923003: Don't add siblingRules with combinator left of ::content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missing clear Created 4 years, 10 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
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 Apple Inc. All r ights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights 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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 if (current->pseudoType() == CSSSelector::PseudoWindowInactive) 580 if (current->pseudoType() == CSSSelector::PseudoWindowInactive)
581 metadata.usesWindowInactiveSelector = true; 581 metadata.usesWindowInactiveSelector = true;
582 if (current->relation() == CSSSelector::DirectAdjacent) { 582 if (current->relation() == CSSSelector::DirectAdjacent) {
583 maxDirectAdjacentSelectors++; 583 maxDirectAdjacentSelectors++;
584 } else if (maxDirectAdjacentSelectors 584 } else if (maxDirectAdjacentSelectors
585 && ((current->relation() != CSSSelector::SubSelector) || current->is LastInTagHistory())) { 585 && ((current->relation() != CSSSelector::SubSelector) || current->is LastInTagHistory())) {
586 if (maxDirectAdjacentSelectors > metadata.maxDirectAdjacentSelectors ) 586 if (maxDirectAdjacentSelectors > metadata.maxDirectAdjacentSelectors )
587 metadata.maxDirectAdjacentSelectors = maxDirectAdjacentSelectors ; 587 metadata.maxDirectAdjacentSelectors = maxDirectAdjacentSelectors ;
588 maxDirectAdjacentSelectors = 0; 588 maxDirectAdjacentSelectors = 0;
589 } 589 }
590 if (current->isSiblingSelector()) 590 if (!metadata.foundInsertionPointCrossing && current->isSiblingSelector( ))
591 metadata.foundSiblingSelector = true; 591 metadata.foundSiblingSelector = true;
592 592
593 const CSSSelectorList* selectorList = current->selectorList(); 593 if (const CSSSelectorList* selectorList = current->selectorList()) {
594 if (!selectorList) 594 for (const CSSSelector* subSelector = selectorList->first(); subSele ctor; subSelector = CSSSelectorList::next(*subSelector))
595 continue; 595 collectFeaturesFromSelector(*subSelector, metadata);
596 596 }
597 for (const CSSSelector* subSelector = selectorList->first(); subSelector ; subSelector = CSSSelectorList::next(*subSelector)) 597 if (current->relationIsAffectedByPseudoContent())
598 collectFeaturesFromSelector(*subSelector, metadata); 598 metadata.foundInsertionPointCrossing = true;
599 } 599 }
600 600
601 ASSERT(!maxDirectAdjacentSelectors); 601 ASSERT(!maxDirectAdjacentSelectors);
602 } 602 }
603 603
604 void RuleFeatureSet::FeatureMetadata::add(const FeatureMetadata& other) 604 void RuleFeatureSet::FeatureMetadata::add(const FeatureMetadata& other)
605 { 605 {
606 usesFirstLineRules = usesFirstLineRules || other.usesFirstLineRules; 606 usesFirstLineRules = usesFirstLineRules || other.usesFirstLineRules;
607 usesWindowInactiveSelector = usesWindowInactiveSelector || other.usesWindowI nactiveSelector; 607 usesWindowInactiveSelector = usesWindowInactiveSelector || other.usesWindowI nactiveSelector;
608 maxDirectAdjacentSelectors = std::max(maxDirectAdjacentSelectors, other.maxD irectAdjacentSelectors); 608 maxDirectAdjacentSelectors = std::max(maxDirectAdjacentSelectors, other.maxD irectAdjacentSelectors);
609 } 609 }
610 610
611 void RuleFeatureSet::FeatureMetadata::clear() 611 void RuleFeatureSet::FeatureMetadata::clear()
612 { 612 {
613 usesFirstLineRules = false; 613 usesFirstLineRules = false;
614 usesWindowInactiveSelector = false; 614 usesWindowInactiveSelector = false;
615 foundSiblingSelector = false; 615 foundSiblingSelector = false;
616 foundInsertionPointCrossing = false;
616 maxDirectAdjacentSelectors = 0; 617 maxDirectAdjacentSelectors = 0;
617 } 618 }
618 619
619 void RuleFeatureSet::add(const RuleFeatureSet& other) 620 void RuleFeatureSet::add(const RuleFeatureSet& other)
620 { 621 {
621 for (const auto& entry : other.m_classInvalidationSets) 622 for (const auto& entry : other.m_classInvalidationSets)
622 ensureInvalidationSet(m_classInvalidationSets, entry.key, entry.value->t ype()).combine(*entry.value); 623 ensureInvalidationSet(m_classInvalidationSets, entry.key, entry.value->t ype()).combine(*entry.value);
623 for (const auto& entry : other.m_attributeInvalidationSets) 624 for (const auto& entry : other.m_attributeInvalidationSets)
624 ensureInvalidationSet(m_attributeInvalidationSets, entry.key, entry.valu e->type()).combine(*entry.value); 625 ensureInvalidationSet(m_attributeInvalidationSets, entry.key, entry.valu e->type()).combine(*entry.value);
625 for (const auto& entry : other.m_idInvalidationSets) 626 for (const auto& entry : other.m_idInvalidationSets)
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 731
731 DEFINE_TRACE(RuleFeatureSet) 732 DEFINE_TRACE(RuleFeatureSet)
732 { 733 {
733 #if ENABLE(OILPAN) 734 #if ENABLE(OILPAN)
734 visitor->trace(siblingRules); 735 visitor->trace(siblingRules);
735 visitor->trace(uncommonAttributeRules); 736 visitor->trace(uncommonAttributeRules);
736 #endif 737 #endif
737 } 738 }
738 739
739 } // namespace blink 740 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/RuleFeature.h ('k') | third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698