| 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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 const String& new_value, | 391 const String& new_value, |
| 392 TextFieldEventBehavior event_behavior, | 392 TextFieldEventBehavior event_behavior, |
| 393 TextControlSetValueSelection selection) { | 393 TextControlSetValueSelection selection) { |
| 394 // Code elsewhere normalizes line endings added by the user via the keyboard | 394 // Code elsewhere normalizes line endings added by the user via the keyboard |
| 395 // or pasting. We normalize line endings coming from JavaScript here. | 395 // or pasting. We normalize line endings coming from JavaScript here. |
| 396 String normalized_value = new_value.IsNull() ? "" : new_value; | 396 String normalized_value = new_value.IsNull() ? "" : new_value; |
| 397 normalized_value.Replace("\r\n", "\n"); | 397 normalized_value.Replace("\r\n", "\n"); |
| 398 normalized_value.Replace('\r', '\n'); | 398 normalized_value.Replace('\r', '\n'); |
| 399 | 399 |
| 400 // Return early because we don't want to trigger other side effects when the | 400 // Return early because we don't want to trigger other side effects when the |
| 401 // value isn't changing. This is interoperable though the specification | 401 // value isn't changing. This is interoperable. |
| 402 // doesn't define so. | |
| 403 // https://github.com/whatwg/html/issues/2412 | |
| 404 if (normalized_value == value()) | 402 if (normalized_value == value()) |
| 405 return; | 403 return; |
| 406 | 404 |
| 407 if (event_behavior != kDispatchNoEvent) | 405 if (event_behavior != kDispatchNoEvent) |
| 408 SetValueBeforeFirstUserEditIfNotSet(); | 406 SetValueBeforeFirstUserEditIfNotSet(); |
| 409 value_ = normalized_value; | 407 value_ = normalized_value; |
| 410 SetInnerEditorValue(value_); | 408 SetInnerEditorValue(value_); |
| 411 if (event_behavior == kDispatchNoEvent) | 409 if (event_behavior == kDispatchNoEvent) |
| 412 SetLastChangeWasNotUserEdit(); | 410 SetLastChangeWasNotUserEdit(); |
| 413 else | 411 else |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 const Element& source) { | 630 const Element& source) { |
| 633 const HTMLTextAreaElement& source_element = | 631 const HTMLTextAreaElement& source_element = |
| 634 static_cast<const HTMLTextAreaElement&>(source); | 632 static_cast<const HTMLTextAreaElement&>(source); |
| 635 SetValueCommon(source_element.value(), kDispatchNoEvent, | 633 SetValueCommon(source_element.value(), kDispatchNoEvent, |
| 636 TextControlSetValueSelection::kSetSelectionToEnd); | 634 TextControlSetValueSelection::kSetSelectionToEnd); |
| 637 is_dirty_ = source_element.is_dirty_; | 635 is_dirty_ = source_element.is_dirty_; |
| 638 TextControlElement::CopyNonAttributePropertiesFromElement(source); | 636 TextControlElement::CopyNonAttributePropertiesFromElement(source); |
| 639 } | 637 } |
| 640 | 638 |
| 641 } // namespace blink | 639 } // namespace blink |
| OLD | NEW |