Closed Bug 898175 Opened 11 years ago Closed 11 years ago

[CSS Filters] Refactor parsing to use a keyword lookup table for filter function names

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla26

People

(Reporter: mvujovic, Assigned: mvujovic)

References

Details

Attachments

(1 file, 1 obsolete file)

In bug 895182, dbaron suggested:

"""
One minor comment:  I tend to dislike storing data as code rather than storing data as data; I think the two functions GetFilterFunctionName and StyleFilterTypeForFunctionName could have been replaced by a keyword table in nsCSSProps plus calls to nsCSSProps::FindKeyword and nsCSSProps::ValueToKeyword.
"""
Attached patch 898175-1-git.patch (obsolete) — Splinter Review
This patch passes Mochitests locally.

Small issue: I wish I could use "uint8_t mType" instead of "int32_t mType" in nsStyleFilter, but the keyword lookup APIs like FindKeyword want to assign to int32_t. I could use a cast, but I thought that was uglier.
Attachment #781302 - Flags: review?(dbaron)
Adding heycam because he's also been reviewing this code.
Comment on attachment 781302 [details] [diff] [review]
898175-1-git.patch

>-  Type mType;
>-  nsIURI* mURL;
>-  nsStyleCoord mCoord;
>+  int32_t mType;       // [reset] see nsStyleConsts.h
>+  nsIURI* mURL;        // [reset]
>+  nsStyleCoord mCoord; // [reset]

I would prefer not to have these [reset] comments, which are for properties (noting whether they're inherited or non-inherited (reset)). These are parts of a value, not properties.

On the other hand, the see comment should say "see NS_STYLE_FILTER_* constants in nsStyleConsts.h" or similar.

r=dbaron with that
Attachment #781302 - Flags: review?(dbaron) → review+
The patch should be updated and landed after the patch for hue-rotate and drop-shadow landed (both uploaded and read ready for review/landing).
(In reply to David Baron [:dbaron] (don't cc:, use needinfo? instead) from comment #3)
> Comment on attachment 781302 [details] [diff] [review]
> 898175-1-git.patch
> 
> >-  Type mType;
> >-  nsIURI* mURL;
> >-  nsStyleCoord mCoord;
> >+  int32_t mType;       // [reset] see nsStyleConsts.h
> >+  nsIURI* mURL;        // [reset]
> >+  nsStyleCoord mCoord; // [reset]
> 
> I would prefer not to have these [reset] comments, which are for properties
> (noting whether they're inherited or non-inherited (reset)). These are parts
> of a value, not properties.
> 
> On the other hand, the see comment should say "see NS_STYLE_FILTER_*
> constants in nsStyleConsts.h" or similar.
> 
> r=dbaron with that

Makes sense. I'll do that. Thanks for reviewing!
(In reply to Dirk Schulze from comment #4)
> The patch should be updated and landed after the patch for hue-rotate and
> drop-shadow landed (both uploaded and read ready for review/landing).

Yes, I will rebase after hue-rotate and drop-shadow land and add constants for them. Should be a trivial change.
Blocks: 896050
patch for landing
Attachment #781302 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/d7c45e9d8a9d
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: