void ElementRuleCollector::matchUARules() { // First we match rules from the user agent sheet. if (CSSDefaultStyleSheets::simpleDefaultStyleSheet) m_result.isCacheable = false; RuleSet* userAgentStyleSheet = m_isPrintStyle ? CSSDefaultStyleSheets::defaultPrintStyle : CSSDefaultStyleSheets::defaultStyle; matchUARules(userAgentStyleSheet); // In quirks mode, we match rules from the quirks user agent sheet. if (m_element.document().inQuirksMode()) matchUARules(CSSDefaultStyleSheets::defaultQuirksStyle); }
void ElementRuleCollector::matchUARules() { MatchingUARulesScope scope; // First we match rules from the user agent sheet. if (CSSDefaultStyleSheets::simpleDefaultStyleSheet) m_result.isCacheable = false; RuleSet* userAgentStyleSheet = m_isPrintStyle ? CSSDefaultStyleSheets::defaultPrintStyle : CSSDefaultStyleSheets::defaultStyle; matchUARules(userAgentStyleSheet); // In quirks mode, we match rules from the quirks user agent sheet. if (document()->inQuirksMode()) matchUARules(CSSDefaultStyleSheets::defaultQuirksStyle); // If document uses view source styles (in view source mode or in xml viewer mode), then we match rules from the view source style sheet. if (document()->isViewSource()) matchUARules(CSSDefaultStyleSheets::viewSourceStyle()); }
void ElementRuleCollector::matchAllRules(bool matchAuthorAndUserStyles, bool includeSMILProperties) { matchUARules(); // Now we check user sheet rules. if (matchAuthorAndUserStyles) matchUserRules(false); // Now check author rules, beginning first with presentational attributes mapped from HTML. if (m_state.styledElement()) { addElementStyleProperties(m_state.styledElement()->presentationAttributeStyle()); // Now we check additional mapped declarations. // Tables and table cells share an additional mapped rule that must be applied // after all attributes, since their mapped style depends on the values of multiple attributes. addElementStyleProperties(m_state.styledElement()->additionalPresentationAttributeStyle()); if (m_state.styledElement()->isHTMLElement()) { bool isAuto; TextDirection textDirection = toHTMLElement(m_state.styledElement())->directionalityIfhasDirAutoAttribute(isAuto); if (isAuto) m_result.addMatchedProperties(textDirection == LTR ? leftToRightDeclaration() : rightToLeftDeclaration()); } } // Check the rules in author sheets next. if (matchAuthorAndUserStyles) matchAuthorRules(false); // Now check our inline style attribute. if (matchAuthorAndUserStyles && m_state.styledElement() && m_state.styledElement()->inlineStyle()) { // Inline style is immutable as long as there is no CSSOM wrapper. // FIXME: Media control shadow trees seem to have problems with caching. bool isInlineStyleCacheable = !m_state.styledElement()->inlineStyle()->isMutable() && !m_state.styledElement()->isInShadowTree(); // FIXME: Constify. addElementStyleProperties(m_state.styledElement()->inlineStyle(), isInlineStyleCacheable); } #if ENABLE(SVG) // Now check SMIL animation override style. if (includeSMILProperties && matchAuthorAndUserStyles && m_state.styledElement() && m_state.styledElement()->isSVGElement()) addElementStyleProperties(toSVGElement(m_state.styledElement())->animatedSMILStyleProperties(), false /* isCacheable */); #else UNUSED_PARAM(includeSMILProperties); #endif }