Bug 106533 - [Refactoring] HTMLTextFormControlElement should use shadowHost instead of shadowAncestorNode
Summary: [Refactoring] HTMLTextFormControlElement should use shadowHost instead of sha...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Shinya Kawanaka
URL:
Keywords:
Depends on:
Blocks: 91821 107089
  Show dependency treegraph
 
Reported: 2013-01-09 23:39 PST by Shinya Kawanaka
Modified: 2013-01-17 20:17 PST (History)
4 users (show)

See Also:


Attachments
Patch (3.03 KB, patch)
2013-01-09 23:53 PST, Shinya Kawanaka
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Shinya Kawanaka 2013-01-09 23:39:16 PST
shadowAncestorNode() is deprecated. We would like to use shadowHost.
Comment 1 Shinya Kawanaka 2013-01-09 23:53:47 PST
Created attachment 182076 [details]
Patch
Comment 2 Kent Tamura 2013-01-15 03:39:08 PST
Comment on attachment 182076 [details]
Patch

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

ok

> Source/WebCore/html/HTMLTextFormControlElement.cpp:647
> +    return ancestor ? toTextFormControl(ancestor) : 0;

Not your fault, but this code looks dangerous.  Who ensures that the position points shadow nodes in text input or textarea?
Comment 3 Shinya Kawanaka 2013-01-16 20:43:53 PST
I'll land this patch anyway, and I'll file another bug to address the issue.
Comment 4 Shinya Kawanaka 2013-01-16 20:45:48 PST
https://bugs.webkit.org/show_bug.cgi?id=107089
Comment 5 WebKit Review Bot 2013-01-16 21:14:26 PST
Comment on attachment 182076 [details]
Patch

Clearing flags on attachment: 182076

Committed r139962: <http://trac.webkit.org/changeset/139962>
Comment 6 WebKit Review Bot 2013-01-16 21:14:29 PST
All reviewed patches have been landed.  Closing bug.
Comment 7 Darin Adler 2013-01-17 09:42:35 PST
Comment on attachment 182076 [details]
Patch

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

> Source/WebCore/html/HTMLTextFormControlElement.cpp:646
> +    Node* ancestor = container->shadowHost();

The ancestor variable should be of type Element*, not Node*.

>> Source/WebCore/html/HTMLTextFormControlElement.cpp:647
>> +    return ancestor ? toTextFormControl(ancestor) : 0;
> 
> Not your fault, but this code looks dangerous.  Who ensures that the position points shadow nodes in text input or textarea?

Good point, this can be a bad cast! We need a type check.
Comment 8 Shinya Kawanaka 2013-01-17 20:17:23 PST
Comment on attachment 182076 [details]
Patch

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

>>> Source/WebCore/html/HTMLTextFormControlElement.cpp:647
>>> +    return ancestor ? toTextFormControl(ancestor) : 0;
>> 
>> Not your fault, but this code looks dangerous.  Who ensures that the position points shadow nodes in text input or textarea?
> 
> Good point, this can be a bad cast! We need a type check.

toTextFormControl() returns 0 if it's not TextFormControl.
So this would be safe, but I think it does not align our recent code convention. Maybe refactoring is desired.