Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp

Issue 1765933003: style: Rename the PseudoId enum values to CamelCase and prefix them. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enum-clash-PseudoId: none Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 { 729 {
730 if (value) { 730 if (value) {
731 StyleBuilder::applyProperty(property, state, value); 731 StyleBuilder::applyProperty(property, state, value);
732 state.fontBuilder().createFont(state.document().styleEngine().fontSelect or(), state.mutableStyleRef()); 732 state.fontBuilder().createFont(state.document().styleEngine().fontSelect or(), state.mutableStyleRef());
733 } 733 }
734 return CSSAnimatableValueFactory::create(property, *state.style()); 734 return CSSAnimatableValueFactory::create(property, *state.style());
735 } 735 }
736 736
737 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElement(Element * parent, PseudoId pseudoId) 737 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElement(Element * parent, PseudoId pseudoId)
738 { 738 {
739 if (pseudoId == FIRST_LETTER) 739 if (pseudoId == PseudoIdFirstLetter)
740 return FirstLetterPseudoElement::create(parent); 740 return FirstLetterPseudoElement::create(parent);
741 return PseudoElement::create(parent, pseudoId); 741 return PseudoElement::create(parent, pseudoId);
742 } 742 }
743 743
744 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElementIfNeeded (Element& parent, PseudoId pseudoId) 744 PassRefPtrWillBeRawPtr<PseudoElement> StyleResolver::createPseudoElementIfNeeded (Element& parent, PseudoId pseudoId)
745 { 745 {
746 LayoutObject* parentLayoutObject = parent.layoutObject(); 746 LayoutObject* parentLayoutObject = parent.layoutObject();
747 if (!parentLayoutObject) 747 if (!parentLayoutObject)
748 return nullptr; 748 return nullptr;
749 749
750 // The first letter pseudo element has to look up the tree and see if any 750 // The first letter pseudo element has to look up the tree and see if any
751 // of the ancestors are first letter. 751 // of the ancestors are first letter.
752 if (pseudoId < FIRST_INTERNAL_PSEUDOID && pseudoId != FIRST_LETTER && !paren tLayoutObject->style()->hasPseudoStyle(pseudoId)) 752 if (pseudoId < FirstInternalPseudoId && pseudoId != PseudoIdFirstLetter && ! parentLayoutObject->style()->hasPseudoStyle(pseudoId))
753 return nullptr; 753 return nullptr;
754 754
755 if (pseudoId == BACKDROP && !parent.isInTopLayer()) 755 if (pseudoId == PseudoIdBackdrop && !parent.isInTopLayer())
756 return nullptr; 756 return nullptr;
757 757
758 if (pseudoId == FIRST_LETTER && (parent.isSVGElement() || !FirstLetterPseudo Element::firstLetterTextLayoutObject(parent))) 758 if (pseudoId == PseudoIdFirstLetter && (parent.isSVGElement() || !FirstLette rPseudoElement::firstLetterTextLayoutObject(parent)))
759 return nullptr; 759 return nullptr;
760 760
761 if (!canHaveGeneratedChildren(*parentLayoutObject)) 761 if (!canHaveGeneratedChildren(*parentLayoutObject))
762 return nullptr; 762 return nullptr;
763 763
764 ComputedStyle* parentStyle = parentLayoutObject->mutableStyle(); 764 ComputedStyle* parentStyle = parentLayoutObject->mutableStyle();
765 if (ComputedStyle* cachedStyle = parentStyle->getCachedPseudoStyle(pseudoId) ) { 765 if (ComputedStyle* cachedStyle = parentStyle->getCachedPseudoStyle(pseudoId) ) {
766 if (!pseudoElementLayoutObjectIsNeeded(cachedStyle)) 766 if (!pseudoElementLayoutObjectIsNeeded(cachedStyle))
767 return nullptr; 767 return nullptr;
768 return createPseudoElement(&parent, pseudoId); 768 return createPseudoElement(&parent, pseudoId);
(...skipping 14 matching lines...) Expand all
783 setAnimationUpdateIfNeeded(state, *pseudo); 783 setAnimationUpdateIfNeeded(state, *pseudo);
784 if (ElementAnimations* elementAnimations = pseudo->elementAnimations()) 784 if (ElementAnimations* elementAnimations = pseudo->elementAnimations())
785 elementAnimations->cssAnimations().maybeApplyPendingUpdate(pseudo.get()) ; 785 elementAnimations->cssAnimations().maybeApplyPendingUpdate(pseudo.get()) ;
786 return pseudo.release(); 786 return pseudo.release();
787 } 787 }
788 788
789 bool StyleResolver::pseudoStyleForElementInternal(Element& element, const Pseudo StyleRequest& pseudoStyleRequest, const ComputedStyle* parentStyle, StyleResolve rState& state) 789 bool StyleResolver::pseudoStyleForElementInternal(Element& element, const Pseudo StyleRequest& pseudoStyleRequest, const ComputedStyle* parentStyle, StyleResolve rState& state)
790 { 790 {
791 ASSERT(document().frame()); 791 ASSERT(document().frame());
792 ASSERT(document().settings()); 792 ASSERT(document().settings());
793 ASSERT(pseudoStyleRequest.pseudoId != FIRST_LINE_INHERITED); 793 ASSERT(pseudoStyleRequest.pseudoId != PseudoIdFirstLineInherited);
794 ASSERT(state.parentStyle()); 794 ASSERT(state.parentStyle());
795 795
796 SelectorFilterParentScope::ensureParentStackIsPushed(); 796 SelectorFilterParentScope::ensureParentStackIsPushed();
797 797
798 Element* pseudoElement = element.pseudoElement(pseudoStyleRequest.pseudoId); 798 Element* pseudoElement = element.pseudoElement(pseudoStyleRequest.pseudoId);
799 799
800 ElementAnimations* elementAnimations = pseudoElement ? pseudoElement->elemen tAnimations() : nullptr; 800 ElementAnimations* elementAnimations = pseudoElement ? pseudoElement->elemen tAnimations() : nullptr;
801 const ComputedStyle* baseComputedStyle = elementAnimations ? elementAnimatio ns->baseComputedStyle() : nullptr; 801 const ComputedStyle* baseComputedStyle = elementAnimations ? elementAnimatio ns->baseComputedStyle() : nullptr;
802 802
803 if (baseComputedStyle) { 803 if (baseComputedStyle) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 state.setConversionFontSizes(CSSToLengthConversionData::FontSizes(state.styl e(), state.rootElementStyle())); 936 state.setConversionFontSizes(CSSToLengthConversionData::FontSizes(state.styl e(), state.rootElementStyle()));
937 state.setConversionZoom(state.style()->effectiveZoom()); 937 state.setConversionZoom(state.style()->effectiveZoom());
938 } 938 }
939 939
940 PassRefPtrWillBeRawPtr<StyleRuleList> StyleResolver::styleRulesForElement(Elemen t* element, unsigned rulesToInclude) 940 PassRefPtrWillBeRawPtr<StyleRuleList> StyleResolver::styleRulesForElement(Elemen t* element, unsigned rulesToInclude)
941 { 941 {
942 ASSERT(element); 942 ASSERT(element);
943 StyleResolverState state(document(), element); 943 StyleResolverState state(document(), element);
944 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, sta te.style()); 944 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, sta te.style());
945 collector.setMode(SelectorChecker::CollectingStyleRules); 945 collector.setMode(SelectorChecker::CollectingStyleRules);
946 collectPseudoRulesForElement(*element, collector, NOPSEUDO, rulesToInclude); 946 collectPseudoRulesForElement(*element, collector, PseudoIdNone, rulesToInclu de);
947 return collector.matchedStyleRuleList(); 947 return collector.matchedStyleRuleList();
948 } 948 }
949 949
950 PassRefPtrWillBeRawPtr<CSSRuleList> StyleResolver::pseudoCSSRulesForElement(Elem ent* element, PseudoId pseudoId, unsigned rulesToInclude) 950 PassRefPtrWillBeRawPtr<CSSRuleList> StyleResolver::pseudoCSSRulesForElement(Elem ent* element, PseudoId pseudoId, unsigned rulesToInclude)
951 { 951 {
952 ASSERT(element); 952 ASSERT(element);
953 StyleResolverState state(document(), element); 953 StyleResolverState state(document(), element);
954 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, sta te.style()); 954 ElementRuleCollector collector(state.elementContext(), m_selectorFilter, sta te.style());
955 collector.setMode(SelectorChecker::CollectingCSSRules); 955 collector.setMode(SelectorChecker::CollectingCSSRules);
956 collectPseudoRulesForElement(*element, collector, pseudoId, rulesToInclude); 956 collectPseudoRulesForElement(*element, collector, pseudoId, rulesToInclude);
957 return collector.matchedCSSRuleList(); 957 return collector.matchedCSSRuleList();
958 } 958 }
959 959
960 PassRefPtrWillBeRawPtr<CSSRuleList> StyleResolver::cssRulesForElement(Element* e lement, unsigned rulesToInclude) 960 PassRefPtrWillBeRawPtr<CSSRuleList> StyleResolver::cssRulesForElement(Element* e lement, unsigned rulesToInclude)
961 { 961 {
962 return pseudoCSSRulesForElement(element, NOPSEUDO, rulesToInclude); 962 return pseudoCSSRulesForElement(element, PseudoIdNone, rulesToInclude);
963 } 963 }
964 964
965 void StyleResolver::collectPseudoRulesForElement(const Element& element, Element RuleCollector& collector, PseudoId pseudoId, unsigned rulesToInclude) 965 void StyleResolver::collectPseudoRulesForElement(const Element& element, Element RuleCollector& collector, PseudoId pseudoId, unsigned rulesToInclude)
966 { 966 {
967 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); 967 collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId));
968 968
969 if (rulesToInclude & UAAndUserCSSRules) 969 if (rulesToInclude & UAAndUserCSSRules)
970 matchUARules(collector); 970 matchUARules(collector);
971 971
972 if (rulesToInclude & AuthorCSSRules) { 972 if (rulesToInclude & AuthorCSSRules) {
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 visitor->trace(m_uncommonAttributeRuleSet); 1612 visitor->trace(m_uncommonAttributeRuleSet);
1613 visitor->trace(m_watchedSelectorsRules); 1613 visitor->trace(m_watchedSelectorsRules);
1614 visitor->trace(m_treeBoundaryCrossingScopes); 1614 visitor->trace(m_treeBoundaryCrossingScopes);
1615 visitor->trace(m_styleSharingLists); 1615 visitor->trace(m_styleSharingLists);
1616 visitor->trace(m_pendingStyleSheets); 1616 visitor->trace(m_pendingStyleSheets);
1617 visitor->trace(m_document); 1617 visitor->trace(m_document);
1618 #endif 1618 #endif
1619 } 1619 }
1620 1620
1621 } // namespace blink 1621 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698