Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: Source/core/html/BaseMultipleFieldsDateAndTimeInputType.cpp

Issue 14859003: Remove the compile time flag for DATALIST Element. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebasing after r150849 Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/features.gypi ('k') | Source/core/html/ColorInputType.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 32 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
33 #include "core/html/BaseMultipleFieldsDateAndTimeInputType.h" 33 #include "core/html/BaseMultipleFieldsDateAndTimeInputType.h"
34 34
35 #include "CSSValueKeywords.h" 35 #include "CSSValueKeywords.h"
36 #include "RuntimeEnabledFeatures.h"
36 #include "core/dom/KeyboardEvent.h" 37 #include "core/dom/KeyboardEvent.h"
37 #include "core/dom/NodeTraversal.h" 38 #include "core/dom/NodeTraversal.h"
38 #include "core/dom/shadow/ElementShadow.h" 39 #include "core/dom/shadow/ElementShadow.h"
39 #include "core/dom/shadow/ShadowRoot.h" 40 #include "core/dom/shadow/ShadowRoot.h"
40 #include "core/html/DateTimeFieldsState.h" 41 #include "core/html/DateTimeFieldsState.h"
41 #include "core/html/FormController.h" 42 #include "core/html/FormController.h"
42 #include "core/html/HTMLDataListElement.h" 43 #include "core/html/HTMLDataListElement.h"
43 #include "core/html/HTMLInputElement.h" 44 #include "core/html/HTMLInputElement.h"
44 #include "core/html/HTMLOptionElement.h" 45 #include "core/html/HTMLOptionElement.h"
45 #include "core/html/shadow/PickerIndicatorElement.h" 46 #include "core/html/shadow/PickerIndicatorElement.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 301
301 RefPtr<ClearButtonElement> clearButton = ClearButtonElement::create(document , *this); 302 RefPtr<ClearButtonElement> clearButton = ClearButtonElement::create(document , *this);
302 m_clearButton = clearButton.get(); 303 m_clearButton = clearButton.get();
303 container->appendChild(clearButton); 304 container->appendChild(clearButton);
304 305
305 RefPtr<SpinButtonElement> spinButton = SpinButtonElement::create(document, * this); 306 RefPtr<SpinButtonElement> spinButton = SpinButtonElement::create(document, * this);
306 m_spinButtonElement = spinButton.get(); 307 m_spinButtonElement = spinButton.get();
307 container->appendChild(spinButton); 308 container->appendChild(spinButton);
308 309
309 bool shouldAddPickerIndicator = false; 310 bool shouldAddPickerIndicator = false;
310 #if ENABLE(DATALIST_ELEMENT)
311 if (InputType::themeSupportsDataListUI(this)) 311 if (InputType::themeSupportsDataListUI(this))
312 shouldAddPickerIndicator = true; 312 shouldAddPickerIndicator = true;
313 #endif
314 RefPtr<RenderTheme> theme = document->page() ? document->page()->theme() : R enderTheme::defaultTheme(); 313 RefPtr<RenderTheme> theme = document->page() ? document->page()->theme() : R enderTheme::defaultTheme();
315 if (theme->supportsCalendarPicker(formControlType())) { 314 if (theme->supportsCalendarPicker(formControlType())) {
316 shouldAddPickerIndicator = true; 315 shouldAddPickerIndicator = true;
317 m_pickerIndicatorIsAlwaysVisible = true; 316 m_pickerIndicatorIsAlwaysVisible = true;
318 } 317 }
319 if (shouldAddPickerIndicator) { 318 if (shouldAddPickerIndicator) {
320 RefPtr<PickerIndicatorElement> pickerElement = PickerIndicatorElement::c reate(document, *this); 319 RefPtr<PickerIndicatorElement> pickerElement = PickerIndicatorElement::c reate(document, *this);
321 m_pickerIndicatorElement = pickerElement.get(); 320 m_pickerIndicatorElement = pickerElement.get();
322 container->appendChild(m_pickerIndicatorElement); 321 container->appendChild(m_pickerIndicatorElement);
323 m_pickerIndicatorIsVisible = true; 322 m_pickerIndicatorIsVisible = true;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 m_dateTimeEditElement->setEmptyValue(layoutParameters, date); 500 m_dateTimeEditElement->setEmptyValue(layoutParameters, date);
502 updateClearButtonVisibility(); 501 updateClearButtonVisibility();
503 } 502 }
504 503
505 void BaseMultipleFieldsDateAndTimeInputType::valueAttributeChanged() 504 void BaseMultipleFieldsDateAndTimeInputType::valueAttributeChanged()
506 { 505 {
507 if (!element()->hasDirtyValue()) 506 if (!element()->hasDirtyValue())
508 updateInnerTextValue(); 507 updateInnerTextValue();
509 } 508 }
510 509
511 #if ENABLE(DATALIST_ELEMENT)
512 void BaseMultipleFieldsDateAndTimeInputType::listAttributeTargetChanged() 510 void BaseMultipleFieldsDateAndTimeInputType::listAttributeTargetChanged()
513 { 511 {
514 updatePickerIndicatorVisibility(); 512 updatePickerIndicatorVisibility();
515 } 513 }
516 #endif
517 514
518 void BaseMultipleFieldsDateAndTimeInputType::updatePickerIndicatorVisibility() 515 void BaseMultipleFieldsDateAndTimeInputType::updatePickerIndicatorVisibility()
519 { 516 {
520 if (m_pickerIndicatorIsAlwaysVisible) { 517 if (m_pickerIndicatorIsAlwaysVisible) {
521 showPickerIndicator(); 518 showPickerIndicator();
522 return; 519 return;
523 } 520 }
524 #if ENABLE(DATALIST_ELEMENT) 521 if (RuntimeEnabledFeatures::dataListElementEnabled()) {
525 if (HTMLDataListElement* dataList = element()->dataList()) { 522 if (HTMLDataListElement* dataList = element()->dataList()) {
526 RefPtr<HTMLCollection> options = dataList->options(); 523 RefPtr<HTMLCollection> options = dataList->options();
527 for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement(opt ions->item(i)); ++i) { 524 for (unsigned i = 0; HTMLOptionElement* option = toHTMLOptionElement (options->item(i)); ++i) {
528 if (element()->isValidValue(option->value())) { 525 if (element()->isValidValue(option->value())) {
529 showPickerIndicator(); 526 showPickerIndicator();
530 return; 527 return;
528 }
531 } 529 }
532 } 530 }
531 hidePickerIndicator();
533 } 532 }
534 hidePickerIndicator();
535 #endif
536 } 533 }
537 534
538 void BaseMultipleFieldsDateAndTimeInputType::hidePickerIndicator() 535 void BaseMultipleFieldsDateAndTimeInputType::hidePickerIndicator()
539 { 536 {
540 if (!m_pickerIndicatorIsVisible) 537 if (!m_pickerIndicatorIsVisible)
541 return; 538 return;
542 m_pickerIndicatorIsVisible = false; 539 m_pickerIndicatorIsVisible = false;
543 ASSERT(m_pickerIndicatorElement); 540 ASSERT(m_pickerIndicatorElement);
544 m_pickerIndicatorElement->setInlineStyleProperty(CSSPropertyDisplay, CSSValu eNone); 541 m_pickerIndicatorElement->setInlineStyleProperty(CSSPropertyDisplay, CSSValu eNone);
545 } 542 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 582
586 if (element()->isRequired() || !m_dateTimeEditElement->anyEditableFieldsHave Values()) 583 if (element()->isRequired() || !m_dateTimeEditElement->anyEditableFieldsHave Values())
587 m_clearButton->setInlineStyleProperty(CSSPropertyVisibility, CSSValueHid den); 584 m_clearButton->setInlineStyleProperty(CSSPropertyVisibility, CSSValueHid den);
588 else 585 else
589 m_clearButton->removeInlineStyleProperty(CSSPropertyVisibility); 586 m_clearButton->removeInlineStyleProperty(CSSPropertyVisibility);
590 } 587 }
591 588
592 } // namespace WebCore 589 } // namespace WebCore
593 590
594 #endif 591 #endif
OLDNEW
« no previous file with comments | « Source/core/features.gypi ('k') | Source/core/html/ColorInputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698