WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
99003
[CSS3 Media Queries] Aspect ratio value re-parsed when media query expression is evaluated
https://bugs.webkit.org/show_bug.cgi?id=99003
Summary
[CSS3 Media Queries] Aspect ratio value re-parsed when media query expression...
Alexander Shalamov
Reported
2012-10-11 00:55:03 PDT
Aspect ratio css value is parsed every time when media query expression is evaluated. That would degrade performance if there are multiple media queries or multiple media query listeners. Aspect ratio css value should be constructed once and should not be parsed during expression evaluation.
Attachments
Patch 1
(7.09 KB, patch)
2012-10-11 01:19 PDT
,
Alexander Shalamov
no flags
Details
Formatted Diff
Diff
Patch 2
(7.18 KB, patch)
2012-10-11 02:40 PDT
,
Alexander Shalamov
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Alexander Shalamov
Comment 1
2012-10-11 01:19:17 PDT
Created
attachment 168166
[details]
Patch 1 Use CSSAspectRatioValue instead of CSSValueList to avoid aspect-ratio re-parsing.
Kenneth Rohde Christiansen
Comment 2
2012-10-11 02:13:28 PDT
Comment on
attachment 168166
[details]
Patch 1 View in context:
https://bugs.webkit.org/attachment.cgi?id=168166&action=review
> Source/WebCore/css/MediaQueryExp.cpp:177 > + for (int i = 0; i < 3; ++i, valueList->next()) {
I would use unsigned
> Source/WebCore/css/MediaQueryExp.cpp:180 > + !i ? numeratorValue = value->fValue : denominatorValue = value->fValue;
I think an if sentence would be more readable
> Source/WebCore/css/MediaQueryExp.cpp:182 > + else if (i == 1 && value->unit == CSSParserValue::Operator && value->iValue == '/') > + continue;
So can you get an integer in 0 and then nothing in 1? and then another integer in 2? What if there is no operator
Alexander Shalamov
Comment 3
2012-10-11 02:27:16 PDT
(In reply to
comment #2
)
> (From update of
attachment 168166
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=168166&action=review
> > So can you get an integer in 0 and then nothing in 1? and then another integer in 2? What if there is no operator
if there is nothing in 1, then else if (i == 1... will check that value at 1 must be operator '/', otherwise aspect-ratio is invalid.
http://www.w3.org/TR/css3-mediaqueries/#values
"The <ratio> value is a positive (not zero or negative) <integer> followed by optional whitespace, followed by a solidus (‘/’), followed by optional whitespace, followed by a positive <integer>." I'm fixing patch according to your comments. Will upload in few minutes.
Alexander Shalamov
Comment 4
2012-10-11 02:40:56 PDT
Created
attachment 168177
[details]
Patch 2 - Use unsigned instead of int in for loop. MediaQueryExp.cpp:177 - Use if statement instead of ternary operator. MediaQueryExp.cpp:180
WebKit Review Bot
Comment 5
2012-10-11 03:11:59 PDT
Comment on
attachment 168177
[details]
Patch 2 Clearing flags on attachment: 168177 Committed
r131037
: <
http://trac.webkit.org/changeset/131037
>
WebKit Review Bot
Comment 6
2012-10-11 03:12:02 PDT
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