Title: [141526] branches/chromium/1364
Revision
141526
Author
tk...@chromium.org
Date
2013-01-31 19:28:33 -0800 (Thu, 31 Jan 2013)

Log Message

Merge 141195

> INPUT_MULTIPLE_FIELDS_UI: The content should not overflow the <input> boundary
> https://bugs.webkit.org/show_bug.cgi?id=108069
> 
> Reviewed by Hajime Morita.
> 
> Source/WebCore:
> 
> To avoid the overflow, we do:
> A) Specify overflow:hidden to <input>.
> 
> However, we need to make sub-fields and buttons workable even if the
> width is smaller than the intrinsic size. So, we do:
> B) Make DateTimeEditElement shrinkable, and
> C) Make the sub-fields scrollable horizontally like input[type=text].
> 
> To achieve B, we need to remove -webkit-date-and-time-container (D)
> because width property for <input> can shrink only the direct child
> elements.
> 
> Tests: fast/forms/time-multiple-fields/time-multiple-fields-narrow-width-scroll.html
> and new test cases in fast/forms/date/date-appearance-basic.html.
> 
> * css/html.css:
> (input[type="date"]):
> Change -webkit-align-items value. (D)
> Specify overflow:hidden. (A)
> (input[type="datetime"]): Ditto.
> (input[type="datetime-local"]): Ditto.
> (input[type="month"]): Ditto.
> (input[type="time"]): Ditto.
> (input[type="week"]): Ditto.
> (input::-webkit-datetime-edit):
> Add min-width:0 (B), and overflow:hidden. (C)
> Remove unnecessary white-space:pre because of white-space:nowrap below.
> (input::-webkit-datetime-edit-fields-wrapper):
> Added. This is the child of -webkit-datetime-edit, and contains
> sub-fields. (C)
> * html/BaseMultipleFieldsDateAndTimeInputType.cpp:
> (WebCore::BaseMultipleFieldsDateAndTimeInputType::createShadowSubtree):
> Remove -webkit-date-and-time-container, and append DateTimeEditElement,
> spin button, and picker indicator element to the ShadowRoot. (D)
> (WebCore::BaseMultipleFieldsDateAndTimeInputType::shouldApplyLocaleDirection):
> <input> for multiple fields UI should have the direction of the browser
> locale. This is a replacement of the code for dir attribute in
> updateInnerTextValue below. (D)
> (WebCore::BaseMultipleFieldsDateAndTimeInputType::updateInnerTextValue):
> Remove the code to set dir= to -webkit-date-and-time-container.
> * html/BaseMultipleFieldsDateAndTimeInputType.h:
> (BaseMultipleFieldsDateAndTimeInputType):
> Declare shouldApplyLocaleDirection. (D)
> * html/HTMLInputElement.cpp:
> (WebCore::HTMLInputElement::HTMLInputElement):
> Calls setHasCustomCallbacks for customStyleForRenderer. (D)
> (WebCore::HTMLInputElement::customStyleForRenderer):
> Set direction to RenderStyle if shouldApplyLocaleDirection is true. This
> is a replacement of the dir setting code in
> BaseMultipleFieldsDateAndTimeInputType::updateInnerTextValue. (D)
> * html/HTMLInputElement.h:
> (HTMLInputElement): Declare customStyleForRenderer. (D)
> * html/InputType.cpp:
> (WebCore::InputType::shouldApplyLocaleDirection):
> Add default implmentation of shouldApplyLocaleDirection. (D)
> * html/InputType.h:
> (InputType): Declare shouldApplyLocaleDirection. (D)
> 
> * html/shadow/DateTimeEditElement.cpp:
> (WebCore::DateTimeEditBuilder::visitLiteral):
> Add elements to -webkit-datetime-edit-fields-wrapper element. (C)
> (WebCore::DateTimeEditElement::fieldsWrapperElement):
> A helper to get -webkit-datetime-edit-fields-wrapper element. (C)
> (WebCore::DateTimeEditElement::addField):
> Add elements to -webkit-datetime-edit-fields-wrapper element. (C)
> (WebCore::DateTimeEditElement::customStyleForRenderer):
> - Iterate over children of -webkit-datetime-edit-fields-wrapper element. (C)
> - Set width property instead of min-width. (B)
> (WebCore::DateTimeEditElement::layout):
> - Prepare -webkit-datetime-edit-fields-wrapper element. (C)
> - Handle children of -webkit-datetime-edit-fields-wrapper element. (C)
> - Need to do style recalc because child structure is changed. (C)
> * html/shadow/DateTimeEditElement.h:
> (DateTimeEditElement): Declare fieldsWrapperElement. (C)
> 
> LayoutTests:
> 
> * fast/forms/date/date-appearance-basic-expected.txt:
> * fast/forms/date/date-appearance-basic.html:
> Add test cases for small width and small height.
> * fast/forms/time-multiple-fields/time-multiple-fields-focus-style.html:
> Update the code because of shadow tree structure change.
> * fast/forms/time-multiple-fields/time-multiple-fields-narrow-width-scroll.html:
> Added.
> * fast/forms/time-multiple-fields/time-multiple-fields-narrow-width-scroll-expected.txt:
> Added.
> * platform/chromium-mac/fast/forms/date/date-appearance-basic-expected.png:
> * platform/chromium/TestExpectations:
>  - date-appearance-basic.html: New test cases are added.
>  - *-appearance-pseudo-element.html: :before :after position is slightly
>    changed because of the -webkit-align-items change.
>  - suggestion-picker/*.html: RTL behavior is changed. The direction of
>    suggestion pickers matches to the direction of the input content
>    (browser locale).

TBR=tk...@chromium.org
BUG=crbug.com/172029
Review URL: https://codereview.chromium.org/12159003

Modified Paths

Added Paths

Diff

Modified: branches/chromium/1364/LayoutTests/fast/forms/date/date-appearance-basic-expected.txt (141525 => 141526)


--- branches/chromium/1364/LayoutTests/fast/forms/date/date-appearance-basic-expected.txt	2013-02-01 03:20:48 UTC (rev 141525)
+++ branches/chromium/1364/LayoutTests/fast/forms/date/date-appearance-basic-expected.txt	2013-02-01 03:28:33 UTC (rev 141526)
@@ -7,6 +7,6 @@
 text-transform: 
 background, color: 
 font-size, font-weight: 
-font-size with fixed input width: 
-Fixed input height: 
+font-size with fixed input width:   
+Fixed input height:   
 -webkit-appearance:none: 

Modified: branches/chromium/1364/LayoutTests/fast/forms/date/date-appearance-basic.html (141525 => 141526)


--- branches/chromium/1364/LayoutTests/fast/forms/date/date-appearance-basic.html	2013-02-01 03:20:48 UTC (rev 141525)
+++ branches/chromium/1364/LayoutTests/fast/forms/date/date-appearance-basic.html	2013-02-01 03:28:33 UTC (rev 141526)
@@ -17,8 +17,10 @@
     <li>text-transform: <input type="date" value="2012-10-05" style="text-transform: lowercase;"></li>
     <li>background, color: <input type="date" value="2012-10-05" style="border: 0px; background: green; color: yellow;"></li>
     <li>font-size, font-weight: <input type="date" value="2012-10-05" style="font-size: 20pt; font-weight: bold;"></li>
-    <li>font-size with fixed input width: <input type="date" value="2012-10-05" style="font-size: 20pt; width: 14em;"></li>
-    <li>Fixed input height: <input type="date" value="2012-10-05" style="height: 4em;"></li>
+    <li>font-size with fixed input width: <input type="date" value="2012-10-05" style="font-size: 20pt; width: 14em;">
+      <input type="date" value="99999-12-31" style="font-size: 20pt; width: 5em;"></li>
+    <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>
 </ul>
 </body>

Modified: branches/chromium/1364/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-focus-style.html (141525 => 141526)


--- branches/chromium/1364/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-focus-style.html	2013-02-01 03:20:48 UTC (rev 141525)
+++ branches/chromium/1364/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-focus-style.html	2013-02-01 03:28:33 UTC (rev 141526)
@@ -29,7 +29,7 @@
 
 testInput.focus();
 var shadowRoot = internals.oldestShadowRoot(testInput);
-var fields = getElementByPseudoId(shadowRoot, "-webkit-datetime-edit").childNodes;
+var fields = getElementByPseudoId(shadowRoot, "-webkit-datetime-edit-fields-wrapper").childNodes;
 for (var index = 0; index < fields.length; ++index) {
     var field = fields[index];
     if (field.nodeType != 1)

Copied: branches/chromium/1364/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-narrow-width-scroll-expected.txt (from rev 141195, trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-narrow-width-scroll-expected.txt) (0 => 141526)


--- branches/chromium/1364/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-narrow-width-scroll-expected.txt	                        (rev 0)
+++ branches/chromium/1364/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-narrow-width-scroll-expected.txt	2013-02-01 03:28:33 UTC (rev 141526)
@@ -0,0 +1,10 @@
+Check if changing focus in a multiple fields input scrolls the content.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS initialScrollLeft < container.scrollLeft is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: branches/chromium/1364/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-narrow-width-scroll.html (from rev 141195, trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-narrow-width-scroll.html) (0 => 141526)


--- branches/chromium/1364/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-narrow-width-scroll.html	                        (rev 0)
+++ branches/chromium/1364/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-narrow-width-scroll.html	2013-02-01 03:28:33 UTC (rev 141526)
@@ -0,0 +1,20 @@
+<!DOCTYPE>
+<body>
+<script src=""
+<script src=""
+
+<input id="time1" type="time" style="font-size:20px; width:40px;">
+
+<script>
+description('Check if changing focus in a multiple fields input scrolls the content.');
+if (!window.eventSender || !window.internals)
+    debug('This test rquires DRT/WRT.');
+var time1 = $('time1');
+time1.focus();
+var container = getElementByPseudoId(internals.oldestShadowRoot(time1), '-webkit-datetime-edit');
+var initialScrollLeft = container.scrollLeft;
+eventSender.keyDown('\t');
+shouldBeTrue('initialScrollLeft < container.scrollLeft');
+</script>
+<script src=""
+</body>

Modified: branches/chromium/1364/LayoutTests/platform/chromium/TestExpectations (141525 => 141526)


--- branches/chromium/1364/LayoutTests/platform/chromium/TestExpectations	2013-02-01 03:20:48 UTC (rev 141525)
+++ branches/chromium/1364/LayoutTests/platform/chromium/TestExpectations	2013-02-01 03:28:33 UTC (rev 141526)
@@ -4273,3 +4273,23 @@
 webkit.org/b/107508 platform/chromium/fast/forms/calendar-picker/calendar-picker-appearance-step.html [ ImageOnlyFailure Pass ]
 webkit.org/b/107508 platform/chromium/fast/forms/calendar-picker/calendar-picker-appearance.html [ ImageOnlyFailure Pass ]
                     
+webkit.org/b/105574 platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar.html [ ImageOnlyFailure ]
+webkit.org/b/105574 platform/chromium/fast/forms/suggestion-picker/month-suggestion-picker-appearance-with-scroll-bar.html [ ImageOnlyFailure ]
+webkit.org/b/105574 platform/chromium/fast/forms/suggestion-picker/week-suggestion-picker-appearance-with-scroll-bar.html [ ImageOnlyFailure ]
+
+# Needs rebaseline.
+webkit.org/b/108069 fast/forms/date/date-appearance-basic.html [ ImageOnlyFailure ]
+webkit.org/b/108069 fast/forms/date/date-appearance-pseudo-elements.html [ ImageOnlyFailure ]
+webkit.org/b/108069 fast/forms/month/month-appearance-pseudo-elements.html [ ImageOnlyFailure ]
+webkit.org/b/108069 fast/forms/time/time-appearance-pseudo-elements.html [ ImageOnlyFailure ]
+webkit.org/b/108069 fast/forms/week/week-appearance-pseudo-elements.html [ ImageOnlyFailure ]
+webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl.html [ ImageOnlyFailure ]
+webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/datetime-suggestion-picker-appearance-locale-hebrew.html [ ImageOnlyFailure ]
+webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/datetime-suggestion-picker-appearance-rtl.html [ ImageOnlyFailure ]
+webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-locale-hebrew.html [ ImageOnlyFailure ]
+webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-rtl.html [ ImageOnlyFailure ]
+webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/month-suggestion-picker-appearance-rtl.html [ ImageOnlyFailure ]
+webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/time-suggestion-picker-appearance-locale-hebrew.html [ ImageOnlyFailure ]
+webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/time-suggestion-picker-appearance-rtl.html [ ImageOnlyFailure ]
+webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/time-suggestion-picker-appearance-with-scroll-bar.html [ ImageOnlyFailure ]
+webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/week-suggestion-picker-appearance-rtl.html [ ImageOnlyFailure ]

Modified: branches/chromium/1364/Source/WebCore/css/html.css (141525 => 141526)


--- branches/chromium/1364/Source/WebCore/css/html.css	2013-02-01 03:20:48 UTC (rev 141525)
+++ branches/chromium/1364/Source/WebCore/css/html.css	2013-02-01 03:28:33 UTC (rev 141526)
@@ -480,54 +480,60 @@
 #if defined(ENABLE_INPUT_MULTIPLE_FIELDS_UI) && ENABLE_INPUT_MULTIPLE_FIELDS_UI
 #if defined(ENABLE_INPUT_TYPE_DATE) && ENABLE_INPUT_TYPE_DATE
 input[type="date"] {
-    -webkit-align-items: stretch;
+    -webkit-align-items: center;
     display: -webkit-inline-flex;
     font-family: monospace;
+    overflow: hidden;
     padding: 0;
     -webkit-padding-start: 1px;
 }
 #endif
 #if defined(ENABLE_INPUT_TYPE_DATETIME) && ENABLE_INPUT_TYPE_DATETIME
 input[type="datetime"] {
-    -webkit-align-items: stretch;
+    -webkit-align-items: center;
     display: -webkit-inline-flex;
     font-family: monospace;
+    overflow: hidden;
     padding: 0;
     -webkit-padding-start: 1px;
 }
 #endif
 #if defined(ENABLE_INPUT_TYPE_DATETIMELOCAL) && ENABLE_INPUT_TYPE_DATETIMELOCAL
 input[type="datetime-local"] {
-    -webkit-align-items: stretch;
+    -webkit-align-items: center;
     display: -webkit-inline-flex;
     font-family: monospace;
+    overflow: hidden;
     padding: 0;
     -webkit-padding-start: 1px;
 }
 #endif
 #if defined(ENABLE_INPUT_TYPE_MONTH) && ENABLE_INPUT_TYPE_MONTH
 input[type="month"] {
-    -webkit-align-items: stretch;
+    -webkit-align-items: center;
     display: -webkit-inline-flex;
     font-family: monospace;
+    overflow: hidden;
     padding: 0;
     -webkit-padding-start: 1px;
 }
 #endif
 #if defined(ENABLE_INPUT_TYPE_TIME) && ENABLE_INPUT_TYPE_TIME
 input[type="time"] {
-    -webkit-align-items: stretch;
+    -webkit-align-items: center;
     display: -webkit-inline-flex;
     font-family: monospace;
+    overflow: hidden;
     padding: 0;
     -webkit-padding-start: 1px;
 }
 #endif
 #if defined(ENABLE_INPUT_TYPE_WEEK) && ENABLE_INPUT_TYPE_WEEK
 input[type="week"] {
-    -webkit-align-items: stretch;
+    -webkit-align-items: center;
     display: -webkit-inline-flex;
     font-family: monospace;
+    overflow: hidden;
     padding: 0;
     -webkit-padding-start: 1px;
 }
@@ -537,9 +543,17 @@
     -webkit-flex: 1;
     -webkit-user-modify: read-only !important;
     display: inline-block;
-    white-space: pre;
+    min-width: 0;
+    overflow: hidden;
 }
 
+input::-webkit-datetime-edit-fields-wrapper {
+    -webkit-user-modify: read-only !important;
+    display: inline-block;
+    padding: 1px 0;
+    white-space: nowrap;
+}
+
 /* If you update padding, border, or margin in the following ruleset, update
    DateTimeFieldElement::maximumWidth too. */
 input::-webkit-datetime-edit-ampm-field,
