WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
77065
Clean up CSSPrimitiveValue::computeLengthDouble().
https://bugs.webkit.org/show_bug.cgi?id=77065
Summary
Clean up CSSPrimitiveValue::computeLengthDouble().
Luke Macpherson
Reported
2012-01-25 18:17:39 PST
clean up CSSPrimitiveValue::computeLengthDouble().
Attachments
Patch
(3.00 KB, patch)
2012-01-25 18:19 PST
,
Luke Macpherson
no flags
Details
Formatted Diff
Diff
Patch
(3.74 KB, patch)
2012-01-26 22:24 PST
,
Luke Macpherson
no flags
Details
Formatted Diff
Diff
Patch
(3.90 KB, patch)
2012-02-27 20:44 PST
,
Luke Macpherson
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Luke Macpherson
Comment 1
2012-01-25 18:19:26 PST
Created
attachment 124052
[details]
Patch
Jessie Berlin
Comment 2
2012-01-26 09:01:11 PST
Comment on
attachment 124052
[details]
Patch Unofficial r=me (not a reviewer yet)
Darin Adler
Comment 3
2012-01-26 11:06:02 PST
Comment on
attachment 124052
[details]
Patch Some people like to follow a style rule where they don’t modify the values of arguments. It seems that the original author of this function was doing that. In this patch we stop following that style rule, and that eliminates a local variable, but also makes the code seem a bit more oblique to me. We now also use a hand-written maximum branch instead of the max function. That seems to slightly hurt the code clarity. I’m not sure these changes are improvements. I don’t feel strongly the other way, so I’m not saying review- but this doesn’t seem great to me.
Luke Macpherson
Comment 4
2012-01-26 21:16:28 PST
(In reply to
comment #3
)
> (From update of
attachment 124052
[details]
) > Some people like to follow a style rule where they don’t modify the values of arguments. It seems that the original author of this function was doing that. In this patch we stop following that style rule, and that eliminates a local variable, but also makes the code seem a bit more oblique to me.
New code is better because: 1) The current code uses two variables to represent what is effectively one piece of state. 2) The state space you have to think about has doubled when analyzing the code. 3) The new code is strictly more efficient, saving a few unnecessary computations.
> We now also use a hand-written maximum branch instead of the max function. That seems to slightly hurt the code clarity.
The new code is better because: 1) The zoomedResult is now only returned from a single, obvious location. 2) It is more efficient because the multiple branches can be skipped when the zoomedResult is > 1. 3) It more clearly reflects the intent of the comment.
> I’m not sure these changes are improvements. I don’t feel strongly the other way, so I’m not saying review- but this doesn’t seem great to me.
It's a small difference, but as someone who looks at this code almost daily, I thought the cleanup was worthwhile.
Luke Macpherson
Comment 5
2012-01-26 22:24:19 PST
Created
attachment 124262
[details]
Patch
Luke Macpherson
Comment 6
2012-02-27 19:14:25 PST
Just wanted to ping this patch to see if someone will review the second patch.
Luke Macpherson
Comment 7
2012-02-27 20:44:43 PST
Created
attachment 129180
[details]
Patch
Eric Seidel (no email)
Comment 8
2012-02-29 00:33:27 PST
Comment on
attachment 129180
[details]
Patch It's difficult for me to tell what's going on here. I guess "isFontRelativeLength" is true for EMS, EXS and REMS (and nothing else?)
Luke Macpherson
Comment 9
2012-02-29 14:28:10 PST
(In reply to
comment #8
)
> (From update of
attachment 129180
[details]
) > It's difficult for me to tell what's going on here. I guess "isFontRelativeLength" is true for EMS, EXS and REMS (and nothing else?)
That is correct.
Eric Seidel (no email)
Comment 10
2012-02-29 14:33:46 PST
Comment on
attachment 129180
[details]
Patch OK.
WebKit Review Bot
Comment 11
2012-02-29 16:12:08 PST
Comment on
attachment 129180
[details]
Patch Clearing flags on attachment: 129180 Committed
r109279
: <
http://trac.webkit.org/changeset/109279
>
WebKit Review Bot
Comment 12
2012-02-29 16:12:13 PST
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug