Bug 109271 - Keyframe rule should be ignored if keyframe selector has invalid value
Summary: Keyframe rule should be ignored if keyframe selector has invalid value
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alexander Shalamov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-08 01:04 PST by Alexander Shalamov
Modified: 2022-07-13 14:04 PDT (History)
17 users (show)

See Also:


Attachments
Patch 1 (11.91 KB, patch)
2013-02-08 05:24 PST, Alexander Shalamov
no flags Details | Formatted Diff | Diff
Patch 2 (11.88 KB, patch)
2013-02-08 05:32 PST, Alexander Shalamov
webkit-ews: commit-queue-
Details | Formatted Diff | Diff
Patch 3 (11.85 KB, patch)
2013-02-11 05:17 PST, Alexander Shalamov
no flags Details | Formatted Diff | Diff
Patch 4 (11.77 KB, patch)
2013-04-12 04:44 PDT, Alexander Shalamov
simon.fraser: review-
Details | Formatted Diff | Diff
Patch 5 (11.90 KB, patch)
2013-04-16 06:27 PDT, Alexander Shalamov
dino: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Shalamov 2013-02-08 01:04:51 PST
Whenever keyframe selector has invalid value (negative or more than 100%), keyframe rule should be ignored.
Comment 1 Alexander Shalamov 2013-02-08 05:24:59 PST
Created attachment 187297 [details]
Patch 1

Patch for initial review.
Comment 2 Alexander Shalamov 2013-02-08 05:32:40 PST
Created attachment 187299 [details]
Patch 2

- remove unnecessary rule.release() in CSSParser::createKeyframesRule
Comment 3 Early Warning System Bot 2013-02-08 05:42:09 PST
Comment on attachment 187299 [details]
Patch 2

Attachment 187299 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/16427613
Comment 4 Early Warning System Bot 2013-02-08 05:43:51 PST
Comment on attachment 187299 [details]
Patch 2

Attachment 187299 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/16427615
Comment 5 WebKit Review Bot 2013-02-08 05:55:22 PST
Comment on attachment 187299 [details]
Patch 2

Attachment 187299 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/16408747
Comment 6 EFL EWS Bot 2013-02-08 06:09:35 PST
Comment on attachment 187299 [details]
Patch 2

Attachment 187299 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/16434636
Comment 7 Peter Beverloo (cr-android ews) 2013-02-08 06:11:27 PST
Comment on attachment 187299 [details]
Patch 2

Attachment 187299 [details] did not pass cr-android-ews (chromium-android):
Output: http://queues.webkit.org/results/16418649
Comment 8 WebKit Review Bot 2013-02-08 06:17:09 PST
Comment on attachment 187299 [details]
Patch 2

Attachment 187299 [details] did not pass cr-linux-debug-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/16432666
Comment 9 Build Bot 2013-02-08 06:29:25 PST
Comment on attachment 187299 [details]
Patch 2

Attachment 187299 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://queues.webkit.org/results/16445707
Comment 10 Build Bot 2013-02-08 07:19:39 PST
Comment on attachment 187299 [details]
Patch 2

Attachment 187299 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/16415765
Comment 11 Alexander Shalamov 2013-02-11 05:17:43 PST
Created attachment 187550 [details]
Patch 3

fix for linking issue
Comment 12 Alexander Shalamov 2013-04-12 04:44:12 PDT
Created attachment 197744 [details]
Patch 4

rebased to master
Comment 13 Simon Fraser (smfr) 2013-04-12 09:15:01 PDT
Comment on attachment 197744 [details]
Patch 4

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

> LayoutTests/animations/keyframe-rule-negative-selector-percentage.html:6
> +            -100% {

What about comma-separate keyframe selectors, like 10%, -20%? Please test those.
Comment 14 Alexander Shalamov 2013-04-16 06:27:47 PDT
Created attachment 198324 [details]
Patch 5

Added comma separated keyframe selectors to layout test.
Comment 15 Dean Jackson 2013-04-18 22:18:44 PDT
Comment on attachment 198324 [details]
Patch 5

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

Nearly there!

You might want to test -0% as well.

> Source/WebCore/ChangeLog:7
> +        Keyframe rule should be ignored if keyframe selector has invalid value
> +        https://bugs.webkit.org/show_bug.cgi?id=109271
> +
> +        Reviewed by NOBODY (OOPS!).
> +

Please outline what you changed. You updated the CSS grammar - it's important to describe why you did that.

> Source/WebCore/ChangeLog:26
> +        * css/CSSGrammar.y.in:
> +        * css/CSSParser.cpp:
> +        (WebCore::CSSParser::createKeyframesRule):
> +        (WebCore::CSSParser::updateSpecifiers):
> +        * css/StyleResolver.cpp:
> +        (WebCore::StyleResolver::keyframeStylesForAnimation):
> +        * css/WebKitCSSKeyframeRule.cpp:
> +        (WebCore::StyleKeyframe::keyText):
> +        (WebCore):
> +        (WebCore::StyleKeyframe::setKeyText):
> +        (WebCore::StyleKeyframe::setKeys):
> +        (WebCore::StyleKeyframe::parseKeyString):
> +        (WebCore::StyleKeyframe::reportMemoryUsage):
> +        * css/WebKitCSSKeyframeRule.h:
> +        (StyleKeyframe):
> +        (WebCore::StyleKeyframe::isValid):
> +        (WebCore::StyleKeyframe::getKeys):

And provide some details here too.

> Source/WebCore/css/CSSParser.cpp:11351
> +        if (keyframe->isValid()) {
> +            rule->parserAppendKeyframe(keyframe);
> +            continue;
> +        }
> +        return 0;

You should do this the other way around.

if (!keyframe->isValid())
  return 0;

rule->parserAppendKeyframe(keyframe);

> Source/WebCore/css/CSSParser.cpp:11630
> +        if (value && value->unit == CSSPrimitiveValue::CSS_NUMBER) {
> +            keyframeKeys.append(static_cast<float>(value->fValue / 100));
> +            continue;
> +        }
> +        keyframeKeys.clear();
> +        break;

Same here. Early break/return in the invalid case.
Comment 16 Brent Fulgham 2022-07-13 14:04:01 PDT
I believe keyframe animation works properly now. Could you REOPEN if you believe a specific case is still not handled properly?