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

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: 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 18 matching lines...) Expand all
29 #include "CSSValueKeywords.h" 29 #include "CSSValueKeywords.h"
30 #include "HTMLNames.h" 30 #include "HTMLNames.h"
31 #include "core/dom/BeforeTextInsertedEvent.h" 31 #include "core/dom/BeforeTextInsertedEvent.h"
32 #include "core/dom/Document.h" 32 #include "core/dom/Document.h"
33 #include "core/dom/Event.h" 33 #include "core/dom/Event.h"
34 #include "core/dom/EventNames.h" 34 #include "core/dom/EventNames.h"
35 #include "core/dom/ExceptionCode.h" 35 #include "core/dom/ExceptionCode.h"
36 #include "core/dom/ExceptionCodePlaceholder.h" 36 #include "core/dom/ExceptionCodePlaceholder.h"
37 #include "core/dom/Text.h" 37 #include "core/dom/Text.h"
38 #include "core/dom/shadow/ShadowRoot.h" 38 #include "core/dom/shadow/ShadowRoot.h"
39 #include "core/editing/Editor.h"
39 #include "core/editing/FrameSelection.h" 40 #include "core/editing/FrameSelection.h"
40 #include "core/editing/TextIterator.h" 41 #include "core/editing/TextIterator.h"
41 #include "core/html/FormController.h" 42 #include "core/html/FormController.h"
42 #include "core/html/FormDataList.h" 43 #include "core/html/FormDataList.h"
43 #include "core/html/shadow/TextControlInnerElements.h" 44 #include "core/html/shadow/TextControlInnerElements.h"
44 #include "core/page/Frame.h" 45 #include "core/page/Frame.h"
45 #include "core/platform/LocalizedStrings.h" 46 #include "core/platform/LocalizedStrings.h"
46 #include "core/rendering/RenderTextControlMultiLine.h" 47 #include "core/rendering/RenderTextControlMultiLine.h"
47 #include "wtf/StdLibExtras.h" 48 #include "wtf/StdLibExtras.h"
48 #include "wtf/text/StringBuilder.h" 49 #include "wtf/text/StringBuilder.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 void HTMLTextAreaElement::defaultEventHandler(Event* event) 264 void HTMLTextAreaElement::defaultEventHandler(Event* event)
264 { 265 {
265 if (renderer() && (event->isMouseEvent() || event->isDragEvent() || event->h asInterface(eventNames().interfaceForWheelEvent) || event->type() == eventNames( ).blurEvent)) 266 if (renderer() && (event->isMouseEvent() || event->isDragEvent() || event->h asInterface(eventNames().interfaceForWheelEvent) || event->type() == eventNames( ).blurEvent))
266 forwardEvent(event); 267 forwardEvent(event);
267 else if (renderer() && event->isBeforeTextInsertedEvent()) 268 else if (renderer() && event->isBeforeTextInsertedEvent())
268 handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(even t)); 269 handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(even t));
269 270
270 HTMLTextFormControlElement::defaultEventHandler(event); 271 HTMLTextFormControlElement::defaultEventHandler(event);
271 } 272 }
272 273
274 void HTMLTextAreaElement::handleFocusEvent(Element* oldFocusedNode, FocusDirecti on direction)
275 {
276 if (Frame* frame = document()->frame())
277 frame->editor()->textAreaDidBeginEditing(this);
278 }
279
273 void HTMLTextAreaElement::subtreeHasChanged() 280 void HTMLTextAreaElement::subtreeHasChanged()
274 { 281 {
275 setChangedSinceLastFormControlChangeEvent(true); 282 setChangedSinceLastFormControlChangeEvent(true);
276 setFormControlValueMatchesRenderer(false); 283 setFormControlValueMatchesRenderer(false);
277 setNeedsValidityCheck(); 284 setNeedsValidityCheck();
278 285
279 if (!focused()) 286 if (!focused())
280 return; 287 return;
281 288
282 // When typing in a textarea, childrenChanged is not called, so we need to f orce the directionality check. 289 // When typing in a textarea, childrenChanged is not called, so we need to f orce the directionality check.
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document()); 556 RefPtr<HTMLDivElement> placeholder = HTMLDivElement::create(document());
550 m_placeholder = placeholder.get(); 557 m_placeholder = placeholder.get();
551 m_placeholder->setPseudo(AtomicString("-webkit-input-placeholder", Atomi cString::ConstructFromLiteral)); 558 m_placeholder->setPseudo(AtomicString("-webkit-input-placeholder", Atomi cString::ConstructFromLiteral));
552 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->n extSibling(), ASSERT_NO_EXCEPTION); 559 userAgentShadowRoot()->insertBefore(m_placeholder, innerTextElement()->n extSibling(), ASSERT_NO_EXCEPTION);
553 } 560 }
554 m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION); 561 m_placeholder->setInnerText(placeholderText, ASSERT_NO_EXCEPTION);
555 fixPlaceholderRenderer(m_placeholder, innerTextElement()); 562 fixPlaceholderRenderer(m_placeholder, innerTextElement());
556 } 563 }
557 564
558 } 565 }
OLDNEW
« Source/core/editing/Editor.cpp ('K') | « Source/core/html/HTMLTextAreaElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698