Changeset 189987 in webkit
- Timestamp:
- Sep 18, 2015 3:25:08 PM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r189985 r189987 1 2015-09-18 Antti Koivisto <antti@apple.com> 2 3 Support style isolation in shadow trees 4 https://bugs.webkit.org/show_bug.cgi?id=149353 5 6 Reviewed by Ryosuke Niwa. 7 8 Allow ShadowRoots to have their own StyleResolvers. 9 10 This patch just adds the mechanism, all shadow roots still use the document resolver. 11 12 * css/StyleResolver.h: 13 (WebCore::StyleResolverParentPusher::push): 14 (WebCore::StyleResolverParentPusher::~StyleResolverParentPusher): 15 * dom/Element.cpp: 16 (WebCore::Element::absoluteLinkURL): 17 (WebCore::Element::styleResolver): 18 19 Helper function for getting the right StyleResolver for the element. 20 21 (WebCore::Element::resolveStyle): 22 23 Helper function for resolving element style. 24 25 * dom/Element.h: 26 * dom/ShadowRoot.cpp: 27 (WebCore::ShadowRoot::~ShadowRoot): 28 (WebCore::ShadowRoot::styleResolver): 29 (WebCore::ShadowRoot::cloneNode): 30 * dom/ShadowRoot.h: 31 (WebCore::ShadowRoot::resetStyleInheritance): 32 * editing/EditingStyle.cpp: 33 (WebCore::styleFromMatchedRulesForElement): 34 * html/HTMLTitleElement.cpp: 35 (WebCore::HTMLTitleElement::computedTextWithDirection): 36 * html/canvas/CanvasRenderingContext2D.cpp: 37 (WebCore::CanvasRenderingContext2D::setFont): 38 * inspector/InspectorCSSAgent.cpp: 39 (WebCore::InspectorCSSAgent::getMatchedStylesForNode): 40 * page/animation/KeyframeAnimation.cpp: 41 (WebCore::KeyframeAnimation::KeyframeAnimation): 42 * rendering/RenderElement.cpp: 43 (WebCore::RenderElement::getUncachedPseudoStyle): 44 (WebCore::RenderElement::containingBlockForFixedPosition): 45 * rendering/RenderNamedFlowFragment.cpp: 46 (WebCore::RenderNamedFlowFragment::checkRegionStyle): 47 (WebCore::RenderNamedFlowFragment::computeStyleInRegion): 48 * style/StyleResolveTree.cpp: 49 (WebCore::Style::styleForElement): 50 * svg/SVGElement.cpp: 51 (WebCore::SVGElement::customStyleForRenderer): 52 (WebCore::SVGElement::animatedSMILStyleProperties): 53 * svg/SVGElementRareData.h: 54 (WebCore::SVGElementRareData::overrideComputedStyle): 55 1 56 2015-09-18 Alex Christensen <achristensen@webkit.org> 2 57 -
trunk/Source/WebCore/css/StyleResolver.h
r189830 r189987 579 579 if (m_pushedStyleResolver) 580 580 return; 581 m_pushedStyleResolver = &m_parent-> document().ensureStyleResolver();581 m_pushedStyleResolver = &m_parent->styleResolver(); 582 582 m_pushedStyleResolver->pushParentElement(m_parent); 583 583 } … … 588 588 // This tells us that our pushed style selector is in a bad state, 589 589 // so we should just bail out in that scenario. 590 ASSERT(m_pushedStyleResolver == &m_parent->document().ensureStyleResolver()); 591 if (m_pushedStyleResolver != &m_parent->document().ensureStyleResolver()) 592 return; 590 ASSERT(m_pushedStyleResolver == &m_parent->styleResolver()); 593 591 m_pushedStyleResolver->popParentElement(m_parent); 594 592 } -
trunk/Source/WebCore/dom/Element.cpp
r189950 r189987 1382 1382 } 1383 1383 1384 StyleResolver& Element::styleResolver() 1385 { 1386 if (auto* shadowRoot = containingShadowRoot()) 1387 return shadowRoot->styleResolver(); 1388 1389 return document().ensureStyleResolver(); 1390 } 1391 1392 Ref<RenderStyle> Element::resolveStyle(RenderStyle* parentStyle) 1393 { 1394 return styleResolver().styleForElement(this, parentStyle); 1395 } 1396 1384 1397 // Returns true is the given attribute is an event handler. 1385 1398 // We consider an event handler any attribute that begins with "on". -
trunk/Source/WebCore/dom/Element.h
r189841 r189987 488 488 WEBCORE_EXPORT URL absoluteLinkURL() const; 489 489 490 StyleResolver& styleResolver(); 491 Ref<RenderStyle> resolveStyle(RenderStyle* parentStyle); 492 490 493 protected: 491 494 Element(const QualifiedName&, Document&, ConstructionType); -
trunk/Source/WebCore/dom/ShadowRoot.cpp
r189950 r189987 40 40 struct SameSizeAsShadowRoot : public DocumentFragment, public TreeScope { 41 41 unsigned countersAndFlags[1]; 42 void* styleResolver; 42 43 void* host; 43 44 #if ENABLE(SHADOW_DOM) … … 69 70 // destructed tree scope in each descendant. 70 71 removeDetachedChildren(); 72 } 73 74 StyleResolver& ShadowRoot::styleResolver() 75 { 76 if (m_styleResolver) 77 return *m_styleResolver; 78 79 return document().ensureStyleResolver(); 71 80 } 72 81 -
trunk/Source/WebCore/dom/ShadowRoot.h
r189950 r189987 56 56 virtual ~ShadowRoot(); 57 57 58 StyleResolver& styleResolver(); 59 58 60 bool resetStyleInheritance() const { return m_resetStyleInheritance; } 59 61 void setResetStyleInheritance(bool); … … 100 102 Type m_type; 101 103 104 std::unique_ptr<StyleResolver> m_styleResolver; 105 102 106 Element* m_host; 103 107 -
trunk/Source/WebCore/editing/EditingStyle.cpp
r189182 r189987 1278 1278 { 1279 1279 RefPtr<MutableStyleProperties> style = MutableStyleProperties::create(); 1280 auto matchedRules = element-> document().ensureStyleResolver().styleRulesForElement(element, rulesToInclude);1280 auto matchedRules = element->styleResolver().styleRulesForElement(element, rulesToInclude); 1281 1281 for (unsigned i = 0; i < matchedRules.size(); ++i) { 1282 1282 if (matchedRules[i]->isStyleRule()) -
trunk/Source/WebCore/html/HTMLTitleElement.cpp
r189680 r189987 83 83 direction = computedStyle->direction(); 84 84 else { 85 Ref<RenderStyle> style(document().ensureStyleResolver().styleForElement(this, parentElement() ? parentElement()->renderStyle() : nullptr));85 auto style = resolveStyle(parentElement() ? parentElement()->renderStyle() : nullptr); 86 86 direction = style.get().direction(); 87 87 } -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r189830 r189987 2164 2164 2165 2165 // Now map the font property longhands into the style. 2166 StyleResolver& styleResolver = canvas()-> document().ensureStyleResolver();2166 StyleResolver& styleResolver = canvas()->styleResolver(); 2167 2167 styleResolver.applyPropertyToStyle(CSSPropertyFontFamily, parsedStyle->getPropertyCSSValue(CSSPropertyFontFamily).get(), &newStyle.get()); 2168 2168 styleResolver.applyPropertyToCurrentStyle(CSSPropertyFontStyle, parsedStyle->getPropertyCSSValue(CSSPropertyFontStyle).get()); -
trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp
r189576 r189987 572 572 573 573 // Matched rules. 574 StyleResolver& styleResolver = element-> document().ensureStyleResolver();574 StyleResolver& styleResolver = element->styleResolver(); 575 575 auto matchedRules = styleResolver.pseudoStyleRulesForElement(element, elementPseudoId, StyleResolver::AllCSSRules); 576 576 matchedCSSRules = buildArrayForMatchedRuleList(matchedRules, styleResolver, element, elementPseudoId); … … 599 599 Element* parentElement = element->parentElement(); 600 600 while (parentElement) { 601 StyleResolver& parentStyleResolver = parentElement-> document().ensureStyleResolver();601 StyleResolver& parentStyleResolver = parentElement->styleResolver(); 602 602 auto parentMatchedRules = parentStyleResolver.styleRulesForElement(parentElement, StyleResolver::AllCSSRules); 603 603 auto entry = Inspector::Protocol::CSS::InheritedStyleEntry::create() -
trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp
r188647 r189987 50 50 // Get the keyframe RenderStyles 51 51 if (m_object && m_object->element()) 52 m_object-> document().ensureStyleResolver().keyframeStylesForAnimation(m_object->element(), unanimatedStyle, m_keyframes);52 m_object->element()->styleResolver().keyframeStylesForAnimation(m_object->element(), unanimatedStyle, m_keyframes); 53 53 54 54 // Update the m_transformFunctionListValid flag based on whether the function lists in the keyframes match. -
trunk/Source/WebCore/rendering/RenderElement.cpp
r189841 r189987 1538 1538 return nullptr; 1539 1539 1540 auto& styleResolver = element()->styleResolver(); 1541 1540 1542 if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) { 1541 RefPtr<RenderStyle> result = document().ensureStyleResolver().styleForElement(element(), parentStyle, DisallowStyleSharing);1543 RefPtr<RenderStyle> result = styleResolver.styleForElement(element(), parentStyle, DisallowStyleSharing); 1542 1544 result->setStyleType(FIRST_LINE_INHERITED); 1543 1545 return result.release(); 1544 1546 } 1545 1547 1546 return document().ensureStyleResolver().pseudoStyleForElement(element(), pseudoStyleRequest, parentStyle);1548 return styleResolver.pseudoStyleForElement(element(), pseudoStyleRequest, parentStyle); 1547 1549 } 1548 1550 -
trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp
r189567 r189987 343 343 // FIXME: Region styling doesn't work for pseudo elements. 344 344 if (!isPseudoElement()) 345 customRegionStyle = view().document().ensureStyleResolver().checkRegionStyle(generatingElement());345 customRegionStyle = generatingElement()->styleResolver().checkRegionStyle(generatingElement()); 346 346 setHasCustomRegionStyle(customRegionStyle); 347 347 downcast<RenderNamedFlowThread>(*m_flowThread).checkRegionsWithStyling(); … … 353 353 354 354 // FIXME: Region styling fails for pseudo-elements because the renderers don't have a node. 355 RefPtr<RenderStyle> renderObjectRegionStyle = renderer. view().document().ensureStyleResolver().styleForElement(renderer.element(), &parentStyle, DisallowStyleSharing, MatchAllRules, this);355 RefPtr<RenderStyle> renderObjectRegionStyle = renderer.element()->styleResolver().styleForElement(renderer.element(), &parentStyle, DisallowStyleSharing, MatchAllRules, this); 356 356 357 357 return renderObjectRegionStyle.release(); -
trunk/Source/WebCore/style/StyleResolveTree.cpp
r189910 r189987 142 142 return style.releaseNonNull(); 143 143 } 144 return element. document().ensureStyleResolver().styleForElement(&element,&inheritedStyle);144 return element.resolveStyle(&inheritedStyle); 145 145 } 146 146 -
trunk/Source/WebCore/svg/SVGElement.cpp
r189841 r189987 793 793 { 794 794 if (!correspondingElement()) 795 return document().ensureStyleResolver().styleForElement(this,&parentStyle);796 797 return document().ensureStyleResolver().styleForElement(correspondingElement(), &parentStyle, DisallowStyleSharing);795 return resolveStyle(&parentStyle); 796 797 return styleResolver().styleForElement(correspondingElement(), &parentStyle, DisallowStyleSharing); 798 798 } 799 799 -
trunk/Source/WebCore/svg/SVGElementRareData.h
r179260 r189987 73 73 if (!m_overrideComputedStyle || m_needsOverrideComputedStyleUpdate) { 74 74 // The style computed here contains no CSS Animations/Transitions or SMIL induced rules - this is needed to compute the "base value" for the SMIL animation sandwhich model. 75 m_overrideComputedStyle = element-> document().ensureStyleResolver().styleForElement(element, parentStyle, DisallowStyleSharing, MatchAllRulesExcludingSMIL);75 m_overrideComputedStyle = element->styleResolver().styleForElement(element, parentStyle, DisallowStyleSharing, MatchAllRulesExcludingSMIL); 76 76 m_needsOverrideComputedStyleUpdate = false; 77 77 }
Note: See TracChangeset
for help on using the changeset viewer.