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

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

Issue 133443011: Add text field change handling for autofill preview in textarea element. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Wrap text Created 6 years, 9 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
« no previous file with comments | « no previous file | Source/core/page/ChromeClient.h » ('j') | Source/web/WebFormControlElement.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 22 matching lines...) Expand all
33 #include "core/dom/Document.h" 33 #include "core/dom/Document.h"
34 #include "core/dom/ExceptionCode.h" 34 #include "core/dom/ExceptionCode.h"
35 #include "core/dom/Text.h" 35 #include "core/dom/Text.h"
36 #include "core/dom/shadow/ShadowRoot.h" 36 #include "core/dom/shadow/ShadowRoot.h"
37 #include "core/editing/FrameSelection.h" 37 #include "core/editing/FrameSelection.h"
38 #include "core/editing/SpellChecker.h" 38 #include "core/editing/SpellChecker.h"
39 #include "core/editing/TextIterator.h" 39 #include "core/editing/TextIterator.h"
40 #include "core/events/BeforeTextInsertedEvent.h" 40 #include "core/events/BeforeTextInsertedEvent.h"
41 #include "core/events/Event.h" 41 #include "core/events/Event.h"
42 #include "core/events/ThreadLocalEventNames.h" 42 #include "core/events/ThreadLocalEventNames.h"
43 #include "core/frame/FrameHost.h"
43 #include "core/frame/LocalFrame.h" 44 #include "core/frame/LocalFrame.h"
44 #include "core/html/FormDataList.h" 45 #include "core/html/FormDataList.h"
45 #include "core/html/forms/FormController.h" 46 #include "core/html/forms/FormController.h"
46 #include "core/html/shadow/ShadowElementNames.h" 47 #include "core/html/shadow/ShadowElementNames.h"
47 #include "core/html/shadow/TextControlInnerElements.h" 48 #include "core/html/shadow/TextControlInnerElements.h"
49 #include "core/page/Chrome.h"
50 #include "core/page/ChromeClient.h"
48 #include "core/rendering/RenderTextControlMultiLine.h" 51 #include "core/rendering/RenderTextControlMultiLine.h"
49 #include "platform/text/PlatformLocale.h" 52 #include "platform/text/PlatformLocale.h"
50 #include "wtf/StdLibExtras.h" 53 #include "wtf/StdLibExtras.h"
51 #include "wtf/text/StringBuilder.h" 54 #include "wtf/text/StringBuilder.h"
52 55
53 namespace WebCore { 56 namespace WebCore {
54 57
55 using namespace HTMLNames; 58 using namespace HTMLNames;
56 59
57 static const int defaultRows = 2; 60 static const int defaultRows = 2;
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 { 273 {
271 setChangedSinceLastFormControlChangeEvent(true); 274 setChangedSinceLastFormControlChangeEvent(true);
272 setFormControlValueMatchesRenderer(false); 275 setFormControlValueMatchesRenderer(false);
273 setNeedsValidityCheck(); 276 setNeedsValidityCheck();
274 277
275 if (!focused()) 278 if (!focused())
276 return; 279 return;
277 280
278 // When typing in a textarea, childrenChanged is not called, so we need to f orce the directionality check. 281 // When typing in a textarea, childrenChanged is not called, so we need to f orce the directionality check.
279 calculateAndAdjustDirectionality(); 282 calculateAndAdjustDirectionality();
283
284 ASSERT(document().isActive());
285 document().frameHost()->chrome().client().didChangeValueInTextField(*this);
280 } 286 }
281 287
282 void HTMLTextAreaElement::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent* event) const 288 void HTMLTextAreaElement::handleBeforeTextInsertedEvent(BeforeTextInsertedEvent* event) const
283 { 289 {
284 ASSERT(event); 290 ASSERT(event);
285 ASSERT(renderer()); 291 ASSERT(renderer());
286 int signedMaxLength = maxLength(); 292 int signedMaxLength = maxLength();
287 if (signedMaxLength < 0) 293 if (signedMaxLength < 0)
288 return; 294 return;
289 unsigned unsignedMaxLength = static_cast<unsigned>(signedMaxLength); 295 unsigned unsignedMaxLength = static_cast<unsigned>(signedMaxLength);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 } 436 }
431 437
432 String HTMLTextAreaElement::suggestedValue() const 438 String HTMLTextAreaElement::suggestedValue() const
433 { 439 {
434 return m_suggestedValue; 440 return m_suggestedValue;
435 } 441 }
436 442
437 void HTMLTextAreaElement::setSuggestedValue(const String& value) 443 void HTMLTextAreaElement::setSuggestedValue(const String& value)
438 { 444 {
439 m_suggestedValue = value; 445 m_suggestedValue = value;
440 setInnerTextValue(m_suggestedValue); 446 setNeedsStyleRecalc(SubtreeStyleChange);
447 if (!value.isNull())
448 setInnerTextValue(m_suggestedValue);
449 else
450 setInnerTextValue(m_value);
441 updatePlaceholderVisibility(false); 451 updatePlaceholderVisibility(false);
442 setNeedsStyleRecalc(SubtreeStyleChange);
443 setFormControlValueMatchesRenderer(true);
tkent 2014/03/04 00:15:56 Why do you remove this?
ziran.sun 2014/03/04 12:12:40 "setFormControlValueMatchesRenderer(true);" is inc
444 } 452 }
445 453
446 String HTMLTextAreaElement::validationMessage() const 454 String HTMLTextAreaElement::validationMessage() const
447 { 455 {
448 if (!willValidate()) 456 if (!willValidate())
449 return String(); 457 return String();
450 458
451 if (customError()) 459 if (customError())
452 return customValidationMessage(); 460 return customValidationMessage();
453 461
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 { 549 {
542 return true; 550 return true;
543 } 551 }
544 552
545 bool HTMLTextAreaElement::supportsAutofocus() const 553 bool HTMLTextAreaElement::supportsAutofocus() const
546 { 554 {
547 return true; 555 return true;
548 } 556 }
549 557
550 } 558 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/page/ChromeClient.h » ('j') | Source/web/WebFormControlElement.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698