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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLInputElement.cpp

Issue 2809543002: bindings: Pass is_null flag to attribute setters when they are nullable (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 * rights reserved. 6 * rights reserved.
7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
9 * Copyright (C) 2010 Google Inc. All rights reserved. 9 * Copyright (C) 2010 Google Inc. All rights reserved.
10 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. 10 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved.
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 String HTMLInputElement::selectionDirectionForBinding( 569 String HTMLInputElement::selectionDirectionForBinding(
570 ExceptionState& exception_state) const { 570 ExceptionState& exception_state) const {
571 if (!input_type_->SupportsSelectionAPI()) { 571 if (!input_type_->SupportsSelectionAPI()) {
572 return String(); 572 return String();
573 } 573 }
574 return TextControlElement::selectionDirection(); 574 return TextControlElement::selectionDirection();
575 } 575 }
576 576
577 void HTMLInputElement::setSelectionStartForBinding( 577 void HTMLInputElement::setSelectionStartForBinding(
578 unsigned start, 578 unsigned start,
579 bool is_null,
579 ExceptionState& exception_state) { 580 ExceptionState& exception_state) {
580 if (!input_type_->SupportsSelectionAPI()) { 581 if (!input_type_->SupportsSelectionAPI()) {
581 exception_state.ThrowDOMException(kInvalidStateError, 582 exception_state.ThrowDOMException(kInvalidStateError,
582 "The input element's type ('" + 583 "The input element's type ('" +
583 input_type_->FormControlType() + 584 input_type_->FormControlType() +
584 "') does not support selection."); 585 "') does not support selection.");
585 return; 586 return;
586 } 587 }
587 TextControlElement::setSelectionStart(start); 588 TextControlElement::setSelectionStart(start);
588 } 589 }
589 590
590 void HTMLInputElement::setSelectionEndForBinding( 591 void HTMLInputElement::setSelectionEndForBinding(
591 unsigned end, 592 unsigned end,
593 bool is_null,
592 ExceptionState& exception_state) { 594 ExceptionState& exception_state) {
593 if (!input_type_->SupportsSelectionAPI()) { 595 if (!input_type_->SupportsSelectionAPI()) {
594 exception_state.ThrowDOMException(kInvalidStateError, 596 exception_state.ThrowDOMException(kInvalidStateError,
595 "The input element's type ('" + 597 "The input element's type ('" +
596 input_type_->FormControlType() + 598 input_type_->FormControlType() +
597 "') does not support selection."); 599 "') does not support selection.");
598 return; 600 return;
599 } 601 }
600 TextControlElement::setSelectionEnd(end); 602 TextControlElement::setSelectionEnd(end);
601 } 603 }
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 input_type_view_->UpdateView(); 1125 input_type_view_->UpdateView();
1124 } 1126 }
1125 1127
1126 double HTMLInputElement::valueAsDate(bool& is_null) const { 1128 double HTMLInputElement::valueAsDate(bool& is_null) const {
1127 double date = input_type_->ValueAsDate(); 1129 double date = input_type_->ValueAsDate();
1128 is_null = !std::isfinite(date); 1130 is_null = !std::isfinite(date);
1129 return date; 1131 return date;
1130 } 1132 }
1131 1133
1132 void HTMLInputElement::setValueAsDate(double value, 1134 void HTMLInputElement::setValueAsDate(double value,
1135 bool is_null,
1133 ExceptionState& exception_state) { 1136 ExceptionState& exception_state) {
1134 input_type_->SetValueAsDate(value, exception_state); 1137 input_type_->SetValueAsDate(value, exception_state);
1135 } 1138 }
1136 1139
1137 double HTMLInputElement::valueAsNumber() const { 1140 double HTMLInputElement::valueAsNumber() const {
1138 return input_type_->ValueAsDouble(); 1141 return input_type_->ValueAsDouble();
1139 } 1142 }
1140 1143
1141 void HTMLInputElement::setValueAsNumber(double new_value, 1144 void HTMLInputElement::setValueAsNumber(double new_value,
1142 ExceptionState& exception_state, 1145 ExceptionState& exception_state,
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 1887
1885 bool HTMLInputElement::HasFallbackContent() const { 1888 bool HTMLInputElement::HasFallbackContent() const {
1886 return input_type_view_->HasFallbackContent(); 1889 return input_type_view_->HasFallbackContent();
1887 } 1890 }
1888 1891
1889 void HTMLInputElement::SetFilesFromPaths(const Vector<String>& paths) { 1892 void HTMLInputElement::SetFilesFromPaths(const Vector<String>& paths) {
1890 return input_type_->SetFilesFromPaths(paths); 1893 return input_type_->SetFilesFromPaths(paths);
1891 } 1894 }
1892 1895
1893 } // namespace blink 1896 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698