Title: [144352] trunk
Revision
144352
Author
[email protected]
Date
2013-02-28 12:59:15 -0800 (Thu, 28 Feb 2013)

Log Message

REGRESSION: INPUT_MULTIPLE_FIELDS_UI: Changing CSS display property on input[type=date] unexpectedly makes another line for ::-webkit-calendar-picker-indicator
https://bugs.webkit.org/show_bug.cgi?id=110974

Reviewed by Kentaro Hara.

Source/WebCore:

Input elements with the multiple fields UI require flexible box
layout.
- If display:inline or display:inline-block is specified, we
  replace it with display:inline-flex.
- If display:block is specified, we replace it with
  display:flex.
- If other display value is specified, we use it as is, but it
  won't wrap inside an input element because we have
  display:inline-block for ::-webkit-calendar-pixker-indicaotor.

r144184 was incomplete. It avoided the wrapping issue, but it
didn't make spin buttons and calendar arrows right-aligned.

Tests: Update fast/forms/date/date-apparance-basic.html

* css/html.css:
(input::-webkit-calendar-picker-indicator):
Add display:inline-block in orde to avoid line-wrapping.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::customStyleForRenderer):
Move the code to BaseMultipleFieldsDateAndTimeInputType::customStyleForRenderer.
* html/InputType.cpp:
(WebCore::InputType::customStyleForRenderer): Added.
* html/InputType.h:
(InputType): Add customStyleForRenderer, and remove
shouldApplyLocaleDirection.
* html/BaseMultipleFieldsDateAndTimeInputType.cpp:
(WebCore::BaseMultipleFieldsDateAndTimeInputType::customStyleForRenderer):
Moved the code from HTMLInputElement::customStyleForRenderer, and
add display property updatting code.
* html/BaseMultipleFieldsDateAndTimeInputType.h:
(BaseMultipleFieldsDateAndTimeInputType):
Add customStyleForRenderer, and remove shouldApplyLocaleDirection.

LayoutTests:

* fast/forms/date/date-appearance-basic-expected.txt:
* fast/forms/date/date-appearance-basic.html:
* platform/chromium-mac/fast/forms/date/date-appearance-basic-expected.png:
* platform/chromium/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (144351 => 144352)


--- trunk/LayoutTests/ChangeLog	2013-02-28 20:51:44 UTC (rev 144351)
+++ trunk/LayoutTests/ChangeLog	2013-02-28 20:59:15 UTC (rev 144352)
@@ -1,3 +1,15 @@
+2013-02-28  Kent Tamura  <[email protected]>
+
+        REGRESSION: INPUT_MULTIPLE_FIELDS_UI: Changing CSS display property on input[type=date] unexpectedly makes another line for ::-webkit-calendar-picker-indicator
+        https://bugs.webkit.org/show_bug.cgi?id=110974
+
+        Reviewed by Kentaro Hara.
+
+        * fast/forms/date/date-appearance-basic-expected.txt:
+        * fast/forms/date/date-appearance-basic.html:
+        * platform/chromium-mac/fast/forms/date/date-appearance-basic-expected.png:
+        * platform/chromium/TestExpectations:
+
 2013-02-28  Xianzhu Wang  <[email protected]>
 
         Focus ring for a child layer is incorrectly offset by ancestor composited layer's position

Modified: trunk/LayoutTests/fast/forms/date/date-appearance-basic-expected.txt (144351 => 144352)


--- trunk/LayoutTests/fast/forms/date/date-appearance-basic-expected.txt	2013-02-28 20:51:44 UTC (rev 144351)
+++ trunk/LayoutTests/fast/forms/date/date-appearance-basic-expected.txt	2013-02-28 20:59:15 UTC (rev 144352)
@@ -10,3 +10,4 @@
 font-size with fixed input width:   
 Fixed input height:   
 -webkit-appearance:none: 
+display: none: inline: inline-block: block:table-cell:   

Modified: trunk/LayoutTests/fast/forms/date/date-appearance-basic.html (144351 => 144352)


--- trunk/LayoutTests/fast/forms/date/date-appearance-basic.html	2013-02-28 20:51:44 UTC (rev 144351)
+++ trunk/LayoutTests/fast/forms/date/date-appearance-basic.html	2013-02-28 20:59:15 UTC (rev 144352)
@@ -22,6 +22,11 @@
     <li>Fixed input height: <input type="date" value="2012-10-05" style="height: 4em;">
       <input type="date" value="2013-01-28" style="font-size: 20px; height: 10px;"></li>
     <li>-webkit-appearance:none: <input type="date" value="2012-10-05" style="-webkit-appearance: none;"></li>
+    <li>display: none:<input type="date" style="display:none;">
+    inline:<input type="date" style="display:inline;">
+    inline-block:<input type="date" style="display:inline-block; width:14em;">
+    block:<input type="date" style="display:block; width:14em;">
+    table-cell: <div style="display:inline-table"><input type="date" style="display:table-cell; width:14em;"></div>
 </ul>
 </body>
 </html>

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (144351 => 144352)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2013-02-28 20:51:44 UTC (rev 144351)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2013-02-28 20:59:15 UTC (rev 144352)
@@ -3993,6 +3993,9 @@
 webkit.org/b/98687 fast/css-generated-content/table-row-group-to-inline.html [ Failure ]
 webkit.org/b/104595 fast/css/empty-generated-content.html [ Failure ]
 
+# Needs rebaseline
+webkit.org/b/110974 fast/forms/date/date-appearance-basic.html [ ImageOnlyFailure ]
+
 # These are real failues due to 95121.
 # This is spilling caused by LANCZOS3 scaling algorithm that samples outside the source rect.
 webkit.org/b/95121 [ Win Mac Android ] fast/images/pixel-crack-image-background-webkit-transform-scale.html [ ImageOnlyFailure ]

Modified: trunk/LayoutTests/platform/chromium-mac/fast/forms/date/date-appearance-basic-expected.png


(Binary files differ)

Modified: trunk/Source/WebCore/ChangeLog (144351 => 144352)


--- trunk/Source/WebCore/ChangeLog	2013-02-28 20:51:44 UTC (rev 144351)
+++ trunk/Source/WebCore/ChangeLog	2013-02-28 20:59:15 UTC (rev 144352)
@@ -1,3 +1,44 @@
+2013-02-28  Kent Tamura  <[email protected]>
+
+        REGRESSION: INPUT_MULTIPLE_FIELDS_UI: Changing CSS display property on input[type=date] unexpectedly makes another line for ::-webkit-calendar-picker-indicator
+        https://bugs.webkit.org/show_bug.cgi?id=110974
+
+        Reviewed by Kentaro Hara.
+
+        Input elements with the multiple fields UI require flexible box
+        layout.
+        - If display:inline or display:inline-block is specified, we
+          replace it with display:inline-flex.
+        - If display:block is specified, we replace it with
+          display:flex.
+        - If other display value is specified, we use it as is, but it
+          won't wrap inside an input element because we have
+          display:inline-block for ::-webkit-calendar-pixker-indicaotor.
+
+        r144184 was incomplete. It avoided the wrapping issue, but it
+        didn't make spin buttons and calendar arrows right-aligned.
+
+        Tests: Update fast/forms/date/date-apparance-basic.html
+
+        * css/html.css:
+        (input::-webkit-calendar-picker-indicator):
+        Add display:inline-block in orde to avoid line-wrapping.
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::customStyleForRenderer):
+        Move the code to BaseMultipleFieldsDateAndTimeInputType::customStyleForRenderer.
+        * html/InputType.cpp:
+        (WebCore::InputType::customStyleForRenderer): Added.
+        * html/InputType.h:
+        (InputType): Add customStyleForRenderer, and remove
+        shouldApplyLocaleDirection.
+        * html/BaseMultipleFieldsDateAndTimeInputType.cpp:
+        (WebCore::BaseMultipleFieldsDateAndTimeInputType::customStyleForRenderer):
+        Moved the code from HTMLInputElement::customStyleForRenderer, and
+        add display property updatting code.
+        * html/BaseMultipleFieldsDateAndTimeInputType.h:
+        (BaseMultipleFieldsDateAndTimeInputType):
+        Add customStyleForRenderer, and remove shouldApplyLocaleDirection.
+
 2013-02-28  Anders Carlsson  <[email protected]>
 
         Implement more StorageAreaProxy member functions

Modified: trunk/Source/WebCore/css/html.css (144351 => 144352)


--- trunk/Source/WebCore/css/html.css	2013-02-28 20:51:44 UTC (rev 144351)
+++ trunk/Source/WebCore/css/html.css	2013-02-28 20:59:15 UTC (rev 144352)
@@ -914,6 +914,7 @@
 
 #if defined(ENABLE_CALENDAR_PICKER) && ENABLE_CALENDAR_PICKER
 input::-webkit-calendar-picker-indicator {
+    display: inline-block;
     width: 0.66em;
     height: 0.66em;
     padding: 0.17em 0.34em;

Modified: trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp (144351 => 144352)


--- trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp	2013-02-28 20:51:44 UTC (rev 144351)
+++ trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp	2013-02-28 20:59:15 UTC (rev 144352)
@@ -189,6 +189,24 @@
         m_dateTimeEditElement->blurByOwner();
 }
 
+PassRefPtr<RenderStyle> BaseMultipleFieldsDateAndTimeInputType::customStyleForRenderer(PassRefPtr<RenderStyle> originalStyle)
+{
+    EDisplay originalDisplay = originalStyle->display();
+    EDisplay newDisplay = originalDisplay;
+    if (originalDisplay == INLINE || originalDisplay == INLINE_BLOCK)
+        newDisplay = INLINE_FLEX;
+    else if (originalDisplay == BLOCK)
+        newDisplay = FLEX;
+    TextDirection contentDirection = element()->locale().isRTL() ? RTL : LTR;
+    if (originalStyle->direction() == contentDirection && originalDisplay == newDisplay)
+        return originalStyle;
+
+    RefPtr<RenderStyle> style = RenderStyle::clone(originalStyle.get());
+    style->setDirection(contentDirection);
+    style->setDisplay(newDisplay);
+    return style.release();
+}
+
 void BaseMultipleFieldsDateAndTimeInputType::createShadowSubtree()
 {
     ASSERT(element()->shadow());
@@ -344,11 +362,6 @@
     }
 }
 
