Changeset 160536 in webkit
- Timestamp:
- Dec 13, 2013 1:14:30 AM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r160535 r160536 1 2013-12-13 Darin Adler <darin@apple.com> 2 3 Eliminate awkward virtualComputedStyle construction 4 https://bugs.webkit.org/show_bug.cgi?id=125681 5 6 Reviewed by Andreas Kling. 7 8 * dom/Element.cpp: 9 (WebCore::Element::computedStyle): Tweak coding style a bit. 10 11 * dom/Element.h: Marked computedStyle virtual and got rid of virtualComputedStyle. 12 This fixes a bug that we would not call SVGElement::computedStyle if we called 13 it through an Element pointer or reference. Not sure how to get test coverage for this. 14 15 * dom/Node.cpp: 16 (WebCore::Node::computedStyle): Use a loop instead of recursive virtual calls. 17 18 * dom/Node.h: Made computedStyle virtual and got rid of virtualComputedStyle. 19 20 * svg/SVGElement.cpp: 21 (WebCore::SVGElement::computedStyle): Tweak coding style a bit. 22 23 * svg/SVGElement.h: Made computedStyle virtual (and FINAL) and got rid fo 24 virtualComputedStyle. 25 1 26 2013-12-13 Darin Adler <darin@apple.com> 2 27 -
trunk/Source/WebCore/dom/Element.cpp
r160138 r160536 2155 2155 RenderStyle* cachedPseudoStyle = usedStyle->getCachedPseudoStyle(pseudoElementSpecifier); 2156 2156 return cachedPseudoStyle ? cachedPseudoStyle : usedStyle; 2157 } else2158 2159 } 2160 2161 if (!attached()) 2157 } 2158 return usedStyle; 2159 } 2160 2161 if (!attached()) { 2162 2162 // FIXME: Try to do better than this. Ensure that styleForElement() works for elements that are not in the 2163 2163 // document tree and figure out when to destroy the computed style for such elements. 2164 return 0; 2164 return nullptr; 2165 } 2165 2166 2166 2167 ElementRareData& data = ensureElementRareData(); -
trunk/Source/WebCore/dom/Element.h
r160138 r160536 341 341 virtual Element* focusDelegate(); 342 342 343 RenderStyle* computedStyle(PseudoId = NOPSEUDO);343 virtual RenderStyle* computedStyle(PseudoId = NOPSEUDO) OVERRIDE; 344 344 345 345 // Methods for indicating the style is affected by dynamic updates (e.g., children changing, our position changing in our sibling list, etc.) … … 637 637 void cancelFocusAppearanceUpdate(); 638 638 639 virtual RenderStyle* virtualComputedStyle(PseudoId pseudoElementSpecifier = NOPSEUDO) OVERRIDE { return computedStyle(pseudoElementSpecifier); }640 641 639 // cloneNode is private so that non-virtual cloneElementWithChildren and cloneElementWithoutChildren 642 640 // are used instead. -
trunk/Source/WebCore/dom/Node.cpp
r158663 r160536 885 885 } 886 886 887 RenderStyle* Node::virtualComputedStyle(PseudoId pseudoElementSpecifier) 888 { 889 return parentOrShadowHostNode() ? parentOrShadowHostNode()->computedStyle(pseudoElementSpecifier) : 0; 887 RenderStyle* Node::computedStyle(PseudoId pseudoElementSpecifier) 888 { 889 for (Node* node = this; node; node = node->parentOrShadowHostNode()) { 890 if (node->isElementNode()) 891 return toElement(node)->computedStyle(pseudoElementSpecifier); 892 } 893 return nullptr; 890 894 } 891 895 -
trunk/Source/WebCore/dom/Node.h
r159191 r160536 453 453 RenderStyle* renderStyle() const; 454 454 455 RenderStyle* computedStyle(PseudoId pseudoElementSpecifier = NOPSEUDO) { return virtualComputedStyle(pseudoElementSpecifier); }455 virtual RenderStyle* computedStyle(PseudoId pseudoElementSpecifier = NOPSEUDO); 456 456 457 457 // ----------------------------------------------------------------------------- … … 665 665 666 666 virtual RenderStyle* nonRendererStyle() const { return 0; } 667 virtual RenderStyle* virtualComputedStyle(PseudoId = NOPSEUDO);668 667 669 668 Element* ancestorElement() const; -
trunk/Source/WebCore/svg/SVGElement.cpp
r159856 r160536 783 783 return Element::computedStyle(pseudoElementSpecifier); 784 784 785 RenderStyle* parentStyle = 0;785 RenderStyle* parentStyle = nullptr; 786 786 if (Element* parent = parentOrShadowHostElement()) { 787 787 if (auto renderer = parent->renderer()) -
trunk/Source/WebCore/svg/SVGElement.h
r159856 r160536 172 172 virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; } 173 173 174 RenderStyle* computedStyle(PseudoId = NOPSEUDO); 175 virtual RenderStyle* virtualComputedStyle(PseudoId pseudoElementSpecifier = NOPSEUDO) OVERRIDE { return computedStyle(pseudoElementSpecifier); } 174 virtual RenderStyle* computedStyle(PseudoId = NOPSEUDO) OVERRIDE FINAL; 176 175 virtual bool willRecalcStyle(Style::Change) OVERRIDE; 177 176
Note: See TracChangeset
for help on using the changeset viewer.