Title: [260854] trunk/Source
- Revision
- 260854
- Author
- [email protected]
- Date
- 2020-04-28 16:35:05 -0700 (Tue, 28 Apr 2020)
Log Message
[WebKitLegacy] Implement -hidePlaceholder and -showPlaceholderIfNecessary in terms of setCanShowPlaceholder()
https://bugs.webkit.org/show_bug.cgi?id=211139
Reviewed by Simon Fraser.
Source/WebCore:
Remove hidePlaceholder() and showPlaceholderIfNecessary() as they are no longer needed.
Callers should use setCanShowPlaceholder() instead.
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::hidePlaceholder): Deleted.
(WebCore::HTMLTextFormControlElement::showPlaceholderIfNecessary): Deleted.
* html/HTMLTextFormControlElement.h:
Source/WebKitLegacy/mac:
Implement -hidePlaceholder and -showPlaceholderIfNecessary in terms of setCanShowPlaceholder()
because:
1. Unlike -hidePlaceholder and -showPlaceholderIfNecessary, setCanShowPlaceholder() does NOT of
reach into the guts of the control and mutate its CSS.
2. Because of (1), it works correctly should future code be written that modifies the structure
of the guts or the CSS of the placeholder element (which is inside the guts of the control).
3. Unlike -hidePlaceholder and -showPlaceholderIfNecessary, there is test coverage for setCanShowPlaceholder()
to ensure (2).
* DOM/WebDOMOperations.mm:
(-[DOMNode hidePlaceholder]):
(-[DOMNode showPlaceholderIfNecessary]):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (260853 => 260854)
--- trunk/Source/WebCore/ChangeLog 2020-04-28 22:57:27 UTC (rev 260853)
+++ trunk/Source/WebCore/ChangeLog 2020-04-28 23:35:05 UTC (rev 260854)
@@ -1,3 +1,18 @@
+2020-04-28 Daniel Bates <[email protected]>
+
+ [WebKitLegacy] Implement -hidePlaceholder and -showPlaceholderIfNecessary in terms of setCanShowPlaceholder()
+ https://bugs.webkit.org/show_bug.cgi?id=211139
+
+ Reviewed by Simon Fraser.
+
+ Remove hidePlaceholder() and showPlaceholderIfNecessary() as they are no longer needed.
+ Callers should use setCanShowPlaceholder() instead.
+
+ * html/HTMLTextFormControlElement.cpp:
+ (WebCore::HTMLTextFormControlElement::hidePlaceholder): Deleted.
+ (WebCore::HTMLTextFormControlElement::showPlaceholderIfNecessary): Deleted.
+ * html/HTMLTextFormControlElement.h:
+
2020-04-28 ChangSeok Oh <[email protected]>
[GTK] Fix build failures for ANGLE_WEBGL after r259589
Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp (260853 => 260854)
--- trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp 2020-04-28 22:57:27 UTC (rev 260853)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.cpp 2020-04-28 23:35:05 UTC (rev 260854)
@@ -677,20 +677,6 @@
return index;
}
-#if PLATFORM(IOS_FAMILY)
-void HTMLTextFormControlElement::hidePlaceholder()
-{
- if (RefPtr<HTMLElement> placeholder = placeholderElement())
- placeholder->setInlineStyleProperty(CSSPropertyVisibility, CSSValueHidden, true);
-}
-
-void HTMLTextFormControlElement::showPlaceholderIfNecessary()
-{
- if (RefPtr<HTMLElement> placeholder = placeholderElement())
- placeholder->setInlineStyleProperty(CSSPropertyVisibility, CSSValueVisible, true);
-}
-#endif
-
static void getNextSoftBreak(RootInlineBox*& line, Node*& breakNode, unsigned& breakOffset)
{
RootInlineBox* next;
Modified: trunk/Source/WebCore/html/HTMLTextFormControlElement.h (260853 => 260854)
--- trunk/Source/WebCore/html/HTMLTextFormControlElement.h 2020-04-28 22:57:27 UTC (rev 260853)
+++ trunk/Source/WebCore/html/HTMLTextFormControlElement.h 2020-04-28 23:35:05 UTC (rev 260854)
@@ -99,10 +99,6 @@
String directionForFormData() const;
void setTextAsOfLastFormControlChangeEvent(const String& text) { m_textAsOfLastFormControlChangeEvent = text; }
-#if PLATFORM(IOS_FAMILY)
- WEBCORE_EXPORT void hidePlaceholder();
- WEBCORE_EXPORT void showPlaceholderIfNecessary();
-#endif
WEBCORE_EXPORT virtual bool isInnerTextElementEditable() const;
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (260853 => 260854)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2020-04-28 22:57:27 UTC (rev 260853)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2020-04-28 23:35:05 UTC (rev 260854)
@@ -1,3 +1,26 @@
+2020-04-28 Daniel Bates <[email protected]>
+
+ [WebKitLegacy] Implement -hidePlaceholder and -showPlaceholderIfNecessary in terms of setCanShowPlaceholder()
+ https://bugs.webkit.org/show_bug.cgi?id=211139
+
+ Reviewed by Simon Fraser.
+
+ Implement -hidePlaceholder and -showPlaceholderIfNecessary in terms of setCanShowPlaceholder()
+ because:
+
+ 1. Unlike -hidePlaceholder and -showPlaceholderIfNecessary, setCanShowPlaceholder() does NOT of
+ reach into the guts of the control and mutate its CSS.
+
+ 2. Because of (1), it works correctly should future code be written that modifies the structure
+ of the guts or the CSS of the placeholder element (which is inside the guts of the control).
+
+ 3. Unlike -hidePlaceholder and -showPlaceholderIfNecessary, there is test coverage for setCanShowPlaceholder()
+ to ensure (2).
+
+ * DOM/WebDOMOperations.mm:
+ (-[DOMNode hidePlaceholder]):
+ (-[DOMNode showPlaceholderIfNecessary]):
+
2020-04-27 Antoine Quint <[email protected]>
Clean up some useless includes of CSSAnimationController.h
Modified: trunk/Source/WebKitLegacy/mac/DOM/WebDOMOperations.mm (260853 => 260854)
--- trunk/Source/WebKitLegacy/mac/DOM/WebDOMOperations.mm 2020-04-28 22:57:27 UTC (rev 260853)
+++ trunk/Source/WebKitLegacy/mac/DOM/WebDOMOperations.mm 2020-04-28 23:35:05 UTC (rev 260854)
@@ -48,6 +48,7 @@
#import <WebCore/FrameLoader.h>
#import <WebCore/HTMLInputElement.h>
#import <WebCore/HTMLParserIdioms.h>
+#import <WebCore/HTMLTextFormControlElement.h>
#import <WebCore/JSElement.h>
#import <WebCore/LegacyWebArchive.h>
#import <WebCore/PlatformWheelEvent.h>
@@ -97,6 +98,7 @@
}
#if PLATFORM(IOS_FAMILY)
+
- (BOOL)isHorizontalWritingMode
{
Node* node = core(self);
@@ -112,24 +114,16 @@
- (void)hidePlaceholder
{
- if (![self isKindOfClass:[DOMHTMLInputElement class]]
- && ![self isKindOfClass:[DOMHTMLTextAreaElement class]])
- return;
-
- Node *node = core(self);
- HTMLTextFormControlElement *formControl = static_cast<HTMLTextFormControlElement *>(node);
- formControl->hidePlaceholder();
+ if (auto node = core(self); is<HTMLTextFormControlElement>(node))
+ downcast<HTMLTextFormControlElement>(*node).setCanShowPlaceholder(false);
}
- (void)showPlaceholderIfNecessary
{
- if (![self isKindOfClass:[DOMHTMLInputElement class]]
- && ![self isKindOfClass:[DOMHTMLTextAreaElement class]])
- return;
-
- HTMLTextFormControlElement *formControl = static_cast<HTMLTextFormControlElement *>(core(self));
- formControl->showPlaceholderIfNecessary();
+ if (auto node = core(self); is<HTMLTextFormControlElement>(node))
+ downcast<HTMLTextFormControlElement>(*node).setCanShowPlaceholder(true);
}
+
#endif
@end
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes