| Index: Source/core/css/resolver/StyleResolver.cpp
|
| diff --git a/Source/core/css/resolver/StyleResolver.cpp b/Source/core/css/resolver/StyleResolver.cpp
|
| index ebcded48891cfafe116004bf9a4c75c426d3be0e..c9d35d788ec6fe83312e91bfa46069fee76b90da 100644
|
| --- a/Source/core/css/resolver/StyleResolver.cpp
|
| +++ b/Source/core/css/resolver/StyleResolver.cpp
|
| @@ -208,7 +208,7 @@ StyleResolver::StyleResolver(Document* document, bool matchAuthorAndUserStyles)
|
| m_styleTree.clear();
|
|
|
| DocumentStyleSheetCollection* styleSheetCollection = document->styleSheetCollection();
|
| - m_ruleSets.initUserStyle(styleSheetCollection, *m_medium, *this);
|
| + m_ruleSets.initUserStyle(styleSheetCollection, document->watchedCallbackSelectors(), *m_medium, *this);
|
|
|
| #if ENABLE(SVG_FONTS)
|
| if (document->svgExtensions()) {
|
| @@ -1074,10 +1074,10 @@ PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS
|
| StyleResolverState& state = m_state;
|
| state.initForStyleResolve(document(), element, defaultParent, regionForStyling);
|
| if (sharingBehavior == AllowStyleSharing && !state.distributedToInsertionPoint()) {
|
| - RenderStyle* sharedStyle = locateSharedStyle();
|
| + RefPtr<RenderStyle> sharedStyle = locateSharedStyle();
|
| if (sharedStyle) {
|
| state.clear();
|
| - return sharedStyle;
|
| + return sharedStyle.release();
|
| }
|
| }
|
|
|
| @@ -1128,15 +1128,13 @@ PassRefPtr<RenderStyle> StyleResolver::styleForElement(Element* element, RenderS
|
| // Clean up our style object's display and text decorations (among other fixups).
|
| adjustRenderStyle(state.style(), state.parentStyle(), element);
|
|
|
| - state.clear(); // Clear out for the next resolve.
|
| -
|
| document()->didAccessStyleResolver();
|
|
|
| if (element->hasTagName(bodyTag))
|
| document()->textLinkColors().setTextColor(state.style()->visitedDependentColor(CSSPropertyColor));
|
|
|
| - // Now return the style.
|
| - return state.takeStyle();
|
| + // Now return the style and clear out for the next resolve.
|
| + return state.takeStyleAndClear();
|
| }
|
|
|
| PassRefPtr<RenderStyle> StyleResolver::styleForKeyframe(const RenderStyle* elementStyle, const StyleKeyframe* keyframe, KeyframeValue& keyframeValue)
|
| @@ -1254,6 +1252,7 @@ void StyleResolver::keyframeStylesForAnimation(Element* e, const RenderStyle* el
|
| keyframeValue.setStyle(styleForKeyframe(elementStyle, hundredPercentKeyframe, keyframeValue));
|
| list.insert(keyframeValue);
|
| }
|
| + m_state.clear();
|
| }
|
|
|
| PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const PseudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle)
|
| @@ -1287,8 +1286,10 @@ PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P
|
| matchAuthorRules(collector, false);
|
| }
|
|
|
| - if (collector.matchedResult().matchedProperties.isEmpty())
|
| + if (collector.matchedResult().matchedProperties.isEmpty()) {
|
| + state.clear();
|
| return 0;
|
| + }
|
|
|
| state.style()->setStyleType(pseudoStyleRequest.pseudoId);
|
|
|
| @@ -1303,7 +1304,7 @@ PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* e, const P
|
| document()->didAccessStyleResolver();
|
|
|
| // Now return the style.
|
| - return state.takeStyle();
|
| + return state.takeStyleAndClear();
|
| }
|
|
|
| PassRefPtr<RenderStyle> StyleResolver::styleForPage(int pageIndex)
|
| @@ -1343,7 +1344,7 @@ PassRefPtr<RenderStyle> StyleResolver::styleForPage(int pageIndex)
|
| document()->didAccessStyleResolver();
|
|
|
| // Now return the style.
|
| - return m_state.takeStyle();
|
| + return m_state.takeStyleAndClear();
|
| }
|
|
|
| PassRefPtr<RenderStyle> StyleResolver::defaultStyleForElement()
|
| @@ -1786,6 +1787,7 @@ PassRefPtr<CSSRuleList> StyleResolver::pseudoStyleRulesForElement(Element* e, Ps
|
| matchAuthorRules(collector, rulesToInclude & EmptyCSSRules);
|
| }
|
|
|
| + m_state.clear();
|
| return collector.matchedRuleList();
|
| }
|
|
|
| @@ -1923,6 +1925,9 @@ void StyleResolver::applyProperties(const StylePropertySet* properties, StyleRul
|
| {
|
| ASSERT((propertyWhitelistType != PropertyWhitelistRegion) || m_state.regionForStyling());
|
| InspectorInstrumentationCookie cookie = InspectorInstrumentation::willProcessRule(document(), rule, this);
|
| +#if ENABLE(CSS_CALLBACKS)
|
| + m_state.setRule(rule);
|
| +#endif
|
|
|
| unsigned propertyCount = properties->propertyCount();
|
| for (unsigned i = 0; i < propertyCount; ++i) {
|
| @@ -2186,6 +2191,7 @@ void StyleResolver::applyPropertyToStyle(CSSPropertyID id, CSSValue* value, Rend
|
| m_state.initForStyleResolve(document(), 0, style);
|
| m_state.setStyle(style);
|
| applyPropertyToCurrentStyle(id, value);
|
| + m_state.clear();
|
| }
|
|
|
| void StyleResolver::applyPropertyToCurrentStyle(CSSPropertyID id, CSSValue* value)
|
| @@ -2813,6 +2819,24 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
|
| state.style()->setTapHighlightColor(col);
|
| return;
|
| }
|
| +#if ENABLE(CSS_CALLBACKS)
|
| + case CSSPropertyInternalCallback: {
|
| + if (isInherit || isInitial)
|
| + return;
|
| + if (primitiveValue) {
|
| + switch (primitiveValue->getValueID()) {
|
| + case CSSValueInternalPresence:
|
| + state.style()->addCallbackSelector(
|
| + state.rule()->selectorList().selectorsText(),
|
| + state.element()->document());
|
| + return;
|
| + default:
|
| + break;
|
| + }
|
| + }
|
| + break;
|
| + }
|
| +#endif
|
| case CSSPropertyInvalid:
|
| return;
|
| // Directional properties are resolved by resolveDirectionAwareProperty() before the switch.
|
|
|