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

Unified Diff: Source/core/html/shadow/TextControlInnerElements.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/shadow/SpinButtonElement.cpp ('k') | Source/core/html/track/LoadableTextTrack.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/shadow/TextControlInnerElements.cpp
diff --git a/Source/core/html/shadow/TextControlInnerElements.cpp b/Source/core/html/shadow/TextControlInnerElements.cpp
index 7dc3244dd13ac4f18e11b7c55681537cb7c9dbee..d07e132d5852cc2a71b34836c3ec4f168c8fe3a2 100644
--- a/Source/core/html/shadow/TextControlInnerElements.cpp
+++ b/Source/core/html/shadow/TextControlInnerElements.cpp
@@ -208,7 +208,7 @@ PassRefPtr<SearchFieldCancelButtonElement> SearchFieldCancelButtonElement::creat
void SearchFieldCancelButtonElement::detach(const AttachContext& context)
{
if (m_capturing) {
- if (Frame* frame = document()->frame())
+ if (Frame* frame = document().frame())
frame->eventHandler()->setCapturingMouseEventsNode(0);
}
HTMLDivElement::detach(context);
@@ -227,7 +227,7 @@ void SearchFieldCancelButtonElement::defaultEventHandler(Event* event)
if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
if (renderer() && renderer()->visibleToHitTesting()) {
- if (Frame* frame = document()->frame()) {
+ if (Frame* frame = document().frame()) {
frame->eventHandler()->setCapturingMouseEventsNode(this);
m_capturing = true;
}
@@ -238,7 +238,7 @@ void SearchFieldCancelButtonElement::defaultEventHandler(Event* event)
}
if (event->type() == eventNames().mouseupEvent && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
if (m_capturing) {
- if (Frame* frame = document()->frame()) {
+ if (Frame* frame = document().frame()) {
frame->eventHandler()->setCapturingMouseEventsNode(0);
m_capturing = false;
}
@@ -316,7 +316,7 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event)
// On mouse down, select the text and set focus.
if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
if (renderer() && renderer()->visibleToHitTesting()) {
- if (Frame* frame = document()->frame()) {
+ if (Frame* frame = document().frame()) {
frame->eventHandler()->setCapturingMouseEventsNode(this);
m_capturing = true;
}
@@ -329,7 +329,7 @@ void InputFieldSpeechButtonElement::defaultEventHandler(Event* event)
// On mouse up, release capture cleanly.
if (event->type() == eventNames().mouseupEvent && event->isMouseEvent() && toMouseEvent(event)->button() == LeftButton) {
if (m_capturing && renderer() && renderer()->visibleToHitTesting()) {
- if (Frame* frame = document()->frame()) {
+ if (Frame* frame = document().frame()) {
frame->eventHandler()->setCapturingMouseEventsNode(0);
m_capturing = false;
}
@@ -374,7 +374,7 @@ void InputFieldSpeechButtonElement::setState(SpeechInputState state)
SpeechInput* InputFieldSpeechButtonElement::speechInput()
{
- return SpeechInput::from(document()->page());
+ return SpeechInput::from(document().page());
}
void InputFieldSpeechButtonElement::didCompleteRecording(int)
@@ -399,12 +399,12 @@ void InputFieldSpeechButtonElement::setRecognitionResult(int, const SpeechInputR
return;
RefPtr<InputFieldSpeechButtonElement> holdRefButton(this);
- if (document() && document()->domWindow()) {
+ if (document().domWindow()) {
// Call selectionChanged, causing the element to cache the selection,
// so that the text event inserts the text in this element even if
// focus has moved away from it.
input->selectionChanged(false);
- input->dispatchEvent(TextEvent::create(document()->domWindow(), results.isEmpty() ? "" : results[0]->utterance(), TextEventInputOther));
+ input->dispatchEvent(TextEvent::create(document().domWindow(), results.isEmpty() ? "" : results[0]->utterance(), TextEventInputOther));
}
// This event is sent after the text event so the website can perform actions using the input field content immediately.
@@ -420,7 +420,7 @@ void InputFieldSpeechButtonElement::setRecognitionResult(int, const SpeechInputR
void InputFieldSpeechButtonElement::attach(const AttachContext& context)
{
ASSERT(!m_listenerId);
- if (SpeechInput* input = SpeechInput::from(document()->page()))
+ if (SpeechInput* input = SpeechInput::from(document().page()))
m_listenerId = input->registerListener(this);
HTMLDivElement::attach(context);
}
@@ -428,7 +428,7 @@ void InputFieldSpeechButtonElement::attach(const AttachContext& context)
void InputFieldSpeechButtonElement::detach(const AttachContext& context)
{
if (m_capturing) {
- if (Frame* frame = document()->frame())
+ if (Frame* frame = document().frame())
frame->eventHandler()->setCapturingMouseEventsNode(0);
}
@@ -450,8 +450,8 @@ void InputFieldSpeechButtonElement::startSpeechInput()
RefPtr<HTMLInputElement> input = toHTMLInputElement(shadowHost());
AtomicString language = input->computeInheritedLanguage();
String grammar = input->getAttribute(webkitgrammarAttr);
- IntRect rect = document()->view()->contentsToRootView(pixelSnappedBoundingBox());
- if (speechInput()->startRecognition(m_listenerId, rect, language, grammar, document()->securityOrigin()))
+ IntRect rect = document().view()->contentsToRootView(pixelSnappedBoundingBox());
+ if (speechInput()->startRecognition(m_listenerId, rect, language, grammar, document().securityOrigin()))
setState(Recording);
}
« no previous file with comments | « Source/core/html/shadow/SpinButtonElement.cpp ('k') | Source/core/html/track/LoadableTextTrack.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698