Bug 179600

Summary: More is<> and downcast<>, less static_cast<>
Product: WebKit Reporter: Darin Adler <darin>
Component: WebCore Misc.Assignee: Darin Adler <darin>
Status: RESOLVED FIXED    
Severity: Normal CC: buildbot, cdumez, sam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Archive of layout-test-results from ews113 for mac-elcapitan
none
Patch
none
Patch none

Description Darin Adler 2017-11-12 16:18:00 PST
More is<> and downcast<>, less static_cast<>
Comment 1 Darin Adler 2017-11-12 16:50:56 PST Comment hidden (obsolete)
Comment 2 Chris Dumez 2017-11-12 18:10:51 PST
Seems to break GTK build.
Comment 3 Darin Adler 2017-11-12 18:14:24 PST Comment hidden (obsolete)
Comment 4 Darin Adler 2017-11-12 18:15:11 PST
New one should compile in GTK. Ready for review, I think.
Comment 5 Darin Adler 2017-11-12 18:39:21 PST
Created attachment 326738 [details]
Patch
Comment 6 Chris Dumez 2017-11-12 19:04:48 PST
GTK bubble still red.
Comment 7 Chris Dumez 2017-11-12 19:21:55 PST
Comment on attachment 326738 [details]
Patch

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

r=me with comment. Please make sure GTK builds before landing.

> Source/WebCore/html/HTMLFormElement.cpp:671
> +    if (!event || !is<Element>(event->target()))

Doesn’t this change behavior? If the target is a Text node that is a descendant of an HTMLFormControlElement, then we will return nullptr instead of the control ancestor. Or I am missing something?

> Source/WebCore/html/HTMLFormElement.cpp:673
> +    return lineageOfType<HTMLFormControlElement>(downcast<Element>(*event->target())).first();

I discussed this Antti and he agreed with should have a lineageOfType overload that takes in a Node.
Comment 8 Build Bot 2017-11-12 20:06:08 PST
Comment on attachment 326738 [details]
Patch

Attachment 326738 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/5205827

New failing tests:
fast/canvas/webgl/webgl2-runtime-flag.html
fast/canvas/webgl/getBufferSubData-webgl1.html
Comment 9 Build Bot 2017-11-12 20:06:09 PST Comment hidden (obsolete)
Comment 10 Darin Adler 2017-11-12 21:16:44 PST
Comment on attachment 326738 [details]
Patch

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

>> Source/WebCore/html/HTMLFormElement.cpp:671
>> +    if (!event || !is<Element>(event->target()))
> 
> Doesn’t this change behavior? If the target is a Text node that is a descendant of an HTMLFormControlElement, then we will return nullptr instead of the control ancestor. Or I am missing something?

Mostly event targets can’t be text nodes. They target the element, not the text node.

But I can’t verify this easily, and so I will rewrite to start with the node instead. Easy to do that with the parentElement function for now, while waiting for lineageOfType.
Comment 11 Darin Adler 2017-11-12 21:20:38 PST
OK, so four things to resolve before landing:

1) Crashing WebGL tests due to a mistake in HTMLCanvasElement::createContextWebGL. I fixed that.

2) Compiling on GTK failing because I used nil instead of nullptr. I fixed that.

3) Node vs. Element in findSubmitElement. Fixing that now.

4) Crash in svg/animations/svgtransform-animation-discrete.html test; seems unlikely to be due to my changes. Will test and see what I can learn.
Comment 12 Darin Adler 2017-11-12 21:24:42 PST
Created attachment 326741 [details]
Patch
Comment 13 Darin Adler 2017-11-12 21:25:16 PST
Uploaded a patch that probably fixes 1-3, testing locally for 4 soon.
Comment 14 Darin Adler 2017-11-12 21:41:21 PST
Created attachment 326742 [details]
Patch
Comment 15 Darin Adler 2017-11-12 22:12:17 PST
Committed r224740: <https://trac.webkit.org/changeset/224740>
Comment 16 Radar WebKit Bug Importer 2017-11-15 09:34:17 PST
<rdar://problem/35561978>