-bool BaseMultipleFieldsDateAndTimeInputType::shouldApplyLocaleDirection() const
-{
-    return true;
-}
-
 bool BaseMultipleFieldsDateAndTimeInputType::shouldUseInputMethod() const
 {
     return false;

Modified: trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h (144351 => 144352)


--- trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h	2013-02-28 20:51:44 UTC (rev 144351)
+++ trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h	2013-02-28 20:59:15 UTC (rev 144352)
@@ -78,6 +78,7 @@
     // InputType functions
     virtual String badInputText() const OVERRIDE;
     virtual void blur() OVERRIDE FINAL;
+    virtual PassRefPtr<RenderStyle> customStyleForRenderer(PassRefPtr<RenderStyle>) OVERRIDE;
     virtual void createShadowSubtree() OVERRIDE FINAL;
     virtual void destroyShadowSubtree() OVERRIDE FINAL;
     virtual void disabledAttributeChanged() OVERRIDE FINAL;
@@ -93,7 +94,6 @@
     virtual void restoreFormControlState(const FormControlState&) OVERRIDE FINAL;
     virtual FormControlState saveFormControlState() const OVERRIDE FINAL;
     virtual void setValue(const String&, bool valueChanged, TextFieldEventBehavior) OVERRIDE FINAL;
-    virtual bool shouldApplyLocaleDirection() const OVERRIDE;
     virtual bool shouldUseInputMethod() const OVERRIDE FINAL;
     virtual void stepAttributeChanged() OVERRIDE FINAL;
     virtual void updateInnerTextValue() OVERRIDE FINAL;

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (144351 => 144352)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2013-02-28 20:51:44 UTC (rev 144351)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2013-02-28 20:59:15 UTC (rev 144352)
@@ -1963,15 +1963,7 @@
 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer()
 {
-    RefPtr<RenderStyle> originalStyle = document()->styleResolver()->styleForElement(this);
-    if (!m_inputType->shouldApplyLocaleDirection())
-        return originalStyle.release();
-    TextDirection contentDirection = locale().isRTL() ? RTL : LTR;
-    if (originalStyle->direction() == contentDirection)
-        return originalStyle.release();
-    RefPtr<RenderStyle> style = RenderStyle::clone(originalStyle.get());
-    style->setDirection(contentDirection);
-    return style.release();
+    return m_inputType->customStyleForRenderer(document()->styleResolver()->styleForElement(this));
 }
 #endif
 

Modified: trunk/Source/WebCore/html/InputType.cpp (144351 => 144352)


--- trunk/Source/WebCore/html/InputType.cpp	2013-02-28 20:51:44 UTC (rev 144351)
+++ trunk/Source/WebCore/html/InputType.cpp	2013-02-28 20:59:15 UTC (rev 144352)
@@ -466,6 +466,11 @@
     return RenderObject::createObject(element(), style);
 }
 
+PassRefPtr<RenderStyle> InputType::customStyleForRenderer(PassRefPtr<RenderStyle> originalStyle)
+{
+    return originalStyle;
+}
+
 void InputType::blur()
 {
     element()->defaultBlur();
@@ -735,11 +740,6 @@
     return 0;
 }
 
-bool InputType::shouldApplyLocaleDirection() const
-{
-    return false;
-}
-
 bool InputType::shouldResetOnDocumentActivation()
 {
     return false;

Modified: trunk/Source/WebCore/html/InputType.h (144351 => 144352)


--- trunk/Source/WebCore/html/InputType.h	2013-02-28 20:51:44 UTC (rev 144351)
+++ trunk/Source/WebCore/html/InputType.h	2013-02-28 20:59:15 UTC (rev 144352)
@@ -237,6 +237,7 @@
 
     virtual bool rendererIsNeeded();
     virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) const;
+    virtual PassRefPtr<RenderStyle> customStyleForRenderer(PassRefPtr<RenderStyle>);
     virtual void addSearchResult();
     virtual void attach();
     virtual void detach();
@@ -260,7 +261,6 @@
     virtual bool canSetValue(const String&);
     virtual bool storesValueSeparateFromAttribute();
     virtual void setValue(const String&, bool valueChanged, TextFieldEventBehavior);
-    virtual bool shouldApplyLocaleDirection() const;
     virtual bool shouldResetOnDocumentActivation();
     virtual bool shouldRespectListAttribute();
     virtual bool shouldRespectSpeechAttribute();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to