OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 |
| 447 if (!value.isNull()) |
| 448 setInnerTextValue(m_suggestedValue); |
| 449 else |
| 450 setInnerTextValue(m_value); |
441 updatePlaceholderVisibility(false); | 451 updatePlaceholderVisibility(false); |
442 setNeedsStyleRecalc(SubtreeStyleChange); | 452 setNeedsStyleRecalc(SubtreeStyleChange); |
443 setFormControlValueMatchesRenderer(true); | |
444 } | 453 } |
445 | 454 |
446 String HTMLTextAreaElement::validationMessage() const | 455 String HTMLTextAreaElement::validationMessage() const |
447 { | 456 { |
448 if (!willValidate()) | 457 if (!willValidate()) |
449 return String(); | 458 return String(); |
450 | 459 |
451 if (customError()) | 460 if (customError()) |
452 return customValidationMessage(); | 461 return customValidationMessage(); |
453 | 462 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 { | 550 { |
542 return true; | 551 return true; |
543 } | 552 } |
544 | 553 |
545 bool HTMLTextAreaElement::supportsAutofocus() const | 554 bool HTMLTextAreaElement::supportsAutofocus() const |
546 { | 555 { |
547 return true; | 556 return true; |
548 } | 557 } |
549 | 558 |
550 } | 559 } |
OLD | NEW |