getComputedStyle(svgText).width|height returns internal used value of 'width'/'height' |
|||||
Issue descriptionCSS properties 'width' and 'height' don't apply to svg <text>, so according to the spec (https://drafts.csswg.org/cssom/#resolved-value), we should return the computed values of the properties for getComputedStyle(svgText).width|height. For now Chrome returns the internal used value in 'px' unit. http://jsbin.com/sekeli <svg> <text id="text1">Text</text> <text id="text2" style="width: 200px; height: 30%">Text</text> </svg> Chrome (incorrect): text1.width = "28.2031px" text1.height = "0px" text2.width = "28.2031px" text2.height = "0px" (0px values are because of bug 708101 .) FireFox (correct): text1.width = "auto" text1.height = "auto" text2.width = "200px" text2.height = "30%" IE11 (incorrect): text1.width = "0px" text1.height = "0px" text2.width = "0px" text2.height = "0px"
,
Apr 5 2017
,
Apr 5 2017
,
Apr 6 2017
,
Apr 6 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e60f30d448ad169ebc5c7f1cf45e83da2af33959 commit e60f30d448ad169ebc5c7f1cf45e83da2af33959 Author: wangxianzhu <wangxianzhu@chromium.org> Date: Thu Apr 06 16:46:42 2017 Return 'auto' for width/height for non-root SVG According to the specs: - https://www.w3.org/TR/CSS2/visudet.html#the-height-property: The 'height' property doesn't apply to non-atomic inline elements. - https://drafts.csswg.org/cssom/#resolved-value: getComputeStyle() returns resolved values. For a property that doesn't apply, the resolved value is the computed value. Actually because of crbug.com/708888 'auto' is not the computed value when width/height is specified, but this keeps the current behavior. I didn't find spec about whether a non-root SVG is inline or not, but SVG's display's initial value is 'inline', and we treat most of the SVG elements always as inline. We treat SVG text as block internally just because we implement SVG text based on LayoutBlockFlow, which is an implementation detail and should not affect cssom. BUG= 708687 Review-Url: https://codereview.chromium.org/2798903005 Cr-Commit-Position: refs/heads/master@{#462508} [add] https://crrev.com/e60f30d448ad169ebc5c7f1cf45e83da2af33959/third_party/WebKit/LayoutTests/svg/css/getComputedStyle-svg-text-width-height.html [modify] https://crrev.com/e60f30d448ad169ebc5c7f1cf45e83da2af33959/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
,
Apr 6 2017
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by schenney@chromium.org
, Apr 5 2017