Bug 201663 - SVGLengthValue should use two enums for 'type' and 'mode' instead of one unsigned for 'units'
Summary: SVGLengthValue should use two enums for 'type' and 'mode' instead of one unsi...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks: 199843
  Show dependency treegraph
 
Reported: 2019-09-10 15:59 PDT by Said Abou-Hallawa
Modified: 2019-09-12 17:41 PDT (History)
19 users (show)

See Also:


Attachments
Patch (126.68 KB, patch)
2019-09-10 16:25 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (131.65 KB, patch)
2019-09-11 16:39 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (131.63 KB, patch)
2019-09-11 16:54 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (131.63 KB, patch)
2019-09-11 16:58 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (131.88 KB, patch)
2019-09-12 01:47 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (128.37 KB, patch)
2019-09-12 15:28 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Patch (128.47 KB, patch)
2019-09-12 16:17 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2019-09-10 15:59:19 PDT
If SVGLengthType and SVGLengthMode are converted to enum class type with size unit_8, SVGLengthValue will not need to use the bit operations to store them in on unsigned.
Comment 1 Said Abou-Hallawa 2019-09-10 16:25:05 PDT
Created attachment 378508 [details]
Patch
Comment 2 Simon Fraser (smfr) 2019-09-10 17:31:12 PDT
Comment on attachment 378508 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=378508&action=review

> Source/WebCore/svg/SVGLengthValue.cpp:328
> +    if (from.lengthType() == lengthType() || from.isZero() || isZero() || from.lengthType() == SVGLengthType::EMS || from.lengthType() == SVGLengthType::EXS) {

This is pretty confusing.

> Source/WebCore/svg/SVGLengthValue.h:87
> +    void newValueSpecifiedUnits(SVGLengthType, float valueInSpecifiedUnits);

What does "new value" mean here?
Comment 3 Nikolas Zimmermann 2019-09-11 01:42:01 PDT
Comment on attachment 378508 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=378508&action=review

Nice cleanup, much better to read!

> Source/WebCore/ChangeLog:9
> +        It used to allocate the least significant bits 4 bits to the SVGLengthMode

bits 4 bits -> 4 bits

>> Source/WebCore/svg/SVGLengthValue.h:87
>> +    void newValueSpecifiedUnits(SVGLengthType, float valueInSpecifiedUnits);
> 
> What does "new value" mean here?

I agree, we can use a better naming convention in SVGLengthValue -- after all only SVGLength is exposed to the Web, and we have to stick with the confusing official names like newValueSpecifiedUnits (see SVGLength.idl).
Comment 4 Said Abou-Hallawa 2019-09-11 16:39:55 PDT
Created attachment 378596 [details]
Patch
Comment 5 Said Abou-Hallawa 2019-09-11 16:53:26 PDT
Comment on attachment 378508 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=378508&action=review

>> Source/WebCore/ChangeLog:9
>> +        It used to allocate the least significant bits 4 bits to the SVGLengthMode
> 
> bits 4 bits -> 4 bits

Fixed.

>> Source/WebCore/svg/SVGLengthValue.cpp:328
>> +    if (from.lengthType() == lengthType() || from.isZero() || isZero() || from.lengthType() == SVGLengthType::EMS || from.lengthType() == SVGLengthType::EXS) {
> 
> This is pretty confusing.

I replaced the last two clauses "from.lengthType() == SVGLengthType::EMS || from.lengthType() == SVGLengthType::EXS" with from.isRelative() since from.lengthType() == SVGLengthType::Percentage is handled above..
Comment 6 Said Abou-Hallawa 2019-09-11 16:54:31 PDT
Created attachment 378598 [details]
Patch
Comment 7 Said Abou-Hallawa 2019-09-11 16:58:50 PDT
Created attachment 378599 [details]
Patch
Comment 8 Said Abou-Hallawa 2019-09-12 01:47:20 PDT
Created attachment 378635 [details]
Patch
Comment 9 Said Abou-Hallawa 2019-09-12 15:28:10 PDT
Created attachment 378682 [details]
Patch
Comment 10 Said Abou-Hallawa 2019-09-12 16:17:14 PDT
Created attachment 378687 [details]
Patch
Comment 11 WebKit Commit Bot 2019-09-12 17:40:02 PDT
Comment on attachment 378687 [details]
Patch

Clearing flags on attachment: 378687

Committed r249822: <https://trac.webkit.org/changeset/249822>
Comment 12 WebKit Commit Bot 2019-09-12 17:40:04 PDT
All reviewed patches have been landed.  Closing bug.
Comment 13 Radar WebKit Bug Importer 2019-09-12 17:41:19 PDT
<rdar://problem/55324552>