| 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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 if (currentLength + computeLengthForSubmission(event->text()) < unsignedMaxL
ength) | 319 if (currentLength + computeLengthForSubmission(event->text()) < unsignedMaxL
ength) |
| 320 return; | 320 return; |
| 321 | 321 |
| 322 // selectionLength represents the selection length of this text field to be | 322 // selectionLength represents the selection length of this text field to be |
| 323 // removed by this insertion. | 323 // removed by this insertion. |
| 324 // If the text field has no focus, we don't need to take account of the | 324 // If the text field has no focus, we don't need to take account of the |
| 325 // selection length. The selection is the source of text drag-and-drop in | 325 // selection length. The selection is the source of text drag-and-drop in |
| 326 // that case, and nothing in the text field will be removed. | 326 // that case, and nothing in the text field will be removed. |
| 327 unsigned selectionLength = 0; | 327 unsigned selectionLength = 0; |
| 328 if (focused()) { | 328 if (focused()) { |
| 329 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesh
eets |
| 330 // needs to be audited. See http://crbug.com/590369 for more details. |
| 331 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 332 |
| 329 selectionLength = computeLengthForSubmission(document().frame()->selecti
on().selectedText()); | 333 selectionLength = computeLengthForSubmission(document().frame()->selecti
on().selectedText()); |
| 330 } | 334 } |
| 331 DCHECK_GE(currentLength, selectionLength); | 335 DCHECK_GE(currentLength, selectionLength); |
| 332 unsigned baseLength = currentLength - selectionLength; | 336 unsigned baseLength = currentLength - selectionLength; |
| 333 unsigned appendableLength = unsignedMaxLength > baseLength ? unsignedMaxLeng
th - baseLength : 0; | 337 unsigned appendableLength = unsignedMaxLength > baseLength ? unsignedMaxLeng
th - baseLength : 0; |
| 334 event->setText(sanitizeUserInputValue(event->text(), appendableLength)); | 338 event->setText(sanitizeUserInputValue(event->text(), appendableLength)); |
| 335 } | 339 } |
| 336 | 340 |
| 337 String HTMLTextAreaElement::sanitizeUserInputValue(const String& proposedValue,
unsigned maxLength) | 341 String HTMLTextAreaElement::sanitizeUserInputValue(const String& proposedValue,
unsigned maxLength) |
| 338 { | 342 { |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 | 677 |
| 674 void HTMLTextAreaElement::copyNonAttributePropertiesFromElement(const Element& s
ource) | 678 void HTMLTextAreaElement::copyNonAttributePropertiesFromElement(const Element& s
ource) |
| 675 { | 679 { |
| 676 const HTMLTextAreaElement& sourceElement = static_cast<const HTMLTextAreaEle
ment&>(source); | 680 const HTMLTextAreaElement& sourceElement = static_cast<const HTMLTextAreaEle
ment&>(source); |
| 677 setValueCommon(sourceElement.value(), DispatchNoEvent, SetSeletion); | 681 setValueCommon(sourceElement.value(), DispatchNoEvent, SetSeletion); |
| 678 m_isDirty = sourceElement.m_isDirty; | 682 m_isDirty = sourceElement.m_isDirty; |
| 679 HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source); | 683 HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(source); |
| 680 } | 684 } |
| 681 | 685 |
| 682 } // namespace blink | 686 } // namespace blink |
| OLD | NEW |