@@ -589,12 +603,6 @@
     font: inherit !important;
 }
 
-input::-webkit-date-and-time-container {
-    -webkit-align-items: center;
-    -webkit-flex: 1;
-    display: -webkit-inline-flex;
-}
-
 input[type="date"]::-webkit-inner-spin-button,
 input[type="datetime"]::-webkit-inner-spin-button,
 input[type="datetime-local"]::-webkit-inner-spin-button,

Modified: branches/chromium/1364/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp (141525 => 141526)


--- branches/chromium/1364/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp	2013-02-01 03:20:48 UTC (rev 141525)
+++ branches/chromium/1364/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp	2013-02-01 03:28:33 UTC (rev 141526)
@@ -195,14 +195,10 @@
 
 void BaseMultipleFieldsDateAndTimeInputType::createShadowSubtree()
 {
-    DEFINE_STATIC_LOCAL(AtomicString, dateAndTimeInputContainerPseudoId, ("-webkit-date-and-time-container", AtomicString::ConstructFromLiteral));
-
     ASSERT(element()->shadow());
 
     Document* document = element()->document();
-    RefPtr<HTMLDivElement> container = HTMLDivElement::create(document);
-    element()->userAgentShadowRoot()->appendChild(container);
-    container->setPseudo(dateAndTimeInputContainerPseudoId);
+    ContainerNode* container = element()->userAgentShadowRoot();
 
     RefPtr<DateTimeEditElement> dateTimeEditElement(DateTimeEditElement::create(document, *this));
     m_dateTimeEditElement = dateTimeEditElement.get();
@@ -350,6 +346,11 @@
     }
 }
 
