New issue
Advanced search Search tips

Issue 774018 link

Starred by 1 user

Issue metadata

Status: Archived
Owner: ----
Closed: Oct 24
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows
Pri: 2
Type: Compat



Sign in to add a comment

svg text.getBBox() returns different size on headless mode

Reported by hiroyuki...@gmail.com, Oct 12 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0

Example URL:
about:blank + tiny javascript

Steps to reproduce the problem:
1. please run chrome headless:
"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe" --headless --disable-gpu --remote-debugging-port=9222 about:blank

2. connect to headless process (port 9222) by using devtools. And exec the following javascript to get text width:

var svgElm = document.createElementNS("http://www.w3.org/2000/svg", "svg");
document.body.appendChild(svgElm);
var textElm = document.createElementNS("http://www.w3.org/2000/svg", "text");
textElm.textContent = 'h';
svgElm.appendChild(textElm);
textElm.getBBox();

And test on normal (not-headless) mode and compare getBBox() result.

3. getBBox() returns different value:
normal mode: SVGRect {x: 0, y: -17, width: 9.890625, height: 24}
headless mode: SVGRect {x: 0, y: -14, width: 8, height: 17}

What is the expected behavior?
textElm.getBBox() result is same.

What went wrong?
textElm.getBBox() result is different.

Does it occur on multiple sites: N/A

Is it a problem with a plugin? N/A 

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 61.0.3163.100 (Official Build) (32 ビット) (cohort: Stable)  Channel: stable
OS Version: 10.0
Flash Version:
 
please load attached 774018.html on (normal and headless mode) and check console:

result on my environment is:
----------------------------------------------------
// normal: 
font-family: initial: 12: 12
774018.html:16 font-family: serif: 12: 12
774018.html:18 font-family: Meiryo: 12: 12
774018.html:20 font-family: Arial: 12: 12

// headless:
font-family: initial: 5.40625: 5.4140625
774018.html:16 font-family: serif: 5.40625: 5.4140625
774018.html:18 font-family: Meiryo: 12: 12
774018.html:20 font-family: Arial: 5.40625: 5.4140625
----------------------------------------------------

* not only getBBox() but also getComputedTextLength() returns different value on (normal and headless mode).

* only {font-family = 'Meiryo'}, result is same on (normal and headless mode).

774018.html
940 bytes View Download
Components: Internals>Headless
Labels: Proj-Headless Needs-Triage-M61
Adding Internals>Headless component. Requesting someone from Headless Chrome team to look into this issue.

Components: Blink>SVG
Labels: OS-Linux
Thanks for providing the steps to reproduce!
I also get different values in Linux
Headless: SVGRect {x: 0, y: -14, width: 8, height: 17}
Non-Headless: SVGRect {x: -1, y: -14, width: 10, height: 17}


The interesting thing is that Headless is consistent across platforms, while non-headless isn't

Adding SVG in case they could know what's going on.

attached rendered-fonts.png shows that {Computed:Rendered Fonts} (for 'h' on w10) is different on devtools.

So font fallback order may different?
rendered-fonts.png
57.0 KB View Download

Comment 5 by f...@opera.com, Oct 16 2017

5.40625 vs. 5.4140625 is issue 757436 (LayoutUnit precision), so we can ignore that in this context.

I'd start by checking the font settings. Part of what's seen in c#1 can probably be explained by differences because of locale (different generic fonts.)
Components: -Blink>SVG
Back to the Headless team because the font fallback seems to be the issue.
Project Member

Comment 7 by sheriffbot@chromium.org, Oct 24

Status: Archived (was: Unconfirmed)
Issue has not been modified or commented on in the last 365 days, please re-open or file a new bug if this is still an issue.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Sign in to add a comment