Bug 76966 - Move opacity clamping into RenderStyle setter.
Summary: Move opacity clamping into RenderStyle setter.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Luke Macpherson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-24 17:28 PST by Luke Macpherson
Modified: 2012-03-13 20:19 PDT (History)
3 users (show)

See Also:


Attachments
Patch (2.59 KB, patch)
2012-01-24 17:32 PST, Luke Macpherson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Luke Macpherson 2012-01-24 17:28:35 PST
Move opacity clamping into RenderStyle setter.
Comment 1 Luke Macpherson 2012-01-24 17:32:07 PST
Created attachment 123857 [details]
Patch
Comment 2 Darin Adler 2012-01-24 17:56:12 PST
Comment on attachment 123857 [details]
Patch

Is this really the design we want going forward? RenderStyle was a sort of data holder without behavior. This goes in a different direction.
Comment 3 Luke Macpherson 2012-01-24 18:18:09 PST
This is a convenient place to enforce the invariant. I guess an alternate approach would be to introduce an Opacity type and have that enforce the value between 0 and 1, but that requires significantly more code.
Comment 4 Eric Seidel (no email) 2012-02-28 23:43:03 PST
Comment on attachment 123857 [details]
Patch

This removes the error handling.. so now we'll set opacity to 0 on error, no?
Comment 5 Luke Macpherson 2012-02-29 14:45:31 PST
That "error case" is unreachable.
CSSParser.cpp:1653: case CSSPropertyOpacity:
CSSParser.cpp:1654: validPrimitive = validUnit(value, FNumber, m_strict);
So the parser can only generate numbers for this property.

If it existed at all, it should have been an assertion, but most of the code in ::applyProperty() assumes that the parser has only passed in valid types at this point.
Comment 6 Eric Seidel (no email) 2012-03-13 18:41:07 PDT
Comment on attachment 123857 [details]
Patch

LGTM.
Comment 7 WebKit Review Bot 2012-03-13 20:19:18 PDT
Comment on attachment 123857 [details]
Patch

Clearing flags on attachment: 123857

Committed r110662: <http://trac.webkit.org/changeset/110662>
Comment 8 WebKit Review Bot 2012-03-13 20:19:22 PDT
All reviewed patches have been landed.  Closing bug.