OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 16 matching lines...) Expand all Loading... |
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
32 #include "config.h" | 32 #include "config.h" |
33 #include "core/html/forms/TextFieldInputType.h" | 33 #include "core/html/forms/TextFieldInputType.h" |
34 | 34 |
35 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 35 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
36 #include "core/HTMLNames.h" | 36 #include "core/HTMLNames.h" |
37 #include "core/dom/NodeLayoutStyle.h" | 37 #include "core/dom/NodeComputedStyle.h" |
38 #include "core/dom/shadow/ShadowRoot.h" | 38 #include "core/dom/shadow/ShadowRoot.h" |
39 #include "core/editing/FrameSelection.h" | 39 #include "core/editing/FrameSelection.h" |
40 #include "core/editing/iterators/TextIterator.h" | 40 #include "core/editing/iterators/TextIterator.h" |
41 #include "core/events/BeforeTextInsertedEvent.h" | 41 #include "core/events/BeforeTextInsertedEvent.h" |
42 #include "core/events/KeyboardEvent.h" | 42 #include "core/events/KeyboardEvent.h" |
43 #include "core/events/TextEvent.h" | 43 #include "core/events/TextEvent.h" |
44 #include "core/frame/FrameHost.h" | 44 #include "core/frame/FrameHost.h" |
45 #include "core/frame/LocalFrame.h" | 45 #include "core/frame/LocalFrame.h" |
46 #include "core/html/FormDataList.h" | 46 #include "core/html/FormDataList.h" |
47 #include "core/html/HTMLInputElement.h" | 47 #include "core/html/HTMLInputElement.h" |
(...skipping 10 matching lines...) Expand all Loading... |
58 | 58 |
59 namespace blink { | 59 namespace blink { |
60 | 60 |
61 using namespace HTMLNames; | 61 using namespace HTMLNames; |
62 | 62 |
63 class DataListIndicatorElement final : public HTMLDivElement { | 63 class DataListIndicatorElement final : public HTMLDivElement { |
64 private: | 64 private: |
65 inline DataListIndicatorElement(Document& document) : HTMLDivElement(documen
t) { } | 65 inline DataListIndicatorElement(Document& document) : HTMLDivElement(documen
t) { } |
66 inline HTMLInputElement* hostInput() const { return toHTMLInputElement(shado
wHost()); } | 66 inline HTMLInputElement* hostInput() const { return toHTMLInputElement(shado
wHost()); } |
67 | 67 |
68 virtual LayoutObject* createLayoutObject(const LayoutStyle&) override | 68 virtual LayoutObject* createLayoutObject(const ComputedStyle&) override |
69 { | 69 { |
70 return new LayoutDetailsMarker(this); | 70 return new LayoutDetailsMarker(this); |
71 } | 71 } |
72 | 72 |
73 virtual void* preDispatchEventHandler(Event* event) override | 73 virtual void* preDispatchEventHandler(Event* event) override |
74 { | 74 { |
75 // Chromium opens autofill popup in a mousedown event listener | 75 // Chromium opens autofill popup in a mousedown event listener |
76 // associated to the document. We don't want to open it in this case | 76 // associated to the document. We don't want to open it in this case |
77 // because we opens a datalist chooser later. | 77 // because we opens a datalist chooser later. |
78 // FIXME: We should dispatch mousedown events even in such case. | 78 // FIXME: We should dispatch mousedown events even in such case. |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 element().endEditing(); | 261 element().endEditing(); |
262 if (SpinButtonElement *spinButton = spinButtonElement()) | 262 if (SpinButtonElement *spinButton = spinButtonElement()) |
263 spinButton->releaseCapture(); | 263 spinButton->releaseCapture(); |
264 } | 264 } |
265 | 265 |
266 bool TextFieldInputType::shouldSubmitImplicitly(Event* event) | 266 bool TextFieldInputType::shouldSubmitImplicitly(Event* event) |
267 { | 267 { |
268 return (event->type() == EventTypeNames::textInput && event->hasInterface(Ev
entNames::TextEvent) && toTextEvent(event)->data() == "\n") || InputType::should
SubmitImplicitly(event); | 268 return (event->type() == EventTypeNames::textInput && event->hasInterface(Ev
entNames::TextEvent) && toTextEvent(event)->data() == "\n") || InputType::should
SubmitImplicitly(event); |
269 } | 269 } |
270 | 270 |
271 LayoutObject* TextFieldInputType::createLayoutObject(const LayoutStyle&) const | 271 LayoutObject* TextFieldInputType::createLayoutObject(const ComputedStyle&) const |
272 { | 272 { |
273 return new LayoutTextControlSingleLine(&element()); | 273 return new LayoutTextControlSingleLine(&element()); |
274 } | 274 } |
275 | 275 |
276 bool TextFieldInputType::shouldHaveSpinButton() const | 276 bool TextFieldInputType::shouldHaveSpinButton() const |
277 { | 277 { |
278 return LayoutTheme::theme().shouldHaveSpinButton(&element()); | 278 return LayoutTheme::theme().shouldHaveSpinButton(&element()); |
279 } | 279 } |
280 | 280 |
281 void TextFieldInputType::createShadowSubtree() | 281 void TextFieldInputType::createShadowSubtree() |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 return shouldSpinButtonRespondToMouseEvents() && element().focused(); | 553 return shouldSpinButtonRespondToMouseEvents() && element().focused(); |
554 } | 554 } |
555 | 555 |
556 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve
ntDispatch eventDispatch) | 556 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve
ntDispatch eventDispatch) |
557 { | 557 { |
558 if (eventDispatch == SpinButtonElement::EventDispatchAllowed) | 558 if (eventDispatch == SpinButtonElement::EventDispatchAllowed) |
559 element().dispatchFormControlChangeEvent(); | 559 element().dispatchFormControlChangeEvent(); |
560 } | 560 } |
561 | 561 |
562 } // namespace blink | 562 } // namespace blink |
OLD | NEW |