X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fthird_party%2FWebKit%2FSource%2Fcore%2Fcss%2FElementRuleCollector.cpp;h=d7c7a0e596bc0ab06ef9ca89b5d1db75176712e3;hb=1afa4dd80ef85af7c90efaea6959db1d92330844;hp=3ae2bd734da6c57d51bc15bd7bfe4feca786a139;hpb=90762837333c13ccf56f2ad88e4481fc71e8d281;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/third_party/WebKit/Source/core/css/ElementRuleCollector.cpp b/src/third_party/WebKit/Source/core/css/ElementRuleCollector.cpp index 3ae2bd7..d7c7a0e 100644 --- a/src/third_party/WebKit/Source/core/css/ElementRuleCollector.cpp +++ b/src/third_party/WebKit/Source/core/css/ElementRuleCollector.cpp @@ -55,6 +55,7 @@ ElementRuleCollector::ElementRuleCollector(const ElementResolveContext& context, , m_canUseFastReject(m_selectorFilter.parentStackIsConsistent(context.parentNode())) , m_sameOriginOnly(false) , m_matchingUARules(false) + , m_scopeContainsLastMatchedElement(false) { } ElementRuleCollector::~ElementRuleCollector() @@ -133,7 +134,7 @@ static bool rulesApplicableInCurrentTreeScope(const Element* element, const Cont return false; } -void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest, RuleRange& ruleRange, SelectorChecker::ContextFlags contextFlags, CascadeScope cascadeScope, CascadeOrder cascadeOrder, bool matchingTreeBoundaryRules) +void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest, RuleRange& ruleRange, CascadeScope cascadeScope, CascadeOrder cascadeOrder, bool matchingTreeBoundaryRules) { ASSERT(matchRequest.ruleSet); ASSERT(m_context.element()); @@ -142,11 +143,11 @@ void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest const AtomicString& pseudoId = element.shadowPseudoId(); if (!pseudoId.isEmpty()) { ASSERT(element.isStyledElement()); - collectMatchingRulesForList(matchRequest.ruleSet->shadowPseudoElementRules(pseudoId), contextFlags, ignoreCascadeScope, cascadeOrder, matchRequest, ruleRange); + collectMatchingRulesForList(matchRequest.ruleSet->shadowPseudoElementRules(pseudoId), ignoreCascadeScope, cascadeOrder, matchRequest, ruleRange); } if (element.isVTTElement()) - collectMatchingRulesForList(matchRequest.ruleSet->cuePseudoRules(), contextFlags, cascadeScope, cascadeOrder, matchRequest, ruleRange); + collectMatchingRulesForList(matchRequest.ruleSet->cuePseudoRules(), cascadeScope, cascadeOrder, matchRequest, ruleRange); // Check whether other types of rules are applicable in the current tree scope. Criteria for this: // a) it's a UA rule // b) the rules comes from a scoped style sheet within the same tree scope @@ -159,18 +160,18 @@ void ElementRuleCollector::collectMatchingRules(const MatchRequest& matchRequest // We need to collect the rules for id, class, tag, and everything else into a buffer and // then sort the buffer. if (element.hasID()) - collectMatchingRulesForList(matchRequest.ruleSet->idRules(element.idForStyleResolution()), contextFlags, cascadeScope, cascadeOrder, matchRequest, ruleRange); + collectMatchingRulesForList(matchRequest.ruleSet->idRules(element.idForStyleResolution()), cascadeScope, cascadeOrder, matchRequest, ruleRange); if (element.isStyledElement() && element.hasClass()) { for (size_t i = 0; i < element.classNames().size(); ++i) - collectMatchingRulesForList(matchRequest.ruleSet->classRules(element.classNames()[i]), contextFlags, cascadeScope, cascadeOrder, matchRequest, ruleRange); + collectMatchingRulesForList(matchRequest.ruleSet->classRules(element.classNames()[i]), cascadeScope, cascadeOrder, matchRequest, ruleRange); } if (element.isLink()) - collectMatchingRulesForList(matchRequest.ruleSet->linkPseudoClassRules(), contextFlags, cascadeScope, cascadeOrder, matchRequest, ruleRange); + collectMatchingRulesForList(matchRequest.ruleSet->linkPseudoClassRules(), cascadeScope, cascadeOrder, matchRequest, ruleRange); if (SelectorChecker::matchesFocusPseudoClass(element)) - collectMatchingRulesForList(matchRequest.ruleSet->focusPseudoClassRules(), contextFlags, cascadeScope, cascadeOrder, matchRequest, ruleRange); - collectMatchingRulesForList(matchRequest.ruleSet->tagRules(element.localName()), contextFlags, cascadeScope, cascadeOrder, matchRequest, ruleRange); - collectMatchingRulesForList(matchRequest.ruleSet->universalRules(), contextFlags, cascadeScope, cascadeOrder, matchRequest, ruleRange); + collectMatchingRulesForList(matchRequest.ruleSet->focusPseudoClassRules(), cascadeScope, cascadeOrder, matchRequest, ruleRange); + collectMatchingRulesForList(matchRequest.ruleSet->tagRules(element.localName()), cascadeScope, cascadeOrder, matchRequest, ruleRange); + collectMatchingRulesForList(matchRequest.ruleSet->universalRules(), cascadeScope, cascadeOrder, matchRequest, ruleRange); } CSSRuleList* ElementRuleCollector::nestedRuleList(CSSRule* rule) @@ -254,7 +255,7 @@ void ElementRuleCollector::sortAndTransferMatchedRules() } } -inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, const ContainerNode* scope, SelectorChecker::ContextFlags contextFlags, SelectorChecker::MatchResult* result) +inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, const ContainerNode* scope, SelectorChecker::MatchResult* result) { SelectorChecker selectorChecker(m_context.element()->document(), m_mode); SelectorChecker::SelectorCheckingContext context(ruleData.selector(), m_context.element(), SelectorChecker::VisitedMatchEnabled); @@ -264,7 +265,7 @@ inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, const Co context.scrollbar = m_pseudoStyleRequest.scrollbar; context.scrollbarPart = m_pseudoStyleRequest.scrollbarPart; context.isUARule = m_matchingUARules; - context.contextFlags = contextFlags; + context.scopeContainsLastMatchedElement = m_scopeContainsLastMatchedElement; SelectorChecker::Match match = selectorChecker.match(context, DOMSiblingTraversalStrategy(), result); if (match != SelectorChecker::SelectorMatches) return false; @@ -273,14 +274,14 @@ inline bool ElementRuleCollector::ruleMatches(const RuleData& ruleData, const Co return true; } -void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, SelectorChecker::ContextFlags contextFlags, CascadeScope cascadeScope, CascadeOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange) +void ElementRuleCollector::collectRuleIfMatches(const RuleData& ruleData, CascadeScope cascadeScope, CascadeOrder cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange) { if (m_canUseFastReject && m_selectorFilter.fastRejectSelector(ruleData.descendantSelectorIdentifierHashes())) return; StyleRule* rule = ruleData.rule(); SelectorChecker::MatchResult result; - if (ruleMatches(ruleData, matchRequest.scope, contextFlags, &result)) { + if (ruleMatches(ruleData, matchRequest.scope, &result)) { // If the rule has no properties to apply, then ignore it in the non-debug mode. const StylePropertySet& properties = rule->properties(); if (properties.isEmpty() && !matchRequest.includeEmptyRules) @@ -344,7 +345,7 @@ bool ElementRuleCollector::hasAnyMatchingRules(RuleSet* ruleSet) int firstRuleIndex = -1, lastRuleIndex = -1; RuleRange ruleRange(firstRuleIndex, lastRuleIndex); // FIXME: Verify whether it's ok to ignore CascadeScope here. - collectMatchingRules(MatchRequest(ruleSet), ruleRange, SelectorChecker::DefaultBehavior); + collectMatchingRules(MatchRequest(ruleSet), ruleRange); return m_matchedRules && !m_matchedRules->isEmpty(); }