Bug 261180 - Fix inconsistent LengthMode definition for 'textLength'
Summary: Fix inconsistent LengthMode definition for 'textLength'
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2023-09-05 14:58 PDT by Ahmad Saleem
Modified: 2023-09-13 02:37 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmad Saleem 2023-09-05 14:58:52 PDT
Hi Team,

While going through Blink's commit, I came across another potential merge and looked in Blink's latest source code and the length is still 'Width'.

Blink Commit - https://src.chromium.org/viewvc/blink?view=revision&revision=189707

WebKit Source - https://github.com/WebKit/WebKit/blob/94ce519cd2eaba3a1f2f4cb9753f40c98e9d9472/Source/WebCore/svg/SVGTextContentElement.cpp#L175

From changing:

m_textLength->setBaseValInternal(SVGLengthValue::construct(SVGLengthMode::Other

to

m_textLength->setBaseValInternal(SVGLengthValue::construct(SVGLengthMode::Width

___

Just raising so we can fix it.

Thanks!
Comment 1 Ahmad Saleem 2023-09-05 15:19:22 PDT
Although this commit deleted other use: https://github.com/WebKit/WebKit/commit/4c53eb1e29f8c451411f0ef7f5f47d84adeb3118
Comment 2 Ahmad Saleem 2023-09-06 03:08:56 PDT
Chromium Source: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/svg/svg_text_content_element.cc;l=67?q=SVGAnimatedTextLength

and

class SVGAnimatedTextLength final : public SVGAnimatedLength {
 public:
  SVGAnimatedTextLength(SVGTextContentElement* context_element)
      : SVGAnimatedLength(context_element,
                          svg_names::kTextLengthAttr,
                          SVGLengthMode::kWidth, <----- HERE
                          SVGLength::Initial::kUnitlessZero) {}
Comment 3 Ahmad Saleem 2023-09-09 15:22:31 PDT
We don't crash in --debug build on top of WebKit ToT and running this test via --debug flag.
Comment 4 Radar WebKit Bug Importer 2023-09-12 14:59:15 PDT
<rdar://problem/115389551>
Comment 5 Said Abou-Hallawa 2023-09-12 18:05:00 PDT
In WebKit we do not have inconsistency in the LengthMode when changing the baseVal of 'textLength'.

This is how  we create the textLength in SVGTextContentElement:

    Ref<SVGAnimatedLength> m_textLength { SVGAnimatedLength::create(this, SVGLengthMode::Other) };

And this is how we change its baseVal

    m_textLength->setBaseValInternal(SVGLengthValue::construct(SVGLengthMode::Other, newValue, parseError, SVGLengthNegativeValuesMode::Forbid));

So the LengthMode is always SVGLengthMode::Other.

If you want to change the LengthMode to be SVGLengthMode::Width, please retitle this bug. Otherwise please close it.