| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "core/rendering/RenderDetailsMarker.h" | 52 #include "core/rendering/RenderDetailsMarker.h" |
| 53 #include "core/rendering/RenderLayer.h" | 53 #include "core/rendering/RenderLayer.h" |
| 54 #include "core/rendering/RenderTextControlSingleLine.h" | 54 #include "core/rendering/RenderTextControlSingleLine.h" |
| 55 #include "core/rendering/RenderTheme.h" | 55 #include "core/rendering/RenderTheme.h" |
| 56 #include "wtf/text/WTFString.h" | 56 #include "wtf/text/WTFString.h" |
| 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 RenderObject* createRenderer(RenderStyle*) OVERRIDE | 67 virtual RenderObject* createRenderer(RenderStyle*) override |
| 68 { | 68 { |
| 69 return new RenderDetailsMarker(this); | 69 return new RenderDetailsMarker(this); |
| 70 } | 70 } |
| 71 | 71 |
| 72 virtual void* preDispatchEventHandler(Event* event) OVERRIDE | 72 virtual 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 0; | 80 return 0; |
| 81 } | 81 } |
| 82 | 82 |
| 83 virtual void defaultEventHandler(Event* event) OVERRIDE | 83 virtual 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()->chrome().openTextDataListChooser(*host); | 90 document().frameHost()->chrome().openTextDataListChooser(*host); |
| 91 event->setDefaultHandled(); | 91 event->setDefaultHandled(); |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 | 94 |
| 95 virtual bool willRespondToMouseClickEvents() OVERRIDE | 95 virtual 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 return shouldSpinButtonRespondToMouseEvents() && element().focused(); | 549 return shouldSpinButtonRespondToMouseEvents() && element().focused(); |
| 550 } | 550 } |
| 551 | 551 |
| 552 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve
ntDispatch eventDispatch) | 552 void TextFieldInputType::spinButtonDidReleaseMouseCapture(SpinButtonElement::Eve
ntDispatch eventDispatch) |
| 553 { | 553 { |
| 554 if (eventDispatch == SpinButtonElement::EventDispatchAllowed) | 554 if (eventDispatch == SpinButtonElement::EventDispatchAllowed) |
| 555 element().dispatchFormControlChangeEvent(); | 555 element().dispatchFormControlChangeEvent(); |
| 556 } | 556 } |
| 557 | 557 |
| 558 } // namespace blink | 558 } // namespace blink |
| OLD | NEW |