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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/svg/SVGElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGElement.cpp b/third_party/WebKit/Source/core/svg/SVGElement.cpp
index 88b13cabd79b091f5a2cf4d69f8c1e4987973a16..41ce743cf7e10c025ac8df688eef8c7798bf9d70 100644
--- a/third_party/WebKit/Source/core/svg/SVGElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGElement.cpp
@@ -1026,6 +1026,27 @@ PassRefPtr<ComputedStyle> SVGElement::customStyleForLayoutObject() {
correspondingElement(), style, DisallowStyleSharing);
}
+bool SVGElement::layoutObjectIsNeeded(const ComputedStyle& style) {
+ // SVG elements only render when inside <svg>, or if the element is an <svg>
+ // itself.
+ if (!isSVGSVGElement(*this) &&
+ (!parentNode() || !parentNode()->isSVGElement())) {
+ return false;
+ }
+
+ if (!isValid())
+ return false;
+
+ // Ignore display: contents, since it isn't really specified for SVG and Gecko
+ // doesn't take display into account at all for SVG (except display: none).
+ //
+ // [1]: https://www.w3.org/TR/SVG/painting.html#DisplayProperty
+ if (style.display() == EDisplay::Contents)
+ return true;
+
+ return Element::layoutObjectIsNeeded(style);
+}
+
MutableStylePropertySet* SVGElement::animatedSMILStyleProperties() const {
if (hasSVGRareData())
return svgRareData()->animatedSMILStyleProperties();

Powered by Google App Engine
This is Rietveld 408576698