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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 namespace blink { | 58 namespace blink { |
59 | 59 |
60 using namespace HTMLNames; | 60 using namespace HTMLNames; |
61 | 61 |
62 class DataListIndicatorElement final : public HTMLDivElement { | 62 class DataListIndicatorElement final : public HTMLDivElement { |
63 private: | 63 private: |
64 inline DataListIndicatorElement(Document& document) : HTMLDivElement(documen
t) { } | 64 inline DataListIndicatorElement(Document& document) : HTMLDivElement(documen
t) { } |
65 inline HTMLInputElement* hostInput() const { return toHTMLInputElement(shado
wHost()); } | 65 inline HTMLInputElement* hostInput() const { return toHTMLInputElement(shado
wHost()); } |
66 | 66 |
67 virtual LayoutObject* createLayoutObject(const ComputedStyle&) override | 67 LayoutObject* createLayoutObject(const ComputedStyle&) override |
68 { | 68 { |
69 return new LayoutDetailsMarker(this); | 69 return new LayoutDetailsMarker(this); |
70 } | 70 } |
71 | 71 |
72 virtual void* preDispatchEventHandler(Event* event) override | 72 void* preDispatchEventHandler(Event* event) override |
73 { | 73 { |
74 // Chromium opens autofill popup in a mousedown event listener | 74 // Chromium opens autofill popup in a mousedown event listener |
75 // associated to the document. We don't want to open it in this case | 75 // associated to the document. We don't want to open it in this case |
76 // because we opens a datalist chooser later. | 76 // because we opens a datalist chooser later. |
77 // FIXME: We should dispatch mousedown events even in such case. | 77 // FIXME: We should dispatch mousedown events even in such case. |
78 if (event->type() == EventTypeNames::mousedown) | 78 if (event->type() == EventTypeNames::mousedown) |
79 event->stopPropagation(); | 79 event->stopPropagation(); |
80 return nullptr; | 80 return nullptr; |
81 } | 81 } |
82 | 82 |
83 virtual void defaultEventHandler(Event* event) override | 83 void defaultEventHandler(Event* event) override |
84 { | 84 { |
85 ASSERT(document().isActive()); | 85 ASSERT(document().isActive()); |
86 if (event->type() != EventTypeNames::click) | 86 if (event->type() != EventTypeNames::click) |
87 return; | 87 return; |
88 HTMLInputElement* host = hostInput(); | 88 HTMLInputElement* host = hostInput(); |
89 if (host && !host->isDisabledOrReadOnly()) { | 89 if (host && !host->isDisabledOrReadOnly()) { |
90 document().frameHost()->chromeClient().openTextDataListChooser(*host
); | 90 document().frameHost()->chromeClient().openTextDataListChooser(*host
); |
91 event->setDefaultHandled(); | 91 event->setDefaultHandled(); |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 virtual bool willRespondToMouseClickEvents() override | 95 bool willRespondToMouseClickEvents() override |
96 { | 96 { |
97 return hostInput() && !hostInput()->isDisabledOrReadOnly() && document()
.isActive(); | 97 return hostInput() && !hostInput()->isDisabledOrReadOnly() && document()
.isActive(); |
98 } | 98 } |
99 | 99 |
100 public: | 100 public: |
101 static PassRefPtrWillBeRawPtr<DataListIndicatorElement> create(Document& doc
ument) | 101 static PassRefPtrWillBeRawPtr<DataListIndicatorElement> create(Document& doc
ument) |
102 { | 102 { |
103 RefPtrWillBeRawPtr<DataListIndicatorElement> element = adoptRefWillBeNoo
p(new DataListIndicatorElement(document)); | 103 RefPtrWillBeRawPtr<DataListIndicatorElement> element = adoptRefWillBeNoo
p(new DataListIndicatorElement(document)); |
104 element->setShadowPseudoId(AtomicString("-webkit-calendar-picker-indicat
or", AtomicString::ConstructFromLiteral)); | 104 element->setShadowPseudoId(AtomicString("-webkit-calendar-picker-indicat
or", AtomicString::ConstructFromLiteral)); |
105 element->setAttribute(idAttr, ShadowElementNames::pickerIndicator()); | 105 element->setAttribute(idAttr, ShadowElementNames::pickerIndicator()); |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 return shouldSpinButtonRespondToMouseEvents() && element().focused(); | 559 return shouldSpinButtonRespondToMouseEvents() && element().focused(); |
560 } | 560 } |
561 | 561 |
562 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve
ntDispatch eventDispatch) | 562 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve
ntDispatch eventDispatch) |
563 { | 563 { |
564 if (eventDispatch == SpinButtonElement::EventDispatchAllowed) | 564 if (eventDispatch == SpinButtonElement::EventDispatchAllowed) |
565 element().dispatchFormControlChangeEvent(); | 565 element().dispatchFormControlChangeEvent(); |
566 } | 566 } |
567 | 567 |
568 } // namespace blink | 568 } // namespace blink |
OLD | NEW |