Changeset 197779 in webkit
- Timestamp:
- Mar 8, 2016, 10:11:17 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r197778 r197779 1 2016-03-08 Antti Koivisto <antti@apple.com> 2 3 Make Element const in ElementRuleCollector 4 https://bugs.webkit.org/show_bug.cgi?id=155170 5 6 Reviewed by Andreas Kling. 7 8 More const. 9 10 * css/ElementRuleCollector.cpp: 11 (WebCore::ElementRuleCollector::ElementRuleCollector): 12 (WebCore::ElementRuleCollector::matchAllRules): 13 * css/ElementRuleCollector.h: 14 * css/SelectorChecker.cpp: 15 (WebCore::SelectorChecker::checkOne): 16 (WebCore::SelectorChecker::matchesFocusPseudoClass): 17 * cssjit/SelectorCompiler.cpp: 18 (WebCore::SelectorCompiler::SelectorCodeGenerator::generateAddStyleRelationIfResolvingStyle): 19 (WebCore::SelectorCompiler::addStyleRelationFunction): 20 (WebCore::SelectorCompiler::SelectorCodeGenerator::generateContextFunctionCallTest): 21 (WebCore::SelectorCompiler::elementIsActive): 22 (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsFirstChild): 23 (WebCore::SelectorCompiler::elementIsHovered): 24 (WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsOnlyChild): 25 (WebCore::SelectorCompiler::makeContextStyleUniqueIfNecessaryAndTestIsPlaceholderShown): 26 (WebCore::SelectorCompiler::isPlaceholderShown): 27 * cssjit/SelectorCompiler.h: 28 * dom/StyledElement.h: 29 (WebCore::StyledElement::additionalPresentationAttributeStyle): 30 (WebCore::StyledElement::inlineStyle): 31 (WebCore::StyledElement::collectStyleForPresentationAttribute): 32 (WebCore::StyledElement::invalidateStyleAttribute): 33 (WebCore::StyledElement::presentationAttributeStyle): 34 * html/HTMLTableCellElement.cpp: 35 (WebCore::HTMLTableCellElement::parseAttribute): 36 (WebCore::HTMLTableCellElement::additionalPresentationAttributeStyle): 37 * html/HTMLTableCellElement.h: 38 * html/HTMLTableColElement.cpp: 39 (WebCore::HTMLTableColElement::parseAttribute): 40 (WebCore::HTMLTableColElement::additionalPresentationAttributeStyle): 41 * html/HTMLTableColElement.h: 42 * html/HTMLTableElement.cpp: 43 (WebCore::leakBorderStyle): 44 (WebCore::HTMLTableElement::additionalPresentationAttributeStyle): 45 * html/HTMLTableElement.h: 46 * html/HTMLTableSectionElement.cpp: 47 (WebCore::HTMLTableSectionElement::create): 48 (WebCore::HTMLTableSectionElement::additionalPresentationAttributeStyle): 49 * html/HTMLTableSectionElement.h: 50 * inspector/InspectorCSSAgent.cpp: 51 (WebCore::InspectorCSSAgent::didUnregisterNamedFlowContentElement): 52 (WebCore::InspectorCSSAgent::forcePseudoState): 53 * inspector/InspectorCSSAgent.h: 54 * inspector/InspectorDOMAgent.cpp: 55 (WebCore::InspectorDOMAgent::pushNodePathToFrontend): 56 (WebCore::InspectorDOMAgent::boundNodeId): 57 (WebCore::InspectorDOMAgent::backendNodeIdForNode): 58 * inspector/InspectorDOMAgent.h: 59 * inspector/InspectorInstrumentation.cpp: 60 (WebCore::InspectorInstrumentation::handleMousePressImpl): 61 (WebCore::InspectorInstrumentation::forcePseudoStateImpl): 62 * inspector/InspectorInstrumentation.h: 63 (WebCore::InspectorInstrumentation::handleMousePress): 64 (WebCore::InspectorInstrumentation::forcePseudoState): 65 1 66 2016-03-08 Youenn Fablet <youenn.fablet@crf.canon.fr> 2 67 -
trunk/Source/WebCore/css/ElementRuleCollector.cpp
r197764 r197779 79 79 }; 80 80 81 ElementRuleCollector::ElementRuleCollector( Element& element, const DocumentRuleSets& ruleSets, const SelectorFilter* selectorFilter)81 ElementRuleCollector::ElementRuleCollector(const Element& element, const DocumentRuleSets& ruleSets, const SelectorFilter* selectorFilter) 82 82 : m_element(element) 83 83 , m_authorStyle(*ruleSets.authorStyle()) … … 88 88 } 89 89 90 ElementRuleCollector::ElementRuleCollector( Element& element, const RuleSet& authorStyle, const SelectorFilter* selectorFilter)90 ElementRuleCollector::ElementRuleCollector(const Element& element, const RuleSet& authorStyle, const SelectorFilter* selectorFilter) 91 91 : m_element(element) 92 92 , m_authorStyle(authorStyle) … … 521 521 // Now check author rules, beginning first with presentational attributes mapped from HTML. 522 522 if (is<StyledElement>(m_element)) { 523 StyledElement& styledElement = downcast<StyledElement>(m_element);523 auto& styledElement = downcast<StyledElement>(m_element); 524 524 addElementStyleProperties(styledElement.presentationAttributeStyle()); 525 525 … … 542 542 543 543 if (matchAuthorAndUserStyles && is<StyledElement>(m_element)) { 544 StyledElement& styledElement = downcast<StyledElement>(m_element);544 auto& styledElement = downcast<StyledElement>(m_element); 545 545 // Now check our inline style attribute. 546 546 if (styledElement.inlineStyle()) { -
trunk/Source/WebCore/css/ElementRuleCollector.h
r197764 r197779 46 46 class ElementRuleCollector { 47 47 public: 48 ElementRuleCollector( Element&, const DocumentRuleSets&, const SelectorFilter*);49 ElementRuleCollector( Element&, const RuleSet& authorStyle, const SelectorFilter*);48 ElementRuleCollector(const Element&, const DocumentRuleSets&, const SelectorFilter*); 49 ElementRuleCollector(const Element&, const RuleSet& authorStyle, const SelectorFilter*); 50 50 51 51 void matchAllRules(bool matchAuthorAndUserStyles, bool includeSMILProperties); … … 92 92 void addMatchedRule(const MatchedRule&); 93 93 94 Element& m_element;94 const Element& m_element; 95 95 const RuleSet& m_authorStyle; 96 96 const RuleSet* m_userStyle { nullptr }; -
trunk/Source/WebCore/css/SelectorChecker.cpp
r197764 r197779 914 914 addStyleRelation(checkingContext, element, Style::Relation::AffectedByHover); 915 915 916 if (element.hovered() || InspectorInstrumentation::forcePseudoState( const_cast<Element&>(element), CSSSelector::PseudoClassHover))916 if (element.hovered() || InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoClassHover)) 917 917 return true; 918 918 } … … 922 922 addStyleRelation(checkingContext, element, Style::Relation::AffectedByActive); 923 923 924 if (element.active() || InspectorInstrumentation::forcePseudoState( const_cast<Element&>(element), CSSSelector::PseudoClassActive))924 if (element.active() || InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoClassActive)) 925 925 return true; 926 926 } … … 1151 1151 bool SelectorChecker::matchesFocusPseudoClass(const Element& element) 1152 1152 { 1153 if (InspectorInstrumentation::forcePseudoState( const_cast<Element&>(element), CSSSelector::PseudoClassFocus))1153 if (InspectorInstrumentation::forcePseudoState(element, CSSSelector::PseudoClassFocus)) 1154 1154 return true; 1155 1155 return element.focused() && isFrameFocused(element); -
trunk/Source/WebCore/cssjit/SelectorCompiler.cpp
r197764 r197779 2185 2185 } 2186 2186 2187 static void addStyleRelationFunction(SelectorChecker::CheckingContext* checkingContext, Element* element)2187 static void addStyleRelationFunction(SelectorChecker::CheckingContext* checkingContext, const Element* element) 2188 2188 { 2189 2189 checkingContext->styleRelations.append({ *element, Style::Relation::AffectedByActive, 1 }); … … 3049 3049 } 3050 3050 3051 static bool elementIsActive( Element* element)3051 static bool elementIsActive(const Element* element) 3052 3052 { 3053 3053 return element->active() || InspectorInstrumentation::forcePseudoState(*element, CSSSelector::PseudoClassActive); … … 3155 3155 } 3156 3156 3157 static bool elementIsHovered( Element* element)3157 static bool elementIsHovered(const Element* element) 3158 3158 { 3159 3159 return element->hovered() || InspectorInstrumentation::forcePseudoState(*element, CSSSelector::PseudoClassHover); … … 3301 3301 } 3302 3302 3303 static bool makeContextStyleUniqueIfNecessaryAndTestIsPlaceholderShown( Element* element, SelectorChecker::CheckingContext* checkingContext)3303 static bool makeContextStyleUniqueIfNecessaryAndTestIsPlaceholderShown(const Element* element, SelectorChecker::CheckingContext* checkingContext) 3304 3304 { 3305 3305 if (is<HTMLTextFormControlElement>(*element)) { … … 3311 3311 } 3312 3312 3313 static bool isPlaceholderShown( Element* element)3313 static bool isPlaceholderShown(const Element* element) 3314 3314 { 3315 3315 return is<HTMLTextFormControlElement>(*element) && downcast<HTMLTextFormControlElement>(*element).isPlaceholderVisible(); -
trunk/Source/WebCore/cssjit/SelectorCompiler.h
r178011 r197779 78 78 }; 79 79 80 typedef unsigned (*RuleCollectorSimpleSelectorChecker)( Element*, unsigned*);81 typedef unsigned (*QuerySelectorSimpleSelectorChecker)( Element*);80 typedef unsigned (*RuleCollectorSimpleSelectorChecker)(const Element*, unsigned*); 81 typedef unsigned (*QuerySelectorSimpleSelectorChecker)(const Element*); 82 82 83 typedef unsigned (*RuleCollectorSelectorCheckerWithCheckingContext)( Element*, const SelectorChecker::CheckingContext*, unsigned*);84 typedef unsigned (*QuerySelectorSelectorCheckerWithCheckingContext)( Element*, const SelectorChecker::CheckingContext*);83 typedef unsigned (*RuleCollectorSelectorCheckerWithCheckingContext)(const Element*, const SelectorChecker::CheckingContext*, unsigned*); 84 typedef unsigned (*QuerySelectorSelectorCheckerWithCheckingContext)(const Element*, const SelectorChecker::CheckingContext*); 85 85 86 86 SelectorCompilationStatus compileSelector(const CSSSelector*, JSC::VM*, SelectorContext, JSC::MacroAssemblerCodeRef& outputCodeRef); -
trunk/Source/WebCore/dom/StyledElement.h
r197566 r197779 44 44 virtual ~StyledElement(); 45 45 46 virtual const StyleProperties* additionalPresentationAttributeStyle() { return 0; }46 virtual const StyleProperties* additionalPresentationAttributeStyle() const { return nullptr; } 47 47 void invalidateStyleAttribute(); 48 48 … … 61 61 CSSStyleDeclaration* cssomStyle() final; 62 62 63 const StyleProperties* presentationAttributeStyle() ;63 const StyleProperties* presentationAttributeStyle() const; 64 64 virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) { } 65 65 … … 101 101 } 102 102 103 inline const StyleProperties* StyledElement::presentationAttributeStyle() 103 inline const StyleProperties* StyledElement::presentationAttributeStyle() const 104 104 { 105 105 if (!elementData()) 106 106 return nullptr; 107 107 if (elementData()->presentationAttributeStyleIsDirty()) 108 rebuildPresentationAttributeStyle();108 const_cast<StyledElement&>(*this).rebuildPresentationAttributeStyle(); 109 109 return elementData()->presentationAttributeStyle(); 110 110 } -
trunk/Source/WebCore/html/HTMLTableCellElement.cpp
r197354 r197779 118 118 } 119 119 120 const StyleProperties* HTMLTableCellElement::additionalPresentationAttributeStyle() 120 const StyleProperties* HTMLTableCellElement::additionalPresentationAttributeStyle() const 121 121 { 122 122 if (HTMLTableElement* table = findParentTable()) -
trunk/Source/WebCore/html/HTMLTableCellElement.h
r197563 r197779 56 56 bool isPresentationAttribute(const QualifiedName&) const override; 57 57 void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override; 58 const StyleProperties* additionalPresentationAttributeStyle() override;58 const StyleProperties* additionalPresentationAttributeStyle() const override; 59 59 60 60 bool isURLAttribute(const Attribute&) const override; -
trunk/Source/WebCore/html/HTMLTableColElement.cpp
r196893 r197779 82 82 } 83 83 84 const StyleProperties* HTMLTableColElement::additionalPresentationAttributeStyle() 84 const StyleProperties* HTMLTableColElement::additionalPresentationAttributeStyle() const 85 85 { 86 86 if (!hasTagName(colgroupTag)) -
trunk/Source/WebCore/html/HTMLTableColElement.h
r197563 r197779 46 46 bool isPresentationAttribute(const QualifiedName&) const override; 47 47 void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override; 48 const StyleProperties* additionalPresentationAttributeStyle() override;48 const StyleProperties* additionalPresentationAttributeStyle() const override; 49 49 50 50 unsigned m_span; -
trunk/Source/WebCore/html/HTMLTableElement.cpp
r195452 r197779 444 444 } 445 445 446 const StyleProperties* HTMLTableElement::additionalPresentationAttributeStyle() 446 const StyleProperties* HTMLTableElement::additionalPresentationAttributeStyle() const 447 447 { 448 448 if (m_frameAttr) -
trunk/Source/WebCore/html/HTMLTableElement.h
r197563 r197779 79 79 80 80 // Used to obtain either a solid or outset border decl and to deal with the frame and rules attributes. 81 const StyleProperties* additionalPresentationAttributeStyle() override;81 const StyleProperties* additionalPresentationAttributeStyle() const override; 82 82 83 83 void addSubresourceAttributeURLs(ListHashSet<URL>&) const override; -
trunk/Source/WebCore/html/HTMLTableSectionElement.cpp
r191351 r197779 50 50 } 51 51 52 const StyleProperties* HTMLTableSectionElement::additionalPresentationAttributeStyle() 52 const StyleProperties* HTMLTableSectionElement::additionalPresentationAttributeStyle() const 53 53 { 54 54 if (HTMLTableElement* table = findParentTable()) -
trunk/Source/WebCore/html/HTMLTableSectionElement.h
r197563 r197779 59 59 HTMLTableSectionElement(const QualifiedName& tagName, Document&); 60 60 61 const StyleProperties* additionalPresentationAttributeStyle() override;61 const StyleProperties* additionalPresentationAttributeStyle() const override; 62 62 }; 63 63 -
trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp
r197563 r197779 530 530 } 531 531 532 bool InspectorCSSAgent::forcePseudoState( Element& element, CSSSelector::PseudoClassType pseudoClassType)532 bool InspectorCSSAgent::forcePseudoState(const Element& element, CSSSelector::PseudoClassType pseudoClassType) 533 533 { 534 534 if (m_nodeIdToForcedPseudoState.isEmpty()) -
trunk/Source/WebCore/inspector/InspectorCSSAgent.h
r197563 r197779 104 104 void didRegisterNamedFlowContentElement(Document&, WebKitNamedFlow&, Node& contentElement, Node* nextContentElement = nullptr); 105 105 void didUnregisterNamedFlowContentElement(Document&, WebKitNamedFlow&, Node& contentElement); 106 bool forcePseudoState( Element&, CSSSelector::PseudoClassType);106 bool forcePseudoState(const Element&, CSSSelector::PseudoClassType); 107 107 108 108 void getComputedStyleForNode(ErrorString&, int nodeId, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::CSS::CSSComputedStyleProperty>>&) override; -
trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp
r195538 r197779 604 604 } 605 605 606 int InspectorDOMAgent::boundNodeId( Node* node)607 { 608 return m_documentNodeToIdMap.get( node);606 int InspectorDOMAgent::boundNodeId(const Node* node) 607 { 608 return m_documentNodeToIdMap.get(const_cast<Node*>(node)); 609 609 } 610 610 -
trunk/Source/WebCore/inspector/InspectorDOMAgent.h
r197563 r197779 180 180 int pushNodeToFrontend(ErrorString&, int documentNodeId, Node*); 181 181 Node* nodeForId(int nodeId); 182 int boundNodeId( Node*);182 int boundNodeId(const Node*); 183 183 void setDOMListener(DOMListener*); 184 184 BackendNodeId backendNodeIdForNode(Node*, const String& nodeGroup); -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r197599 r197779 292 292 } 293 293 294 bool InspectorInstrumentation::forcePseudoStateImpl(InstrumentingAgents& instrumentingAgents, Element& element, CSSSelector::PseudoClassType pseudoState)294 bool InspectorInstrumentation::forcePseudoStateImpl(InstrumentingAgents& instrumentingAgents, const Element& element, CSSSelector::PseudoClassType pseudoState) 295 295 { 296 296 if (InspectorCSSAgent* cssAgent = instrumentingAgents.inspectorCSSAgent()) -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r197599 r197779 138 138 static bool handleMousePress(Frame&); 139 139 static bool handleTouchEvent(Frame&, Node&); 140 static bool forcePseudoState( Element&, CSSSelector::PseudoClassType);140 static bool forcePseudoState(const Element&, CSSSelector::PseudoClassType); 141 141 142 142 static void willSendXMLHttpRequest(ScriptExecutionContext*, const String& url); … … 307 307 static bool handleTouchEventImpl(InstrumentingAgents&, Node&); 308 308 static bool handleMousePressImpl(InstrumentingAgents&); 309 static bool forcePseudoStateImpl(InstrumentingAgents&, Element&, CSSSelector::PseudoClassType);309 static bool forcePseudoStateImpl(InstrumentingAgents&, const Element&, CSSSelector::PseudoClassType); 310 310 311 311 static void willSendXMLHttpRequestImpl(InstrumentingAgents&, const String& url); … … 627 627 } 628 628 629 inline bool InspectorInstrumentation::forcePseudoState( Element& element, CSSSelector::PseudoClassType pseudoState)629 inline bool InspectorInstrumentation::forcePseudoState(const Element& element, CSSSelector::PseudoClassType pseudoState) 630 630 { 631 631 FAST_RETURN_IF_NO_FRONTENDS(false);
Note:
See TracChangeset
for help on using the changeset viewer.