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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 using namespace HTMLNames; | 46 using namespace HTMLNames; |
47 | 47 |
48 TextControlInnerContainer::TextControlInnerContainer(Document& document) | 48 TextControlInnerContainer::TextControlInnerContainer(Document& document) |
49 : HTMLDivElement(document) | 49 : HTMLDivElement(document) |
50 { | 50 { |
51 } | 51 } |
52 | 52 |
53 PassRefPtrWillBeRawPtr<TextControlInnerContainer> TextControlInnerContainer::cre
ate(Document& document) | 53 PassRefPtrWillBeRawPtr<TextControlInnerContainer> TextControlInnerContainer::cre
ate(Document& document) |
54 { | 54 { |
55 RefPtrWillBeRawPtr<TextControlInnerContainer> element = adoptRefWillBeRefCou
ntedGarbageCollected(new TextControlInnerContainer(document)); | 55 RefPtrWillBeRawPtr<TextControlInnerContainer> element = adoptRefWillBeNoop(n
ew TextControlInnerContainer(document)); |
56 element->setAttribute(idAttr, ShadowElementNames::textFieldContainer()); | 56 element->setAttribute(idAttr, ShadowElementNames::textFieldContainer()); |
57 return element.release(); | 57 return element.release(); |
58 } | 58 } |
59 | 59 |
60 RenderObject* TextControlInnerContainer::createRenderer(RenderStyle*) | 60 RenderObject* TextControlInnerContainer::createRenderer(RenderStyle*) |
61 { | 61 { |
62 return new RenderTextControlInnerContainer(this); | 62 return new RenderTextControlInnerContainer(this); |
63 } | 63 } |
64 | 64 |
65 // --------------------------- | 65 // --------------------------- |
66 | 66 |
67 EditingViewPortElement::EditingViewPortElement(Document& document) | 67 EditingViewPortElement::EditingViewPortElement(Document& document) |
68 : HTMLDivElement(document) | 68 : HTMLDivElement(document) |
69 { | 69 { |
70 setHasCustomStyleCallbacks(); | 70 setHasCustomStyleCallbacks(); |
71 } | 71 } |
72 | 72 |
73 PassRefPtrWillBeRawPtr<EditingViewPortElement> EditingViewPortElement::create(Do
cument& document) | 73 PassRefPtrWillBeRawPtr<EditingViewPortElement> EditingViewPortElement::create(Do
cument& document) |
74 { | 74 { |
75 RefPtrWillBeRawPtr<EditingViewPortElement> element = adoptRefWillBeRefCounte
dGarbageCollected(new EditingViewPortElement(document)); | 75 RefPtrWillBeRawPtr<EditingViewPortElement> element = adoptRefWillBeNoop(new
EditingViewPortElement(document)); |
76 element->setAttribute(idAttr, ShadowElementNames::editingViewPort()); | 76 element->setAttribute(idAttr, ShadowElementNames::editingViewPort()); |
77 return element.release(); | 77 return element.release(); |
78 } | 78 } |
79 | 79 |
80 PassRefPtr<RenderStyle> EditingViewPortElement::customStyleForRenderer() | 80 PassRefPtr<RenderStyle> EditingViewPortElement::customStyleForRenderer() |
81 { | 81 { |
82 // FXIME: Move these styles to html.css. | 82 // FXIME: Move these styles to html.css. |
83 | 83 |
84 RefPtr<RenderStyle> style = RenderStyle::create(); | 84 RefPtr<RenderStyle> style = RenderStyle::create(); |
85 style->inheritFrom(shadowHost()->renderStyle()); | 85 style->inheritFrom(shadowHost()->renderStyle()); |
(...skipping 13 matching lines...) Expand all Loading... |
99 // --------------------------- | 99 // --------------------------- |
100 | 100 |
101 inline TextControlInnerTextElement::TextControlInnerTextElement(Document& docume
nt) | 101 inline TextControlInnerTextElement::TextControlInnerTextElement(Document& docume
nt) |
102 : HTMLDivElement(document) | 102 : HTMLDivElement(document) |
103 { | 103 { |
104 setHasCustomStyleCallbacks(); | 104 setHasCustomStyleCallbacks(); |
105 } | 105 } |
106 | 106 |
107 PassRefPtrWillBeRawPtr<TextControlInnerTextElement> TextControlInnerTextElement:
:create(Document& document) | 107 PassRefPtrWillBeRawPtr<TextControlInnerTextElement> TextControlInnerTextElement:
:create(Document& document) |
108 { | 108 { |
109 RefPtrWillBeRawPtr<TextControlInnerTextElement> element = adoptRefWillBeRefC
ountedGarbageCollected(new TextControlInnerTextElement(document)); | 109 RefPtrWillBeRawPtr<TextControlInnerTextElement> element = adoptRefWillBeNoop
(new TextControlInnerTextElement(document)); |
110 element->setAttribute(idAttr, ShadowElementNames::innerEditor()); | 110 element->setAttribute(idAttr, ShadowElementNames::innerEditor()); |
111 return element.release(); | 111 return element.release(); |
112 } | 112 } |
113 | 113 |
114 void TextControlInnerTextElement::defaultEventHandler(Event* event) | 114 void TextControlInnerTextElement::defaultEventHandler(Event* event) |
115 { | 115 { |
116 // FIXME: In the future, we should add a way to have default event listeners
. | 116 // FIXME: In the future, we should add a way to have default event listeners
. |
117 // Then we would add one to the text field's inner div, and we wouldn't need
this subclass. | 117 // Then we would add one to the text field's inner div, and we wouldn't need
this subclass. |
118 // Or possibly we could just use a normal event listener. | 118 // Or possibly we could just use a normal event listener. |
119 if (event->isBeforeTextInsertedEvent() || event->type() == EventTypeNames::w
ebkitEditableContentChanged) { | 119 if (event->isBeforeTextInsertedEvent() || event->type() == EventTypeNames::w
ebkitEditableContentChanged) { |
(...skipping 26 matching lines...) Expand all Loading... |
146 | 146 |
147 // ---------------------------- | 147 // ---------------------------- |
148 | 148 |
149 inline SearchFieldDecorationElement::SearchFieldDecorationElement(Document& docu
ment) | 149 inline SearchFieldDecorationElement::SearchFieldDecorationElement(Document& docu
ment) |
150 : HTMLDivElement(document) | 150 : HTMLDivElement(document) |
151 { | 151 { |
152 } | 152 } |
153 | 153 |
154 PassRefPtrWillBeRawPtr<SearchFieldDecorationElement> SearchFieldDecorationElemen
t::create(Document& document) | 154 PassRefPtrWillBeRawPtr<SearchFieldDecorationElement> SearchFieldDecorationElemen
t::create(Document& document) |
155 { | 155 { |
156 RefPtrWillBeRawPtr<SearchFieldDecorationElement> element = adoptRefWillBeRef
CountedGarbageCollected(new SearchFieldDecorationElement(document)); | 156 RefPtrWillBeRawPtr<SearchFieldDecorationElement> element = adoptRefWillBeNoo
p(new SearchFieldDecorationElement(document)); |
157 element->setAttribute(idAttr, ShadowElementNames::searchDecoration()); | 157 element->setAttribute(idAttr, ShadowElementNames::searchDecoration()); |
158 return element.release(); | 158 return element.release(); |
159 } | 159 } |
160 | 160 |
161 const AtomicString& SearchFieldDecorationElement::shadowPseudoId() const | 161 const AtomicString& SearchFieldDecorationElement::shadowPseudoId() const |
162 { | 162 { |
163 DEFINE_STATIC_LOCAL(AtomicString, resultsDecorationId, ("-webkit-search-resu
lts-decoration", AtomicString::ConstructFromLiteral)); | 163 DEFINE_STATIC_LOCAL(AtomicString, resultsDecorationId, ("-webkit-search-resu
lts-decoration", AtomicString::ConstructFromLiteral)); |
164 DEFINE_STATIC_LOCAL(AtomicString, decorationId, ("-webkit-search-decoration"
, AtomicString::ConstructFromLiteral)); | 164 DEFINE_STATIC_LOCAL(AtomicString, decorationId, ("-webkit-search-decoration"
, AtomicString::ConstructFromLiteral)); |
165 Element* host = shadowHost(); | 165 Element* host = shadowHost(); |
166 if (!host) | 166 if (!host) |
(...skipping 28 matching lines...) Expand all Loading... |
195 // ---------------------------- | 195 // ---------------------------- |
196 | 196 |
197 inline SearchFieldCancelButtonElement::SearchFieldCancelButtonElement(Document&
document) | 197 inline SearchFieldCancelButtonElement::SearchFieldCancelButtonElement(Document&
document) |
198 : HTMLDivElement(document) | 198 : HTMLDivElement(document) |
199 , m_capturing(false) | 199 , m_capturing(false) |
200 { | 200 { |
201 } | 201 } |
202 | 202 |
203 PassRefPtrWillBeRawPtr<SearchFieldCancelButtonElement> SearchFieldCancelButtonEl
ement::create(Document& document) | 203 PassRefPtrWillBeRawPtr<SearchFieldCancelButtonElement> SearchFieldCancelButtonEl
ement::create(Document& document) |
204 { | 204 { |
205 RefPtrWillBeRawPtr<SearchFieldCancelButtonElement> element = adoptRefWillBeR
efCountedGarbageCollected(new SearchFieldCancelButtonElement(document)); | 205 RefPtrWillBeRawPtr<SearchFieldCancelButtonElement> element = adoptRefWillBeN
oop(new SearchFieldCancelButtonElement(document)); |
206 element->setShadowPseudoId(AtomicString("-webkit-search-cancel-button", Atom
icString::ConstructFromLiteral)); | 206 element->setShadowPseudoId(AtomicString("-webkit-search-cancel-button", Atom
icString::ConstructFromLiteral)); |
207 element->setAttribute(idAttr, ShadowElementNames::clearButton()); | 207 element->setAttribute(idAttr, ShadowElementNames::clearButton()); |
208 return element.release(); | 208 return element.release(); |
209 } | 209 } |
210 | 210 |
211 void SearchFieldCancelButtonElement::detach(const AttachContext& context) | 211 void SearchFieldCancelButtonElement::detach(const AttachContext& context) |
212 { | 212 { |
213 if (m_capturing) { | 213 if (m_capturing) { |
214 if (LocalFrame* frame = document().frame()) | 214 if (LocalFrame* frame = document().frame()) |
215 frame->eventHandler().setCapturingMouseEventsNode(nullptr); | 215 frame->eventHandler().setCapturingMouseEventsNode(nullptr); |
(...skipping 26 matching lines...) Expand all Loading... |
242 bool SearchFieldCancelButtonElement::willRespondToMouseClickEvents() | 242 bool SearchFieldCancelButtonElement::willRespondToMouseClickEvents() |
243 { | 243 { |
244 const HTMLInputElement* input = toHTMLInputElement(shadowHost()); | 244 const HTMLInputElement* input = toHTMLInputElement(shadowHost()); |
245 if (input && !input->isDisabledOrReadOnly()) | 245 if (input && !input->isDisabledOrReadOnly()) |
246 return true; | 246 return true; |
247 | 247 |
248 return HTMLDivElement::willRespondToMouseClickEvents(); | 248 return HTMLDivElement::willRespondToMouseClickEvents(); |
249 } | 249 } |
250 | 250 |
251 } | 251 } |
OLD | NEW |