- Revision
- 144539
- Author
- [email protected]
- Date
- 2013-03-02 03:59:30 -0800 (Sat, 02 Mar 2013)
Log Message
Merge 144352
> 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:
>
[email protected]
BUG=crbug.com/178175
Modified Paths
Diff
Modified: branches/chromium/1410/LayoutTests/fast/forms/date/date-appearance-basic-expected.txt (144538 => 144539)
--- branches/chromium/1410/LayoutTests/fast/forms/date/date-appearance-basic-expected.txt 2013-03-02 10:14:04 UTC (rev 144538)
+++ branches/chromium/1410/LayoutTests/fast/forms/date/date-appearance-basic-expected.txt 2013-03-02 11:59:30 UTC (rev 144539)
@@ -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: branches/chromium/1410/LayoutTests/fast/forms/date/date-appearance-basic.html (144538 => 144539)
--- branches/chromium/1410/LayoutTests/fast/forms/date/date-appearance-basic.html 2013-03-02 10:14:04 UTC (rev 144538)
+++ branches/chromium/1410/LayoutTests/fast/forms/date/date-appearance-basic.html 2013-03-02 11:59:30 UTC (rev 144539)
@@ -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: branches/chromium/1410/LayoutTests/platform/chromium/TestExpectations (144538 => 144539)
--- branches/chromium/1410/LayoutTests/platform/chromium/TestExpectations 2013-03-02 10:14:04 UTC (rev 144538)
+++ branches/chromium/1410/LayoutTests/platform/chromium/TestExpectations 2013-03-02 11:59:30 UTC (rev 144539)
@@ -3910,6 +3910,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: branches/chromium/1410/LayoutTests/platform/chromium-mac/fast/forms/date/date-appearance-basic-expected.png
(Binary files differ)
Modified: branches/chromium/1410/Source/WebCore/css/html.css (144538 => 144539)
--- branches/chromium/1410/Source/WebCore/css/html.css 2013-03-02 10:14:04 UTC (rev 144538)
+++ branches/chromium/1410/Source/WebCore/css/html.css 2013-03-02 11:59:30 UTC (rev 144539)
@@ -913,6 +913,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: branches/chromium/1410/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp (144538 => 144539)
--- branches/chromium/1410/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp 2013-03-02 10:14:04 UTC (rev 144538)
+++ branches/chromium/1410/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp 2013-03-02 11:59:30 UTC (rev 144539)
@@ -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());
@@ -347,11 +365,6 @@
}
}
-bool BaseMultipleFieldsDateAndTimeInputType::shouldApplyLocaleDirection() const
-{
- return true;
-}
-
bool BaseMultipleFieldsDateAndTimeInputType::shouldUseInputMethod() const
{
return false;
Modified: branches/chromium/1410/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h (144538 => 144539)
--- branches/chromium/1410/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h 2013-03-02 10:14:04 UTC (rev 144538)
+++ branches/chromium/1410/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h 2013-03-02 11:59:30 UTC (rev 144539)
@@ -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;
@@ -94,7 +95,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: branches/chromium/1410/Source/WebCore/html/HTMLInputElement.cpp (144538 => 144539)
--- branches/chromium/1410/Source/WebCore/html/HTMLInputElement.cpp 2013-03-02 10:14:04 UTC (rev 144538)
+++ branches/chromium/1410/Source/WebCore/html/HTMLInputElement.cpp 2013-03-02 11:59:30 UTC (rev 144539)
@@ -1969,15 +1969,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: branches/chromium/1410/Source/WebCore/html/InputType.cpp (144538 => 144539)
--- branches/chromium/1410/Source/WebCore/html/InputType.cpp 2013-03-02 10:14:04 UTC (rev 144538)
+++ branches/chromium/1410/Source/WebCore/html/InputType.cpp 2013-03-02 11:59:30 UTC (rev 144539)
@@ -466,6 +466,11 @@
return RenderObject::createObject(element(), style);
}
+PassRefPtr<RenderStyle> InputType::customStyleForRenderer(PassRefPtr<RenderStyle> originalStyle)
+{
+ return originalStyle;
+}
+
void InputType::blur()
{
element()->defaultBlur();
@@ -740,11 +745,6 @@
return 0;
}
-bool InputType::shouldApplyLocaleDirection() const
-{
- return false;
-}
-
bool InputType::shouldResetOnDocumentActivation()
{
return false;
Modified: branches/chromium/1410/Source/WebCore/html/InputType.h (144538 => 144539)
--- branches/chromium/1410/Source/WebCore/html/InputType.h 2013-03-02 10:14:04 UTC (rev 144538)
+++ branches/chromium/1410/Source/WebCore/html/InputType.h 2013-03-02 11:59:30 UTC (rev 144539)
@@ -238,6 +238,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();
@@ -261,7 +262,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();