| 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 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
| 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 if (event->type() == EventTypeNames::blur || event->type() == EventTypeNames
::focus) | 112 if (event->type() == EventTypeNames::blur || event->type() == EventTypeNames
::focus) |
| 113 return; | 113 return; |
| 114 innerEditorElement()->defaultEventHandler(event); | 114 innerEditorElement()->defaultEventHandler(event); |
| 115 } | 115 } |
| 116 | 116 |
| 117 String HTMLTextFormControlElement::strippedPlaceholder() const | 117 String HTMLTextFormControlElement::strippedPlaceholder() const |
| 118 { | 118 { |
| 119 // According to the HTML5 specification, we need to remove CR and LF from | 119 // According to the HTML5 specification, we need to remove CR and LF from |
| 120 // the attribute value. | 120 // the attribute value. |
| 121 const AtomicString& attributeValue = fastGetAttribute(placeholderAttr); | 121 const AtomicString& attributeValue = fastGetAttribute(placeholderAttr); |
| 122 if (!attributeValue.contains(newlineCharacter) && !attributeValue.contains(c
arriageReturn)) | 122 if (!attributeValue.contains(newlineCharacter) && !attributeValue.contains(c
arriageReturnCharacter)) |
| 123 return attributeValue; | 123 return attributeValue; |
| 124 | 124 |
| 125 StringBuilder stripped; | 125 StringBuilder stripped; |
| 126 unsigned length = attributeValue.length(); | 126 unsigned length = attributeValue.length(); |
| 127 stripped.reserveCapacity(length); | 127 stripped.reserveCapacity(length); |
| 128 for (unsigned i = 0; i < length; ++i) { | 128 for (unsigned i = 0; i < length; ++i) { |
| 129 UChar character = attributeValue[i]; | 129 UChar character = attributeValue[i]; |
| 130 if (character == newlineCharacter || character == carriageReturn) | 130 if (character == newlineCharacter || character == carriageReturnCharacte
r) |
| 131 continue; | 131 continue; |
| 132 stripped.append(character); | 132 stripped.append(character); |
| 133 } | 133 } |
| 134 return stripped.toString(); | 134 return stripped.toString(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 static bool isNotLineBreak(UChar ch) { return ch != newlineCharacter && ch != ca
rriageReturn; } | 137 static bool isNotLineBreak(UChar ch) { return ch != newlineCharacter && ch != ca
rriageReturnCharacter; } |
| 138 | 138 |
| 139 bool HTMLTextFormControlElement::isPlaceholderEmpty() const | 139 bool HTMLTextFormControlElement::isPlaceholderEmpty() const |
| 140 { | 140 { |
| 141 const AtomicString& attributeValue = fastGetAttribute(placeholderAttr); | 141 const AtomicString& attributeValue = fastGetAttribute(placeholderAttr); |
| 142 return attributeValue.string().find(isNotLineBreak) == kNotFound; | 142 return attributeValue.string().find(isNotLineBreak) == kNotFound; |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool HTMLTextFormControlElement::placeholderShouldBeVisible() const | 145 bool HTMLTextFormControlElement::placeholderShouldBeVisible() const |
| 146 { | 146 { |
| 147 return supportsPlaceholder() | 147 return supportsPlaceholder() |
| (...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 void HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(const Ele
ment& source) | 1009 void HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(const Ele
ment& source) |
| 1010 { | 1010 { |
| 1011 const HTMLTextFormControlElement& sourceElement = static_cast<const HTMLText
FormControlElement&>(source); | 1011 const HTMLTextFormControlElement& sourceElement = static_cast<const HTMLText
FormControlElement&>(source); |
| 1012 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; | 1012 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; |
| 1013 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); | 1013 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 } // namespace blink | 1016 } // namespace blink |
| OLD | NEW |