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

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, 8 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 namespace blink { 45 namespace blink {
46 46
47 using namespace HTMLNames; 47 using namespace HTMLNames;
48 48
49 TextControlInnerContainer::TextControlInnerContainer(Document& document) 49 TextControlInnerContainer::TextControlInnerContainer(Document& document)
50 : HTMLDivElement(document) 50 : HTMLDivElement(document)
51 { 51 {
52 } 52 }
53 53
54 PassRefPtrWillBeRawPtr<TextControlInnerContainer> TextControlInnerContainer::cre ate(Document& document) 54 RawPtr<TextControlInnerContainer> TextControlInnerContainer::create(Document& do cument)
55 { 55 {
56 RefPtrWillBeRawPtr<TextControlInnerContainer> element = adoptRefWillBeNoop(n ew TextControlInnerContainer(document)); 56 RawPtr<TextControlInnerContainer> element = new TextControlInnerContainer(do cument);
57 element->setAttribute(idAttr, ShadowElementNames::textFieldContainer()); 57 element->setAttribute(idAttr, ShadowElementNames::textFieldContainer());
58 return element.release(); 58 return element.release();
59 } 59 }
60 60
61 LayoutObject* TextControlInnerContainer::createLayoutObject(const ComputedStyle& ) 61 LayoutObject* TextControlInnerContainer::createLayoutObject(const ComputedStyle& )
62 { 62 {
63 return new LayoutTextControlInnerContainer(this); 63 return new LayoutTextControlInnerContainer(this);
64 } 64 }
65 65
66 // --------------------------- 66 // ---------------------------
67 67
68 EditingViewPortElement::EditingViewPortElement(Document& document) 68 EditingViewPortElement::EditingViewPortElement(Document& document)
69 : HTMLDivElement(document) 69 : HTMLDivElement(document)
70 { 70 {
71 setHasCustomStyleCallbacks(); 71 setHasCustomStyleCallbacks();
72 } 72 }
73 73
74 PassRefPtrWillBeRawPtr<EditingViewPortElement> EditingViewPortElement::create(Do cument& document) 74 RawPtr<EditingViewPortElement> EditingViewPortElement::create(Document& document )
75 { 75 {
76 RefPtrWillBeRawPtr<EditingViewPortElement> element = adoptRefWillBeNoop(new EditingViewPortElement(document)); 76 RawPtr<EditingViewPortElement> element = new EditingViewPortElement(document );
77 element->setAttribute(idAttr, ShadowElementNames::editingViewPort()); 77 element->setAttribute(idAttr, ShadowElementNames::editingViewPort());
78 return element.release(); 78 return element.release();
79 } 79 }
80 80
81 PassRefPtr<ComputedStyle> EditingViewPortElement::customStyleForLayoutObject() 81 PassRefPtr<ComputedStyle> EditingViewPortElement::customStyleForLayoutObject()
82 { 82 {
83 // FXIME: Move these styles to html.css. 83 // FXIME: Move these styles to html.css.
84 84
85 RefPtr<ComputedStyle> style = ComputedStyle::create(); 85 RefPtr<ComputedStyle> style = ComputedStyle::create();
86 style->inheritFrom(shadowHost()->computedStyleRef()); 86 style->inheritFrom(shadowHost()->computedStyleRef());
(...skipping 12 matching lines...) Expand all
99 } 99 }
100 100
101 // --------------------------- 101 // ---------------------------
102 102
103 inline TextControlInnerEditorElement::TextControlInnerEditorElement(Document& do cument) 103 inline TextControlInnerEditorElement::TextControlInnerEditorElement(Document& do cument)
104 : HTMLDivElement(document) 104 : HTMLDivElement(document)
105 { 105 {
106 setHasCustomStyleCallbacks(); 106 setHasCustomStyleCallbacks();
107 } 107 }
108 108
109 PassRefPtrWillBeRawPtr<TextControlInnerEditorElement> TextControlInnerEditorElem ent::create(Document& document) 109 RawPtr<TextControlInnerEditorElement> TextControlInnerEditorElement::create(Docu ment& document)
110 { 110 {
111 RefPtrWillBeRawPtr<TextControlInnerEditorElement> element = adoptRefWillBeNo op(new TextControlInnerEditorElement(document)); 111 RawPtr<TextControlInnerEditorElement> element = new TextControlInnerEditorEl ement(document);
112 element->setAttribute(idAttr, ShadowElementNames::innerEditor()); 112 element->setAttribute(idAttr, ShadowElementNames::innerEditor());
113 return element.release(); 113 return element.release();
114 } 114 }
115 115
116 void TextControlInnerEditorElement::defaultEventHandler(Event* event) 116 void TextControlInnerEditorElement::defaultEventHandler(Event* event)
117 { 117 {
118 // FIXME: In the future, we should add a way to have default event listeners . 118 // FIXME: In the future, we should add a way to have default event listeners .
119 // Then we would add one to the text field's inner div, and we wouldn't need this subclass. 119 // Then we would add one to the text field's inner div, and we wouldn't need this subclass.
120 // Or possibly we could just use a normal event listener. 120 // Or possibly we could just use a normal event listener.
121 if (event->isBeforeTextInsertedEvent() || event->type() == EventTypeNames::w ebkitEditableContentChanged) { 121 if (event->isBeforeTextInsertedEvent() || event->type() == EventTypeNames::w ebkitEditableContentChanged) {
(...skipping 28 matching lines...) Expand all
150 return innerEditorStyle.release(); 150 return innerEditorStyle.release();
151 } 151 }
152 152
153 // ---------------------------- 153 // ----------------------------
154 154
155 inline SearchFieldDecorationElement::SearchFieldDecorationElement(Document& docu ment) 155 inline SearchFieldDecorationElement::SearchFieldDecorationElement(Document& docu ment)
156 : HTMLDivElement(document) 156 : HTMLDivElement(document)
157 { 157 {
158 } 158 }
159 159
160 PassRefPtrWillBeRawPtr<SearchFieldDecorationElement> SearchFieldDecorationElemen t::create(Document& document) 160 RawPtr<SearchFieldDecorationElement> SearchFieldDecorationElement::create(Docume nt& document)
161 { 161 {
162 RefPtrWillBeRawPtr<SearchFieldDecorationElement> element = adoptRefWillBeNoo p(new SearchFieldDecorationElement(document)); 162 RawPtr<SearchFieldDecorationElement> element = new SearchFieldDecorationElem ent(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
167 const AtomicString& SearchFieldDecorationElement::shadowPseudoId() const 167 const AtomicString& SearchFieldDecorationElement::shadowPseudoId() const
168 { 168 {
169 DEFINE_STATIC_LOCAL(AtomicString, resultsDecorationId, ("-webkit-search-resu lts-decoration", AtomicString::ConstructFromLiteral)); 169 DEFINE_STATIC_LOCAL(AtomicString, resultsDecorationId, ("-webkit-search-resu lts-decoration", AtomicString::ConstructFromLiteral));
170 DEFINE_STATIC_LOCAL(AtomicString, decorationId, ("-webkit-search-decoration" , AtomicString::ConstructFromLiteral)); 170 DEFINE_STATIC_LOCAL(AtomicString, decorationId, ("-webkit-search-decoration" , AtomicString::ConstructFromLiteral));
171 Element* host = shadowHost(); 171 Element* host = shadowHost();
172 if (!host) 172 if (!host)
(...skipping 26 matching lines...) Expand all
199 } 199 }
200 200
201 // ---------------------------- 201 // ----------------------------
202 202
203 inline SearchFieldCancelButtonElement::SearchFieldCancelButtonElement(Document& document) 203 inline SearchFieldCancelButtonElement::SearchFieldCancelButtonElement(Document& document)
204 : HTMLDivElement(document) 204 : HTMLDivElement(document)
205 , m_capturing(false) 205 , m_capturing(false)
206 { 206 {
207 } 207 }
208 208
209 PassRefPtrWillBeRawPtr<SearchFieldCancelButtonElement> SearchFieldCancelButtonEl ement::create(Document& document) 209 RawPtr<SearchFieldCancelButtonElement> SearchFieldCancelButtonElement::create(Do cument& document)
210 { 210 {
211 RefPtrWillBeRawPtr<SearchFieldCancelButtonElement> element = adoptRefWillBeN oop(new SearchFieldCancelButtonElement(document)); 211 RawPtr<SearchFieldCancelButtonElement> element = new SearchFieldCancelButton Element(document);
212 element->setShadowPseudoId(AtomicString("-webkit-search-cancel-button", Atom icString::ConstructFromLiteral)); 212 element->setShadowPseudoId(AtomicString("-webkit-search-cancel-button", Atom icString::ConstructFromLiteral));
213 element->setAttribute(idAttr, ShadowElementNames::clearButton()); 213 element->setAttribute(idAttr, ShadowElementNames::clearButton());
214 return element.release(); 214 return element.release();
215 } 215 }
216 216
217 void SearchFieldCancelButtonElement::detach(const AttachContext& context) 217 void SearchFieldCancelButtonElement::detach(const AttachContext& context)
218 { 218 {
219 if (m_capturing) { 219 if (m_capturing) {
220 if (LocalFrame* frame = document().frame()) 220 if (LocalFrame* frame = document().frame())
221 frame->eventHandler().setCapturingMouseEventsNode(nullptr); 221 frame->eventHandler().setCapturingMouseEventsNode(nullptr);
222 } 222 }
223 HTMLDivElement::detach(context); 223 HTMLDivElement::detach(context);
224 } 224 }
225 225
226 226
227 void SearchFieldCancelButtonElement::defaultEventHandler(Event* event) 227 void SearchFieldCancelButtonElement::defaultEventHandler(Event* event)
228 { 228 {
229 // If the element is visible, on mouseup, clear the value, and set selection 229 // If the element is visible, on mouseup, clear the value, and set selection
230 RefPtrWillBeRawPtr<HTMLInputElement> input(toHTMLInputElement(shadowHost())) ; 230 RawPtr<HTMLInputElement> input(toHTMLInputElement(shadowHost()));
231 if (!input || input->isDisabledOrReadOnly()) { 231 if (!input || input->isDisabledOrReadOnly()) {
232 if (!event->defaultHandled()) 232 if (!event->defaultHandled())
233 HTMLDivElement::defaultEventHandler(event); 233 HTMLDivElement::defaultEventHandler(event);
234 return; 234 return;
235 } 235 }
236 236
237 237
238 if (event->type() == EventTypeNames::click && event->isMouseEvent() && toMou seEvent(event)->button() == LeftButton) { 238 if (event->type() == EventTypeNames::click && event->isMouseEvent() && toMou seEvent(event)->button() == LeftButton) {
239 input->setValueForUser(""); 239 input->setValueForUser("");
240 input->setAutofilled(false); 240 input->setAutofilled(false);
241 input->onSearch(); 241 input->onSearch();
242 event->setDefaultHandled(); 242 event->setDefaultHandled();
243 } 243 }
244 244
245 if (!event->defaultHandled()) 245 if (!event->defaultHandled())
246 HTMLDivElement::defaultEventHandler(event); 246 HTMLDivElement::defaultEventHandler(event);
247 } 247 }
248 248
249 bool SearchFieldCancelButtonElement::willRespondToMouseClickEvents() 249 bool SearchFieldCancelButtonElement::willRespondToMouseClickEvents()
250 { 250 {
251 const HTMLInputElement* input = toHTMLInputElement(shadowHost()); 251 const HTMLInputElement* input = toHTMLInputElement(shadowHost());
252 if (input && !input->isDisabledOrReadOnly()) 252 if (input && !input->isDisabledOrReadOnly())
253 return true; 253 return true;
254 254
255 return HTMLDivElement::willRespondToMouseClickEvents(); 255 return HTMLDivElement::willRespondToMouseClickEvents();
256 } 256 }
257 257
258 } // namespace blink 258 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698