+bool BaseMultipleFieldsDateAndTimeInputType::shouldApplyLocaleDirection() const
+{
+    return true;
+}
+
 bool BaseMultipleFieldsDateAndTimeInputType::shouldUseInputMethod() const
 {
     return false;
@@ -365,10 +366,6 @@
     if (!m_dateTimeEditElement)
         return;
 
-    AtomicString direction = element()->locale().isRTL() ? AtomicString("rtl", AtomicString::ConstructFromLiteral) : AtomicString("ltr", AtomicString::ConstructFromLiteral);
-    if (Element* container = ElementTraversal::firstWithin(element()->userAgentShadowRoot()))
-        container->setAttribute(HTMLNames::dirAttr, direction);
-
     DateTimeEditElement::LayoutParameters layoutParameters(element()->locale(), createStepRange(AnyIsDefaultStep));
 
     DateComponents date;

Modified: branches/chromium/1364/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h (141525 => 141526)


--- branches/chromium/1364/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h	2013-02-01 03:20:48 UTC (rev 141525)
+++ branches/chromium/1364/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h	2013-02-01 03:28:33 UTC (rev 141526)
@@ -92,6 +92,7 @@
     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/1364/Source/WebCore/html/HTMLInputElement.cpp (141525 => 141526)


--- branches/chromium/1364/Source/WebCore/html/HTMLInputElement.cpp	2013-02-01 03:20:48 UTC (rev 141525)
+++ branches/chromium/1364/Source/WebCore/html/HTMLInputElement.cpp	2013-02-01 03:28:33 UTC (rev 141526)
@@ -56,6 +56,7 @@
 #include "Language.h"
 #include "LocalizedStrings.h"
 #include "MouseEvent.h"
+#include "PlatformLocale.h"
 #include "RenderTextControlSingleLine.h"
 #include "RenderTheme.h"
 #include "RuntimeEnabledFeatures.h"
@@ -63,6 +64,7 @@
 #include "SearchInputType.h"
 #include "ShadowRoot.h"
 #include "ScriptEventListener.h"
+#include "StyleResolver.h"
 #include <wtf/MathExtras.h>
 #include <wtf/StdLibExtras.h>
 
@@ -132,6 +134,9 @@
     , m_inputType(InputType::createText(this))
 {
     ASSERT(hasTagName(inputTag) || hasTagName(isindexTag));
+#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
+    setHasCustomCallbacks();
+#endif
 }
 
 PassRefPtr<HTMLInputElement> HTMLInputElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form, bool createdByParser)
