| 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 | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights |
| 6 * reserved. | 6 * reserved. |
| 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 restoreCachedSelection(); | 250 restoreCachedSelection(); |
| 251 break; | 251 break; |
| 252 case SelectionBehaviorOnFocus::None: | 252 case SelectionBehaviorOnFocus::None: |
| 253 return; | 253 return; |
| 254 } | 254 } |
| 255 if (document().frame()) | 255 if (document().frame()) |
| 256 document().frame()->selection().revealSelection(); | 256 document().frame()->selection().revealSelection(); |
| 257 } | 257 } |
| 258 | 258 |
| 259 void HTMLTextAreaElement::defaultEventHandler(Event* event) { | 259 void HTMLTextAreaElement::defaultEventHandler(Event* event) { |
| 260 if (layoutObject() && (event->isMouseEvent() || event->isDragEvent() || | 260 if (layoutObject() && |
| 261 event->hasInterface(EventNames::WheelEvent) || | 261 (event->isMouseEvent() || event->isDragEvent() || |
| 262 event->type() == EventTypeNames::blur)) | 262 event->hasInterface(EventNames::WheelEvent) || |
| 263 event->type() == EventTypeNames::blur)) |
| 263 forwardEvent(event); | 264 forwardEvent(event); |
| 264 else if (layoutObject() && event->isBeforeTextInsertedEvent()) | 265 else if (layoutObject() && event->isBeforeTextInsertedEvent()) |
| 265 handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(event)); | 266 handleBeforeTextInsertedEvent(static_cast<BeforeTextInsertedEvent*>(event)); |
| 266 | 267 |
| 267 TextControlElement::defaultEventHandler(event); | 268 TextControlElement::defaultEventHandler(event); |
| 268 } | 269 } |
| 269 | 270 |
| 270 void HTMLTextAreaElement::handleFocusEvent(Element*, WebFocusType) { | 271 void HTMLTextAreaElement::handleFocusEvent(Element*, WebFocusType) { |
| 271 if (LocalFrame* frame = document().frame()) | 272 if (LocalFrame* frame = document().frame()) |
| 272 frame->spellChecker().didBeginEditing(this); | 273 frame->spellChecker().didBeginEditing(this); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 } | 411 } |
| 411 } | 412 } |
| 412 return; | 413 return; |
| 413 } | 414 } |
| 414 | 415 |
| 415 m_value = normalizedValue; | 416 m_value = normalizedValue; |
| 416 setInnerEditorValue(m_value); | 417 setInnerEditorValue(m_value); |
| 417 if (eventBehavior == DispatchNoEvent) | 418 if (eventBehavior == DispatchNoEvent) |
| 418 setLastChangeWasNotUserEdit(); | 419 setLastChangeWasNotUserEdit(); |
| 419 updatePlaceholderVisibility(); | 420 updatePlaceholderVisibility(); |
| 420 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create( | 421 setNeedsStyleRecalc( |
| 421 StyleChangeReason::ControlValue)); | 422 SubtreeStyleChange, |
| 423 StyleChangeReasonForTracing::create(StyleChangeReason::ControlValue)); |
| 422 m_suggestedValue = String(); | 424 m_suggestedValue = String(); |
| 423 setNeedsValidityCheck(); | 425 setNeedsValidityCheck(); |
| 424 if (isFinishedParsingChildren()) { | 426 if (isFinishedParsingChildren()) { |
| 425 // Set the caret to the end of the text value except for initialize. | 427 // Set the caret to the end of the text value except for initialize. |
| 426 unsigned endOfString = m_value.length(); | 428 unsigned endOfString = m_value.length(); |
| 427 setSelectionRange(endOfString, endOfString); | 429 setSelectionRange(endOfString, endOfString); |
| 428 } | 430 } |
| 429 | 431 |
| 430 notifyFormStateChanged(); | 432 notifyFormStateChanged(); |
| 431 switch (eventBehavior) { | 433 switch (eventBehavior) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 } | 495 } |
| 494 | 496 |
| 495 void HTMLTextAreaElement::setSuggestedValue(const String& value) { | 497 void HTMLTextAreaElement::setSuggestedValue(const String& value) { |
| 496 m_suggestedValue = value; | 498 m_suggestedValue = value; |
| 497 | 499 |
| 498 if (!value.isNull()) | 500 if (!value.isNull()) |
| 499 setInnerEditorValue(m_suggestedValue); | 501 setInnerEditorValue(m_suggestedValue); |
| 500 else | 502 else |
| 501 setInnerEditorValue(m_value); | 503 setInnerEditorValue(m_value); |
| 502 updatePlaceholderVisibility(); | 504 updatePlaceholderVisibility(); |
| 503 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create( | 505 setNeedsStyleRecalc( |
| 504 StyleChangeReason::ControlValue)); | 506 SubtreeStyleChange, |
| 507 StyleChangeReasonForTracing::create(StyleChangeReason::ControlValue)); |
| 505 } | 508 } |
| 506 | 509 |
| 507 String HTMLTextAreaElement::validationMessage() const { | 510 String HTMLTextAreaElement::validationMessage() const { |
| 508 if (!willValidate()) | 511 if (!willValidate()) |
| 509 return String(); | 512 return String(); |
| 510 | 513 |
| 511 if (customError()) | 514 if (customError()) |
| 512 return customValidationMessage(); | 515 return customValidationMessage(); |
| 513 | 516 |
| 514 if (valueMissing()) | 517 if (valueMissing()) |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 void HTMLTextAreaElement::copyNonAttributePropertiesFromElement( | 644 void HTMLTextAreaElement::copyNonAttributePropertiesFromElement( |
| 642 const Element& source) { | 645 const Element& source) { |
| 643 const HTMLTextAreaElement& sourceElement = | 646 const HTMLTextAreaElement& sourceElement = |
| 644 static_cast<const HTMLTextAreaElement&>(source); | 647 static_cast<const HTMLTextAreaElement&>(source); |
| 645 setValueCommon(sourceElement.value(), DispatchNoEvent, SetSeletion); | 648 setValueCommon(sourceElement.value(), DispatchNoEvent, SetSeletion); |
| 646 m_isDirty = sourceElement.m_isDirty; | 649 m_isDirty = sourceElement.m_isDirty; |
| 647 TextControlElement::copyNonAttributePropertiesFromElement(source); | 650 TextControlElement::copyNonAttributePropertiesFromElement(source); |
| 648 } | 651 } |
| 649 | 652 |
| 650 } // namespace blink | 653 } // namespace blink |
| OLD | NEW |