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

Unified Diff: Source/core/html/HTMLTextAreaElement.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 4 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/HTMLTemplateElement.cpp ('k') | Source/core/html/HTMLTextFormControlElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLTextAreaElement.cpp
diff --git a/Source/core/html/HTMLTextAreaElement.cpp b/Source/core/html/HTMLTextAreaElement.cpp
index 7445d1e5b037752f4fd98fcfddffa04e877eb632..1e72db1dc54ddf022bbd37e327e0acbcf0336580 100644
--- a/Source/core/html/HTMLTextAreaElement.cpp
+++ b/Source/core/html/HTMLTextAreaElement.cpp
@@ -102,7 +102,7 @@ PassRefPtr<HTMLTextAreaElement> HTMLTextAreaElement::create(const QualifiedName&
void HTMLTextAreaElement::didAddUserAgentShadowRoot(ShadowRoot* root)
{
- root->appendChild(TextControlInnerTextElement::create(document()));
+ root->appendChild(TextControlInnerTextElement::create(&document()));
}
const AtomicString& HTMLTextAreaElement::formControlType() const
@@ -211,7 +211,7 @@ bool HTMLTextAreaElement::appendFormData(FormDataList& encoding, bool)
if (name().isEmpty())
return false;
- document()->updateLayout();
+ document().updateLayout();
const String& text = (m_wrap == HardWrap) ? valueWithHardLineBreaks() : value();
encoding.appendData(name(), text);
@@ -253,8 +253,8 @@ void HTMLTextAreaElement::updateFocusAppearance(bool restorePreviousSelection)
} else
restoreCachedSelection();
- if (document()->frame())
- document()->frame()->selection()->revealSelection();
+ if (document().frame())
+ document().frame()->selection()->revealSelection();
}
void HTMLTextAreaElement::defaultEventHandler(Event* event)
@@ -269,7 +269,7 @@ void HTMLTextAreaElement::defaultEventHandler(Event* event)
void HTMLTextAreaElement::handleFocusEvent(Element*, FocusDirection)
{
- if (Frame* frame = document()->frame())
+ if (Frame* frame = document().frame())
frame->editor().textAreaOrTextFieldDidBeginEditing(this);
}
@@ -305,7 +305,7 @@ void HTMLTextAreaElement::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent*
// If the text field has no focus, we don't need to take account of the
// selection length. The selection is the source of text drag-and-drop in
// that case, and nothing in the text field will be removed.
- unsigned selectionLength = focused() ? computeLengthForSubmission(plainText(document()->frame()->selection()->selection().toNormalizedRange().get())) : 0;
+ unsigned selectionLength = focused() ? computeLengthForSubmission(plainText(document().frame()->selection()->selection().toNormalizedRange().get())) : 0;
ASSERT(currentLength >= selectionLength);
unsigned baseLength = currentLength - selectionLength;
unsigned appendableLength = unsignedMaxLength > baseLength ? unsignedMaxLength - baseLength : 0;
@@ -387,7 +387,7 @@ void HTMLTextAreaElement::setValueCommon(const String& newValue)
setFormControlValueMatchesRenderer(true);
// Set the caret to the end of the text value.
- if (document()->focusedElement() == this) {
+ if (document().focusedElement() == this) {
unsigned endOfString = m_value.length();
setSelectionRange(endOfString, endOfString);
}
@@ -428,7 +428,7 @@ void HTMLTextAreaElement::setDefaultValue(const String& defaultValue)
value.replace("\r\n", "\n");
value.replace('\r', '\n');
- insertBefore(document()->createTextNode(value), firstChild(), IGNORE_EXCEPTION);
+ insertBefore(document().createTextNode(value), firstChild(), IGNORE_EXCEPTION);
if (!m_isDirty)
setNonDirtyValue(value);
@@ -540,7 +540,7 @@ void HTMLTextAreaElement::updatePlaceholderText()
return;
}
if (!m_placeholder) {
- RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document());
+ RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(&document());
m_placeholder = placeholder.get();
m_placeholder->setPart(AtomicString("-webkit-input-placeholder", AtomicString::ConstructFromLiteral));
userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->nextSibling());
« no previous file with comments | « Source/core/html/HTMLTemplateElement.cpp ('k') | Source/core/html/HTMLTextFormControlElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698