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

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

Issue 2684833003: Disable display: contents in SVG. (Closed)
Patch Set: Make display: contents act as an inline when it has a layout box, and ignore display: contents in S… 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 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 const ComputedStyle* style = nullptr; 1019 const ComputedStyle* style = nullptr;
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) {
1030 // SVG elements only render when inside <svg>, or if the element is an <svg>
1031 // itself.
1032 if (!isSVGSVGElement(*this) &&
1033 (!parentNode() || !parentNode()->isSVGElement())) {
1034 return false;
1035 }
1036
1037 if (!isValid())
1038 return false;
1039
1040 // Ignore display: contents, since it isn't really specified for SVG and Gecko
1041 // doesn't take display into account at all for SVG (except display: none).
1042 //
1043 // [1]: https://www.w3.org/TR/SVG/painting.html#DisplayProperty
1044 if (style.display() == EDisplay::Contents)
1045 return true;
1046
1047 return Element::layoutObjectIsNeeded(style);
1048 }
1049
1029 MutableStylePropertySet* SVGElement::animatedSMILStyleProperties() const { 1050 MutableStylePropertySet* SVGElement::animatedSMILStyleProperties() const {
1030 if (hasSVGRareData()) 1051 if (hasSVGRareData())
1031 return svgRareData()->animatedSMILStyleProperties(); 1052 return svgRareData()->animatedSMILStyleProperties();
1032 return nullptr; 1053 return nullptr;
1033 } 1054 }
1034 1055
1035 MutableStylePropertySet* SVGElement::ensureAnimatedSMILStyleProperties() { 1056 MutableStylePropertySet* SVGElement::ensureAnimatedSMILStyleProperties() {
1036 return ensureSVGRareData()->ensureAnimatedSMILStyleProperties(); 1057 return ensureSVGRareData()->ensureAnimatedSMILStyleProperties();
1037 } 1058 }
1038 1059
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 visitor->trace(m_className); 1310 visitor->trace(m_className);
1290 Element::trace(visitor); 1311 Element::trace(visitor);
1291 } 1312 }
1292 1313
1293 const AtomicString& SVGElement::eventParameterName() { 1314 const AtomicString& SVGElement::eventParameterName() {
1294 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt")); 1315 DEFINE_STATIC_LOCAL(const AtomicString, evtString, ("evt"));
1295 return evtString; 1316 return evtString;
1296 } 1317 }
1297 1318
1298 } // namespace blink 1319 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698