Changeset 195465 in webkit
- Timestamp:
- Jan 22, 2016 12:00:34 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r195463 r195465 1 2016-01-22 Antti Koivisto <antti@apple.com> 2 3 Style resolver initialization cleanups 4 https://bugs.webkit.org/show_bug.cgi?id=153356 5 6 Reviewed by Simon Fraser. 7 8 Simplify StyleResolver::State initialization. 9 Also use more references and other cleanups. 10 11 * css/MediaQueryMatcher.cpp: 12 (WebCore::MediaQueryMatcher::prepareEvaluator): 13 * css/StyleMedia.cpp: 14 (WebCore::StyleMedia::matchMedium): 15 * css/StyleResolver.cpp: 16 (WebCore::StyleResolver::State::clear): 17 (WebCore::StyleResolver::StyleResolver): 18 (WebCore::StyleResolver::classNamesAffectedByRules): 19 (WebCore::StyleResolver::State::State): 20 21 Initialize State using a constructor instead of bunch of construction functions. 22 Remove m_styledElement field which is just a casted version of m_element. 23 24 (WebCore::StyleResolver::State::updateConversionData): 25 (WebCore::StyleResolver::State::setStyle): 26 (WebCore::StyleResolver::sharingCandidateHasIdenticalStyleAffectingAttributes): 27 (WebCore::StyleResolver::canShareStyleWithElement): 28 (WebCore::StyleResolver::locateSharedStyle): 29 (WebCore::isAtShadowBoundary): 30 (WebCore::StyleResolver::styleForElement): 31 (WebCore::StyleResolver::styleForKeyframe): 32 (WebCore::StyleResolver::keyframeStylesForAnimation): 33 (WebCore::StyleResolver::pseudoStyleForElement): 34 (WebCore::StyleResolver::styleForPage): 35 (WebCore::StyleResolver::pseudoStyleRulesForElement): 36 (WebCore::StyleResolver::clearCachedPropertiesAffectedByViewportUnits): 37 (WebCore::isCacheableInMatchedPropertiesCache): 38 39 Disallow caching of document element style entirely because the writing-mode and direction properties have special handling. 40 The existing check wasn't robust. 41 42 (WebCore::extractDirectionAndWritingMode): 43 (WebCore::StyleResolver::applyMatchedProperties): 44 (WebCore::StyleResolver::applyPropertyToStyle): 45 (WebCore::StyleResolver::State::initElement): Deleted. 46 (WebCore::StyleResolver::initElement): Deleted. 47 (WebCore::StyleResolver::State::initForStyleResolve): Deleted. 48 * css/StyleResolver.h: 49 (WebCore::StyleResolver::mediaQueryEvaluator): 50 (WebCore::StyleResolver::State::State): 51 (WebCore::StyleResolver::State::document): 52 (WebCore::StyleResolver::State::element): 53 (WebCore::StyleResolver::State::style): 54 (WebCore::StyleResolver::State::takeStyle): 55 (WebCore::StyleResolver::State::styledElement): Deleted. 56 * dom/Element.cpp: 57 (WebCore::Element::resolveStyle): 58 * page/animation/KeyframeAnimation.cpp: 59 (WebCore::KeyframeAnimation::KeyframeAnimation): 60 * rendering/RenderElement.cpp: 61 (WebCore::RenderElement::getUncachedPseudoStyle): 62 (WebCore::RenderElement::containingBlockForFixedPosition): 63 * rendering/RenderNamedFlowFragment.cpp: 64 (WebCore::RenderNamedFlowFragment::computeStyleInRegion): 65 * style/StyleTreeResolver.cpp: 66 (WebCore::Style::TreeResolver::styleForElement): 67 * svg/SVGElement.cpp: 68 (WebCore::SVGElement::customStyleForRenderer): 69 (WebCore::SVGElement::computedStyle): 70 (WebCore::addQualifiedName): 71 * svg/SVGElementRareData.h: 72 (WebCore::SVGElementRareData::ensureAnimatedSMILStyleProperties): 73 (WebCore::SVGElementRareData::overrideComputedStyle): 74 1 75 2016-01-22 Chris Fleizach <cfleizach@apple.com> 2 76 -
trunk/Source/WebCore/css/MediaQueryMatcher.cpp
r188315 r195465 86 86 return nullptr; 87 87 88 RefPtr<RenderStyle> rootStyle = m_document->ensureStyleResolver().styleForElement( documentElement, m_document->renderStyle(), DisallowStyleSharing, MatchOnlyUserAgentRules);88 RefPtr<RenderStyle> rootStyle = m_document->ensureStyleResolver().styleForElement(*documentElement, m_document->renderStyle(), DisallowStyleSharing, MatchOnlyUserAgentRules); 89 89 90 90 return std::make_unique<MediaQueryEvaluator>(mediaType(), m_document->frame(), rootStyle.get()); -
trunk/Source/WebCore/css/StyleMedia.cpp
r165676 r195465 62 62 return false; 63 63 64 RefPtr<RenderStyle> rootStyle = document->ensureStyleResolver().styleForElement( documentElement, document->renderStyle(), DisallowStyleSharing, MatchOnlyUserAgentRules);64 RefPtr<RenderStyle> rootStyle = document->ensureStyleResolver().styleForElement(*documentElement, document->renderStyle(), DisallowStyleSharing, MatchOnlyUserAgentRules); 65 65 66 66 RefPtr<MediaQuerySet> media = MediaQuerySet::create(); -
trunk/Source/WebCore/css/StyleResolver.cpp
r194854 r195465 192 192 { 193 193 m_element = nullptr; 194 m_styledElement = nullptr;195 194 m_parentStyle = nullptr; 196 195 m_regionForStyling = nullptr; … … 266 265 267 266 if (root) 268 m_rootDefaultStyle = styleForElement( root, m_document.renderStyle(), DisallowStyleSharing, MatchOnlyUserAgentRules);267 m_rootDefaultStyle = styleForElement(*root, m_document.renderStyle(), DisallowStyleSharing, MatchOnlyUserAgentRules); 269 268 270 269 if (m_rootDefaultStyle && view) … … 343 342 } 344 343 344 StyleResolver::State::State(Element& element, RenderStyle* parentStyle, const RenderRegion* regionForStyling, const SelectorFilter* selectorFilter) 345 : m_element(&element) 346 , m_parentStyle(parentStyle) 347 , m_regionForStyling(regionForStyling) 348 , m_elementLinkState(element.document().visitedLinkState().determineLinkState(element)) 349 , m_selectorFilter(selectorFilter) 350 { 351 bool resetStyleInheritance = hasShadowRootParent(element) && downcast<ShadowRoot>(element.parentNode())->resetStyleInheritance(); 352 if (resetStyleInheritance) 353 m_parentStyle = nullptr; 354 355 auto& document = element.document(); 356 auto* documentElement = document.documentElement(); 357 m_rootElementStyle = (!documentElement || documentElement == &element) ? document.renderStyle() : documentElement->renderStyle(); 358 359 updateConversionData(); 360 } 361 345 362 inline void StyleResolver::State::updateConversionData() 346 363 { 347 364 m_cssToLengthConversionData = CSSToLengthConversionData(m_style.get(), m_rootElementStyle, m_element ? document().renderView() : nullptr); 348 }349 350 inline void StyleResolver::State::initElement(Element* element)351 {352 m_element = element;353 m_styledElement = element && is<StyledElement>(*element) ? downcast<StyledElement>(element) : nullptr;354 m_elementLinkState = element ? element->document().visitedLinkState().determineLinkState(*element) : NotInsideLink;355 updateConversionData();356 }357 358 inline void StyleResolver::initElement(Element* e)359 {360 if (m_state.element() != e) {361 m_state.initElement(e);362 if (e && e == e->document().documentElement()) {363 e->document().setDirectionSetOnDocumentElement(false);364 e->document().setWritingModeSetOnDocumentElement(false);365 }366 }367 }368 369 inline void StyleResolver::State::initForStyleResolve(Document& document, Element* e, RenderStyle* parentStyle, const RenderRegion* regionForStyling, const SelectorFilter* selectorFilter)370 {371 m_regionForStyling = regionForStyling;372 373 if (e) {374 bool resetStyleInheritance = hasShadowRootParent(*e) && downcast<ShadowRoot>(*e->parentNode()).resetStyleInheritance();375 m_parentStyle = resetStyleInheritance ? nullptr : parentStyle;376 } else377 m_parentStyle = parentStyle;378 379 Node* docElement = e ? e->document().documentElement() : nullptr;380 RenderStyle* docStyle = document.renderStyle();381 m_rootElementStyle = docElement && e != docElement ? docElement->renderStyle() : docStyle;382 383 m_style = nullptr;384 m_pendingImageProperties.clear();385 m_fontDirty = false;386 387 m_authorRollback = nullptr;388 m_userRollback = nullptr;389 390 m_selectorFilter = selectorFilter;391 392 updateConversionData();393 365 } 394 366 … … 525 497 return false; 526 498 527 if ( state.styledElement()->presentationAttributeStyle() != sharingCandidate.presentationAttributeStyle())499 if (downcast<StyledElement>(*state.element()).presentationAttributeStyle() != sharingCandidate.presentationAttributeStyle()) 528 500 return false; 529 501 … … 569 541 if (!sharingCandidateHasIdenticalStyleAffectingAttributes(element)) 570 542 return false; 571 if (element.additionalPresentationAttributeStyle() != state.styledElement()->additionalPresentationAttributeStyle())543 if (element.additionalPresentationAttributeStyle() != downcast<StyledElement>(*state.element()).additionalPresentationAttributeStyle()) 572 544 return false; 573 545 if (element.affectsNextSiblingElementStyle() || element.styleIsAffectedByPreviousSibling()) … … 646 618 { 647 619 State& state = m_state; 648 if (! state.styledElement() || !state.parentStyle())620 if (!is<StyledElement>(state.element()) || !state.parentStyle()) 649 621 return nullptr; 622 auto& styledElement = downcast<StyledElement>(*state.element()); 650 623 651 624 // If the element has inline style it is probably unique. 652 if (st ate.styledElement()->inlineStyle())625 if (styledElement.inlineStyle()) 653 626 return nullptr; 654 if (st ate.styledElement()->isSVGElement() && downcast<SVGElement>(*state.styledElement()).animatedSMILStyleProperties())627 if (styledElement.isSVGElement() && downcast<SVGElement>(styledElement).animatedSMILStyleProperties()) 655 628 return nullptr; 656 629 // Ids stop style sharing if they show up in the stylesheets. 657 if (st ate.styledElement()->hasID() && m_ruleSets.features().idsInRules.contains(state.styledElement()->idForStyleResolution().impl()))630 if (styledElement.hasID() && m_ruleSets.features().idsInRules.contains(styledElement.idForStyleResolution().impl())) 658 631 return nullptr; 659 if (parentElementPreventsSharing(st ate.element()->parentElement()))632 if (parentElementPreventsSharing(styledElement.parentElement())) 660 633 return nullptr; 661 634 if (state.element() == state.document().cssTarget()) … … 672 645 unsigned visitedNodeCount = 0; 673 646 StyledElement* shareElement = nullptr; 674 Node* cousinList = st ate.styledElement()->previousSibling();647 Node* cousinList = styledElement.previousSibling(); 675 648 while (cousinList) { 676 649 shareElement = findSiblingForStyleSharing(cousinList, count); … … 691 664 return nullptr; 692 665 // Tracking child index requires unique style for each node. This may get set by the sibling rule match above. 693 if (parentElementPreventsSharing(st ate.element()->parentElement()))666 if (parentElementPreventsSharing(styledElement.parentElement())) 694 667 return nullptr; 695 668 return shareElement->renderStyle(); … … 704 677 } 705 678 706 Ref<RenderStyle> StyleResolver::styleForElement(Element * element, RenderStyle* defaultParent,679 Ref<RenderStyle> StyleResolver::styleForElement(Element& element, RenderStyle* parentStyle, 707 680 StyleSharingBehavior sharingBehavior, RuleMatchingBehavior matchingBehavior, const RenderRegion* regionForStyling, const SelectorFilter* selectorFilter) 708 681 { … … 711 684 // Once an element has a renderer, we don't try to destroy it, since otherwise the renderer 712 685 // will vanish if a style recalc happens during loading. 713 if (sharingBehavior == AllowStyleSharing && ! element->document().haveStylesheetsLoaded() && !element->renderer()) {686 if (sharingBehavior == AllowStyleSharing && !m_document.haveStylesheetsLoaded() && !element.renderer()) { 714 687 if (!s_styleNotYetAvailable) { 715 688 s_styleNotYetAvailable = &RenderStyle::create().leakRef(); 716 689 s_styleNotYetAvailable->setDisplay(NONE); 717 s_styleNotYetAvailable->fontCascade().update(& document().fontSelector());718 } 719 element->document().setHasNodesWithPlaceholderStyle();690 s_styleNotYetAvailable->fontCascade().update(&m_document.fontSelector()); 691 } 692 m_document.setHasNodesWithPlaceholderStyle(); 720 693 return *s_styleNotYetAvailable; 721 694 } 722 695 696 m_state = State(element, parentStyle, regionForStyling, selectorFilter); 723 697 State& state = m_state; 724 initElement(element); 725 state.initForStyleResolve(document(), element, defaultParent, regionForStyling, selectorFilter); 698 699 if (&element == m_document.documentElement() && matchingBehavior == MatchAllRules) { 700 // These bits may be set when resolving document element style. 701 // FIXME: Style resolver shouldn't mutate document. 702 m_document.setDirectionSetOnDocumentElement(false); 703 m_document.setWritingModeSetOnDocumentElement(false); 704 } 726 705 727 706 if (sharingBehavior == AllowStyleSharing) { … … 734 713 if (state.parentStyle()) { 735 714 state.setStyle(RenderStyle::create()); 736 state.style()->inheritFrom(state.parentStyle(), isAtShadowBoundary( element) ? RenderStyle::AtShadowBoundary : RenderStyle::NotAtShadowBoundary);715 state.style()->inheritFrom(state.parentStyle(), isAtShadowBoundary(&element) ? RenderStyle::AtShadowBoundary : RenderStyle::NotAtShadowBoundary); 737 716 } else { 738 717 state.setStyle(defaultStyleForElement()); … … 740 719 } 741 720 742 if (element ->isLink()) {721 if (element.isLink()) { 743 722 state.style()->setIsLink(true); 744 723 EInsideLink linkState = state.elementLinkState(); 745 724 if (linkState != NotInsideLink) { 746 bool forceVisited = InspectorInstrumentation::forcePseudoState( *element, CSSSelector::PseudoClassVisited);725 bool forceVisited = InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoClassVisited); 747 726 if (forceVisited) 748 727 linkState = InsideVisitedLink; … … 752 731 753 732 bool needsCollection = false; 754 CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement( *element, needsCollection);733 CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement(element, needsCollection); 755 734 if (needsCollection) 756 735 m_ruleSets.collectFeatures(); 757 736 758 ElementRuleCollector collector( *element, state.style(), m_ruleSets, m_state.selectorFilter());737 ElementRuleCollector collector(element, state.style(), m_ruleSets, m_state.selectorFilter()); 759 738 collector.setRegionForStyling(regionForStyling); 760 739 collector.setMedium(m_medium.get()); … … 768 747 769 748 // Clean up our style object's display and text decorations (among other fixups). 770 adjustRenderStyle(*state.style(), *state.parentStyle(), element);749 adjustRenderStyle(*state.style(), *state.parentStyle(), &element); 771 750 772 751 if (state.style()->hasViewportUnits()) … … 837 816 } 838 817 839 void StyleResolver::keyframeStylesForAnimation(Element * e, const RenderStyle* elementStyle, KeyframeList& list)818 void StyleResolver::keyframeStylesForAnimation(Element& element, const RenderStyle* elementStyle, KeyframeList& list) 840 819 { 841 820 list.clear(); 842 821 843 822 // Get the keyframesRule for this name 844 if ( !e ||list.animationName().isEmpty())823 if (list.animationName().isEmpty()) 845 824 return; 846 825 … … 857 836 for (unsigned i = 0; i < keyframes.size(); ++i) { 858 837 // Apply the declaration to the style. This is a simplified version of the logic in styleForElement 859 initElement(e); 860 m_state.initForStyleResolve(document(), e, nullptr); 838 m_state = State(element, nullptr); 861 839 862 840 const StyleKeyframe* keyframe = keyframes[i].get(); … … 898 876 } 899 877 900 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element* element, const PseudoStyleRequest& pseudoStyleRequest, RenderStyle* parentStyle) 901 { 902 ASSERT(parentStyle); 903 if (!element) 904 return nullptr; 878 PassRefPtr<RenderStyle> StyleResolver::pseudoStyleForElement(Element& element, const PseudoStyleRequest& pseudoStyleRequest, RenderStyle& parentStyle) 879 { 880 m_state = State(element, &parentStyle); 905 881 906 882 State& state = m_state; 907 908 initElement(element);909 910 state.initForStyleResolve(document(), element, parentStyle);911 883 912 884 if (m_state.parentStyle()) { … … 922 894 923 895 // Check UA, user and author rules. 924 ElementRuleCollector collector( *element, m_state.style(), m_ruleSets, m_state.selectorFilter());896 ElementRuleCollector collector(element, m_state.style(), m_ruleSets, m_state.selectorFilter()); 925 897 collector.setPseudoStyleRequest(pseudoStyleRequest); 926 898 collector.setMedium(m_medium.get()); … … 956 928 RELEASE_ASSERT(!m_inLoadPendingImages); 957 929 958 m_state.initForStyleResolve(m_document, m_document.documentElement(), m_document.renderStyle()); 930 auto* documentElement = m_document.documentElement(); 931 if (!documentElement) 932 return RenderStyle::create(); 933 934 m_state = State(*documentElement, m_document.renderStyle()); 959 935 960 936 m_state.setStyle(RenderStyle::create()); … … 1398 1374 return Vector<RefPtr<StyleRule>>(); 1399 1375 1400 initElement(element); 1401 m_state.initForStyleResolve(document(), element, nullptr); 1402 1403 ElementRuleCollector collector(*element, m_state.style(), m_ruleSets, m_state.selectorFilter()); 1376 m_state = State(*element, nullptr); 1377 1378 ElementRuleCollector collector(*element, nullptr, m_ruleSets, m_state.selectorFilter()); 1404 1379 collector.setMode(SelectorChecker::Mode::CollectingRules); 1405 1380 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); … … 1556 1531 } 1557 1532 1558 static bool isCacheableInMatchedPropertiesCache(const Element* element, const RenderStyle* style, const RenderStyle* parentStyle) 1559 { 1560 // FIXME: CSSPropertyWebkitWritingMode modifies state when applying to document element. We can't skip the applying by caching. 1561 if (element == element->document().documentElement() && element->document().writingModeSetOnDocumentElement()) 1533 static bool isCacheableInMatchedPropertiesCache(const Element& element, const RenderStyle* style, const RenderStyle* parentStyle) 1534 { 1535 // FIXME: Writing mode and direction properties modify state when applying to document element by calling 1536 // Document::setWritingMode/DirectionSetOnDocumentElement. We can't skip the applying by caching. 1537 if (&element == element.document().documentElement()) 1562 1538 return false; 1563 1539 if (style->unique() || (style->styleType() != NOPSEUDO && parentStyle->unique())) … … 1608 1584 } 1609 1585 1610 void StyleResolver::applyMatchedProperties(const MatchResult& matchResult, const Element* element, ShouldUseMatchedPropertiesCache shouldUseMatchedPropertiesCache) 1611 { 1612 ASSERT(element); 1586 void StyleResolver::applyMatchedProperties(const MatchResult& matchResult, const Element& element, ShouldUseMatchedPropertiesCache shouldUseMatchedPropertiesCache) 1587 { 1613 1588 State& state = m_state; 1614 1589 unsigned cacheHash = shouldUseMatchedPropertiesCache && matchResult.isCacheable ? computeMatchedPropertiesHash(matchResult.matchedProperties().data(), matchResult.matchedProperties().size()) : 0; … … 1621 1596 // element context. This is fast and saves memory by reusing the style data structures. 1622 1597 state.style()->copyNonInheritedFrom(cacheItem->renderStyle.get()); 1623 if (state.parentStyle()->inheritedDataShared(cacheItem->parentRenderStyle.get()) && !isAtShadowBoundary( element)) {1598 if (state.parentStyle()->inheritedDataShared(cacheItem->parentRenderStyle.get()) && !isAtShadowBoundary(&element)) { 1624 1599 EInsideLink linkStatus = state.style()->insideLink(); 1625 1600 // If the cache item parent style has identical inherited properties to the current parent style then the … … 1707 1682 if (cacheItem || !cacheHash) 1708 1683 return; 1709 if (!isCacheableInMatchedPropertiesCache( state.element(), state.style(), state.parentStyle()))1684 if (!isCacheableInMatchedPropertiesCache(*state.element(), state.style(), state.parentStyle())) 1710 1685 return; 1711 1686 addToMatchedPropertiesCache(state.style(), state.parentStyle(), cacheHash, matchResult); … … 1714 1689 void StyleResolver::applyPropertyToStyle(CSSPropertyID id, CSSValue* value, RenderStyle* style) 1715 1690 { 1716 initElement(nullptr);1717 m_state. initForStyleResolve(document(), nullptr,style);1691 m_state = State(); 1692 m_state.setParentStyle(*style); 1718 1693 m_state.setStyle(*style); 1719 1694 applyPropertyToCurrentStyle(id, value); -
trunk/Source/WebCore/css/StyleResolver.h
r195293 r195465 136 136 ~StyleResolver(); 137 137 138 Ref<RenderStyle> styleForElement(Element *, RenderStyle* parentStyle, StyleSharingBehavior = AllowStyleSharing,138 Ref<RenderStyle> styleForElement(Element&, RenderStyle* parentStyle, StyleSharingBehavior = AllowStyleSharing, 139 139 RuleMatchingBehavior = MatchAllRules, const RenderRegion* regionForStyling = nullptr, const SelectorFilter* = nullptr); 140 140 141 void keyframeStylesForAnimation(Element *, const RenderStyle*, KeyframeList&);142 143 PassRefPtr<RenderStyle> pseudoStyleForElement(Element *, const PseudoStyleRequest&, RenderStyle*parentStyle);141 void keyframeStylesForAnimation(Element&, const RenderStyle*, KeyframeList&); 142 143 PassRefPtr<RenderStyle> pseudoStyleForElement(Element&, const PseudoStyleRequest&, RenderStyle& parentStyle); 144 144 145 145 Ref<RenderStyle> styleForPage(int pageIndex); … … 161 161 162 162 private: 163 void initElement(Element*);164 163 RenderStyle* locateSharedStyle(); 165 164 bool styleSharingCandidateMatchesRuleSet(RuleSet*); … … 334 333 335 334 enum ShouldUseMatchedPropertiesCache { DoNotUseMatchedPropertiesCache = 0, UseMatchedPropertiesCache }; 336 void applyMatchedProperties(const MatchResult&, const Element *, ShouldUseMatchedPropertiesCache = UseMatchedPropertiesCache);335 void applyMatchedProperties(const MatchResult&, const Element&, ShouldUseMatchedPropertiesCache = UseMatchedPropertiesCache); 337 336 338 337 void applyCascadedProperties(CascadedProperties&, int firstProperty, int lastProperty, const MatchResult*); … … 360 359 361 360 class State { 362 WTF_MAKE_NONCOPYABLE(State);363 361 public: 364 State() 365 : m_element(nullptr) 366 , m_styledElement(nullptr) 367 , m_parentStyle(nullptr) 368 , m_rootElementStyle(nullptr) 369 , m_regionForStyling(nullptr) 370 , m_elementLinkState(NotInsideLink) 371 , m_elementAffectedByClassRules(false) 372 , m_applyPropertyToRegularStyle(true) 373 , m_applyPropertyToVisitedLinkStyle(false) 374 , m_fontDirty(false) 375 , m_fontSizeHasViewportUnits(false) 376 , m_hasUAAppearance(false) 377 , m_backgroundData(BackgroundFillLayer) 378 { 379 } 362 State() { } 363 State(Element&, RenderStyle* parentStyle, const RenderRegion* regionForStyling = nullptr, const SelectorFilter* = nullptr); 380 364 381 365 public: 382 void initElement(Element*);383 void initForStyleResolve(Document&, Element*, RenderStyle* parentStyle, const RenderRegion* regionForStyling = nullptr, const SelectorFilter* = nullptr);384 366 void clear(); 385 367 386 368 Document& document() const { return m_element->document(); } 387 369 Element* element() const { return m_element; } 388 StyledElement* styledElement() const { return m_styledElement; } 370 389 371 void setStyle(Ref<RenderStyle>&&); 390 372 RenderStyle* style() const { return m_style.get(); } … … 445 427 void updateConversionData(); 446 428 447 Element* m_element ;429 Element* m_element { nullptr }; 448 430 RefPtr<RenderStyle> m_style; 449 StyledElement* m_styledElement;450 431 RefPtr<RenderStyle> m_parentStyle; 451 RenderStyle* m_rootElementStyle; 452 453 // Required to ASSERT in applyProperties. 454 const RenderRegion* m_regionForStyling; 455 456 EInsideLink m_elementLinkState; 457 458 bool m_elementAffectedByClassRules; 459 460 bool m_applyPropertyToRegularStyle; 461 bool m_applyPropertyToVisitedLinkStyle; 432 RenderStyle* m_rootElementStyle { nullptr }; 433 434 const RenderRegion* m_regionForStyling { nullptr }; 435 436 EInsideLink m_elementLinkState { NotInsideLink }; 437 438 bool m_elementAffectedByClassRules { false }; 439 bool m_applyPropertyToRegularStyle { true }; 440 bool m_applyPropertyToVisitedLinkStyle { false }; 441 bool m_fontDirty { false }; 442 bool m_fontSizeHasViewportUnits { false }; 443 bool m_hasUAAppearance { false }; 444 445 BorderData m_borderData; 446 FillLayer m_backgroundData { BackgroundFillLayer }; 447 Color m_backgroundColor; 462 448 463 449 PendingImagePropertyMap m_pendingImageProperties; 464 465 450 Vector<RefPtr<ReferenceFilterOperation>> m_filtersWithPendingSVGDocuments; 466 467 bool m_fontDirty;468 bool m_fontSizeHasViewportUnits;469 470 bool m_hasUAAppearance;471 BorderData m_borderData;472 FillLayer m_backgroundData;473 Color m_backgroundColor;474 475 451 CSSToLengthConversionData m_cssToLengthConversionData; 476 452 -
trunk/Source/WebCore/dom/Element.cpp
r195452 r195465 1405 1405 Ref<RenderStyle> Element::resolveStyle(RenderStyle* parentStyle) 1406 1406 { 1407 return styleResolver().styleForElement( this, parentStyle);1407 return styleResolver().styleForElement(*this, parentStyle); 1408 1408 } 1409 1409 -
trunk/Source/WebCore/page/animation/KeyframeAnimation.cpp
r193610 r195465 50 50 // Get the keyframe RenderStyles 51 51 if (m_object && m_object->element()) 52 m_object->element()->styleResolver().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
r195170 r195465 1591 1591 1592 1592 if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) { 1593 RefPtr<RenderStyle> result = styleResolver.styleForElement( element(), parentStyle, DisallowStyleSharing);1593 RefPtr<RenderStyle> result = styleResolver.styleForElement(*element(), parentStyle, DisallowStyleSharing); 1594 1594 result->setStyleType(FIRST_LINE_INHERITED); 1595 1595 return result.release(); 1596 1596 } 1597 1597 1598 return styleResolver.pseudoStyleForElement( element(), pseudoStyleRequest,parentStyle);1598 return styleResolver.pseudoStyleForElement(*element(), pseudoStyleRequest, *parentStyle); 1599 1599 } 1600 1600 -
trunk/Source/WebCore/rendering/RenderNamedFlowFragment.cpp
r194496 r195465 353 353 354 354 // FIXME: Region styling fails for pseudo-elements because the renderers don't have a node. 355 RefPtr<RenderStyle> renderObjectRegionStyle = renderer.element()->styleResolver().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/StyleTreeResolver.cpp
r194762 r195465 128 128 return style.releaseNonNull(); 129 129 } 130 return m_styleResolver.styleForElement( &element, &inheritedStyle, AllowStyleSharing, MatchAllRules, nullptr, &m_selectorFilter);130 return m_styleResolver.styleForElement(element, &inheritedStyle, AllowStyleSharing, MatchAllRules, nullptr, &m_selectorFilter); 131 131 } 132 132 -
trunk/Source/WebCore/svg/SVGElement.cpp
r190347 r195465 794 794 // If the element is in a <use> tree we get the style from the definition tree. 795 795 if (auto* styleElement = this->correspondingElement()) 796 return styleElement->styleResolver().styleForElement( styleElement, &parentStyle, DisallowStyleSharing);796 return styleElement->styleResolver().styleForElement(*styleElement, &parentStyle, DisallowStyleSharing); 797 797 798 798 return resolveStyle(&parentStyle); … … 828 828 } 829 829 830 return m_svgRareData->overrideComputedStyle( this, parentStyle);830 return m_svgRareData->overrideComputedStyle(*this, parentStyle); 831 831 } 832 832 -
trunk/Source/WebCore/svg/SVGElementRareData.h
r189987 r195465 66 66 } 67 67 68 RenderStyle* overrideComputedStyle(Element *element, RenderStyle* parentStyle)68 RenderStyle* overrideComputedStyle(Element& element, RenderStyle* parentStyle) 69 69 { 70 ASSERT(element);71 70 if (!m_useOverrideComputedStyle) 72 71 return 0; 73 72 if (!m_overrideComputedStyle || m_needsOverrideComputedStyleUpdate) { 74 73 // 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 ->styleResolver().styleForElement(element, parentStyle, DisallowStyleSharing, MatchAllRulesExcludingSMIL);74 m_overrideComputedStyle = element.styleResolver().styleForElement(element, parentStyle, DisallowStyleSharing, MatchAllRulesExcludingSMIL); 76 75 m_needsOverrideComputedStyleUpdate = false; 77 76 }
Note: See TracChangeset
for help on using the changeset viewer.