@@ -1936,4 +1941,19 @@
 #endif
 }
 
+#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();
+}
+#endif
+
 } // namespace

Modified: branches/chromium/1364/Source/WebCore/html/HTMLInputElement.h (141525 => 141526)


--- branches/chromium/1364/Source/WebCore/html/HTMLInputElement.h	2013-02-01 03:20:48 UTC (rev 141525)
+++ branches/chromium/1364/Source/WebCore/html/HTMLInputElement.h	2013-02-01 03:28:33 UTC (rev 141526)
@@ -396,6 +396,9 @@
     CheckedRadioButtons* checkedRadioButtons() const;
     void addToRadioButtonGroup();
     void removeFromRadioButtonGroup();
+#if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
+    virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE;
+#endif
 
     AtomicString m_name;
     String m_valueIfDirty;

Modified: branches/chromium/1364/Source/WebCore/html/InputType.cpp (141525 => 141526)


--- branches/chromium/1364/Source/WebCore/html/InputType.cpp	2013-02-01 03:20:48 UTC (rev 141525)
+++ branches/chromium/1364/Source/WebCore/html/InputType.cpp	2013-02-01 03:28:33 UTC (rev 141526)
@@ -734,6 +734,11 @@
     return 0;
 }
 
+bool InputType::shouldApplyLocaleDirection() const
+{
+    return false;
+}
+
 bool InputType::shouldResetOnDocumentActivation()
 {
     return false;

Modified: branches/chromium/1364/Source/WebCore/html/InputType.h (141525 => 141526)


--- branches/chromium/1364/Source/WebCore/html/InputType.h	2013-02-01 03:20:48 UTC (rev 141525)
+++ branches/chromium/1364/Source/WebCore/html/InputType.h	2013-02-01 03:28:33 UTC (rev 141526)
@@ -260,6 +260,7 @@
     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();

Modified: branches/chromium/1364/Source/WebCore/html/shadow/DateTimeEditElement.cpp (141525 => 141526)


--- branches/chromium/1364/Source/WebCore/html/shadow/DateTimeEditElement.cpp	2013-02-01 03:20:48 UTC (rev 141525)
+++ branches/chromium/1364/Source/WebCore/html/shadow/DateTimeEditElement.cpp	2013-02-01 03:28:33 UTC (rev 141526)
@@ -303,7 +303,7 @@
             element->appendChild(Text::create(m_editElement.document(), String(&rightToLeftMark, 1)));
     }
     element->appendChild(Text::create(m_editElement.document(), text));
