Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1276)

Side by Side Diff: third_party/WebKit/Source/core/html/shadow/TextControlInnerElements.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
42 42
43 namespace blink { 43 namespace blink {
44 44
45 using namespace HTMLNames; 45 using namespace HTMLNames;
46 46
47 TextControlInnerContainer::TextControlInnerContainer(Document& document) 47 TextControlInnerContainer::TextControlInnerContainer(Document& document)
48 : HTMLDivElement(document) 48 : HTMLDivElement(document)
49 { 49 {
50 } 50 }
51 51
52 PassRefPtrWillBeRawPtr<TextControlInnerContainer> TextControlInnerContainer::cre ate(Document& document) 52 RawPtr<TextControlInnerContainer> TextControlInnerContainer::create(Document& do cument)
53 { 53 {
54 RefPtrWillBeRawPtr<TextControlInnerContainer> element = adoptRefWillBeNoop(n ew TextControlInnerContainer(document)); 54 RawPtr<TextControlInnerContainer> element = (new TextControlInnerContainer(d ocument));
55 element->setAttribute(idAttr, ShadowElementNames::textFieldContainer()); 55 element->setAttribute(idAttr, ShadowElementNames::textFieldContainer());
56 return element.release(); 56 return element.release();
57 } 57 }
58 58
59 LayoutObject* TextControlInnerContainer::createLayoutObject(const ComputedStyle& ) 59 LayoutObject* TextControlInnerContainer::createLayoutObject(const ComputedStyle& )
60 { 60 {
61 return new LayoutTextControlInnerContainer(this); 61 return new LayoutTextControlInnerContainer(this);
62 } 62 }
63 63
64 // --------------------------- 64 // ---------------------------
65 65
66 EditingViewPortElement::EditingViewPortElement(Document& document) 66 EditingViewPortElement::EditingViewPortElement(Document& document)
67 : HTMLDivElement(document) 67 : HTMLDivElement(document)
68 { 68 {
69 setHasCustomStyleCallbacks(); 69 setHasCustomStyleCallbacks();
70 } 70 }
71 71
72 PassRefPtrWillBeRawPtr<EditingViewPortElement> EditingViewPortElement::create(Do cument& document) 72 RawPtr<EditingViewPortElement> EditingViewPortElement::create(Document& document )
73 { 73 {
74 RefPtrWillBeRawPtr<EditingViewPortElement> element = adoptRefWillBeNoop(new EditingViewPortElement(document)); 74 RawPtr<EditingViewPortElement> element = (new EditingViewPortElement(documen t));
75 element->setAttribute(idAttr, ShadowElementNames::editingViewPort()); 75 element->setAttribute(idAttr, ShadowElementNames::editingViewPort());
76 return element.release(); 76 return element.release();
77 } 77 }
78 78
79 PassRefPtr<ComputedStyle> EditingViewPortElement::customStyleForLayoutObject() 79 PassRefPtr<ComputedStyle> EditingViewPortElement::customStyleForLayoutObject()
80 { 80 {
81 // FXIME: Move these styles to html.css. 81 // FXIME: Move these styles to html.css.
82 82
83 RefPtr<ComputedStyle> style = ComputedStyle::create(); 83 RefPtr<ComputedStyle> style = ComputedStyle::create();
84 style->inheritFrom(shadowHost()->computedStyleRef()); 84 style->inheritFrom(shadowHost()->computedStyleRef());
(...skipping 12 matching lines...) Expand all
97 } 97 }
98 98
99 // --------------------------- 99 // ---------------------------
100 100
101 inline TextControlInnerEditorElement::TextControlInnerEditorElement(Document& do cument) 101 inline TextControlInnerEditorElement::TextControlInnerEditorElement(Document& do cument)
102 : HTMLDivElement(document) 102 : HTMLDivElement(document)
103 { 103 {
104 setHasCustomStyleCallbacks(); 104 setHasCustomStyleCallbacks();
105 } 105 }
106 106
107 PassRefPtrWillBeRawPtr<TextControlInnerEditorElement> TextControlInnerEditorElem ent::create(Document& document) 107 RawPtr<TextControlInnerEditorElement> TextControlInnerEditorElement::create(Docu ment& document)
108 { 108 {
109 RefPtrWillBeRawPtr<TextControlInnerEditorElement> element = adoptRefWillBeNo op(new TextControlInnerEditorElement(document)); 109 RawPtr<TextControlInnerEditorElement> element = (new TextControlInnerEditorE lement(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 TextControlInnerEditorElement::defaultEventHandler(Event* event) 114 void TextControlInnerEditorElement::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 24 matching lines...) Expand all
144 return textControlLayoutObject->createInnerEditorStyle(textControlLayoutObje ct->styleRef()); 144 return textControlLayoutObject->createInnerEditorStyle(textControlLayoutObje ct->styleRef());
145 } 145 }
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 RawPtr<SearchFieldDecorationElement> SearchFieldDecorationElement::create(Docume nt& document)
155 { 155 {
156 RefPtrWillBeRawPtr<SearchFieldDecorationElement> element = adoptRefWillBeNoo p(new SearchFieldDecorationElement(document)); 156 RawPtr<SearchFieldDecorationElement> element = (new SearchFieldDecorationEle ment(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 26 matching lines...) Expand all
193 } 193 }
194 194
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 RawPtr<SearchFieldCancelButtonElement> SearchFieldCancelButtonElement::create(Do cument& document)
204 { 204 {
205 RefPtrWillBeRawPtr<SearchFieldCancelButtonElement> element = adoptRefWillBeN oop(new SearchFieldCancelButtonElement(document)); 205 RawPtr<SearchFieldCancelButtonElement> element = (new SearchFieldCancelButto nElement(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);
216 } 216 }
217 HTMLDivElement::detach(context); 217 HTMLDivElement::detach(context);
218 } 218 }
219 219
220 220
221 void SearchFieldCancelButtonElement::defaultEventHandler(Event* event) 221 void SearchFieldCancelButtonElement::defaultEventHandler(Event* event)
222 { 222 {
223 // If the element is visible, on mouseup, clear the value, and set selection 223 // If the element is visible, on mouseup, clear the value, and set selection
224 RefPtrWillBeRawPtr<HTMLInputElement> input(toHTMLInputElement(shadowHost())) ; 224 RawPtr<HTMLInputElement> input(toHTMLInputElement(shadowHost()));
225 if (!input || input->isDisabledOrReadOnly()) { 225 if (!input || input->isDisabledOrReadOnly()) {
226 if (!event->defaultHandled()) 226 if (!event->defaultHandled())
227 HTMLDivElement::defaultEventHandler(event); 227 HTMLDivElement::defaultEventHandler(event);
228 return; 228 return;
229 } 229 }
230 230
231 231
232 if (event->type() == EventTypeNames::click && event->isMouseEvent() && toMou seEvent(event)->button() == LeftButton) { 232 if (event->type() == EventTypeNames::click && event->isMouseEvent() && toMou seEvent(event)->button() == LeftButton) {
233 input->setValueForUser(""); 233 input->setValueForUser("");
234 input->setAutofilled(false); 234 input->setAutofilled(false);
235 input->onSearch(); 235 input->onSearch();
236 event->setDefaultHandled(); 236 event->setDefaultHandled();
237 } 237 }
238 238
239 if (!event->defaultHandled()) 239 if (!event->defaultHandled())
240 HTMLDivElement::defaultEventHandler(event); 240 HTMLDivElement::defaultEventHandler(event);
241 } 241 }
242 242
243 bool SearchFieldCancelButtonElement::willRespondToMouseClickEvents() 243 bool SearchFieldCancelButtonElement::willRespondToMouseClickEvents()
244 { 244 {
245 const HTMLInputElement* input = toHTMLInputElement(shadowHost()); 245 const HTMLInputElement* input = toHTMLInputElement(shadowHost());
246 if (input && !input->isDisabledOrReadOnly()) 246 if (input && !input->isDisabledOrReadOnly())
247 return true; 247 return true;
248 248
249 return HTMLDivElement::willRespondToMouseClickEvents(); 249 return HTMLDivElement::willRespondToMouseClickEvents();
250 } 250 }
251 251
252 } // namespace blink 252 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698