Bug 139210 - When the textLength attribute is specified on a given <tspan> and also specified on its ancestor, the textLength on this <tspan> is ignored
Summary: When the textLength attribute is specified on a given <tspan> and also specif...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-12-02 16:32 PST by Said Abou-Hallawa
Modified: 2022-08-13 16:10 PDT (History)
8 users (show)

See Also:


Attachments
STP 151 differs from other browsers (565.12 KB, image/png)
2022-08-13 16:09 PDT, Ahmad Saleem
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2014-12-02 16:32:40 PST
Open the following svg in WebKit

<svg xmlns="http://www.w3.org/2000/svg">
  <text x="100" y="100" style="font: 32px sans-serif" textLength="100" lengthAdjust="spacingAndGlyphs">
    hello
    <tspan x="100" y="140" textLength="50" lengthAdjust="spacingAndGlyphs">
      hello
    </tspan>
  </text>
</svg>

Result: Two lines of text are displayed. The width of the first line is 100 pixels while the width of the second line is the measured text of the word hello without glyph of spacing adjustment.
Expected: The quote below is the w3c specs for the textLength attribute of the tspan element (copied from http://www.w3.org/TR/SVG/text.html).  According to the first paragraph, the svg above should display two lines of text each of them has the width of 50 pixels. 
NOTE: FireFox displays the above svg as it is described in the Expected statement above.

------------------------------------------------------
If attribute ‘textLength’ is specified on a given element and also specified on an ancestor, the adjustments on all character data within this element are controlled by the value of ‘textLength’ on this element exclusively, with the possible side-effect that the adjustment ratio for the contents of this element might be different than the adjustment ratio used for other content that shares the same ancestor. The user agent must assume that the total advance values for the other content within that ancestor is the difference between the advance value on that ancestor and the advance value for this element.
A negative value is an error (see Error processing).
If the attribute is not specified anywhere within a ‘text’ element, the effect is as if the author's computation exactly matched the value calculated by the user agent; thus, no advance adjustments are made.
------------------------------------------------------
Comment 1 Radar WebKit Bug Importer 2014-12-02 16:33:43 PST
<rdar://problem/19121927>
Comment 2 Ahmad Saleem 2022-08-13 16:09:50 PDT
Created attachment 461603 [details]
STP 151 differs from other browsers

I changed the test case into JSFiddle:

Link - https://jsfiddle.net/91na45ro/show

As can be seen from attached screenshot, Safari TP 151 (Safari 15.6 is same as well) differs from other browsers. Just wanted to share updated testing status. Thanks!