[Refactoring] ButtonInputType of <input> element should have innerElement to make...
authorshinyak@chromium.org <shinyak@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Sep 2012 02:07:27 +0000 (02:07 +0000)
committershinyak@chromium.org <shinyak@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Sep 2012 02:07:27 +0000 (02:07 +0000)
commitd1832e01e02a0ab8245e8bc055969dbd89142509
tree8d85fe0d8722f87cbc49630b71c0d0c18be98f29
parent5b73a37544ac35f9f79909506fc58afd90a7fa45
[Refactoring] ButtonInputType of <input> element should have innerElement to make <input> AuthorShadowDOM-ready
https://bugs.webkit.org/show_bug.cgi?id=95939

Reviewed by Dimitri Glazkov.

We had 2 ways to show text in RenderButton. One is to use RenderButton::setText() and the other is to add renderer
as a child of RenderButton. <input type="button"> used the former one, and <button> used the latter one.
The former makes RenderButton a bit messy, and also prevents from making <input> AuthorShadowDOM ready.

So we remove RenderButton::setText() and refactor <input type="button"> to use a Shadow DOM to show text.

Since the text in <input type="button"> should create RenderTextFragment, we introduce TextForButtonInputType
class. RenderText will allow us to select the inner text of <input>, but it should not.

No new tests, existing tests should cover the change.

* html/BaseButtonInputType.cpp:
(TextForButtonInputType): Special Text node which creates RenderTextFragment.
(WebCore):
(WebCore::TextForButtonInputType::create):
(WebCore::TextForButtonInputType::TextForButtonInputType):
(WebCore::TextForButtonInputType::createRenderer):
(WebCore::BaseButtonInputType::BaseButtonInputType):
(WebCore::BaseButtonInputType::createShadowSubtree):
(WebCore::BaseButtonInputType::destroyShadowSubtree):
(WebCore::BaseButtonInputType::valueAttributeChanged): When a button value is changed, we reflect the value to
the text node in ShadowDOM.
* html/BaseButtonInputType.h:
(BaseButtonInputType):
* html/FileInputType.cpp:
(WebCore::UploadButtonElement::create): Creates Shadow DOM subtree.
(WebCore::UploadButtonElement::createForMultiple): Creates Shadow DOM subtree.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::parseAttribute):
* html/InputType.cpp:
(WebCore::InputType::valueAttributeChanged):
(WebCore):
* html/InputType.h:
(InputType):
* rendering/RenderButton.cpp:
(WebCore::RenderButton::RenderButton):
(WebCore::RenderButton::styleDidChange): Removed unnecessary text related code.
* rendering/RenderButton.h:
(RenderButton):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@129086 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/html/BaseButtonInputType.cpp
Source/WebCore/html/BaseButtonInputType.h
Source/WebCore/html/FileInputType.cpp
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/InputType.cpp
Source/WebCore/html/InputType.h
Source/WebCore/rendering/RenderButton.cpp
Source/WebCore/rendering/RenderButton.h