Bug 121462 - Introduce CSS_VALUE_TYPE_CASTS macro in order to cast CSSValue type
Summary: Introduce CSS_VALUE_TYPE_CASTS macro in order to cast CSSValue type
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Gyuyoung Kim
URL:
Keywords:
Depends on: 121778
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-16 17:30 PDT by Gyuyoung Kim
Modified: 2013-09-23 17:56 PDT (History)
12 users (show)

See Also:


Attachments
WIP (52.75 KB, patch)
2013-09-16 17:31 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (122.33 KB, patch)
2013-09-16 22:12 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (127.07 KB, patch)
2013-09-17 05:04 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
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 Details
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 Details
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 Details
Patch (121.49 KB, patch)
2013-09-18 00:17 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (119.54 KB, patch)
2013-09-18 06:58 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (119.94 KB, patch)
2013-09-19 00:25 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (8.76 KB, patch)
2013-09-23 00:37 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch for landing (8.79 KB, patch)
2013-09-23 17:03 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch for landing (8.82 KB, patch)
2013-09-23 17:23 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gyuyoung Kim 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&)
Comment 1 Gyuyoung Kim 2013-09-16 17:31:45 PDT
Created attachment 211845 [details]
WIP
Comment 2 Gyuyoung Kim 2013-09-16 22:12:23 PDT
Created attachment 211865 [details]
Patch
Comment 3 Gyuyoung Kim 2013-09-16 22:14:53 PDT
CC'ing kling, could you take a look this patch for CSSValue type casting ?
Comment 4 Early Warning System Bot 2013-09-16 22:21:30 PDT
Comment on attachment 211865 [details]
Patch

Attachment 211865 [details] did not pass qt-ews (qt):
Output: http://webkit-queues.appspot.com/results/1872257
Comment 5 Build Bot 2013-09-16 22:38:30 PDT
Comment on attachment 211865 [details]
Patch

Attachment 211865 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/1855248
Comment 6 Build Bot 2013-09-16 22:50:37 PDT
Comment on attachment 211865 [details]
Patch

Attachment 211865 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/1893171
Comment 7 Early Warning System Bot 2013-09-17 03:08:44 PDT
Comment on attachment 211865 [details]
Patch

Attachment 211865 [details] did not pass qt-wk2-ews (qt-wk2):
Output: http://webkit-queues.appspot.com/results/1859213
Comment 8 Gyuyoung Kim 2013-09-17 05:04:23 PDT
Created attachment 211887 [details]
Patch
Comment 9 Build Bot 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
Comment 10 Build Bot 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
Comment 11 Andreas Kling 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)
Comment 12 Build Bot 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
Comment 13 Build Bot 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
Comment 14 Build Bot 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
Comment 15 Build Bot 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
Comment 16 Gyuyoung Kim 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 ?
Comment 17 Gyuyoung Kim 2013-09-18 00:17:01 PDT
Created attachment 211978 [details]
Patch
Comment 18 Early Warning System Bot 2013-09-18 00:50:20 PDT
Comment on attachment 211978 [details]
Patch

Attachment 211978 [details] did not pass qt-ews (qt):
Output: http://webkit-queues.appspot.com/results/1888184
Comment 19 Early Warning System Bot 2013-09-18 00:53:24 PDT
Comment on attachment 211978 [details]
Patch

Attachment 211978 [details] did not pass qt-wk2-ews (qt-wk2):
Output: http://webkit-queues.appspot.com/results/1928112
Comment 20 Build Bot 2013-09-18 01:08:19 PDT
Comment on attachment 211978 [details]
Patch

Attachment 211978 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/1851298
Comment 21 Build Bot 2013-09-18 01:18:47 PDT
Comment on attachment 211978 [details]
Patch

Attachment 211978 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/1822482
Comment 22 Gyuyoung Kim 2013-09-18 06:58:47 PDT
Created attachment 211994 [details]
Patch
Comment 23 Gyuyoung Kim 2013-09-18 15:34:02 PDT
Comment on attachment 211994 [details]
Patch

I only add CSS_VALUE_TYPE_CASTS at the moment.
Comment 24 Gyuyoung Kim 2013-09-19 00:25:52 PDT
Created attachment 212037 [details]
Patch
Comment 25 Andreas Kling 2013-09-22 17:49:52 PDT
Comment on attachment 212037 [details]
Patch

LGTM
Comment 26 WebKit Commit Bot 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>
Comment 27 WebKit Commit Bot 2013-09-22 18:19:16 PDT
All reviewed patches have been landed.  Closing bug.
Comment 28 WebKit Commit Bot 2013-09-22 23:25:34 PDT
Re-opened since this is blocked by bug 121778
Comment 29 Gyuyoung Kim 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.
Comment 30 Alexey Proskuryakov 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.
Comment 31 Gyuyoung Kim 2013-09-23 00:37:22 PDT
Created attachment 212329 [details]
Patch
Comment 32 Gyuyoung Kim 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.
Comment 33 Darin Adler 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?
Comment 34 Gyuyoung Kim 2013-09-23 17:03:36 PDT
Created attachment 212408 [details]
Patch for landing
Comment 35 Gyuyoung Kim 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.
Comment 36 WebKit Commit Bot 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
Comment 37 Gyuyoung Kim 2013-09-23 17:23:25 PDT
Created attachment 212412 [details]
Patch for landing
Comment 38 WebKit Commit Bot 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>
Comment 39 WebKit Commit Bot 2013-09-23 17:56:41 PDT
All reviewed patches have been landed.  Closing bug.