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

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

Issue 340273003: Rename innerTextElement/Value used in <input> and <textarea> to innerEditor. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // We don't want the shadow dom to be editable, so we set this block to 91 // We don't want the shadow dom to be editable, so we set this block to
92 // read-only in case the input itself is editable. 92 // read-only in case the input itself is editable.
93 style->setUserModify(READ_ONLY); 93 style->setUserModify(READ_ONLY);
94 style->setUnique(); 94 style->setUnique();
95 95
96 return style.release(); 96 return style.release();
97 } 97 }
98 98
99 // --------------------------- 99 // ---------------------------
100 100
101 inline TextControlInnerTextElement::TextControlInnerTextElement(Document& docume nt) 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<TextControlInnerTextElement> TextControlInnerTextElement: :create(Document& document) 107 PassRefPtrWillBeRawPtr<TextControlInnerEditorElement> TextControlInnerEditorElem ent::create(Document& document)
108 { 108 {
109 RefPtrWillBeRawPtr<TextControlInnerTextElement> element = adoptRefWillBeNoop (new TextControlInnerTextElement(document)); 109 RefPtrWillBeRawPtr<TextControlInnerEditorElement> element = adoptRefWillBeNo op(new TextControlInnerEditorElement(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 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) {
120 Element* shadowAncestor = shadowHost(); 120 Element* shadowAncestor = shadowHost();
121 // A TextControlInnerTextElement can have no host if its been detached, 121 // A TextControlInnerTextElement can have no host if its been detached,
122 // but kept alive by an EditCommand. In this case, an undo/redo can 122 // but kept alive by an EditCommand. In this case, an undo/redo can
123 // cause events to be sent to the TextControlInnerTextElement. To 123 // cause events to be sent to the TextControlInnerTextElement. To
124 // prevent an infinite loop, we must check for this case before sending 124 // prevent an infinite loop, we must check for this case before sending
125 // the event up the chain. 125 // the event up the chain.
126 if (shadowAncestor) 126 if (shadowAncestor)
127 shadowAncestor->defaultEventHandler(event); 127 shadowAncestor->defaultEventHandler(event);
128 } 128 }
129 if (!event->defaultHandled()) 129 if (!event->defaultHandled())
130 HTMLDivElement::defaultEventHandler(event); 130 HTMLDivElement::defaultEventHandler(event);
131 } 131 }
132 132
133 RenderObject* TextControlInnerTextElement::createRenderer(RenderStyle*) 133 RenderObject* TextControlInnerEditorElement::createRenderer(RenderStyle*)
134 { 134 {
135 return new RenderTextControlInnerBlock(this); 135 return new RenderTextControlInnerBlock(this);
136 } 136 }
137 137
138 PassRefPtr<RenderStyle> TextControlInnerTextElement::customStyleForRenderer() 138 PassRefPtr<RenderStyle> TextControlInnerEditorElement::customStyleForRenderer()
139 { 139 {
140 RenderObject* parentRenderer = shadowHost()->renderer(); 140 RenderObject* parentRenderer = shadowHost()->renderer();
141 if (!parentRenderer || !parentRenderer->isTextControl()) 141 if (!parentRenderer || !parentRenderer->isTextControl())
142 return originalStyleForRenderer(); 142 return originalStyleForRenderer();
143 RenderTextControl* textControlRenderer = toRenderTextControl(parentRenderer) ; 143 RenderTextControl* textControlRenderer = toRenderTextControl(parentRenderer) ;
144 return textControlRenderer->createInnerTextStyle(textControlRenderer->style( )); 144 return textControlRenderer->createInnerEditorStyle(textControlRenderer->styl e());
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 PassRefPtrWillBeRawPtr<SearchFieldDecorationElement> SearchFieldDecorationElemen t::create(Document& document)
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « Source/core/html/shadow/TextControlInnerElements.h ('k') | Source/core/rendering/RenderTextControl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698