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

Side by Side Diff: Source/core/html/HTMLTextAreaElement.cpp

Issue 21694005: Spell check whole content of an editable element when it gets focused. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: async test added. Sync suffixed with -sync 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserv ed.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 19 matching lines...) Expand all
30 #include "HTMLNames.h" 30 #include "HTMLNames.h"
31 #include "bindings/v8/ExceptionState.h" 31 #include "bindings/v8/ExceptionState.h"
32 #include "bindings/v8/ExceptionStatePlaceholder.h" 32 #include "bindings/v8/ExceptionStatePlaceholder.h"
33 #include "core/dom/BeforeTextInsertedEvent.h" 33 #include "core/dom/BeforeTextInsertedEvent.h"
34 #include "core/dom/Document.h" 34 #include "core/dom/Document.h"
35 #include "core/dom/Event.h" 35 #include "core/dom/Event.h"
36 #include "core/dom/EventNames.h" 36 #include "core/dom/EventNames.h"
37 #include "core/dom/ExceptionCode.h" 37 #include "core/dom/ExceptionCode.h"
38 #include "core/dom/Text.h" 38 #include "core/dom/Text.h"
39 #include "core/dom/shadow/ShadowRoot.h" 39 #include "core/dom/shadow/ShadowRoot.h"
40 #include "core/editing/Editor.h"
40 #include "core/editing/FrameSelection.h" 41 #include "core/editing/FrameSelection.h"
41 #include "core/editing/TextIterator.h" 42 #include "core/editing/TextIterator.h"
42 #include "core/html/FormController.h" 43 #include "core/html/FormController.h"
43 #include "core/html/FormDataList.h" 44 #include "core/html/FormDataList.h"
44 #include "core/html/shadow/TextControlInnerElements.h" 45 #include "core/html/shadow/TextControlInnerElements.h"
45 #include "core/page/Frame.h" 46 #include "core/page/Frame.h"
46 #include "core/platform/LocalizedStrings.h" 47 #include "core/platform/LocalizedStrings.h"
47 #include "core/rendering/RenderTextControlMultiLine.h" 48 #include "core/rendering/RenderTextControlMultiLine.h"
48 #include "wtf/StdLibExtras.h" 49 #include "wtf/StdLibExtras.h"
49 #include "wtf/text/StringBuilder.h" 50 #include "wtf/text/StringBuilder.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 void HTMLTextAreaElement::defaultEventHandler(Event* event) 260 void HTMLTextAreaElement::defaultEventHandler(Event* event)
260 { 261 {
261 if (renderer() && (event->isMouseEvent() || event->isDragEvent() || event->h asInterface(eventNames().interfaceForWheelEvent) || event->type() == eventNames( ).blurEvent)) 262 if (renderer() && (event->isMouseEvent() || event->isDragEvent() || event->h asInterface(eventNames().interfaceForWheelEvent) || event->type() == eventNames( ).blurEvent))
262 forwardEvent(event); 263 forwardEvent(event);
263 else if (renderer() && event->isBeforeTextInsertedEvent()) 264 else if (renderer() && event->isBeforeTextInsertedEvent())
264 handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(even t)); 265 handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(even t));
265 266
266 HTMLTextFormControlElement::defaultEventHandler(event); 267 HTMLTextFormControlElement::defaultEventHandler(event);
267 } 268 }
268 269
270 void HTMLTextAreaElement::handleFocusEvent(Element* oldFocusedNode, FocusDirecti on direction)
tony 2013/08/20 22:10:39 Nit: unused parameters should not be named.
271 {
272 if (Frame* frame = document()->frame())
273 frame->editor()->textAreaOrTextFieldDidBeginEditing(this);
274 }
275
269 void HTMLTextAreaElement::subtreeHasChanged() 276 void HTMLTextAreaElement::subtreeHasChanged()
270 { 277 {
271 setChangedSinceLastFormControlChangeEvent(true); 278 setChangedSinceLastFormControlChangeEvent(true);
272 setFormControlValueMatchesRenderer(false); 279 setFormControlValueMatchesRenderer(false);
273 setNeedsValidityCheck(); 280 setNeedsValidityCheck();
274 281
275 if (!focused()) 282 if (!focused())
276 return; 283 return;
277 284
278 // When typing in a textarea, childrenChanged is not called, so we need to f orce the directionality check. 285 // When typing in a textarea, childrenChanged is not called, so we need to f orce the directionality check.
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document()); 549 RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document());
543 m_placeholder = placeholder.get(); 550 m_placeholder = placeholder.get();
544 m_placeholder->setPart(AtomicString("-webkit-input-placeholder", AtomicS tring::ConstructFromLiteral)); 551 m_placeholder->setPart(AtomicString("-webkit-input-placeholder", AtomicS tring::ConstructFromLiteral));
545 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->n extSibling(), ASSERT_NO_EXCEPTION); 552 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->n extSibling(), ASSERT_NO_EXCEPTION);
546 } 553 }
547 m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION); 554 m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION);
548 fixPlaceholderRenderer(m_placeholder, innerTextElement()); 555 fixPlaceholderRenderer(m_placeholder, innerTextElement());
549 } 556 }
550 557
551 } 558 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698