Bug 144791

Summary: Rename Length::isPercent() and Length::isPercentNotCalculated()
Product: WebKit Reporter: Sungmann Cho <sungmann.cho>
Component: SVGAssignee: Sungmann Cho <sungmann.cho>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, zimmermann
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Sungmann Cho 2015-05-08 01:32:25 PDT
Fix the wrong condition check at the first line of SVGLengthContext::valueForLength().
Comment 1 Sungmann Cho 2015-05-08 01:57:24 PDT
We can replace "length.isPercent() && !length.isCalculated()" with "length.isPercentNotCalculated()" for simplicity and clarity.
Comment 2 Sungmann Cho 2015-05-08 01:57:44 PDT
Created attachment 252703 [details]
Patch
Comment 3 Said Abou-Hallawa 2015-05-08 09:59:17 PDT
Comment on attachment 252703 [details]
Patch

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

> Source/WebCore/svg/SVGLengthContext.cpp:92
> +    if (length.isPercentNotCalculated())

It will be beneficial if we can rename:

Length::isPercentNotCalculated() => Length::isPercent()
Length::isPercent() => Length::isPercentOrCalculated()  // Or something similar

Then we can remove the following FIXME from Length.h

    bool isPercentNotCalculated() const; // FIXME: Rename to isPercent.

And the above condition will be simpler and clearer.
Comment 4 Sungmann Cho 2015-05-08 13:38:38 PDT
Created attachment 252744 [details]
Patch
Comment 5 Sungmann Cho 2015-05-08 13:39:58 PDT
Addressed Said Abou-Hallawa's comments.
Comment 6 Sungmann Cho 2015-05-08 13:58:25 PDT
Created attachment 252746 [details]
Patch
Comment 7 Darin Adler 2015-05-10 14:12:28 PDT
Comment on attachment 252746 [details]
Patch

It’s dangerous to do this all in one pass. If we missed any call site, the behavior will become wrong and the compiler won’t catch it for us.

The safe way to do this is to do the rename of isPercent to isPercentOrCalculated in a first patch, then do the rest in a second patch after we know all platforms compile.
Comment 8 WebKit Commit Bot 2015-05-10 14:44:52 PDT
Comment on attachment 252746 [details]
Patch

Clearing flags on attachment: 252746

Committed r184055: <http://trac.webkit.org/changeset/184055>
Comment 9 WebKit Commit Bot 2015-05-10 14:44:56 PDT
All reviewed patches have been landed.  Closing bug.
Comment 10 Sungmann Cho 2015-05-10 17:54:05 PDT
@Darin Adler: Oops, but the patch has already been committed. Next time, I will be sure to follow your advice. Thank you for your thoughtful review.