Changeset 288005 in webkit
- Timestamp:
- Jan 13, 2022 7:14:33 PM (6 months ago)
- Location:
- trunk
- Files:
-
- 9 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/TestExpectations (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/HTMLInputElement.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLInputElement.h (modified) (1 diff)
-
Source/WebCore/html/HTMLTextAreaElement.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLTextFormControlElement.cpp (modified) (1 diff)
-
Source/WebCore/html/HTMLTextFormControlElement.h (modified) (1 diff)
-
Source/WebCore/html/TextFieldInputType.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r288003 r288005 1 2022-01-13 Chris Dumez <cdumez@apple.com> 2 3 Unable to have new lines in HTMLTextArea's placeholder text 4 https://bugs.webkit.org/show_bug.cgi?id=235205 5 6 Reviewed by Wenson Hsieh. 7 8 Unskip WPT tests that are no longer failing. 9 10 * TestExpectations: 11 1 12 2022-01-13 Cameron McCormack <heycam@apple.com> 2 13 -
trunk/LayoutTests/TestExpectations
r287977 r288005 752 752 imported/w3c/web-platform-tests/html/semantics/forms/the-select-element/reset-algorithm-rendering.html [ ImageOnlyFailure ] 753 753 imported/w3c/web-platform-tests/html/semantics/forms/the-selectmenu-element/selectmenu-option-arbitrary-content-displayed.tentative.html [ ImageOnlyFailure ] 754 imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/multiline-placeholder-cr.html [ ImageOnlyFailure ]755 imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/multiline-placeholder-crlf.html [ ImageOnlyFailure ]756 imported/w3c/web-platform-tests/html/semantics/forms/the-textarea-element/multiline-placeholder.html [ ImageOnlyFailure ]757 754 imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-popup-element/popup-hidden-display.tentative.html [ ImageOnlyFailure ] 758 755 imported/w3c/web-platform-tests/html/semantics/interactive-elements/the-popup-element/popup-initiallyopen-display.tentative.html [ ImageOnlyFailure ] -
trunk/Source/WebCore/ChangeLog
r288004 r288005 1 2022-01-13 Chris Dumez <cdumez@apple.com> 2 3 Unable to have new lines in HTMLTextArea's placeholder text 4 https://bugs.webkit.org/show_bug.cgi?id=235205 5 6 Reviewed by Wenson Hsieh. 7 8 Unlike the placeholder for HTMLInputElement, the placeholder for HTMLTextAreaElement needs 9 to allow new lines as per: 10 - https://html.spec.whatwg.org/multipage/form-elements.html#attr-textarea-placeholder 11 12 This aligns our behavior with Blink and Gecko. 13 14 No new tests, unskipped existing WPT tests. 15 16 * html/HTMLInputElement.cpp: 17 (WebCore::HTMLInputElement::placeholder const): 18 * html/HTMLInputElement.h: 19 * html/HTMLTextAreaElement.cpp: 20 (WebCore::HTMLTextAreaElement::updatePlaceholderText): 21 * html/HTMLTextFormControlElement.cpp: 22 (WebCore::HTMLTextFormControlElement::strippedPlaceholder const): Deleted. 23 * html/HTMLTextFormControlElement.h: 24 * html/TextFieldInputType.cpp: 25 (WebCore::TextFieldInputType::updatePlaceholderText): 26 1 27 2022-01-13 Chris Dumez <cdumez@apple.com> 2 28 -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r287818 r288005 2190 2190 } 2191 2191 2192 String HTMLInputElement::placeholder() const 2193 { 2194 // According to the HTML5 specification, we need to remove CR and LF from 2195 // the attribute value. 2196 String attributeValue = attributeWithoutSynchronization(placeholderAttr); 2197 return attributeValue.removeCharacters([](UChar c) { 2198 return c == newlineCharacter || c == carriageReturn; 2199 }); 2200 } 2201 2192 2202 } // namespace -
trunk/Source/WebCore/html/HTMLInputElement.h
r287551 r288005 178 178 bool hasDirtyValue() const { return !m_valueIfDirty.isNull(); }; 179 179 180 String placeholder() const; 181 180 182 String sanitizeValue(const String&) const; 181 183 -
trunk/Source/WebCore/html/HTMLTextAreaElement.cpp
r286447 r288005 539 539 void HTMLTextAreaElement::updatePlaceholderText() 540 540 { 541 String placeholderText = strippedPlaceholder();541 auto& placeholderText = attributeWithoutSynchronization(placeholderAttr); 542 542 if (placeholderText.isEmpty()) { 543 543 if (m_placeholder) { -
trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp
r287520 r288005 132 132 } 133 133 134 String HTMLTextFormControlElement::strippedPlaceholder() const135 {136 // According to the HTML5 specification, we need to remove CR and LF from137 // the attribute value.138 const AtomString& attributeValue = attributeWithoutSynchronization(placeholderAttr);139 if (!attributeValue.contains(newlineCharacter) && !attributeValue.contains(carriageReturn))140 return attributeValue;141 142 StringBuilder stripped;143 unsigned length = attributeValue.length();144 stripped.reserveCapacity(length);145 for (unsigned i = 0; i < length; ++i) {146 UChar character = attributeValue[i];147 if (character == newlineCharacter || character == carriageReturn)148 continue;149 stripped.append(character);150 }151 return stripped.toString();152 }153 154 134 static bool isNotLineBreak(UChar ch) { return ch != newlineCharacter && ch != carriageReturn; } 155 135 -
trunk/Source/WebCore/html/HTMLTextFormControlElement.h
r278253 r288005 61 61 bool isPlaceholderVisible() const { return m_isPlaceholderVisible; } 62 62 virtual bool supportsPlaceholder() const = 0; 63 String strippedPlaceholder() const;64 63 virtual HTMLElement* placeholderElement() const = 0; 65 64 void updatePlaceholderVisibility(); -
trunk/Source/WebCore/html/TextFieldInputType.cpp
r286447 r288005 620 620 return; 621 621 ASSERT(element()); 622 String placeholderText = element()-> strippedPlaceholder();622 String placeholderText = element()->placeholder(); 623 623 if (placeholderText.isEmpty()) { 624 624 if (m_placeholder) {
Note: See TracChangeset
for help on using the changeset viewer.