RESOLVED FIXED 117481
Make sure to use CSSValueID and CSSPropertyID rather than integers
https://bugs.webkit.org/show_bug.cgi?id=117481
Summary Make sure to use CSSValueID and CSSPropertyID rather than integers
Ryosuke Niwa
Reported 2013-06-10 21:12:19 PDT
Consider merging https://chromium.googlesource.com/chromium/blink/+/cdf054eda8bdc38052421f32c62738dc7aa5e097 This will ensure that types are enforced when passing arguments in various css functions. Having a compile time check make sure that no mistakes will be done over the type. The parser was also patched to directly use CSSValueID over integers. This patch also fixes various call sites abusing the usage of integers.
Attachments
Patch (48.16 KB, patch)
2013-06-19 11:01 PDT, Alexis Menard (darktears)
no flags
attempt to fix efl build (48.69 KB, patch)
2013-06-19 11:21 PDT, Alexis Menard (darktears)
no flags
with benjamin's comments (49.24 KB, patch)
2013-06-19 13:19 PDT, Alexis Menard (darktears)
no flags
Patch for landing (49.27 KB, patch)
2013-06-19 13:46 PDT, Alexis Menard (darktears)
no flags
Alexis Menard (darktears)
Comment 2 2013-06-19 11:01:51 PDT
EFL EWS Bot
Comment 3 2013-06-19 11:15:40 PDT
Alexis Menard (darktears)
Comment 4 2013-06-19 11:21:37 PDT
Created attachment 205020 [details] attempt to fix efl build
Benjamin Poulain
Comment 5 2013-06-19 12:55:12 PDT
Comment on attachment 205020 [details] attempt to fix efl build View in context: https://bugs.webkit.org/attachment.cgi?id=205020&action=review > Source/WebCore/css/CSSParser.cpp:5646 > + addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierValue(static_cast<CSSValueID>(CSSValue100 + weight / 100 - 1)), important); I reeeeaaally don't like this. I would make it a separate function, with pre and post assertions, and a comment. > Source/WebCore/css/CSSParser.cpp:12236 > - return 0; // illegal character > + return CSSValueInvalid; // illegal character Fix the comment. > Source/WebCore/css/CSSValuePool.cpp:55 > - if (ident <= 0 || ident >= numCSSValueKeywords) > + if (ident <= 0) > return CSSPrimitiveValue::createIdentifier(ident); 1) Why would that happen with valid CSSValueID? Shouldn't you instead have two constructors?: one taking an int, the other taking a CSSValueID. > Source/WebCore/css/CSSValuePool.cpp:57 > if (!m_identifierValueCache[ident]) 2) Because of this, you should have a Release Assert for the range of ident!
Alexis Menard (darktears)
Comment 6 2013-06-19 13:19:24 PDT
Created attachment 205030 [details] with benjamin's comments
Benjamin Poulain
Comment 7 2013-06-19 13:45:20 PDT
Comment on attachment 205030 [details] with benjamin's comments View in context: https://bugs.webkit.org/attachment.cgi?id=205030&action=review LGTM > Source/WebCore/css/CSSValuePool.cpp:58 > + ASSERT(ident < numCSSValueKeywords); > if (!m_identifierValueCache[ident]) You should have a full bound checking release assert here.
Alexis Menard (darktears)
Comment 8 2013-06-19 13:46:55 PDT
Created attachment 205031 [details] Patch for landing
WebKit Commit Bot
Comment 9 2013-06-19 15:07:47 PDT
Comment on attachment 205031 [details] Patch for landing Clearing flags on attachment: 205031 Committed r151754: <http://trac.webkit.org/changeset/151754>
WebKit Commit Bot
Comment 10 2013-06-19 15:07:52 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.