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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
10 * (http://www.torchmobile.com/) 10 * (http://www.torchmobile.com/)
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 // If we have first-letter pseudo style, transitions, or animations, do not 457 // If we have first-letter pseudo style, transitions, or animations, do not
458 // share this style. 458 // share this style.
459 if (style.hasPseudoStyle(PseudoIdFirstLetter) || style.transitions() || 459 if (style.hasPseudoStyle(PseudoIdFirstLetter) || style.transitions() ||
460 style.animations()) 460 style.animations())
461 style.setUnique(); 461 style.setUnique();
462 462
463 adjustStyleForEditing(style); 463 adjustStyleForEditing(style);
464 464
465 bool isSVGElement = element && element->isSVGElement(); 465 bool isSVGElement = element && element->isSVGElement();
466 if (isSVGElement) { 466 if (isSVGElement) {
467 // display: contents computes to inline for replaced elements and form
468 // controls, and isn't specified for other kinds of SVG content[1], so let's
469 // just do the same here for all other SVG elements.
470 //
471 // If we wouldn't do this, then we'd need to ensure that display: contents
472 // doesn't prevent SVG elements from generating a LayoutObject in
473 // SVGElement::layoutObjectIsNeeded.
474 //
475 // [1]: https://www.w3.org/TR/SVG/painting.html#DisplayProperty
476 if (style.display() == EDisplay::Contents)
477 style.setDisplay(EDisplay::Inline);
478
467 // Only the root <svg> element in an SVG document fragment tree honors css 479 // Only the root <svg> element in an SVG document fragment tree honors css
468 // position. 480 // position.
469 if (!(isSVGSVGElement(*element) && element->parentNode() && 481 if (!(isSVGSVGElement(*element) && element->parentNode() &&
470 !element->parentNode()->isSVGElement())) 482 !element->parentNode()->isSVGElement()))
471 style.setPosition(ComputedStyle::initialPosition()); 483 style.setPosition(ComputedStyle::initialPosition());
472 484
473 // SVG text layout code expects us to be a block-level style element. 485 // SVG text layout code expects us to be a block-level style element.
474 if ((isSVGForeignObjectElement(*element) || isSVGTextElement(*element)) && 486 if ((isSVGForeignObjectElement(*element) || isSVGTextElement(*element)) &&
475 style.isDisplayInlineType()) 487 style.isDisplayInlineType())
476 style.setDisplay(EDisplay::Block); 488 style.setDisplay(EDisplay::Block);
477 489
478 // Columns don't apply to svg text elements. 490 // Columns don't apply to svg text elements.
479 if (isSVGTextElement(*element)) 491 if (isSVGTextElement(*element))
480 style.clearMultiCol(); 492 style.clearMultiCol();
481 } 493 }
482 adjustStyleForAlignment(style, parentStyle); 494 adjustStyleForAlignment(style, parentStyle);
483 } 495 }
484 496
485 } // namespace blink 497 } // namespace blink
OLDNEW
« 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