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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGElement.cpp

Issue 2688343002: Unify SVG parent checks for LayoutObject construction using always the light tree parent. (Closed)
Patch Set: Created 3 years, 10 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) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann
3 * <zimmermann@kde.org> 3 * <zimmermann@kde.org>
4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> 4 * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org>
5 * Copyright (C) 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 6 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 7 * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 style = layoutObject->style(); 1022 style = layoutObject->style();
1023 } 1023 }
1024 1024
1025 return document().ensureStyleResolver().styleForElement( 1025 return document().ensureStyleResolver().styleForElement(
1026 correspondingElement(), style, DisallowStyleSharing); 1026 correspondingElement(), style, DisallowStyleSharing);
1027 } 1027 }
1028 1028
1029 bool SVGElement::layoutObjectIsNeeded(const ComputedStyle& style) { 1029 bool SVGElement::layoutObjectIsNeeded(const ComputedStyle& style) {
1030 // SVG elements only render when inside <svg>, or if the element is an <svg> 1030 // SVG elements only render when inside <svg>, or if the element is an <svg>
1031 // itself. 1031 // itself.
1032 if (!isSVGSVGElement(*this)) { 1032 if (!isSVGSVGElement(*this) && !isInSVGSubtree())
fs 2017/02/12 10:25:36 Given that we have an override for SVGSVGElement a
1033 ContainerNode* parent = FlatTreeTraversal::parent(*this); 1033 return false;
1034 if (!parent || !parent->isSVGElement())
1035 return false;
1036 }
1037 1034
1038 if (!isValid()) 1035 if (!isValid())
1039 return false; 1036 return false;
1040 1037
1041 return Element::layoutObjectIsNeeded(style); 1038 return Element::layoutObjectIsNeeded(style);
1042 } 1039 }
1043 1040
1041 bool SVGElement::isValidAndInSVGSubtree() const {
1042 return isInSVGSubtree() && isValid();
1043 }
1044
1045 bool SVGElement::isInSVGSubtree() const {
fs 2017/02/12 10:25:36 Maybe "hasSVGParent" or "hasSVGAncestor" or someth
1046 // Should we use the flat tree parent instead? If so, we should probably fix a
1047 // few other checks.
1048 return parentOrShadowHostElement() ||
fs 2017/02/12 10:25:35 &&
1049 parentOrShadowHostElement()->isSVGElement();
1050 }
1051
1044 MutableStylePropertySet* SVGElement::animatedSMILStyleProperties() const { 1052 MutableStylePropertySet* SVGElement::animatedSMILStyleProperties() const {
1045 if (hasSVGRareData()) 1053 if (hasSVGRareData())
1046 return svgRareData()->animatedSMILStyleProperties(); 1054 return svgRareData()->animatedSMILStyleProperties();
1047 return nullptr; 1055 return nullptr;
1048 } 1056 }
1049 1057
1050 MutableStylePropertySet* SVGElement::ensureAnimatedSMILStyleProperties() { 1058 MutableStylePropertySet* SVGElement::ensureAnimatedSMILStyleProperties() {
1051 return ensureSVGRareData()->ensureAnimatedSMILStyleProperties(); 1059 return ensureSVGRareData()->ensureAnimatedSMILStyleProperties();
1052 } 1060 }
1053 1061
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 visitor->trace(m_className); 1312 visitor->trace(m_className);
1305 Element::trace(visitor); 1313 Element::trace(visitor);
1306 } 1314 }
1307 1315
1308 const AtomicString& SVGElement::eventParameterName() { 1316 const AtomicString& SVGElement::eventParameterName() {
1309 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); 1317 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt"));
1310 return evtString; 1318 return evtString;
1311 } 1319 }
1312 1320
1313 } // namespace blink 1321 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGElement.h ('k') | third_party/WebKit/Source/core/svg/SVGGElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698