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

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: Unify SVG parent checks for LayoutObject construction using always the light tree parent. 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 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 if (Element* parent = parentOrShadowHostElement()) { 1020 if (Element* parent = parentOrShadowHostElement()) {
1021 if (LayoutObject* layoutObject = parent->layoutObject()) 1021 if (LayoutObject* layoutObject = parent->layoutObject())
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 return isValid() && hasSVGParent() && Element::layoutObjectIsNeeded(style);
1031 // itself. 1031 }
1032 if (!isSVGSVGElement(*this)) {
1033 ContainerNode* parent = FlatTreeTraversal::parent(*this);
1034 if (!parent || !parent->isSVGElement())
1035 return false;
1036 }
1037 1032
1038 if (!isValid()) 1033 bool SVGElement::hasSVGParent() const {
1039 return false; 1034 // Should we use the flat tree parent instead? If so, we should probably fix a
1040 1035 // few other checks.
1041 return Element::layoutObjectIsNeeded(style); 1036 return parentOrShadowHostElement() &&
1037 parentOrShadowHostElement()->isSVGElement();
1042 } 1038 }
1043 1039
1044 MutableStylePropertySet* SVGElement::animatedSMILStyleProperties() const { 1040 MutableStylePropertySet* SVGElement::animatedSMILStyleProperties() const {
1045 if (hasSVGRareData()) 1041 if (hasSVGRareData())
1046 return svgRareData()->animatedSMILStyleProperties(); 1042 return svgRareData()->animatedSMILStyleProperties();
1047 return nullptr; 1043 return nullptr;
1048 } 1044 }
1049 1045
1050 MutableStylePropertySet* SVGElement::ensureAnimatedSMILStyleProperties() { 1046 MutableStylePropertySet* SVGElement::ensureAnimatedSMILStyleProperties() {
1051 return ensureSVGRareData()->ensureAnimatedSMILStyleProperties(); 1047 return ensureSVGRareData()->ensureAnimatedSMILStyleProperties();
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 visitor->trace(m_className); 1300 visitor->trace(m_className);
1305 Element::trace(visitor); 1301 Element::trace(visitor);
1306 } 1302 }
1307 1303
1308 const AtomicString& SVGElement::eventParameterName() { 1304 const AtomicString& SVGElement::eventParameterName() {
1309 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); 1305 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt"));
1310 return evtString; 1306 return evtString;
1311 } 1307 }
1312 1308
1313 } // namespace blink 1309 } // 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