2011-06-29 Kent Tamura <tkent@chromium.org>
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Jun 2011 06:30:23 +0000 (06:30 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Jun 2011 06:30:23 +0000 (06:30 +0000)
commit9dcd93b6c32978f5242915f0469c61108ea6141e
treeae4121d9a32975bdc1ade798272d0147775b075e
parent9edc8a7f1e0915a951cdae5cf9523463ad1d8bcd
2011-06-29  Kent Tamura  <tkent@chromium.org>

        Reviewed by Dimitri Glazkov.

        Avoid custom layout code of RenderTextControlSingleLine
        https://bugs.webkit.org/show_bug.cgi?id=61415

        Update tests including <input type=search> or <input type=number>. Their
        internal structures are changed.
        Slight position changes for search result buttons and search cancel
        buttons are expected.

        * fast/css/text-input-with-webkit-border-radius-expected.txt:
        * platform/chromium/test_expectations.txt:
        * platform/mac/fast/css/input-search-padding-expected.png:
        * platform/mac/fast/css/input-search-padding-expected.txt:
        * platform/mac/fast/css/pseudo-cache-stale-expected.txt:
        * platform/mac/fast/forms/box-shadow-override-expected.txt:
        * platform/mac/fast/forms/control-restrict-line-height-expected.txt:
        * platform/mac/fast/forms/input-appearance-height-expected.txt:
        * platform/mac/fast/forms/input-appearance-spinbutton-disabled-readonly-expected.txt:
        * platform/mac/fast/forms/input-appearance-spinbutton-expected.txt:
        * platform/mac/fast/forms/input-appearance-spinbutton-layer-expected.txt:
        * platform/mac/fast/forms/input-appearance-spinbutton-up-expected.txt:
        * platform/mac/fast/forms/input-appearance-spinbutton-visibility-expected.txt:
        * platform/mac/fast/forms/placeholder-position-expected.txt:
        * platform/mac/fast/forms/placeholder-pseudo-style-expected.txt:
        * platform/mac/fast/forms/placeholder-set-value-expected.txt:
        * platform/mac/fast/forms/search-cancel-button-style-sharing-expected.txt:
        * platform/mac/fast/forms/search-display-none-cancel-button-expected.txt:
        * platform/mac/fast/forms/search-placeholder-value-changed-expected.txt:
        * platform/mac/fast/forms/search-rtl-expected.txt:
        * platform/mac/fast/forms/search-styled-expected.txt:
        * platform/mac/fast/forms/search-vertical-alignment-expected.png:
        * platform/mac/fast/forms/search-vertical-alignment-expected.txt:
        * platform/mac/fast/forms/searchfield-heights-expected.txt:
        * platform/mac/fast/repaint/search-field-cancel-expected.png:
        * platform/mac/fast/repaint/search-field-cancel-expected.txt:
        * platform/mac/fast/replaced/width100percent-searchfield-expected.txt:
        * platform/mac/fast/table/colspanMinWidth-vertical-expected.png:
        * platform/mac/fast/table/colspanMinWidth-vertical-expected.txt:
2011-06-29  Kent Tamura  <tkent@chromium.org>

        Reviewed by Dimitri Glazkov.

        Avoid custom layout code of RenderTextControlSingleLine
        https://bugs.webkit.org/show_bug.cgi?id=61415

        If a text field has a search results button, a search cancel
        button, a speech button, or a spin button, the editable inner text
        element and the buttons are wrapped by a flexible box container,
        and the editable inner text element has flexibility. As the result
        of applying the flexible box, we don't need any horizontal layout
        code in RenderTextControlSingleLine except the inner spin button.

        Also, we remove custom hit-testing code in nodeAtPoint(). If a
        user clicks on a position left of the inner editable text but not
        on the search results button, the search results button doesn't
        work though it worked.

        * css/html.css:
        (input::-webkit-textfield-decoration-container):
          New style definition for the "container" element.
        (input[type="search"]::-webkit-search-cancel-button):
          It should be a block element because it's a child of the flexible box.
          Also, this doesn't have flexibility.
        (input[type="search"]::-webkit-search-decoration): ditto.
        (input[type="search"]::-webkit-search-results-decoration): ditto.
        (input[type="search"]::-webkit-search-results-button): ditto.
        (input::-webkit-inner-spin-button): ditto.
        (input::-webkit-input-speech-button): ditto.
        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::containerElement):
          Add an accessor of the flexible box container.
          It just calls InputType::containerElement().
        * html/HTMLInputElement.h: Declare it.
        * html/InputType.h:
        (WebCore::InputType::containerElement): New accessor for a shadow element.
        * html/SearchInputType.cpp:
        (WebCore::SearchInputType::SearchInputType):
          m_innerBlock is moved to TextFieldInputType.
        (WebCore::SearchInputType::needsContainer):
          A search field always needs the flexible box container because
          of the results button and the cancel button.
        (WebCore::SearchInputType::createShadowSubtree):
          Use TextFieldInputType::createShadowSubtree(), then modify the tree.
        (WebCore::SearchInputType::destroyShadowSubtree):
          m_innerBlock is moved to TextFieldInputType.
        * html/SearchInputType.h:
        * html/TextFieldInputType.cpp:
        (WebCore::TextFieldInputType::TextFieldInputType):
          Initialize the new members.
        (WebCore::TextFieldInputType::needsContainer):
          Returns true if x-webkit-speech. We check a spin button separately.
        (WebCore::TextFieldInputType::createShadowSubtree):
          Wrap everything with the flexible box container if needsContainer() or we need a spin button.
        (WebCore::TextFieldInputType::containerElement): Added an accessor.
        (WebCore::TextFieldInputType::innerBlockElement): ditto.
        (WebCore::TextFieldInputType::innerTextElement): ditto.
        (WebCore::TextFieldInputType::innerSpinButtonElement): ditto.
        (WebCore::TextFieldInputType::speechButtonElement): ditto.
        (WebCore::TextFieldInputType::destroyShadowSubtree):
          Clear references to new shadow nodes.
        * html/TextFieldInputType.h:
        * rendering/RenderTextControlSingleLine.cpp:
        (WebCore::RenderTextControlSingleLine::containerElement): Added an accessor.
        (WebCore::RenderTextControlSingleLine::innerTextElement):
        (WebCore::RenderTextControlSingleLine::layout):
         - Correct heights check
          Comparing with height(), not contentHeigth(), was incorrect.
         - Adjust the container height like the editable inner text.
         - Remove width adjustment
         - Remove the speech button layout code
          The flexible box layout is enough.
        (WebCore::RenderTextControlSingleLine::nodeAtPoint):
          Remove custom code for results/cancel/speech buttons, and
          Simplify comments.
        (WebCore::RenderTextControlSingleLine::forwardEvent):
          Remove custom forwarding code for results/cancel buttons.
        (WebCore::RenderTextControlSingleLine::styleDidChange):
          Clear the style of the container because we update it in layout().
        (WebCore::RenderTextControlSingleLine::hasControlClip):
          Decoration buttons should be clipped by the container.
        (WebCore::RenderTextControlSingleLine::controlClipRect): ditto.
        (WebCore::RenderTextControlSingleLine::createInnerTextStyle):
          We don't need to use display:inline-block any more.
        (WebCore::RenderTextControlSingleLine::createInnerBlockStyle):
          The text wrapper element should have flexibility.
        (WebCore::RenderTextControlSingleLine::textBlockInsetTop):
          Updated for the tree structure change.
        * rendering/RenderTextControlSingleLine.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@90089 268f45cc-cd09-0410-ab3c-d52691b4dbfc
