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

Unified Diff: third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp

Issue 2684833003: Disable display: contents in SVG. (Closed)
Patch Set: Make display: contents compute to inline in SVG subtrees. 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
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/css/display-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
diff --git a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
index a261919d92e7d4b6b4ec7126baf1880c026fc4a0..1a2332842c907f5238174e1501ef830e89dc71bf 100644
--- a/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
+++ b/third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp
@@ -464,6 +464,18 @@ void StyleAdjuster::adjustComputedStyle(ComputedStyle& style,
bool isSVGElement = element && element->isSVGElement();
if (isSVGElement) {
+ // display: contents computes to inline for replaced elements and form
+ // controls, and isn't specified for other kinds of SVG content[1], so let's
+ // just do the same here for all other SVG elements.
+ //
+ // If we wouldn't do this, then we'd need to ensure that display: contents
+ // doesn't prevent SVG elements from generating a LayoutObject in
+ // SVGElement::layoutObjectIsNeeded.
+ //
+ // [1]: https://www.w3.org/TR/SVG/painting.html#DisplayProperty
+ if (style.display() == EDisplay::Contents)
+ style.setDisplay(EDisplay::Inline);
+
// Only the root <svg> element in an SVG document fragment tree honors css
// position.
if (!(isSVGSVGElement(*element) && element->parentNode() &&
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/css/display-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698