| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 Google 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 | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "core/rendering/RenderView.h" | 42 #include "core/rendering/RenderView.h" |
| 43 #include "core/speech/SpeechInput.h" | 43 #include "core/speech/SpeechInput.h" |
| 44 #include "core/speech/SpeechInputEvent.h" | 44 #include "core/speech/SpeechInputEvent.h" |
| 45 #include "platform/UserGestureIndicator.h" | 45 #include "platform/UserGestureIndicator.h" |
| 46 | 46 |
| 47 namespace WebCore { | 47 namespace WebCore { |
| 48 | 48 |
| 49 using namespace HTMLNames; | 49 using namespace HTMLNames; |
| 50 | 50 |
| 51 TextControlInnerContainer::TextControlInnerContainer(Document& document) | 51 TextControlInnerContainer::TextControlInnerContainer(Document& document) |
| 52 : HTMLDivElement(divTag, document) | 52 : HTMLDivElement(document) |
| 53 { | 53 { |
| 54 } | 54 } |
| 55 | 55 |
| 56 PassRefPtr<TextControlInnerContainer> TextControlInnerContainer::create(Document
& document) | 56 PassRefPtr<TextControlInnerContainer> TextControlInnerContainer::create(Document
& document) |
| 57 { | 57 { |
| 58 RefPtr<TextControlInnerContainer> element = adoptRef(new TextControlInnerCon
tainer(document)); | 58 RefPtr<TextControlInnerContainer> element = adoptRef(new TextControlInnerCon
tainer(document)); |
| 59 element->setAttribute(idAttr, ShadowElementNames::textFieldContainer()); | 59 element->setAttribute(idAttr, ShadowElementNames::textFieldContainer()); |
| 60 return element.release(); | 60 return element.release(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 RenderObject* TextControlInnerContainer::createRenderer(RenderStyle*) | 63 RenderObject* TextControlInnerContainer::createRenderer(RenderStyle*) |
| 64 { | 64 { |
| 65 return new RenderTextControlInnerContainer(this); | 65 return new RenderTextControlInnerContainer(this); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // --------------------------- | 68 // --------------------------- |
| 69 | 69 |
| 70 EditingViewPortElement::EditingViewPortElement(Document& document) | 70 EditingViewPortElement::EditingViewPortElement(Document& document) |
| 71 : HTMLDivElement(divTag, document) | 71 : HTMLDivElement(document) |
| 72 { | 72 { |
| 73 setHasCustomStyleCallbacks(); | 73 setHasCustomStyleCallbacks(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 PassRefPtr<EditingViewPortElement> EditingViewPortElement::create(Document& docu
ment) | 76 PassRefPtr<EditingViewPortElement> EditingViewPortElement::create(Document& docu
ment) |
| 77 { | 77 { |
| 78 RefPtr<EditingViewPortElement> element = adoptRef(new EditingViewPortElement
(document)); | 78 RefPtr<EditingViewPortElement> element = adoptRef(new EditingViewPortElement
(document)); |
| 79 element->setAttribute(idAttr, ShadowElementNames::editingViewPort()); | 79 element->setAttribute(idAttr, ShadowElementNames::editingViewPort()); |
| 80 return element.release(); | 80 return element.release(); |
| 81 } | 81 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 98 // read-only in case the input itself is editable. | 98 // read-only in case the input itself is editable. |
| 99 style->setUserModify(READ_ONLY); | 99 style->setUserModify(READ_ONLY); |
| 100 style->setUnique(); | 100 style->setUnique(); |
| 101 | 101 |
| 102 return style.release(); | 102 return style.release(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 // --------------------------- | 105 // --------------------------- |
| 106 | 106 |
| 107 inline TextControlInnerTextElement::TextControlInnerTextElement(Document& docume
nt) | 107 inline TextControlInnerTextElement::TextControlInnerTextElement(Document& docume
nt) |
| 108 : HTMLDivElement(divTag, document) | 108 : HTMLDivElement(document) |
| 109 { | 109 { |
| 110 setHasCustomStyleCallbacks(); | 110 setHasCustomStyleCallbacks(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 PassRefPtr<TextControlInnerTextElement> TextControlInnerTextElement::create(Docu
ment& document) | 113 PassRefPtr<TextControlInnerTextElement> TextControlInnerTextElement::create(Docu
ment& document) |
| 114 { | 114 { |
| 115 RefPtr<TextControlInnerTextElement> element = adoptRef(new TextControlInnerT
extElement(document)); | 115 RefPtr<TextControlInnerTextElement> element = adoptRef(new TextControlInnerT
extElement(document)); |
| 116 element->setAttribute(idAttr, ShadowElementNames::innerEditor()); | 116 element->setAttribute(idAttr, ShadowElementNames::innerEditor()); |
| 117 return element.release(); | 117 return element.release(); |
| 118 } | 118 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 146 RenderObject* parentRenderer = shadowHost()->renderer(); | 146 RenderObject* parentRenderer = shadowHost()->renderer(); |
| 147 if (!parentRenderer || !parentRenderer->isTextControl()) | 147 if (!parentRenderer || !parentRenderer->isTextControl()) |
| 148 return originalStyleForRenderer(); | 148 return originalStyleForRenderer(); |
| 149 RenderTextControl* textControlRenderer = toRenderTextControl(parentRenderer)
; | 149 RenderTextControl* textControlRenderer = toRenderTextControl(parentRenderer)
; |
| 150 return textControlRenderer->createInnerTextStyle(textControlRenderer->style(
)); | 150 return textControlRenderer->createInnerTextStyle(textControlRenderer->style(
)); |
| 151 } | 151 } |
| 152 | 152 |
| 153 // ---------------------------- | 153 // ---------------------------- |
| 154 | 154 |
| 155 inline SearchFieldDecorationElement::SearchFieldDecorationElement(Document& docu
ment) | 155 inline SearchFieldDecorationElement::SearchFieldDecorationElement(Document& docu
ment) |
| 156 : HTMLDivElement(divTag, document) | 156 : HTMLDivElement(document) |
| 157 { | 157 { |
| 158 } | 158 } |
| 159 | 159 |
| 160 PassRefPtr<SearchFieldDecorationElement> SearchFieldDecorationElement::create(Do
cument& document) | 160 PassRefPtr<SearchFieldDecorationElement> SearchFieldDecorationElement::create(Do
cument& document) |
| 161 { | 161 { |
| 162 RefPtr<SearchFieldDecorationElement> element = adoptRef(new SearchFieldDecor
ationElement(document)); | 162 RefPtr<SearchFieldDecorationElement> element = adoptRef(new SearchFieldDecor
ationElement(document)); |
| 163 element->setAttribute(idAttr, ShadowElementNames::searchDecoration()); | 163 element->setAttribute(idAttr, ShadowElementNames::searchDecoration()); |
| 164 return element.release(); | 164 return element.release(); |
| 165 } | 165 } |
| 166 | 166 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 194 } | 194 } |
| 195 | 195 |
| 196 bool SearchFieldDecorationElement::willRespondToMouseClickEvents() | 196 bool SearchFieldDecorationElement::willRespondToMouseClickEvents() |
| 197 { | 197 { |
| 198 return true; | 198 return true; |
| 199 } | 199 } |
| 200 | 200 |
| 201 // ---------------------------- | 201 // ---------------------------- |
| 202 | 202 |
| 203 inline SearchFieldCancelButtonElement::SearchFieldCancelButtonElement(Document&
document) | 203 inline SearchFieldCancelButtonElement::SearchFieldCancelButtonElement(Document&
document) |
| 204 : HTMLDivElement(divTag, document) | 204 : HTMLDivElement(document) |
| 205 , m_capturing(false) | 205 , m_capturing(false) |
| 206 { | 206 { |
| 207 } | 207 } |
| 208 | 208 |
| 209 PassRefPtr<SearchFieldCancelButtonElement> SearchFieldCancelButtonElement::creat
e(Document& document) | 209 PassRefPtr<SearchFieldCancelButtonElement> SearchFieldCancelButtonElement::creat
e(Document& document) |
| 210 { | 210 { |
| 211 RefPtr<SearchFieldCancelButtonElement> element = adoptRef(new SearchFieldCan
celButtonElement(document)); | 211 RefPtr<SearchFieldCancelButtonElement> element = adoptRef(new SearchFieldCan
celButtonElement(document)); |
| 212 element->setPart(AtomicString("-webkit-search-cancel-button", AtomicString::
ConstructFromLiteral)); | 212 element->setPart(AtomicString("-webkit-search-cancel-button", AtomicString::
ConstructFromLiteral)); |
| 213 element->setAttribute(idAttr, ShadowElementNames::clearButton()); | 213 element->setAttribute(idAttr, ShadowElementNames::clearButton()); |
| 214 return element.release(); | 214 return element.release(); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 return true; | 271 return true; |
| 272 | 272 |
| 273 return HTMLDivElement::willRespondToMouseClickEvents(); | 273 return HTMLDivElement::willRespondToMouseClickEvents(); |
| 274 } | 274 } |
| 275 | 275 |
| 276 // ---------------------------- | 276 // ---------------------------- |
| 277 | 277 |
| 278 #if ENABLE(INPUT_SPEECH) | 278 #if ENABLE(INPUT_SPEECH) |
| 279 | 279 |
| 280 inline InputFieldSpeechButtonElement::InputFieldSpeechButtonElement(Document& do
cument) | 280 inline InputFieldSpeechButtonElement::InputFieldSpeechButtonElement(Document& do
cument) |
| 281 : HTMLDivElement(divTag, document) | 281 : HTMLDivElement(document) |
| 282 , m_capturing(false) | 282 , m_capturing(false) |
| 283 , m_state(Idle) | 283 , m_state(Idle) |
| 284 , m_listenerId(0) | 284 , m_listenerId(0) |
| 285 { | 285 { |
| 286 } | 286 } |
| 287 | 287 |
| 288 InputFieldSpeechButtonElement::~InputFieldSpeechButtonElement() | 288 InputFieldSpeechButtonElement::~InputFieldSpeechButtonElement() |
| 289 { | 289 { |
| 290 SpeechInput* speech = speechInput(); | 290 SpeechInput* speech = speechInput(); |
| 291 if (speech && m_listenerId) { // Could be null when page is unloading. | 291 if (speech && m_listenerId) { // Could be null when page is unloading. |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 } | 465 } |
| 466 | 466 |
| 467 void InputFieldSpeechButtonElement::stopSpeechInput() | 467 void InputFieldSpeechButtonElement::stopSpeechInput() |
| 468 { | 468 { |
| 469 if (m_state == Recording) | 469 if (m_state == Recording) |
| 470 speechInput()->stopRecording(m_listenerId); | 470 speechInput()->stopRecording(m_listenerId); |
| 471 } | 471 } |
| 472 #endif // ENABLE(INPUT_SPEECH) | 472 #endif // ENABLE(INPUT_SPEECH) |
| 473 | 473 |
| 474 } | 474 } |
| OLD | NEW |