-    m_editElement.appendChild(element);
+    m_editElement.fieldsWrapperElement()->appendChild(element);
 }
 
 DateTimeNumericFieldElement::Parameters DateTimeEditBuilder::createNumericFieldParameters(const Decimal& msPerFieldUnit, const Decimal& msPerFieldSize) const
@@ -346,12 +346,18 @@
         m_fields[fieldIndex]->removeEventHandler();
 }
 
+inline Element* DateTimeEditElement::fieldsWrapperElement() const
+{
+    ASSERT(firstChild());
+    return toElement(firstChild());
+}
+
 void DateTimeEditElement::addField(PassRefPtr<DateTimeFieldElement> field)
 {
     if (m_fields.size() == m_fields.capacity())
         return;
     m_fields.append(field.get());
-    appendChild(field);
+    fieldsWrapperElement()->appendChild(field);
 }
 
 bool DateTimeEditElement::anyEditableFieldsHaveValues() const
@@ -382,7 +388,7 @@
     RefPtr<RenderStyle> originalStyle = document()->styleResolver()->styleForElement(this);
     RefPtr<RenderStyle> style = RenderStyle::clone(originalStyle.get());
     float width = 0;
-    for (Node* child = firstChild(); child; child = child->nextSibling()) {
+    for (Node* child = fieldsWrapperElement()->firstChild(); child; child = child->nextSibling()) {
         if (!child->isElementNode())
             continue;
         Element* childElement = toElement(child);
@@ -396,7 +402,7 @@
             width += style->font().width(childElement->textContent());
         }
     }
