Bug 55351

Summary: Add templatized CSSMutableStyleDeclaration::get{ShorthandValue, CommonValue, LayeredShorthandValue}()
Product: WebKit Reporter: Daniel Bates <dbates>
Component: CSSAssignee: Daniel Bates <dbates>
Status: RESOLVED FIXED    
Severity: Normal CC: darin, hyatt
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch darin: review+

Daniel Bates
Reported 2011-02-27 22:26:47 PST
We should add template variants of CSSMutableStyleDeclaration::get{ShorthandValue, CommonValue, LayeredShorthandValue}() that are capable of determining the size of the passed array so that the caller does not need to provide such information. This helps improve the readability of the code (by removing redundant information) as well as makes usage of these functions less error prone (since the caller doesn't need to provide the size of the array). For completeness, we've used this technique before for functions RenderListMarker::to{Alphabetic, Numeric, Symbolic}.
Attachments
Patch (14.49 KB, patch)
2011-02-27 22:36 PST, Daniel Bates
no flags
Patch (14.55 KB, patch)
2011-03-06 20:09 PST, Daniel Bates
darin: review+
Daniel Bates
Comment 1 2011-02-27 22:36:51 PST
Daniel Bates
Comment 2 2011-03-06 20:09:18 PST
Darin Adler
Comment 3 2011-03-07 09:57:49 PST
Comment on attachment 84915 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=84915&action=review > Source/WebCore/css/CSSMutableStyleDeclaration.h:163 > + template <size_t size> String getShorthandValue(const int (&properties)[size]) const { return getShorthandValue(properties, size); } > + template <size_t size> String getCommonValue(const int (&properties)[size]) const { return getCommonValue(properties, size); } > + template <size_t size> String getLayeredShorthandValue(const int (&properties)[size]) const { return getLayeredShorthandValue(properties, size); } I like to leave out the space between “template” and “<” by analogy with function calls. Not sure others like that style.
Daniel Bates
Comment 4 2011-03-08 21:51:49 PST
(In reply to comment #3) > I like to leave out the space between “template” and “<” by analogy with function calls. Not sure others like that style. Will change before landing.
Daniel Bates
Comment 5 2011-03-09 21:02:12 PST
Note You need to log in before you can comment on or make changes to this bug.