41 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css/text-input-with-webkit-border-radius-expected.txt
LayoutTests/platform/chromium/test_expectations.txt
LayoutTests/platform/mac/fast/css/input-search-padding-expected.png
LayoutTests/platform/mac/fast/css/input-search-padding-expected.txt
LayoutTests/platform/mac/fast/css/pseudo-cache-stale-expected.txt
LayoutTests/platform/mac/fast/forms/box-shadow-override-expected.txt
LayoutTests/platform/mac/fast/forms/control-restrict-line-height-expected.txt
LayoutTests/platform/mac/fast/forms/input-appearance-height-expected.txt
LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-disabled-readonly-expected.txt
LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-expected.txt
LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-layer-expected.txt
LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-up-expected.txt
LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-visibility-expected.txt
LayoutTests/platform/mac/fast/forms/placeholder-position-expected.txt
LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.txt
LayoutTests/platform/mac/fast/forms/placeholder-set-value-expected.txt
LayoutTests/platform/mac/fast/forms/search-cancel-button-style-sharing-expected.txt
LayoutTests/platform/mac/fast/forms/search-display-none-cancel-button-expected.txt
LayoutTests/platform/mac/fast/forms/search-placeholder-value-changed-expected.txt
LayoutTests/platform/mac/fast/forms/search-rtl-expected.txt
LayoutTests/platform/mac/fast/forms/search-styled-expected.txt
LayoutTests/platform/mac/fast/forms/search-vertical-alignment-expected.png
LayoutTests/platform/mac/fast/forms/search-vertical-alignment-expected.txt
LayoutTests/platform/mac/fast/forms/searchfield-heights-expected.txt
LayoutTests/platform/mac/fast/repaint/search-field-cancel-expected.png
LayoutTests/platform/mac/fast/repaint/search-field-cancel-expected.txt
LayoutTests/platform/mac/fast/replaced/width100percent-searchfield-expected.txt
LayoutTests/platform/mac/fast/table/colspanMinWidth-vertical-expected.png
LayoutTests/platform/mac/fast/table/colspanMinWidth-vertical-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/css/html.css
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLInputElement.h
Source/WebCore/html/InputType.h
Source/WebCore/html/SearchInputType.cpp
Source/WebCore/html/SearchInputType.h
Source/WebCore/html/TextFieldInputType.cpp
Source/WebCore/html/TextFieldInputType.h
Source/WebCore/rendering/RenderTextControlSingleLine.cpp
Source/WebCore/rendering/RenderTextControlSingleLine.h