void TreeBoundaryCrossingRules::collectTreeBoundaryCrossingRules(Element* element, ElementRuleCollector& collector, bool includeEmptyRules) { if (m_treeBoundaryCrossingRuleSetMap.isEmpty()) return; RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); // When comparing rules declared in outer treescopes, outer's rules win. CascadeOrder outerCascadeOrder = size() + size(); // When comparing rules declared in inner treescopes, inner's rules win. CascadeOrder innerCascadeOrder = size(); for (DocumentOrderedList::iterator it = m_scopingNodes.begin(); it != m_scopingNodes.end(); ++it) { const ContainerNode* scopingNode = toContainerNode(*it); CSSStyleSheetRuleSubSet* ruleSubSet = m_treeBoundaryCrossingRuleSetMap.get(scopingNode); bool isInnerTreeScope = element->treeScope().isInclusiveAncestorOf(scopingNode->treeScope()); CascadeOrder cascadeOrder = isInnerTreeScope ? innerCascadeOrder : outerCascadeOrder; for (CSSStyleSheetRuleSubSet::iterator it = ruleSubSet->begin(); it != ruleSubSet->end(); ++it) { CSSStyleSheet* parentStyleSheet = it->first; RuleSet* ruleSet = it->second.get(); collector.collectMatchingRules(MatchRequest(ruleSet, includeEmptyRules, scopingNode, parentStyleSheet), ruleRange, SelectorChecker::ScopeContainsLastMatchedElement, ignoreCascadeScope, cascadeOrder); } ++innerCascadeOrder; --outerCascadeOrder; } }
void ScopedStyleResolver::matchHostRules(ElementRuleCollector& collector, bool includeEmptyRules) { if (m_atHostRules.isEmpty() || !m_scopingNode->isElementNode()) return; ElementShadow* shadow = toElement(m_scopingNode)->shadow(); if (!shadow) return; collector.clearMatchedRules(); collector.matchedResult().ranges.lastAuthorRule = collector.matchedResult().matchedProperties.size() - 1; // FIXME(99827): https://bugs.webkit.org/show_bug.cgi?id=99827 // add a new flag to ElementShadow and cache whether any @host @-rules are // applied to the element or not. So we can quickly exit this method // by using the flag. ShadowRoot* shadowRoot = shadow->youngestShadowRoot(); for (; shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) if (!ScopeContentDistribution::hasShadowElement(shadowRoot)) break; // All shadow roots have <shadow>. if (!shadowRoot) shadowRoot = shadow->oldestShadowRoot(); StyleResolver::RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); collector.setBehaviorAtBoundary(static_cast<SelectorChecker::BehaviorAtBoundary>(SelectorChecker::DoesNotCrossBoundary | SelectorChecker::ScopeContainsLastMatchedElement)); for (; shadowRoot; shadowRoot = shadowRoot->youngerShadowRoot()) { if (RuleSet* ruleSet = atHostRuleSetFor(shadowRoot)) collector.collectMatchingRules(MatchRequest(ruleSet, includeEmptyRules, m_scopingNode), ruleRange); } collector.sortAndTransferMatchedRules(); }
void UFindTurnBasedMatchCallbackProxy::Activate() { FOnlineSubsystemBPCallHelper Helper(TEXT("ConnectToService"), GEngine->GetWorldFromContextObject(WorldContextObject)); Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get()); if (Helper.IsValid()) { IOnlineTurnBasedPtr TurnBasedInterface = Helper.OnlineSub->GetTurnBasedInterface(); if (TurnBasedInterface.IsValid()) { Delegate->SetFindTurnBasedMatchCallbackProxy(this); Delegate->SetTurnBasedInterface(TurnBasedInterface); TurnBasedInterface->SetMatchmakerDelegate(Delegate); FTurnBasedMatchRequest MatchRequest(MinPlayers, MaxPlayers, PlayerGroup, ShowExistingMatches); TurnBasedInterface->ShowMatchmaker(MatchRequest); // Results will be handled in the FFindTurnBasedMatchCallbackProxyMatchmakerDelegate object return; } else { FFrame::KismetExecutionMessage(TEXT("Turn based games not supported by online subsystem"), ELogVerbosity::Warning); } } // Fail immediately OnFailure.Broadcast(FString()); }
void ElementRuleCollector::matchUARules(RuleSet* rules) { clearMatchedRules(); m_result.ranges.lastUARule = m_result.matchedProperties.size() - 1; StyleResolver::RuleRange ruleRange = m_result.ranges.UARuleRange(); collectMatchingRules(MatchRequest(rules), ruleRange); sortAndTransferMatchedRules(); }
bool ElementRuleCollector::hasAnyMatchingRules(RuleSet* ruleSet) { clearMatchedRules(); m_mode = SelectorChecker::SharingRules; int firstRuleIndex = -1, lastRuleIndex = -1; StyleResolver::RuleRange ruleRange(firstRuleIndex, lastRuleIndex); collectMatchingRules(MatchRequest(ruleSet), ruleRange); return m_matchedRules && !m_matchedRules->isEmpty(); }
bool ElementRuleCollector::hasAnyMatchingRules(const RuleSet* ruleSet) { clearMatchedRules(); m_mode = SelectorChecker::Mode::CollectingRulesIgnoringVirtualPseudoElements; int firstRuleIndex = -1, lastRuleIndex = -1; StyleResolver::RuleRange ruleRange(firstRuleIndex, lastRuleIndex); collectMatchingRules(MatchRequest(ruleSet), ruleRange); return !m_matchedRules.isEmpty(); }
void ElementRuleCollector::collectMatchingRulesForRegion(const MatchRequest& matchRequest, StyleResolver::RuleRange& ruleRange) { if (!m_regionForStyling) return; unsigned size = matchRequest.ruleSet->m_regionSelectorsAndRuleSets.size(); for (unsigned i = 0; i < size; ++i) { const CSSSelector* regionSelector = matchRequest.ruleSet->m_regionSelectorsAndRuleSets.at(i).selector; if (checkRegionSelector(regionSelector, toElement(m_regionForStyling->node()))) { RuleSet* regionRules = matchRequest.ruleSet->m_regionSelectorsAndRuleSets.at(i).ruleSet.get(); ASSERT(regionRules); collectMatchingRules(MatchRequest(regionRules, matchRequest.includeEmptyRules, matchRequest.scope), ruleRange); } } }
bool ElementRuleCollector::hasAnyMatchingRules(RuleSet* ruleSet) { clearMatchedRules(); m_mode = SelectorChecker::SharingRules; // To check whether a given RuleSet has any rule matching a given element, // should not see the element's treescope. Because RuleSet has no // information about "scope". int firstRuleIndex = -1, lastRuleIndex = -1; RuleRange ruleRange(firstRuleIndex, lastRuleIndex); // FIXME: Verify whether it's ok to ignore CascadeScope here. collectMatchingRules(MatchRequest(ruleSet), ruleRange, SelectorChecker::StaysWithinTreeScope); return m_matchedRules && !m_matchedRules->isEmpty(); }
void ElementRuleCollector::collectMatchingRulesForRegion(const MatchRequest& matchRequest, RuleRange& ruleRange, SelectorChecker::BehaviorAtBoundary behaviorAtBoundary, CascadeScope cascadeScope, CascadeOrder cascadeOrder) { if (!m_regionForStyling) return; unsigned size = matchRequest.ruleSet->m_regionSelectorsAndRuleSets.size(); for (unsigned i = 0; i < size; ++i) { const CSSSelector* regionSelector = matchRequest.ruleSet->m_regionSelectorsAndRuleSets.at(i).selector; if (checkRegionSelector(regionSelector, toElement(m_regionForStyling->node()))) { RuleSet* regionRules = matchRequest.ruleSet->m_regionSelectorsAndRuleSets.at(i).ruleSet.get(); ASSERT(regionRules); collectMatchingRules(MatchRequest(regionRules, matchRequest.includeEmptyRules, matchRequest.scope), ruleRange, behaviorAtBoundary, cascadeScope, cascadeOrder); } } }
bool ElementRuleCollector::hasAnyMatchingRules(RuleSet* ruleSet) { clearMatchedRules(); m_mode = SelectorChecker::SharingRules; // To check whether a given RuleSet has any rule matching a given element, // should not see the element's treescope. Because RuleSet has no // information about "scope". m_behaviorAtBoundary = SelectorChecker::StaysWithinTreeScope; int firstRuleIndex = -1, lastRuleIndex = -1; StyleResolver::RuleRange ruleRange(firstRuleIndex, lastRuleIndex); collectMatchingRules(MatchRequest(ruleSet), ruleRange); return m_matchedRules && !m_matchedRules->isEmpty(); }
void StyleResolver::matchRules(Element& element, ElementRuleCollector& collector) { collector.clearMatchedRules(); CascadeOrder cascadeOrder = 0; collector.collectMatchingRules(MatchRequest(&defaultStyles()), ++cascadeOrder); ScopedStyleResolver& resolver = element.treeScope().scopedStyleResolver(); resolver.collectMatchingAuthorRules(collector, ++cascadeOrder); collector.sortAndTransferMatchedRules(); if (const StylePropertySet* inlineStyle = element.inlineStyle()) { // Inline style is immutable as long as there is no CSSOM wrapper. bool isInlineStyleCacheable = !inlineStyle->isMutable(); collector.addElementStyleProperties(inlineStyle, isInlineStyleCacheable); } }
void ElementRuleCollector::matchHostRules(bool includeEmptyRules) { #if ENABLE(SHADOW_DOM) ASSERT(m_scopeResolver); clearMatchedRules(); m_result.ranges.lastAuthorRule = m_result.matchedProperties.size() - 1; Vector<RuleSet*> matchedRules; m_scopeResolver->matchHostRules(m_state.element(), matchedRules); if (matchedRules.isEmpty()) return; for (unsigned i = matchedRules.size(); i > 0; --i) { StyleResolver::RuleRange ruleRange = m_result.ranges.authorRuleRange(); collectMatchingRules(MatchRequest(matchedRules.at(i-1), includeEmptyRules, m_state.element()), ruleRange); } sortAndTransferMatchedRules(); #else UNUSED_PARAM(includeEmptyRules); #endif }
void TreeBoundaryCrossingRules::collectTreeBoundaryCrossingRules(Element* element, ElementRuleCollector& collector, bool includeEmptyRules) { if (m_treeBoundaryCrossingRuleSetMap.isEmpty()) return; RuleRange ruleRange = collector.matchedResult().ranges.authorRuleRange(); // When comparing rules declared in outer treescopes, outer's rules win. CascadeOrder outerCascadeOrder = size() + size(); // When comparing rules declared in inner treescopes, inner's rules win. CascadeOrder innerCascadeOrder = size(); for (DocumentOrderedList::iterator it = m_scopingNodes.begin(); it != m_scopingNodes.end(); ++it) { const ContainerNode* scopingNode = toContainerNode(*it); CSSStyleSheetRuleSubSet* ruleSubSet = m_treeBoundaryCrossingRuleSetMap.get(scopingNode); unsigned boundaryBehavior = SelectorChecker::ScopeContainsLastMatchedElement; bool isInnerTreeScope = element->treeScope().isInclusiveAncestorOf(scopingNode->treeScope()); // If a given scoping node is a shadow root and a given element is in a descendant tree of tree hosted by // the scoping node's shadow host, we should use ScopeIsShadowHost. if (scopingNode && scopingNode->isShadowRoot()) { if (element->isInDescendantTreeOf(toShadowRoot(scopingNode)->host())) boundaryBehavior |= SelectorChecker::ScopeIsShadowHost; scopingNode = toShadowRoot(scopingNode)->host(); } CascadeOrder cascadeOrder = isInnerTreeScope ? innerCascadeOrder : outerCascadeOrder; for (CSSStyleSheetRuleSubSet::iterator it = ruleSubSet->begin(); it != ruleSubSet->end(); ++it) { CSSStyleSheet* parentStyleSheet = it->first; RuleSet* ruleSet = it->second.get(); collector.collectMatchingRules(MatchRequest(ruleSet, includeEmptyRules, scopingNode, parentStyleSheet), ruleRange, static_cast<SelectorChecker::BehaviorAtBoundary>(boundaryBehavior), ignoreCascadeScope, cascadeOrder); } ++innerCascadeOrder; --outerCascadeOrder; } }
BOOL TmHandleRequestMessage(MESSAGE *message) { struct Transaction *t = MatchRequest(message); SIP_METHOD method = MessageGetMethod(message); if (!t) { OnTransactionEvent(NULL, TRANSACTION_EVENT_NEW, message); } else { if (method == SIP_METHOD_INVITE) { RunFsm(t, TRANSACTION_EVENT_INVITE); DestroyMessage(&message); } else if (method == SIP_METHOD_CANCEL) { struct Dialog *d = (struct Dialog *)GetTransactionUser(t); struct Message *rt = BuildResponse(message, 487); OnTransactionEvent(d, TRANSACTION_EVENT_CANCELED, message); ResponseWith(t, rt, TRANSACTION_SEND_REQUEST_TERMINATED); OnTransactionEvent(NULL, TRANSACTION_EVENT_NEW, message); } } return TRUE; }