RESOLVED FIXED 121462
Introduce CSS_VALUE_TYPE_CASTS macro in order to cast CSSValue type
https://bugs.webkit.org/show_bug.cgi?id=121462
Summary Introduce CSS_VALUE_TYPE_CASTS macro in order to cast CSSValue type
Gyuyoung Kim
Reported 2013-09-16 17:30:19 PDT
As r155429 introduced ELEMENT_TYPE_CASTS, CSS_VALUE_TYPE_CASTS can be used by css value type casting. This casting macro will help to detect bad-cast bugs. This patch adds the following methods, - CSSFooValue* toCSSFooValue(CSSValue*) - const CSSFooValue* toCSSFooValue(const CSSValue*) - CSSFooValue& toCSSFooValue(CSSValue&) - const CSSFooValue& toCSSFooValue(const CSSValue&)
Attachments
WIP (52.75 KB, patch)
2013-09-16 17:31 PDT, Gyuyoung Kim
no flags
Patch (122.33 KB, patch)
2013-09-16 22:12 PDT, Gyuyoung Kim
no flags
Patch (127.07 KB, patch)
2013-09-17 05:04 PDT, Gyuyoung Kim
no flags
Archive of layout-test-results from webkit-ews-10 for mac-mountainlion-wk2 (1.09 MB, application/zip)
2013-09-17 06:17 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-16 for mac-mountainlion-wk2 (1.08 MB, application/zip)
2013-09-17 07:15 PDT, Build Bot
no flags
Archive of layout-test-results from webkit-ews-02 for mac-mountainlion (1.07 MB, application/zip)
2013-09-17 07:43 PDT, Build Bot
no flags
Patch (121.49 KB, patch)
2013-09-18 00:17 PDT, Gyuyoung Kim
no flags
Patch (119.54 KB, patch)
2013-09-18 06:58 PDT, Gyuyoung Kim
no flags
Patch (119.94 KB, patch)
2013-09-19 00:25 PDT, Gyuyoung Kim
no flags
Patch (8.76 KB, patch)
2013-09-23 00:37 PDT, Gyuyoung Kim
no flags
Patch for landing (8.79 KB, patch)
2013-09-23 17:03 PDT, Gyuyoung Kim
no flags
Patch for landing (8.82 KB, patch)
2013-09-23 17:23 PDT, Gyuyoung Kim
no flags
Gyuyoung Kim
Comment 1 2013-09-16 17:31:45 PDT
Gyuyoung Kim
Comment 2 2013-09-16 22:12:23 PDT
Gyuyoung Kim
Comment 3 2013-09-16 22:14:53 PDT
CC'ing kling, could you take a look this patch for CSSValue type casting ?
Early Warning System Bot
Comment 4 2013-09-16 22:21:30 PDT
Build Bot
Comment 5 2013-09-16 22:38:30 PDT
Build Bot
Comment 6 2013-09-16 22:50:37 PDT
Early Warning System Bot
Comment 7 2013-09-17 03:08:44 PDT
Gyuyoung Kim
Comment 8 2013-09-17 05:04:23 PDT
Build Bot
Comment 9 2013-09-17 06:17:44 PDT
Comment on attachment 211887 [details] Patch Attachment 211887 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/1850365 New failing tests: css3/filters/custom/custom-filter-matN.html css3/filters/custom/custom-filter-u-tile-size.html css3/filters/custom/custom-filter-property-computed-style.html css3/filters/custom/custom-filter-blend-modes.html css3/filters/custom/custom-filter-array.html css3/filters/custom/custom-filter-u-texture-size.html css3/filters/custom/custom-filter-shader-reuse.html css3/filters/custom/custom-filter-property-parsing.html css3/filters/custom/composited/custom-filter-blend-modes.html css3/filters/custom/custom-filter-css-keyword-as-parameter-name.html css3/filters/custom/custom-filter-clamp-css-mix-color.html css3/filters/custom/custom-filter-composite-fractional-source-alpha.html css3/filters/custom/custom-filter-u-mesh-size.html css3/filters/custom/custom-filter-reload.html css3/filters/custom/custom-filter-clamp-css-mix-color-negative.html css3/filters/custom/custom-filter-clamp-css-color-matrix.html css3/filters/custom/custom-filter-unavailable-varying.html css3/filters/custom/custom-filter-change-blend-mode.html css3/filters/custom/custom-filter-color-matrix.html css3/filters/custom/custom-filter-color.html css3/filters/custom/invalid-custom-filter-uniform-types.html css3/filters/custom/custom-filter-mix-bindings.html css3/filters/custom/custom-filter-u-mesh-box.html css3/filters/custom/missing-custom-filter-shader.html css3/filters/custom/invalid-custom-filter-shader.html css3/filters/custom/custom-filter-clamp-css-color-matrix-negative.html
Build Bot
Comment 10 2013-09-17 06:17:48 PDT
Created attachment 211894 [details] Archive of layout-test-results from webkit-ews-10 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-10 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Andreas Kling
Comment 11 2013-09-17 06:19:33 PDT
Why do we need both CSS_VALUE_TYPE_CASTS and WEBKIT_CSS_VALUE_TYPE_CASTS? Can't we just have one: CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue) CSS_VALUE_TYPE_CASTS(WebKitCSSTransformValue)
Build Bot
Comment 12 2013-09-17 07:15:23 PDT
Comment on attachment 211887 [details] Patch Attachment 211887 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.appspot.com/results/1893278 New failing tests: css3/filters/custom/custom-filter-matN.html css3/filters/custom/custom-filter-u-tile-size.html css3/filters/custom/custom-filter-property-computed-style.html css3/filters/custom/custom-filter-blend-modes.html css3/filters/custom/custom-filter-array.html css3/filters/custom/custom-filter-u-texture-size.html css3/filters/custom/custom-filter-shader-reuse.html css3/filters/custom/custom-filter-property-parsing.html css3/filters/custom/composited/custom-filter-blend-modes.html css3/filters/custom/custom-filter-css-keyword-as-parameter-name.html css3/filters/custom/custom-filter-clamp-css-mix-color.html css3/filters/custom/custom-filter-composite-fractional-source-alpha.html css3/filters/custom/custom-filter-u-mesh-size.html css3/filters/custom/custom-filter-reload.html css3/filters/custom/custom-filter-clamp-css-mix-color-negative.html css3/filters/custom/custom-filter-clamp-css-color-matrix.html css3/filters/custom/custom-filter-unavailable-varying.html css3/filters/custom/custom-filter-change-blend-mode.html css3/filters/custom/custom-filter-color-matrix.html css3/filters/custom/custom-filter-color.html css3/filters/custom/invalid-custom-filter-uniform-types.html css3/filters/custom/custom-filter-mix-bindings.html css3/filters/custom/custom-filter-u-mesh-box.html css3/filters/custom/missing-custom-filter-shader.html css3/filters/custom/invalid-custom-filter-shader.html css3/filters/custom/custom-filter-clamp-css-color-matrix-negative.html
Build Bot
Comment 13 2013-09-17 07:15:26 PDT
Created attachment 211901 [details] Archive of layout-test-results from webkit-ews-16 for mac-mountainlion-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: webkit-ews-16 Port: mac-mountainlion-wk2 Platform: Mac OS X 10.8.5
Build Bot
Comment 14 2013-09-17 07:43:41 PDT
Comment on attachment 211887 [details] Patch Attachment 211887 [details] did not pass mac-ews (mac): Output: http://webkit-queues.appspot.com/results/1850383 New failing tests: css3/filters/custom/custom-filter-matN.html css3/filters/custom/custom-filter-u-tile-size.html css3/filters/custom/custom-filter-property-computed-style.html css3/filters/custom/custom-filter-blend-modes.html css3/filters/custom/custom-filter-array.html css3/filters/custom/custom-filter-u-texture-size.html css3/filters/custom/custom-filter-shader-reuse.html css3/filters/custom/custom-filter-property-parsing.html css3/filters/custom/composited/custom-filter-blend-modes.html css3/filters/custom/custom-filter-css-keyword-as-parameter-name.html css3/filters/custom/custom-filter-clamp-css-mix-color.html css3/filters/custom/custom-filter-composite-fractional-source-alpha.html css3/filters/custom/custom-filter-u-mesh-size.html css3/filters/custom/custom-filter-reload.html css3/filters/custom/custom-filter-clamp-css-mix-color-negative.html css3/filters/custom/custom-filter-clamp-css-color-matrix.html css3/filters/custom/custom-filter-unavailable-varying.html css3/filters/custom/custom-filter-change-blend-mode.html css3/filters/custom/custom-filter-color-matrix.html css3/filters/custom/custom-filter-color.html css3/filters/custom/invalid-custom-filter-uniform-types.html css3/filters/custom/custom-filter-mix-bindings.html css3/filters/custom/custom-filter-u-mesh-box.html css3/filters/custom/missing-custom-filter-shader.html css3/filters/custom/invalid-custom-filter-shader.html css3/filters/custom/custom-filter-clamp-css-color-matrix-negative.html
Build Bot
Comment 15 2013-09-17 07:43:44 PDT
Created attachment 211905 [details] Archive of layout-test-results from webkit-ews-02 for mac-mountainlion The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: webkit-ews-02 Port: mac-mountainlion Platform: Mac OS X 10.8.5
Gyuyoung Kim
Comment 16 2013-09-17 21:08:19 PDT
(In reply to comment #11) > Why do we need both CSS_VALUE_TYPE_CASTS and WEBKIT_CSS_VALUE_TYPE_CASTS? > Can't we just have one: > > CSS_VALUE_TYPE_CASTS(CSSPrimitiveValue) > CSS_VALUE_TYPE_CASTS(WebKitCSSTransformValue) Because, naming style of is*Value() is different from isWebKitCSS*Value() bool isFilterImageValue() const { return m_classType == FilterImageClass; } bool isWebKitCSSFilterValue() const { return m_classType == WebKitCSSFilterClass; } ASSERT_WITH_SECURITY_IMPLICATION(!value || value->is##ValueTypeName()); \ ASSERT_WITH_SECURITY_IMPLICATION(!value || value->isWebKitCSS##ValueTypeName()); \ I couldn't find a way to support both cases in CSS_VALUE_TYPE_CASTS macro. That's why I added two macros as below,Anyway, I will try to find a way to use one macro further. Any idea ?
Gyuyoung Kim
Comment 17 2013-09-18 00:17:01 PDT
Early Warning System Bot
Comment 18 2013-09-18 00:50:20 PDT
Early Warning System Bot
Comment 19 2013-09-18 00:53:24 PDT
Build Bot
Comment 20 2013-09-18 01:08:19 PDT
Build Bot
Comment 21 2013-09-18 01:18:47 PDT
Gyuyoung Kim
Comment 22 2013-09-18 06:58:47 PDT
Gyuyoung Kim
Comment 23 2013-09-18 15:34:02 PDT
Comment on attachment 211994 [details] Patch I only add CSS_VALUE_TYPE_CASTS at the moment.
Gyuyoung Kim
Comment 24 2013-09-19 00:25:52 PDT
Andreas Kling
Comment 25 2013-09-22 17:49:52 PDT
Comment on attachment 212037 [details] Patch LGTM
WebKit Commit Bot
Comment 26 2013-09-22 18:19:12 PDT
Comment on attachment 212037 [details] Patch Clearing flags on attachment: 212037 Committed r156253: <http://trac.webkit.org/changeset/156253>
WebKit Commit Bot
Comment 27 2013-09-22 18:19:16 PDT
All reviewed patches have been landed. Closing bug.
WebKit Commit Bot
Comment 28 2013-09-22 23:25:34 PDT
Re-opened since this is blocked by bug 121778
Gyuyoung Kim
Comment 29 2013-09-22 23:31:23 PDT
I feel this patch is too huge. It looks this patch needs to be separated. Patch will be prepared.
Alexey Proskuryakov
Comment 30 2013-09-22 23:34:32 PDT
Rolled out in <http://trac.webkit.org/changeset/156260>, because this caused a bunch of assertion failures, and Gyuyoung agreed that this was the right course of action.
Gyuyoung Kim
Comment 31 2013-09-23 00:37:22 PDT
Gyuyoung Kim
Comment 32 2013-09-23 02:56:08 PDT
(In reply to comment #31) > Created an attachment (id=212329) [details] > Patch There is no layout test regression on latest patch. I will prepare following patches after landing this master patch.
Darin Adler
Comment 33 2013-09-23 10:08:32 PDT
Comment on attachment 212329 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=212329&action=review > Source/WebCore/ChangeLog:16 > + This patch support CSSImageSetValue and CSSREflectValue first. Other CSS*Values > + will use this macro step by step. Typo: CSSReflectValue > Source/WebCore/css/CSSValue.h:277 > +inline const CSS##ValueTypeName* toCSS##ValueTypeName(const CSSValue* value) \ > +{ \ > + ASSERT_WITH_SECURITY_IMPLICATION(!value || value->is##ValueTypeName()); \ > + return static_cast<const CSS##ValueTypeName*>(value); \ > +} \ > +inline CSS##ValueTypeName* toCSS##ValueTypeName(CSSValue* value) \ > +{ \ > + ASSERT_WITH_SECURITY_IMPLICATION(!value || value->is##ValueTypeName()); \ > + return static_cast<CSS##ValueTypeName*>(value); \ > +} \ Why no versions that take references? Maybe we should have versions that take RefPtr too?
Gyuyoung Kim
Comment 34 2013-09-23 17:03:36 PDT
Created attachment 212408 [details] Patch for landing
Gyuyoung Kim
Comment 35 2013-09-23 17:06:48 PDT
(In reply to comment #33) > > Source/WebCore/css/CSSValue.h:277 > > +inline const CSS##ValueTypeName* toCSS##ValueTypeName(const CSSValue* value) \ > > +{ \ > > + ASSERT_WITH_SECURITY_IMPLICATION(!value || value->is##ValueTypeName()); \ > > + return static_cast<const CSS##ValueTypeName*>(value); \ > > +} \ > > +inline CSS##ValueTypeName* toCSS##ValueTypeName(CSSValue* value) \ > > +{ \ > > + ASSERT_WITH_SECURITY_IMPLICATION(!value || value->is##ValueTypeName()); \ > > + return static_cast<CSS##ValueTypeName*>(value); \ > > +} \ > > Why no versions that take references? Maybe we should have versions that take RefPtr too? Element.h also has similar inline functions. I think it would be good if we support version both together on new bug. I will file a bug.
WebKit Commit Bot
Comment 36 2013-09-23 17:09:05 PDT
Comment on attachment 212408 [details] Patch for landing Rejecting attachment 212408 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.appspot.com', '--bot-id=webkit-cq-03', 'validate-changelog', '--check-oops', '--non-interactive', 212408, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit /Volumes/Data/EWS/WebKit/Source/WebCore/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive). Full output: http://webkit-queues.appspot.com/results/1822648
Gyuyoung Kim
Comment 37 2013-09-23 17:23:25 PDT
Created attachment 212412 [details] Patch for landing
WebKit Commit Bot
Comment 38 2013-09-23 17:56:35 PDT
Comment on attachment 212412 [details] Patch for landing Clearing flags on attachment: 212412 Committed r156313: <http://trac.webkit.org/changeset/156313>
WebKit Commit Bot
Comment 39 2013-09-23 17:56:41 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.