Bug 137243 - Generalize is<>() / downcast<>() support to all types
Summary: Generalize is<>() / downcast<>() support to all types
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on: 137056
Blocks:
  Show dependency treegraph
 
Reported: 2014-09-29 19:59 PDT by Chris Dumez
Modified: 2014-09-30 14:33 PDT (History)
6 users (show)

See Also:


Attachments
Patch (87.46 KB, patch)
2014-09-29 21:25 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (89.27 KB, patch)
2014-09-29 22:15 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (89.45 KB, patch)
2014-09-29 22:18 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (89.56 KB, patch)
2014-09-30 06:48 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (89.39 KB, patch)
2014-09-30 13:10 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (90.67 KB, patch)
2014-09-30 13:48 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2014-09-29 19:59:22 PDT
Generalize is<>() / downcast<>() support to all types, not just Nodes.
Comment 1 Chris Dumez 2014-09-29 21:25:39 PDT
Created attachment 238907 [details]
Patch
Comment 2 WebKit Commit Bot 2014-09-29 21:26:49 PDT
Attachment 238907 [details] did not pass style-queue:


ERROR: Source/WebCore/html/HTMLElement.h:159:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/mathml/MathMLElement.h:86:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 2 in 67 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Chris Dumez 2014-09-29 22:15:24 PDT
Created attachment 238910 [details]
Patch
Comment 4 WebKit Commit Bot 2014-09-29 22:17:32 PDT
Attachment 238910 [details] did not pass style-queue:


ERROR: Source/WebCore/html/HTMLElement.h:159:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/mathml/MathMLElement.h:86:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 2 in 69 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Chris Dumez 2014-09-29 22:18:38 PDT
Created attachment 238911 [details]
Patch
Comment 6 WebKit Commit Bot 2014-09-29 22:22:30 PDT
Attachment 238911 [details] did not pass style-queue:


ERROR: Source/WebCore/html/HTMLElement.h:159:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/mathml/MathMLElement.h:86:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 2 in 69 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Chris Dumez 2014-09-30 06:48:22 PDT
Created attachment 238923 [details]
Patch
Comment 8 WebKit Commit Bot 2014-09-30 06:49:36 PDT
Attachment 238923 [details] did not pass style-queue:


ERROR: Source/WebCore/html/HTMLElement.h:159:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/mathml/MathMLElement.h:86:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 2 in 69 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Benjamin Poulain 2014-09-30 12:33:56 PDT
Comment on attachment 238923 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=238923&action=review

> Source/WebCore/bindings/js/JSEventListener.cpp:136
> -        if (scriptExecutionContext->isWorkerGlobalScope()) {
> +        if (is<WorkerGlobalScope>(scriptExecutionContext)) {
>              bool terminatorCausedException = (exec->hadException() && isTerminatedExecutionException(exec->exception()));
>              if (terminatorCausedException || (vm.watchdog && vm.watchdog->didFire()))

I wonder why those conditions are in that order, looks a bit backward to me.

> Source/WebCore/dom/Element.h:789
> +namespace WTF {
> +template <>
> +struct TypeCastTraits<const WebCore::Element, const WebCore::Node> {
> +    static bool isOfType(const WebCore::Node& node) { return node.isElementNode(); }
> +};
> +}

Would SPECIALIZE_TYPE_TRAITS_BEGIN work here?

> Source/WebCore/dom/ScriptExecutionContext.h:-240
> -#define SCRIPT_EXECUTION_CONTEXT_TYPE_CASTS(ToValueTypeName) \
> -    template<typename T> inline ToValueTypeName* to##ToValueTypeName(const RefPtr<T>& context) { return to##ToValueTypeName(context.get()); } \
> -    TYPE_CASTS_BASE(ToValueTypeName, ScriptExecutionContext, context, context->is##ToValueTypeName(), context.is##ToValueTypeName())
> -

Die preprocessor, die!
Comment 10 Chris Dumez 2014-09-30 12:46:02 PDT
Comment on attachment 238923 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=238923&action=review

>> Source/WebCore/dom/Element.h:789
>> +}
> 
> Would SPECIALIZE_TYPE_TRAITS_BEGIN work here?

https://bugs.webkit.org/show_bug.cgi?id=137241 is taking care of this. It is in the commit queue. I'll rebase this patch as soon as the other one lands.
Comment 11 Chris Dumez 2014-09-30 13:10:06 PDT
Created attachment 238950 [details]
Patch
Comment 12 WebKit Commit Bot 2014-09-30 13:11:19 PDT
Attachment 238950 [details] did not pass style-queue:


ERROR: Source/WebCore/html/HTMLElement.h:159:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/mathml/MathMLElement.h:86:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 2 in 69 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 13 Chris Dumez 2014-09-30 13:48:57 PDT
Created attachment 238955 [details]
Patch
Comment 14 WebKit Commit Bot 2014-09-30 13:50:47 PDT
Attachment 238955 [details] did not pass style-queue:


ERROR: Source/WebCore/html/HTMLElement.h:159:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/mathml/MathMLElement.h:86:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 2 in 70 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 15 WebKit Commit Bot 2014-09-30 14:32:59 PDT
Comment on attachment 238955 [details]
Patch

Clearing flags on attachment: 238955

Committed r174125: <http://trac.webkit.org/changeset/174125>
Comment 16 WebKit Commit Bot 2014-09-30 14:33:04 PDT
All reviewed patches have been landed.  Closing bug.