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

Unified Diff: Source/core/html/HTMLTextFormControlElement.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLTextFormControlElement.h ('k') | Source/core/html/HTMLTextFormControlElementTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLTextFormControlElement.cpp
diff --git a/Source/core/html/HTMLTextFormControlElement.cpp b/Source/core/html/HTMLTextFormControlElement.cpp
index 89cb5509754873d621cccef0f0babd0c66750139..06a5579087d1bb2131efb3dd86802a41428cfacb 100644
--- a/Source/core/html/HTMLTextFormControlElement.cpp
+++ b/Source/core/html/HTMLTextFormControlElement.cpp
@@ -103,7 +103,7 @@ void HTMLTextFormControlElement::forwardEvent(Event* event)
{
if (event->type() == EventTypeNames::blur || event->type() == EventTypeNames::focus)
return;
- innerTextElement()->defaultEventHandler(event);
+ innerEditorElement()->defaultEventHandler(event);
}
String HTMLTextFormControlElement::strippedPlaceholder() const
@@ -217,7 +217,7 @@ void HTMLTextFormControlElement::setRangeText(const String& replacement, unsigne
if (hasAuthorShadowRoot())
return;
- String text = innerTextValue();
+ String text = innerEditorValue();
unsigned textLength = text.length();
unsigned replacementLength = replacement.length();
unsigned newSelectionStart = selectionStart();
@@ -231,7 +231,7 @@ void HTMLTextFormControlElement::setRangeText(const String& replacement, unsigne
else
text.insert(replacement, start);
- setInnerTextValue(text);
+ setInnerEditorValue(text);
// FIXME: What should happen to the value (as in value()) if there's no renderer?
if (!renderer())
@@ -285,7 +285,7 @@ void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextField
end = std::max(end, 0);
start = std::min(std::max(start, 0), end);
- if (!hasVisibleTextArea(renderer(), innerTextElement())) {
+ if (!hasVisibleTextArea(renderer(), innerEditorElement())) {
cacheSelection(start, end, direction);
return;
}
@@ -316,9 +316,9 @@ void HTMLTextFormControlElement::setSelectionRange(int start, int end, TextField
VisiblePosition HTMLTextFormControlElement::visiblePositionForIndex(int index) const
{
if (index <= 0)
- return VisiblePosition(firstPositionInNode(innerTextElement()), DOWNSTREAM);
+ return VisiblePosition(firstPositionInNode(innerEditorElement()), DOWNSTREAM);
RefPtrWillBeRawPtr<Range> range = Range::create(document());
- range->selectNodeContents(innerTextElement(), ASSERT_NO_EXCEPTION);
+ range->selectNodeContents(innerEditorElement(), ASSERT_NO_EXCEPTION);
CharacterIterator it(range.get());
it.advance(index - 1);
return VisiblePosition(it.range()->endPosition(), UPSTREAM);
@@ -331,7 +331,7 @@ int HTMLTextFormControlElement::indexForVisiblePosition(const VisiblePosition& p
return 0;
ASSERT(indexPosition.document());
RefPtrWillBeRawPtr<Range> range = Range::create(*indexPosition.document());
- range->setStart(innerTextElement(), 0, ASSERT_NO_EXCEPTION);
+ range->setStart(innerEditorElement(), 0, ASSERT_NO_EXCEPTION);
range->setEnd(indexPosition.containerNode(), indexPosition.offsetInContainerNode(), ASSERT_NO_EXCEPTION);
return TextIterator::rangeLength(range.get());
}
@@ -435,7 +435,7 @@ PassRefPtrWillBeRawPtr<Range> HTMLTextFormControlElement::selection() const
int end = m_cachedSelectionEnd;
ASSERT(start <= end);
- HTMLElement* innerText = innerTextElement();
+ HTMLElement* innerText = innerEditorElement();
if (!innerText)
return nullptr;
@@ -502,22 +502,22 @@ bool HTMLTextFormControlElement::lastChangeWasUserEdit() const
return m_lastChangeWasUserEdit;
}
-void HTMLTextFormControlElement::setInnerTextValue(const String& value)
+void HTMLTextFormControlElement::setInnerEditorValue(const String& value)
{
ASSERT(!hasAuthorShadowRoot());
if (!isTextFormControl() || hasAuthorShadowRoot())
return;
- bool textIsChanged = value != innerTextValue();
- if (textIsChanged || !innerTextElement()->hasChildren()) {
+ bool textIsChanged = value != innerEditorValue();
+ if (textIsChanged || !innerEditorElement()->hasChildren()) {
if (textIsChanged && renderer()) {
if (AXObjectCache* cache = document().existingAXObjectCache())
cache->postNotification(this, AXObjectCache::AXValueChanged, false);
}
- innerTextElement()->setInnerText(value, ASSERT_NO_EXCEPTION);
+ innerEditorElement()->setInnerText(value, ASSERT_NO_EXCEPTION);
if (value.endsWith('\n') || value.endsWith('\r'))
- innerTextElement()->appendChild(HTMLBRElement::create(document()));
+ innerEditorElement()->appendChild(HTMLBRElement::create(document()));
}
}
@@ -530,15 +530,15 @@ static String finishText(StringBuilder& result)
return result.toString();
}
-String HTMLTextFormControlElement::innerTextValue() const
+String HTMLTextFormControlElement::innerEditorValue() const
{
ASSERT(!hasAuthorShadowRoot());
- HTMLElement* innerText = innerTextElement();
- if (!innerText || !isTextFormControl())
+ HTMLElement* innerEditor = innerEditorElement();
+ if (!innerEditor || !isTextFormControl())
return emptyString();
StringBuilder result;
- for (Node* node = innerText; node; node = NodeTraversal::next(*node, innerText)) {
+ for (Node* node = innerEditor; node; node = NodeTraversal::next(*node, innerEditor)) {
if (isHTMLBRElement(*node))
result.append(newlineCharacter);
else if (node->isTextNode())
@@ -568,7 +568,7 @@ String HTMLTextFormControlElement::valueWithHardLineBreaks() const
{
// FIXME: It's not acceptable to ignore the HardWrap setting when there is no renderer.
// While we have no evidence this has ever been a practical problem, it would be best to fix it some day.
- HTMLElement* innerText = innerTextElement();
+ HTMLElement* innerText = innerEditorElement();
if (!innerText || !isTextFormControl())
return value();
@@ -654,7 +654,7 @@ String HTMLTextFormControlElement::directionForFormData() const
return "ltr";
}
-HTMLElement* HTMLTextFormControlElement::innerTextElement() const
+HTMLElement* HTMLTextFormControlElement::innerEditorElement() const
{
return toHTMLElement(userAgentShadowRoot()->getElementById(ShadowElementNames::innerEditor()));
}
« no previous file with comments | « Source/core/html/HTMLTextFormControlElement.h ('k') | Source/core/html/HTMLTextFormControlElementTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698