Changeset 141195 in webkit
- Timestamp:
- Jan 29, 2013 6:05:22 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r141194 r141195 1 2013-01-29 Kent Tamura <tkent@chromium.org> 2 3 INPUT_MULTIPLE_FIELDS_UI: The content should not overflow the <input> boundary 4 https://bugs.webkit.org/show_bug.cgi?id=108069 5 6 Reviewed by Hajime Morita. 7 8 * fast/forms/date/date-appearance-basic-expected.txt: 9 * fast/forms/date/date-appearance-basic.html: 10 Add test cases for small width and small height. 11 * fast/forms/time-multiple-fields/time-multiple-fields-focus-style.html: 12 Update the code because of shadow tree structure change. 13 * fast/forms/time-multiple-fields/time-multiple-fields-narrow-width-scroll.html: 14 Added. 15 * fast/forms/time-multiple-fields/time-multiple-fields-narrow-width-scroll-expected.txt: 16 Added. 17 * platform/chromium-mac/fast/forms/date/date-appearance-basic-expected.png: 18 * platform/chromium/TestExpectations: 19 - date-appearance-basic.html: New test cases are added. 20 - *-appearance-pseudo-element.html: :before :after position is slightly 21 changed because of the -webkit-align-items change. 22 - suggestion-picker/*.html: RTL behavior is changed. The direction of 23 suggestion pickers matches to the direction of the input content 24 (browser locale). 25 1 26 2013-01-29 Roger Fong <roger_fong@apple.com> 2 27 -
trunk/LayoutTests/fast/forms/date/date-appearance-basic-expected.txt
r135840 r141195 8 8 background, color: 9 9 font-size, font-weight: 10 font-size with fixed input width: 11 Fixed input height: 10 font-size with fixed input width: 11 Fixed input height: 12 12 -webkit-appearance:none: -
trunk/LayoutTests/fast/forms/date/date-appearance-basic.html
r135840 r141195 18 18 <li>background, color: <input type="date" value="2012-10-05" style="border: 0px; background: green; color: yellow;"></li> 19 19 <li>font-size, font-weight: <input type="date" value="2012-10-05" style="font-size: 20pt; font-weight: bold;"></li> 20 <li>font-size with fixed input width: <input type="date" value="2012-10-05" style="font-size: 20pt; width: 14em;"></li> 21 <li>Fixed input height: <input type="date" value="2012-10-05" style="height: 4em;"></li> 20 <li>font-size with fixed input width: <input type="date" value="2012-10-05" style="font-size: 20pt; width: 14em;"> 21 <input type="date" value="99999-12-31" style="font-size: 20pt; width: 5em;"></li> 22 <li>Fixed input height: <input type="date" value="2012-10-05" style="height: 4em;"> 23 <input type="date" value="2013-01-28" style="font-size: 20px; height: 10px;"></li> 22 24 <li>-webkit-appearance:none: <input type="date" value="2012-10-05" style="-webkit-appearance: none;"></li> 23 25 </ul> -
trunk/LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-focus-style.html
r130293 r141195 30 30 testInput.focus(); 31 31 var shadowRoot = internals.oldestShadowRoot(testInput); 32 var fields = getElementByPseudoId(shadowRoot, "-webkit-datetime-edit ").childNodes;32 var fields = getElementByPseudoId(shadowRoot, "-webkit-datetime-edit-fields-wrapper").childNodes; 33 33 for (var index = 0; index < fields.length; ++index) { 34 34 var field = fields[index]; -
trunk/LayoutTests/platform/chromium/TestExpectations
r141188 r141195 4307 4307 webkit.org/b/105574 platform/chromium/fast/forms/suggestion-picker/week-suggestion-picker-appearance-with-scroll-bar.html [ ImageOnlyFailure ] 4308 4308 4309 # Needs rebaseline. 4310 webkit.org/b/108069 fast/forms/date/date-appearance-basic.html [ ImageOnlyFailure ] 4311 webkit.org/b/108069 fast/forms/date/date-appearance-pseudo-elements.html [ ImageOnlyFailure ] 4312 webkit.org/b/108069 fast/forms/month/month-appearance-pseudo-elements.html [ ImageOnlyFailure ] 4313 webkit.org/b/108069 fast/forms/time/time-appearance-pseudo-elements.html [ ImageOnlyFailure ] 4314 webkit.org/b/108069 fast/forms/week/week-appearance-pseudo-elements.html [ ImageOnlyFailure ] 4315 webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl.html [ ImageOnlyFailure ] 4316 webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/datetime-suggestion-picker-appearance-locale-hebrew.html [ ImageOnlyFailure ] 4317 webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/datetime-suggestion-picker-appearance-rtl.html [ ImageOnlyFailure ] 4318 webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-locale-hebrew.html [ ImageOnlyFailure ] 4319 webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-rtl.html [ ImageOnlyFailure ] 4320 webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/month-suggestion-picker-appearance-rtl.html [ ImageOnlyFailure ] 4321 webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/time-suggestion-picker-appearance-locale-hebrew.html [ ImageOnlyFailure ] 4322 webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/time-suggestion-picker-appearance-rtl.html [ ImageOnlyFailure ] 4323 webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/time-suggestion-picker-appearance-with-scroll-bar.html [ ImageOnlyFailure ] 4324 webkit.org/b/108069 platform/chromium/fast/forms/suggestion-picker/week-suggestion-picker-appearance-rtl.html [ ImageOnlyFailure ] 4325 4309 4326 webkit.org/b/97333 fast/canvas/canvas-path-object.html [ Failure ] 4310 4327 webkit.org/b/97333 platform/chromium/virtual/gpu/fast/canvas/canvas-path-object.html [ Failure ] -
trunk/Source/WebCore/ChangeLog
r141193 r141195 1 2013-01-29 Kent Tamura <tkent@chromium.org> 2 3 INPUT_MULTIPLE_FIELDS_UI: The content should not overflow the <input> boundary 4 https://bugs.webkit.org/show_bug.cgi?id=108069 5 6 Reviewed by Hajime Morita. 7 8 To avoid the overflow, we do: 9 A) Specify overflow:hidden to <input>. 10 11 However, we need to make sub-fields and buttons workable even if the 12 width is smaller than the intrinsic size. So, we do: 13 B) Make DateTimeEditElement shrinkable, and 14 C) Make the sub-fields scrollable horizontally like input[type=text]. 15 16 To achieve B, we need to remove -webkit-date-and-time-container (D) 17 because width property for <input> can shrink only the direct child 18 elements. 19 20 Tests: fast/forms/time-multiple-fields/time-multiple-fields-narrow-width-scroll.html 21 and new test cases in fast/forms/date/date-appearance-basic.html. 22 23 * css/html.css: 24 (input[type="date"]): 25 Change -webkit-align-items value. (D) 26 Specify overflow:hidden. (A) 27 (input[type="datetime"]): Ditto. 28 (input[type="datetime-local"]): Ditto. 29 (input[type="month"]): Ditto. 30 (input[type="time"]): Ditto. 31 (input[type="week"]): Ditto. 32 (input::-webkit-datetime-edit): 33 Add min-width:0 (B), and overflow:hidden. (C) 34 Remove unnecessary white-space:pre because of white-space:nowrap below. 35 (input::-webkit-datetime-edit-fields-wrapper): 36 Added. This is the child of -webkit-datetime-edit, and contains 37 sub-fields. (C) 38 * html/BaseMultipleFieldsDateAndTimeInputType.cpp: 39 (WebCore::BaseMultipleFieldsDateAndTimeInputType::createShadowSubtree): 40 Remove -webkit-date-and-time-container, and append DateTimeEditElement, 41 spin button, and picker indicator element to the ShadowRoot. (D) 42 (WebCore::BaseMultipleFieldsDateAndTimeInputType::shouldApplyLocaleDirection): 43 <input> for multiple fields UI should have the direction of the browser 44 locale. This is a replacement of the code for dir attribute in 45 updateInnerTextValue below. (D) 46 (WebCore::BaseMultipleFieldsDateAndTimeInputType::updateInnerTextValue): 47 Remove the code to set dir= to -webkit-date-and-time-container. 48 * html/BaseMultipleFieldsDateAndTimeInputType.h: 49 (BaseMultipleFieldsDateAndTimeInputType): 50 Declare shouldApplyLocaleDirection. (D) 51 * html/HTMLInputElement.cpp: 52 (WebCore::HTMLInputElement::HTMLInputElement): 53 Calls setHasCustomCallbacks for customStyleForRenderer. (D) 54 (WebCore::HTMLInputElement::customStyleForRenderer): 55 Set direction to RenderStyle if shouldApplyLocaleDirection is true. This 56 is a replacement of the dir setting code in 57 BaseMultipleFieldsDateAndTimeInputType::updateInnerTextValue. (D) 58 * html/HTMLInputElement.h: 59 (HTMLInputElement): Declare customStyleForRenderer. (D) 60 * html/InputType.cpp: 61 (WebCore::InputType::shouldApplyLocaleDirection): 62 Add default implmentation of shouldApplyLocaleDirection. (D) 63 * html/InputType.h: 64 (InputType): Declare shouldApplyLocaleDirection. (D) 65 66 * html/shadow/DateTimeEditElement.cpp: 67 (WebCore::DateTimeEditBuilder::visitLiteral): 68 Add elements to -webkit-datetime-edit-fields-wrapper element. (C) 69 (WebCore::DateTimeEditElement::fieldsWrapperElement): 70 A helper to get -webkit-datetime-edit-fields-wrapper element. (C) 71 (WebCore::DateTimeEditElement::addField): 72 Add elements to -webkit-datetime-edit-fields-wrapper element. (C) 73 (WebCore::DateTimeEditElement::customStyleForRenderer): 74 - Iterate over children of -webkit-datetime-edit-fields-wrapper element. (C) 75 - Set width property instead of min-width. (B) 76 (WebCore::DateTimeEditElement::layout): 77 - Prepare -webkit-datetime-edit-fields-wrapper element. (C) 78 - Handle children of -webkit-datetime-edit-fields-wrapper element. (C) 79 - Need to do style recalc because child structure is changed. (C) 80 * html/shadow/DateTimeEditElement.h: 81 (DateTimeEditElement): Declare fieldsWrapperElement. (C) 82 1 83 2013-01-29 Tom Sepez <tsepez@chromium.org> 2 84 -
trunk/Source/WebCore/css/html.css
r140341 r141195 487 487 #if defined(ENABLE_INPUT_TYPE_DATE) && ENABLE_INPUT_TYPE_DATE 488 488 input[type="date"] { 489 -webkit-align-items: stretch;489 -webkit-align-items: center; 490 490 display: -webkit-inline-flex; 491 491 font-family: monospace; 492 overflow: hidden; 492 493 padding: 0; 493 494 -webkit-padding-start: 1px; … … 496 497 #if defined(ENABLE_INPUT_TYPE_DATETIME) && ENABLE_INPUT_TYPE_DATETIME 497 498 input[type="datetime"] { 498 -webkit-align-items: stretch;499 -webkit-align-items: center; 499 500 display: -webkit-inline-flex; 500 501 font-family: monospace; 502 overflow: hidden; 501 503 padding: 0; 502 504 -webkit-padding-start: 1px; … … 505 507 #if defined(ENABLE_INPUT_TYPE_DATETIMELOCAL) && ENABLE_INPUT_TYPE_DATETIMELOCAL 506 508 input[type="datetime-local"] { 507 -webkit-align-items: stretch;509 -webkit-align-items: center; 508 510 display: -webkit-inline-flex; 509 511 font-family: monospace; 512 overflow: hidden; 510 513 padding: 0; 511 514 -webkit-padding-start: 1px; … … 514 517 #if defined(ENABLE_INPUT_TYPE_MONTH) && ENABLE_INPUT_TYPE_MONTH 515 518 input[type="month"] { 516 -webkit-align-items: stretch;519 -webkit-align-items: center; 517 520 display: -webkit-inline-flex; 518 521 font-family: monospace; 522 overflow: hidden; 519 523 padding: 0; 520 524 -webkit-padding-start: 1px; … … 523 527 #if defined(ENABLE_INPUT_TYPE_TIME) && ENABLE_INPUT_TYPE_TIME 524 528 input[type="time"] { 525 -webkit-align-items: stretch;529 -webkit-align-items: center; 526 530 display: -webkit-inline-flex; 527 531 font-family: monospace; 532 overflow: hidden; 528 533 padding: 0; 529 534 -webkit-padding-start: 1px; … … 532 537 #if defined(ENABLE_INPUT_TYPE_WEEK) && ENABLE_INPUT_TYPE_WEEK 533 538 input[type="week"] { 534 -webkit-align-items: stretch;539 -webkit-align-items: center; 535 540 display: -webkit-inline-flex; 536 541 font-family: monospace; 542 overflow: hidden; 537 543 padding: 0; 538 544 -webkit-padding-start: 1px; … … 544 550 -webkit-user-modify: read-only !important; 545 551 display: inline-block; 546 white-space: pre; 552 min-width: 0; 553 overflow: hidden; 554 } 555 556 input::-webkit-datetime-edit-fields-wrapper { 557 -webkit-user-modify: read-only !important; 558 display: inline-block; 559 padding: 1px 0; 560 white-space: nowrap; 547 561 } 548 562 … … 598 612 display: inline; 599 613 font: inherit !important; 600 }601 602 input::-webkit-date-and-time-container {603 -webkit-align-items: center;604 -webkit-flex: 1;605 display: -webkit-inline-flex;606 614 } 607 615 -
trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.cpp
r140385 r141195 191 191 void BaseMultipleFieldsDateAndTimeInputType::createShadowSubtree() 192 192 { 193 DEFINE_STATIC_LOCAL(AtomicString, dateAndTimeInputContainerPseudoId, ("-webkit-date-and-time-container", AtomicString::ConstructFromLiteral));194 195 193 ASSERT(element()->shadow()); 196 194 197 195 Document* document = element()->document(); 198 RefPtr<HTMLDivElement> container = HTMLDivElement::create(document); 199 element()->userAgentShadowRoot()->appendChild(container); 200 container->setPseudo(dateAndTimeInputContainerPseudoId); 196 ContainerNode* container = element()->userAgentShadowRoot(); 201 197 202 198 RefPtr<DateTimeEditElement> dateTimeEditElement(DateTimeEditElement::create(document, *this)); … … 341 337 } 342 338 339 bool BaseMultipleFieldsDateAndTimeInputType::shouldApplyLocaleDirection() const 340 { 341 return true; 342 } 343 343 344 bool BaseMultipleFieldsDateAndTimeInputType::shouldUseInputMethod() const 344 345 { … … 355 356 if (!m_dateTimeEditElement) 356 357 return; 357 358 AtomicString direction = element()->locale().isRTL() ? AtomicString("rtl", AtomicString::ConstructFromLiteral) : AtomicString("ltr", AtomicString::ConstructFromLiteral);359 if (Element* container = ElementTraversal::firstWithin(element()->userAgentShadowRoot()))360 container->setAttribute(HTMLNames::dirAttr, direction);361 358 362 359 DateTimeEditElement::LayoutParameters layoutParameters(element()->locale(), createStepRange(AnyIsDefaultStep)); -
trunk/Source/WebCore/html/BaseMultipleFieldsDateAndTimeInputType.h
r139424 r141195 94 94 virtual FormControlState saveFormControlState() const OVERRIDE FINAL; 95 95 virtual void setValue(const String&, bool valueChanged, TextFieldEventBehavior) OVERRIDE FINAL; 96 virtual bool shouldApplyLocaleDirection() const OVERRIDE; 96 97 virtual bool shouldUseInputMethod() const OVERRIDE FINAL; 97 98 virtual void stepAttributeChanged() OVERRIDE FINAL; -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r141066 r141195 58 58 #include "LocalizedStrings.h" 59 59 #include "MouseEvent.h" 60 #include "PlatformLocale.h" 60 61 #include "RenderTextControlSingleLine.h" 61 62 #include "RenderTheme.h" … … 65 66 #include "ShadowRoot.h" 66 67 #include "ScriptEventListener.h" 68 #include "StyleResolver.h" 67 69 #include <wtf/MathExtras.h> 68 70 #include <wtf/StdLibExtras.h> … … 134 136 { 135 137 ASSERT(hasTagName(inputTag) || hasTagName(isindexTag)); 138 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 139 setHasCustomCallbacks(); 140 #endif 136 141 } 137 142 … … 1965 1970 } 1966 1971 1972 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 1973 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() 1974 { 1975 RefPtr<RenderStyle> originalStyle = document()->styleResolver()->styleForElement(this); 1976 if (!m_inputType->shouldApplyLocaleDirection()) 1977 return originalStyle.release(); 1978 TextDirection contentDirection = locale().isRTL() ? RTL : LTR; 1979 if (originalStyle->direction() == contentDirection) 1980 return originalStyle.release(); 1981 RefPtr<RenderStyle> style = RenderStyle::clone(originalStyle.get()); 1982 style->setDirection(contentDirection); 1983 return style.release(); 1984 } 1985 #endif 1986 1967 1987 } // namespace -
trunk/Source/WebCore/html/HTMLInputElement.h
r141066 r141195 403 403 void addToRadioButtonGroup(); 404 404 void removeFromRadioButtonGroup(); 405 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 406 virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE; 407 #endif 405 408 406 409 AtomicString m_name; -
trunk/Source/WebCore/html/InputType.cpp
r141086 r141195 740 740 } 741 741 742 bool InputType::shouldApplyLocaleDirection() const 743 { 744 return false; 745 } 746 742 747 bool InputType::shouldResetOnDocumentActivation() 743 748 { -
trunk/Source/WebCore/html/InputType.h
r141086 r141195 262 262 virtual bool storesValueSeparateFromAttribute(); 263 263 virtual void setValue(const String&, bool valueChanged, TextFieldEventBehavior); 264 virtual bool shouldApplyLocaleDirection() const; 264 265 virtual bool shouldResetOnDocumentActivation(); 265 266 virtual bool shouldRespectListAttribute(); -
trunk/Source/WebCore/html/shadow/DateTimeEditElement.cpp
r139865 r141195 369 369 } 370 370 element->appendChild(Text::create(m_editElement.document(), text)); 371 m_editElement. appendChild(element);371 m_editElement.fieldsWrapperElement()->appendChild(element); 372 372 } 373 373 … … 412 412 } 413 413 414 inline Element* DateTimeEditElement::fieldsWrapperElement() const 415 { 416 ASSERT(firstChild()); 417 return toElement(firstChild()); 418 } 419 414 420 void DateTimeEditElement::addField(PassRefPtr<DateTimeFieldElement> field) 415 421 { … … 417 423 return; 418 424 m_fields.append(field.get()); 419 appendChild(field);425 fieldsWrapperElement()->appendChild(field); 420 426 } 421 427 … … 448 454 RefPtr<RenderStyle> style = RenderStyle::clone(originalStyle.get()); 449 455 float width = 0; 450 for (Node* child = fi rstChild(); child; child = child->nextSibling()) {456 for (Node* child = fieldsWrapperElement()->firstChild(); child; child = child->nextSibling()) { 451 457 if (!child->isElementNode()) 452 458 continue; … … 462 468 } 463 469 } 464 style->set MinWidth(Length(ceilf(width), Fixed));470 style->setWidth(Length(ceilf(width), Fixed)); 465 471 return style.release(); 466 472 } … … 580 586 void DateTimeEditElement::layout(const LayoutParameters& layoutParameters, const DateComponents& dateValue) 581 587 { 588 DEFINE_STATIC_LOCAL(AtomicString, fieldsWrapperPseudoId, ("-webkit-datetime-edit-fields-wrapper", AtomicString::ConstructFromLiteral)); 589 if (!firstChild()) { 590 RefPtr<HTMLDivElement> element = HTMLDivElement::create(document()); 591 element->setPseudo(fieldsWrapperPseudoId); 592 appendChild(element.get()); 593 } 594 Element* fieldsWrapper = fieldsWrapperElement(); 595 582 596 size_t focusedFieldIndex = this->focusedFieldIndex(); 583 597 DateTimeFieldElement* const focusedField = fieldAt(focusedFieldIndex); … … 585 599 586 600 DateTimeEditBuilder builder(*this, layoutParameters, dateValue); 587 Node* lastChildToBeRemoved = lastChild();601 Node* lastChildToBeRemoved = fieldsWrapper->lastChild(); 588 602 if (!builder.build(layoutParameters.dateTimeFormat) || m_fields.isEmpty()) { 589 lastChildToBeRemoved = lastChild();603 lastChildToBeRemoved = fieldsWrapper->lastChild(); 590 604 builder.build(layoutParameters.fallbackDateTimeFormat); 591 605 } … … 603 617 604 618 if (lastChildToBeRemoved) { 605 for (Node* childNode = fi rstChild(); childNode; childNode =firstChild()) {606 removeChild(childNode);619 for (Node* childNode = fieldsWrapper->firstChild(); childNode; childNode = fieldsWrapper->firstChild()) { 620 fieldsWrapper->removeChild(childNode); 607 621 if (childNode == lastChildToBeRemoved) 608 622 break; 609 623 } 624 setNeedsStyleRecalc(); 610 625 } 611 626 } -
trunk/Source/WebCore/html/shadow/DateTimeEditElement.h
r138254 r141195 88 88 virtual void defaultEventHandler(Event*) OVERRIDE; 89 89 void disabledStateChanged(); 90 Element* fieldsWrapperElement() const; 90 91 void focusIfNoFocus(); 91 92 void focusByOwner();
Note: See TracChangeset
for help on using the changeset viewer.