New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 642524 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Percentage units on SVG use elements don't work inside a symbol

Reported by michaelr...@gmail.com, Aug 30 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36

Example URL:
http://codepen.io/MadeByMike/pen/f049a56e997357f44e8579990fb22635?editors=1000

Steps to reproduce the problem:
The <use> element is not positioned correctly in this example:

<svg x="0%" y="100%" width="100%" height="80">
  <use xlink:href="#example" />
</svg>

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0%" y="100%" width="100%" height="80">
  <symbol id="doesnotwork">
    <rect x="0" y="0" width="40" height="40" />	
  </symbol>

  <symbol id="example">
    <use xlink:href="#doesnotwork" x="50%" y="10" fill="red" />
    <rect x="50%" y="0" width="40" height="40"  fill="green"/>	
  </symbol>

  <use xlink:href="#doesnotwork" x="50%" y="10" fill="green" />

</svg>

What is the expected behavior?
All boxes should be aligned in the centre of the screen starting position 50%.

What went wrong?
http://codepen.io/MadeByMike/pen/f049a56e997357f44e8579990fb22635?editors=1000

SVG <use> element inside the symbol are not positioned correctly when relative units are used. 

Non-relative units work. 

Relative units work on <use> elements when not a child of a symbol.

Relative units work on other elements such as rect, as child of symbol.

Does it occur on multiple sites: Yes

Is it a problem with a plugin? No 

Did this work before? No 

Does this work in other browsers? Yes 

Chrome version: 52.0.2743.116  Channel: stable
OS Version: 10.0
Flash Version: 

Works as expected in other browsers
 
Cc: rnimmagadda@chromium.org
Labels: M-53 OS-Linux OS-Mac
Status: Untriaged (was: Unconfirmed)
Able to repro this issue on Windows 7, MAC (10.11.6) & Ubuntu Trusty (14.04) for Google Chrome Stable Version - 52.0.2743.116

This is a Non-Regression issue existing from M40 - # 40.0.2172.0

Before this build, there was only one block displayed when accessed the codepen URL provided.
Components: -Blink Blink>SVG
Status: Available (was: Untriaged)

Comment 4 by f...@opera.com, Aug 31 2016

I think it's intended for LayoutSVGTransformableContainer::calculateLocalTransform to handle this case through some mild magic, so that's probably a good starting point.
Project Member

Comment 5 by bugdroid1@chromium.org, Sep 1 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/b34ff6fe2d5842a63e2c66f68f050f0cf9163010

commit b34ff6fe2d5842a63e2c66f68f050f0cf9163010
Author: fs <fs@opera.com>
Date: Thu Sep 01 08:27:54 2016

Resolve percentage in <use> against the instance's viewport element

In LayoutSVGTransformableContainer::calculateLocalTransform, 'x' and 'y'
were resolved against the original (corresponding) element. For a <use>
nested within a <symbol>, this would mean that when were going to look
up the viewport element, we'd return the outer <symbol> element and thus
fail to get a viewport.
Use the instance element to setup the SVGLengthContext instead.

BUG= 642524 

Review-Url: https://codereview.chromium.org/2298783002
Cr-Commit-Position: refs/heads/master@{#415910}

[add] https://crrev.com/b34ff6fe2d5842a63e2c66f68f050f0cf9163010/third_party/WebKit/LayoutTests/svg/custom/use-nested-symbol-viewport-expected.html
[add] https://crrev.com/b34ff6fe2d5842a63e2c66f68f050f0cf9163010/third_party/WebKit/LayoutTests/svg/custom/use-nested-symbol-viewport.html
[modify] https://crrev.com/b34ff6fe2d5842a63e2c66f68f050f0cf9163010/third_party/WebKit/Source/core/layout/svg/LayoutSVGTransformableContainer.cpp

Comment 6 by f...@opera.com, Sep 1 2016

Owner: f...@opera.com
Status: Fixed (was: Available)

Sign in to add a comment