Changeset 112839 in webkit
- Timestamp:
- Apr 2, 2012 2:05:32 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 12 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r112835 r112839 1 2012-04-02 Kent Tamura <tkent@chromium.org> 2 3 Add a calendar picker indicator to date-type input fields 4 https://bugs.webkit.org/show_bug.cgi?id=80478 5 6 Reviewed by Hajime Morita. 7 8 * fast/forms/date/date-appearance.html: Added. 9 * platform/chromium-mac-snowleopard/fast/forms/date/date-appearance-expected.png: Added. 10 * platform/chromium-mac-snowleopard/fast/forms/date/date-appearance-expected.txt: Added. 11 1 12 2012-04-02 Philippe Normand <pnormand@igalia.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r112838 r112839 1 2012-04-02 Kent Tamura <tkent@chromium.org> 2 3 Add a calendar picker indicator to date-type input fields 4 https://bugs.webkit.org/show_bug.cgi?id=80478 5 6 Reviewed by Hajime Morita. 7 8 Add an indicator to date-type controls. The bahevior change is enclosed 9 with ENABLE_CALENDAR_PICKER. 10 11 - Remove spin buttons from date-type controls. 12 It's not so helpful if we have a calendar picker. We introduce 13 TextFieldInputType::shouldHaveSpinButton(). 14 15 - Add CalendarPickerElement. 16 This is added into a shadow tree of a date-type control. It uses 17 RenderDetailsMarker. 18 19 We're going to add click handler and so on to CalendarPickerElement. 20 21 Test: fast/forms/date/date-appearance.html 22 23 * WebCore.gypi: Add CalendarPickerElement.{cpp,h} 24 * css/html.css: 25 (input::-webkit-calendar-picker-indicator): 26 * html/DateInputType.cpp: 27 (WebCore::DateInputType::createShadowSubtree): Insert CalendarPickerElement. 28 (WebCore::DateInputType::needsContainer): 29 Alwyas return true because we have an extra decoration element. 30 (WebCore::DateInputType::shouldHaveSpinButton): 31 Always return false to disable spin button. 32 * html/DateInputType.h: 33 (DateInputType): Add declarations. 34 * html/TextFieldInputType.cpp: 35 (WebCore::TextFieldInputType::shouldHaveSpinButton): 36 (WebCore::TextFieldInputType::createShadowSubtree): Move some code to shouldHaveSpinButton(). 37 * html/TextFieldInputType.h: 38 (TextFieldInputType): Add a declartion. 39 * html/shadow/CalendarPickerElement.cpp: 40 (WebCore::CalendarPickerElement::CalendarPickerElement): 41 (WebCore::CalendarPickerElement::create): 42 (WebCore::CalendarPickerElement::createRenderer): Creates RenderDetailsMarker. 43 * html/shadow/CalendarPickerElement.h: Added. 44 * rendering/RenderDetailsMarker.cpp: 45 (WebCore::RenderDetailsMarker::isOpen): Always show a down arrow if this is in <input>. 46 * rendering/RenderDetailsMarker.h: 47 1 48 2012-04-02 Andrey Kosyakov <caseq@chromium.org> 2 49 -
trunk/Source/WebCore/WebCore.gypi
r112834 r112839 5698 5698 'html/parser/XSSAuditor.cpp', 5699 5699 'html/parser/XSSAuditor.h', 5700 'html/shadow/CalendarPickerElement.cpp', 5701 'html/shadow/CalendarPickerElement.h', 5700 5702 'html/shadow/ContentSelectorQuery.cpp', 5701 5703 'html/shadow/ContentSelectorQuery.h', -
trunk/Source/WebCore/css/html.css
r112658 r112839 669 669 #endif // defined(ENABLE_INPUT_TYPE_COLOR) && ENABLE_INPUT_TYPE_COLOR 670 670 671 #if defined(ENABLE_CALENDAR_PICKER) && ENABLE_CALENDAR_PICKER 672 input::-webkit-calendar-picker-indicator { 673 display: inline-block; 674 width: 0.66em; 675 height: 0.66em; 676 -webkit-margin-end: 0.2em; 677 } 678 #endif // ENABLE_CALENDAR_PICKER 679 671 680 select { 672 681 -webkit-appearance: menulist; -
trunk/Source/WebCore/html/DateInputType.cpp
r96678 r112839 32 32 #include "DateInputType.h" 33 33 34 #include "CalendarPickerElement.h" 34 35 #include "DateComponents.h" 35 36 #include "HTMLInputElement.h" … … 99 100 } 100 101 102 #if ENABLE(CALENDAR_PICKER) 103 void DateInputType::createShadowSubtree() 104 { 105 BaseDateAndTimeInputType::createShadowSubtree(); 106 containerElement()->insertBefore(CalendarPickerElement::create(element()->document()), innerBlockElement()->nextSibling(), ASSERT_NO_EXCEPTION); 107 } 108 109 bool DateInputType::needsContainer() const 110 { 111 return true; 112 } 113 114 bool DateInputType::shouldHaveSpinButton() const 115 { 116 return false; 117 } 118 #endif // ENABLE(CALENDAR_PICKER) 119 101 120 } // namespace WebCore 102 121 -
trunk/Source/WebCore/html/DateInputType.h
r103400 r112839 53 53 virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const OVERRIDE; 54 54 virtual bool setMillisecondToDateComponents(double, DateComponents*) const OVERRIDE; 55 #if ENABLE(CALENDAR_PICKER) 56 virtual void createShadowSubtree() OVERRIDE; 57 58 // TextFieldInputType functions 59 virtual bool needsContainer() const OVERRIDE; 60 virtual bool shouldHaveSpinButton() const OVERRIDE; 61 #endif 55 62 }; 56 63 -
trunk/Source/WebCore/html/TextFieldInputType.cpp
r111930 r112839 213 213 } 214 214 215 bool TextFieldInputType::shouldHaveSpinButton() const 216 { 217 Document* document = element()->document(); 218 RefPtr<RenderTheme> theme = document->page() ? document->page()->theme() : RenderTheme::defaultTheme(); 219 return theme->shouldHaveSpinButton(element()); 220 } 221 215 222 void TextFieldInputType::createShadowSubtree() 216 223 { … … 222 229 223 230 Document* document = element()->document(); 224 RefPtr<RenderTheme> theme = document->page() ? document->page()->theme() : RenderTheme::defaultTheme();225 231 ChromeClient* chromeClient = document->page() ? document->page()->chrome()->client() : 0; 226 bool shouldHaveSpinButton = theme->shouldHaveSpinButton(element());227 232 bool shouldAddDecorations = chromeClient && chromeClient->willAddTextFieldDecorationsTo(element()); 233 bool shouldHaveSpinButton = this->shouldHaveSpinButton(); 228 234 bool createsContainer = shouldHaveSpinButton || needsContainer() || shouldAddDecorations; 229 235 -
trunk/Source/WebCore/html/TextFieldInputType.h
r108051 r112839 60 60 protected: 61 61 virtual bool needsContainer() const; 62 virtual bool shouldHaveSpinButton() const; 62 63 virtual void createShadowSubtree() OVERRIDE; 63 64 virtual void destroyShadowSubtree() OVERRIDE; -
trunk/Source/WebCore/html/shadow/CalendarPickerElement.cpp
r112838 r112839 1 1 /* 2 * Copyright (C) 201 0Google Inc. All rights reserved.2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 */ 30 30 31 #i fndef DateInputType_h32 # define DateInputType_h31 #include "config.h" 32 #include "CalendarPickerElement.h" 33 33 34 #i nclude "BaseDateAndTimeInputType.h"34 #if ENABLE(CALENDAR_PICKER) 35 35 36 #if ENABLE(INPUT_TYPE_DATE) 36 #include "HTMLNames.h" 37 #include "RenderDetailsMarker.h" 37 38 38 39 namespace WebCore { 39 40 40 class DateInputType : public BaseDateAndTimeInputType { 41 public: 42 static PassOwnPtr<InputType> create(HTMLInputElement*); 41 using namespace HTMLNames; 43 42 44 private: 45 DateInputType(HTMLInputElement* element) : BaseDateAndTimeInputType(element) { } 46 virtual const AtomicString& formControlType() const OVERRIDE; 47 virtual DateComponents::Type dateType() const OVERRIDE; 48 virtual double minimum() const OVERRIDE; 49 virtual double maximum() const OVERRIDE; 50 virtual double defaultStep() const OVERRIDE; 51 virtual double stepScaleFactor() const OVERRIDE; 52 virtual bool parsedStepValueShouldBeInteger() const OVERRIDE; 53 virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const OVERRIDE; 54 virtual bool setMillisecondToDateComponents(double, DateComponents*) const OVERRIDE; 55 }; 43 inline CalendarPickerElement::CalendarPickerElement(Document* document) 44 : HTMLDivElement(divTag, document) 45 { 46 setShadowPseudoId("-webkit-calendar-picker-indicator"); 47 } 56 48 57 } // namespace WebCore 49 PassRefPtr<CalendarPickerElement> CalendarPickerElement::create(Document* document) 50 { 51 return adoptRef(new CalendarPickerElement(document)); 52 } 53 54 RenderObject* CalendarPickerElement::createRenderer(RenderArena* arena, RenderStyle*) 55 { 56 return new (arena) RenderDetailsMarker(this); 57 } 58 59 } 58 60 59 61 #endif 60 #endif // DateInputType_h -
trunk/Source/WebCore/html/shadow/CalendarPickerElement.h
r112838 r112839 1 1 /* 2 * Copyright (C) 201 0Google Inc. All rights reserved.2 * Copyright (C) 2012 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 */ 30 30 31 #ifndef DateInputType_h32 #define DateInputType_h31 #ifndef CalendarPickerElement_h 32 #define CalendarPickerElement_h 33 33 34 #include "BaseDateAndTimeInputType.h" 35 36 #if ENABLE(INPUT_TYPE_DATE) 34 #include "HTMLDivElement.h" 37 35 38 36 namespace WebCore { 39 37 40 class DateInputType : public BaseDateAndTimeInputType{38 class CalendarPickerElement : public HTMLDivElement { 41 39 public: 42 static Pass OwnPtr<InputType> create(HTMLInputElement*);40 static PassRefPtr<CalendarPickerElement> create(Document*); 43 41 44 42 private: 45 DateInputType(HTMLInputElement* element) : BaseDateAndTimeInputType(element) { } 46 virtual const AtomicString& formControlType() const OVERRIDE; 47 virtual DateComponents::Type dateType() const OVERRIDE; 48 virtual double minimum() const OVERRIDE; 49 virtual double maximum() const OVERRIDE; 50 virtual double defaultStep() const OVERRIDE; 51 virtual double stepScaleFactor() const OVERRIDE; 52 virtual bool parsedStepValueShouldBeInteger() const OVERRIDE; 53 virtual bool parseToDateComponentsInternal(const UChar*, unsigned length, DateComponents*) const OVERRIDE; 54 virtual bool setMillisecondToDateComponents(double, DateComponents*) const OVERRIDE; 43 CalendarPickerElement(Document*); 44 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) OVERRIDE; 45 // FIXME: add click handling. 55 46 }; 56 47 57 } // namespace WebCore 58 48 } 59 49 #endif 60 #endif // DateInputType_h -
trunk/Source/WebCore/rendering/RenderDetailsMarker.cpp
r109192 r112839 22 22 #include "RenderDetailsMarker.h" 23 23 24 #if ENABLE(DETAILS) 24 #if ENABLE(DETAILS) || ENABLE(CALENDAR_PICKER) 25 25 26 26 #include "Element.h" … … 141 141 { 142 142 for (RenderObject* renderer = parent(); renderer; renderer = renderer->parent()) { 143 if (renderer->node() && renderer->node()->hasTagName(detailsTag)) 143 if (!renderer->node()) 144 continue; 145 if (renderer->node()->hasTagName(detailsTag)) 144 146 return !toElement(renderer->node())->getAttribute(openAttr).isNull(); 147 if (renderer->node()->hasTagName(inputTag)) 148 return true; 145 149 } 146 150 -
trunk/Source/WebCore/rendering/RenderDetailsMarker.h
r109192 r112839 22 22 #define RenderDetailsMarker_h 23 23 24 #if ENABLE(DETAILS) 24 #if ENABLE(DETAILS) || ENABLE(CALENDAR_PICKER) 25 25 26 26 #include "RenderBlock.h" -
trunk/Source/WebKit/chromium/ChangeLog
r112834 r112839 1 2012-04-02 Kent Tamura <tkent@chromium.org> 2 3 Add a calendar picker indicator to date-type input fields 4 https://bugs.webkit.org/show_bug.cgi?id=80478 5 6 Reviewed by Hajime Morita. 7 8 * features.gypi: Enable CALENDAR_PICKER for non-Android platforms. This 9 doesn't affect any bahevior because INPUT_TYPE_DATE is disabled. 10 1 11 2012-04-02 Adam Barth <abarth@webkit.org> 2 12 -
trunk/Source/WebKit/chromium/features.gypi
r112658 r112839 131 131 ['OS=="android"', { 132 132 'feature_defines': [ 133 'ENABLE_CALENDAR_PICKER=0', 133 134 'ENABLE_WEB_AUDIO=0', 134 135 ], 135 136 }, { 136 137 'feature_defines': [ 138 'ENABLE_CALENDAR_PICKER=1', 137 139 'ENABLE_WEB_AUDIO=1', 138 140 ],
Note: See TracChangeset
for help on using the changeset viewer.