-    style->setMinWidth(Length(ceilf(width), Fixed));
+    style->setWidth(Length(ceilf(width), Fixed));
     return style.release();
 }
 
@@ -514,14 +520,22 @@
 
 void DateTimeEditElement::layout(const LayoutParameters& layoutParameters, const DateComponents& dateValue)
 {
+    DEFINE_STATIC_LOCAL(AtomicString, fieldsWrapperPseudoId, ("-webkit-datetime-edit-fields-wrapper", AtomicString::ConstructFromLiteral));
+    if (!firstChild()) {
+        RefPtr<HTMLDivElement> element = HTMLDivElement::create(document());
+        element->setPseudo(fieldsWrapperPseudoId);
+        appendChild(element.get());
+    }
+    Element* fieldsWrapper = fieldsWrapperElement();
+
     size_t focusedFieldIndex = this->focusedFieldIndex();
     DateTimeFieldElement* const focusedField = fieldAt(focusedFieldIndex);
     const AtomicString focusedFieldId = focusedField ? focusedField->shadowPseudoId() : nullAtom;
 
     DateTimeEditBuilder builder(*this, layoutParameters, dateValue);
-    Node* lastChildToBeRemoved = lastChild();
+    Node* lastChildToBeRemoved = fieldsWrapper->lastChild();
     if (!builder.build(layoutParameters.dateTimeFormat) || m_fields.isEmpty()) {
-        lastChildToBeRemoved = lastChild();
+        lastChildToBeRemoved = fieldsWrapper->lastChild();
         builder.build(layoutParameters.fallbackDateTimeFormat);
     }
 
@@ -537,11 +551,12 @@
     }
 
     if (lastChildToBeRemoved) {
-        for (Node* childNode = firstChild(); childNode; childNode = firstChild()) {
-            removeChild(childNode);
+        for (Node* childNode = fieldsWrapper->firstChild(); childNode; childNode = fieldsWrapper->firstChild()) {
+            fieldsWrapper->removeChild(childNode);
             if (childNode == lastChildToBeRemoved)
                 break;
         }
+        setNeedsStyleRecalc();
     }
 }
 

Modified: branches/chromium/1364/Source/WebCore/html/shadow/DateTimeEditElement.h (141525 => 141526)


--- branches/chromium/1364/Source/WebCore/html/shadow/DateTimeEditElement.h	2013-02-01 03:20:48 UTC (rev 141525)
+++ branches/chromium/1364/Source/WebCore/html/shadow/DateTimeEditElement.h	2013-02-01 03:28:33 UTC (rev 141526)
@@ -90,6 +90,7 @@
     void blurByOwner();
     virtual void defaultEventHandler(Event*) OVERRIDE;
     void disabledStateChanged();
+    Element* fieldsWrapperElement() const;
     void focusIfNoFocus();
     void focusByOwner();
     bool hasFocusedField();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to