WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
59005
Convert file <input> to use the new shadow DOM model
https://bugs.webkit.org/show_bug.cgi?id=59005
Summary
Convert file <input> to use the new shadow DOM model
Dominic Cooney
Reported
2011-04-20 09:45:09 PDT
RenderFileUploadControl uses setShadowHost via ShadowInputElement. Only ShadowRoot instances should have shadow hosts.
Attachments
Patch
(20.12 KB, patch)
2011-06-03 11:48 PDT
,
Dimitri Glazkov (Google)
no flags
Details
Formatted Diff
Diff
Oh good lord I hate DOMUtilitiesPrivate.
(22.37 KB, patch)
2011-06-03 13:10 PDT
,
Dimitri Glazkov (Google)
no flags
Details
Formatted Diff
Diff
Uses toInputElement.
(18.94 KB, patch)
2011-06-04 09:17 PDT
,
Dimitri Glazkov (Google)
darin
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Dimitri Glazkov (Google)
Comment 1
2011-06-03 11:48:51 PDT
Created
attachment 95935
[details]
Patch
WebKit Review Bot
Comment 2
2011-06-03 12:18:34 PDT
Comment on
attachment 95935
[details]
Patch
Attachment 95935
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/8757833
Dimitri Glazkov (Google)
Comment 3
2011-06-03 13:10:31 PDT
Created
attachment 95952
[details]
Oh good lord I hate DOMUtilitiesPrivate.
Darin Adler
Comment 4
2011-06-03 17:46:20 PDT
Comment on
attachment 95952
[details]
Oh good lord I hate DOMUtilitiesPrivate. View in context:
https://bugs.webkit.org/attachment.cgi?id=95952&action=review
I’m saying review- because I want the toXXX function to match our other toXXX functions (the ones in WebCore, not in Chromium WebKit). Otherwise this looks great
> Source/WebCore/css/html.css:525 > +input[type=file]::-webkit-file-upload-button {
Don’t you need quote marks around “file” as with the other rules in this file?
> Source/WebCore/html/HTMLInputElement.cpp:1846 > +HTMLInputElement* toHTMLInputElement(Node* node) > +{ > + return node && node->hasTagName(inputTag) ? static_cast<HTMLInputElement*>(node) : 0; > +}
These toXXX functions normally assert rather than returning 0. They are the equivalent of static_cast, not of dynamic_cast.
Dimitri Glazkov (Google)
Comment 5
2011-06-03 17:52:55 PDT
Comment on
attachment 95952
[details]
Oh good lord I hate DOMUtilitiesPrivate. View in context:
https://bugs.webkit.org/attachment.cgi?id=95952&action=review
>> Source/WebCore/css/html.css:525 >> +input[type=file]::-webkit-file-upload-button { > > Don’t you need quote marks around “file” as with the other rules in this file?
Nope. The quote marks aren't necessary there.
>> Source/WebCore/html/HTMLInputElement.cpp:1846 >> +} > > These toXXX functions normally assert rather than returning 0. They are the equivalent of static_cast, not of dynamic_cast.
Yeah, you're right. But I really could use this type of function, because it makes the callsites cleaner. Perhaps we could name it asHTMLInputElement?
Darin Adler
Comment 6
2011-06-03 18:01:53 PDT
Comment on
attachment 95952
[details]
Oh good lord I hate DOMUtilitiesPrivate. View in context:
https://bugs.webkit.org/attachment.cgi?id=95952&action=review
>>> Source/WebCore/css/html.css:525 >>> +input[type=file]::-webkit-file-upload-button { >> >> Don’t you need quote marks around “file” as with the other rules in this file? > > Nope. The quote marks aren't necessary there.
Perhaps you could remove the others, then. The inconsistency is irritating.
>>> Source/WebCore/html/HTMLInputElement.cpp:1846 >>> +} >> >> These toXXX functions normally assert rather than returning 0. They are the equivalent of static_cast, not of dynamic_cast. > > Yeah, you're right. But I really could use this type of function, because it makes the callsites cleaner. Perhaps we could name it asHTMLInputElement?
I think that the difference between the two would be unclear if one was “to” and the other was “as”. I agree that if we come up with the right naming scheme we can have both the static_cast-like and dynamic_cast-like versions.
Dimitri Glazkov (Google)
Comment 7
2011-06-03 18:19:53 PDT
Comment on
attachment 95952
[details]
Oh good lord I hate DOMUtilitiesPrivate. View in context:
https://bugs.webkit.org/attachment.cgi?id=95952&action=review
>>>> Source/WebCore/css/html.css:525 >>>> +input[type=file]::-webkit-file-upload-button { >>> >>> Don’t you need quote marks around “file” as with the other rules in this file? >> >> Nope. The quote marks aren't necessary there. > > Perhaps you could remove the others, then. The inconsistency is irritating.
Sure thing. I'll make a separate patch.
>>>> Source/WebCore/html/HTMLInputElement.cpp:1846 >>>> +} >>> >>> These toXXX functions normally assert rather than returning 0. They are the equivalent of static_cast, not of dynamic_cast. >> >> Yeah, you're right. But I really could use this type of function, because it makes the callsites cleaner. Perhaps we could name it asHTMLInputElement? > > I think that the difference between the two would be unclear if one was “to” and the other was “as”. I agree that if we come up with the right naming scheme we can have both the static_cast-like and dynamic_cast-like versions.
I can just localize this problem as a helper function in DragController for now.
Kent Tamura
Comment 8
2011-06-03 19:37:09 PDT
Comment on
attachment 95952
[details]
Oh good lord I hate DOMUtilitiesPrivate. View in context:
https://bugs.webkit.org/attachment.cgi?id=95952&action=review
>>>>> Source/WebCore/html/HTMLInputElement.cpp:1846 >>>>> +} >>>> >>>> These toXXX functions normally assert rather than returning 0. They are the equivalent of static_cast, not of dynamic_cast. >>> >>> Yeah, you're right. But I really could use this type of function, because it makes the callsites cleaner. Perhaps we could name it asHTMLInputElement? >> >> I think that the difference between the two would be unclear if one was “to” and the other was “as”. I agree that if we come up with the right naming scheme we can have both the static_cast-like and dynamic_cast-like versions. > > I can just localize this problem as a helper function in DragController for now.
FYI: We have Node::toInputElement(). I think it's a leftover of HTML/WML abstraction.
Dimitri Glazkov (Google)
Comment 9
2011-06-03 20:52:39 PDT
(In reply to
comment #8
)
> (From update of
attachment 95952
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=95952&action=review
> > >>>>> Source/WebCore/html/HTMLInputElement.cpp:1846 > >>>>> +} > >>>> > >>>> These toXXX functions normally assert rather than returning 0. They are the equivalent of static_cast, not of dynamic_cast. > >>> > >>> Yeah, you're right. But I really could use this type of function, because it makes the callsites cleaner. Perhaps we could name it asHTMLInputElement? > >> > >> I think that the difference between the two would be unclear if one was “to” and the other was “as”. I agree that if we come up with the right naming scheme we can have both the static_cast-like and dynamic_cast-like versions. > > > > I can just localize this problem as a helper function in DragController for now. > > FYI: We have Node::toInputElement(). I think it's a leftover of HTML/WML abstraction.
That's a neat idea: toFoo(Bar*) is like static_cast Bar::toFoo() is like dynamic_cast Darin, what do you think?
Dimitri Glazkov (Google)
Comment 10
2011-06-04 09:17:40 PDT
Created
attachment 96024
[details]
Uses toInputElement.
Dimitri Glazkov (Google)
Comment 11
2011-06-04 09:18:36 PDT
(In reply to
comment #10
)
> Created an attachment (id=96024) [details] > Uses toInputElement.
I also changed to use double-quotes in html.css, for consistency.
Darin Adler
Comment 12
2011-06-04 09:36:40 PDT
(In reply to
comment #9
)
> (In reply to
comment #8
) > > FYI: We have Node::toInputElement(). I think it's a leftover of HTML/WML abstraction. > > That's a neat idea: > > toFoo(Bar*) is like static_cast > Bar::toFoo() is like dynamic_cast > > Darin, what do you think?
I think the distinction there is too subtle.
Darin Adler
Comment 13
2011-06-04 09:39:26 PDT
I don’t think the dynamic_cast version is all that great, because null pointers are not all that great. Having to say if (isInputElement) first before calling toInputElement seems better than dynamic_cast style.
Darin Adler
Comment 14
2011-06-04 09:40:08 PDT
The one good thing about the dynamic_cast style is that you can’t “use it wrong”. But that benefit goes away if you also have static_cast, especially if the two are hard to tell apart.
Dimitri Glazkov (Google)
Comment 15
2011-06-04 10:14:31 PDT
Committed
r88115
: <
http://trac.webkit.org/changeset/88115
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug