- Revision
- 86988
- Author
- enr...@apple.com
- Date
- 2011-05-20 15:26:37 -0700 (Fri, 20 May 2011)
Log Message
Add delegate methods about focus and blur to all elements.
https://bugs.webkit.org/show_bug.cgi?id=61218
Reviewed by David Kilzer.
Source/WebCore:
We want to have delegates for these events for all the elements, not only the form elements.
The patch moves the call to the delegate in the Node class and changes the name
of the methods not to be form element specific.
* dom/Node.cpp:
(WebCore::Node::dispatchFocusEvent): Added call to delegate with the new name.
(WebCore::Node::dispatchBlurEvent): Added call to delegate with the new name.
* html/HTMLFormControlElement.cpp:
(WebCore::HTMLFormControlElement::dispatchBlurEvent): Removed code that calls the delegate since
it has been moved into Node.
* html/HTMLFormControlElement.h: Removed dispatchFocusEvent, since we are using the default inplementation in Node.
* loader/EmptyClients.h:
(WebCore::EmptyChromeClient::elementDidFocus): Name changed.
(WebCore::EmptyChromeClient::elementDidBlur): Name changed.
* page/ChromeClient.h:
(WebCore::ChromeClient::elementDidFocus): Name changed.
(WebCore::ChromeClient::elementDidBlur): Name changed.
Source/WebKit/mac:
We want to have delegates for these events for all the elements, not only the form elements.
The patch changes the name of the methods in a way that is not form element specific.
* WebCoreSupport/WebChromeClient.h:
* WebCoreSupport/WebChromeClient.mm:
(WebChromeClient::elementDidFocus):
(WebChromeClient::elementDidBlur):
* WebView/WebUIDelegatePrivate.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (86987 => 86988)
--- trunk/Source/WebCore/ChangeLog 2011-05-20 22:18:58 UTC (rev 86987)
+++ trunk/Source/WebCore/ChangeLog 2011-05-20 22:26:37 UTC (rev 86988)
@@ -1,3 +1,28 @@
+2011-05-20 Enrica Casucci <enr...@apple.com>
+
+ Reviewed by David Kilzer.
+
+ Add delegate methods about focus and blur to all elements.
+ https://bugs.webkit.org/show_bug.cgi?id=61218
+
+ We want to have delegates for these events for all the elements, not only the form elements.
+ The patch moves the call to the delegate in the Node class and changes the name
+ of the methods not to be form element specific.
+
+ * dom/Node.cpp:
+ (WebCore::Node::dispatchFocusEvent): Added call to delegate with the new name.
+ (WebCore::Node::dispatchBlurEvent): Added call to delegate with the new name.
+ * html/HTMLFormControlElement.cpp:
+ (WebCore::HTMLFormControlElement::dispatchBlurEvent): Removed code that calls the delegate since
+ it has been moved into Node.
+ * html/HTMLFormControlElement.h: Removed dispatchFocusEvent, since we are using the default inplementation in Node.
+ * loader/EmptyClients.h:
+ (WebCore::EmptyChromeClient::elementDidFocus): Name changed.
+ (WebCore::EmptyChromeClient::elementDidBlur): Name changed.
+ * page/ChromeClient.h:
+ (WebCore::ChromeClient::elementDidFocus): Name changed.
+ (WebCore::ChromeClient::elementDidBlur): Name changed.
+
2011-05-20 Ryosuke Niwa <rn...@webkit.org>
Reviewed by Enrica Casucci.
Modified: trunk/Source/WebCore/dom/Node.cpp (86987 => 86988)
--- trunk/Source/WebCore/dom/Node.cpp 2011-05-20 22:18:58 UTC (rev 86987)
+++ trunk/Source/WebCore/dom/Node.cpp 2011-05-20 22:26:37 UTC (rev 86988)
@@ -2888,11 +2888,17 @@
void Node::dispatchFocusEvent()
{
+ if (document()->page())
+ document()->page()->chrome()->client()->elementDidFocus(this);
+
dispatchEvent(Event::create(eventNames().focusEvent, false, false));
}
void Node::dispatchBlurEvent()
{
+ if (document()->page())
+ document()->page()->chrome()->client()->elementDidBlur(this);
+
dispatchEvent(Event::create(eventNames().blurEvent, false, false));
}
Modified: trunk/Source/WebCore/html/HTMLFormControlElement.cpp (86987 => 86988)
--- trunk/Source/WebCore/html/HTMLFormControlElement.cpp 2011-05-20 22:18:58 UTC (rev 86987)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.cpp 2011-05-20 22:26:37 UTC (rev 86988)
@@ -438,19 +438,8 @@
validity()->setCustomErrorMessage(error);
}
-void HTMLFormControlElement::dispatchFocusEvent()
-{
- if (document()->page())
- document()->page()->chrome()->client()->formDidFocus(this);
-
- HTMLElement::dispatchFocusEvent();
-}
-
void HTMLFormControlElement::dispatchBlurEvent()
{
- if (document()->page())
- document()->page()->chrome()->client()->formDidBlur(this);
-
HTMLElement::dispatchBlurEvent();
hideVisibleValidationMessage();
}
Modified: trunk/Source/WebCore/html/HTMLFormControlElement.h (86987 => 86988)
--- trunk/Source/WebCore/html/HTMLFormControlElement.h 2011-05-20 22:18:58 UTC (rev 86987)
+++ trunk/Source/WebCore/html/HTMLFormControlElement.h 2011-05-20 22:26:37 UTC (rev 86988)
@@ -123,7 +123,6 @@
virtual void recalcStyle(StyleChange);
- virtual void dispatchFocusEvent();
virtual void dispatchBlurEvent();
virtual void detach();
Modified: trunk/Source/WebCore/loader/EmptyClients.h (86987 => 86988)
--- trunk/Source/WebCore/loader/EmptyClients.h 2011-05-20 22:18:58 UTC (rev 86987)
+++ trunk/Source/WebCore/loader/EmptyClients.h 2011-05-20 22:26:37 UTC (rev 86988)
@@ -201,8 +201,8 @@
virtual void formStateDidChange(const Node*) { }
- virtual void formDidFocus(const Node*) { }
- virtual void formDidBlur(const Node*) { }
+ virtual void elementDidFocus(const Node*) { }
+ virtual void elementDidBlur(const Node*) { }
virtual void setCursor(const Cursor&) { }
Modified: trunk/Source/WebCore/page/ChromeClient.h (86987 => 86988)
--- trunk/Source/WebCore/page/ChromeClient.h 2011-05-20 22:18:58 UTC (rev 86987)
+++ trunk/Source/WebCore/page/ChromeClient.h 2011-05-20 22:26:37 UTC (rev 86988)
@@ -236,8 +236,8 @@
// will be called frequently, so handling should be very fast.
virtual void formStateDidChange(const Node*) = 0;
- virtual void formDidFocus(const Node*) { };
- virtual void formDidBlur(const Node*) { };
+ virtual void elementDidFocus(const Node*) { };
+ virtual void elementDidBlur(const Node*) { };
#if USE(ACCELERATED_COMPOSITING)
// Pass 0 as the GraphicsLayer to detatch the root layer.
Modified: trunk/Source/WebKit/mac/ChangeLog (86987 => 86988)
--- trunk/Source/WebKit/mac/ChangeLog 2011-05-20 22:18:58 UTC (rev 86987)
+++ trunk/Source/WebKit/mac/ChangeLog 2011-05-20 22:26:37 UTC (rev 86988)
@@ -1,3 +1,19 @@
+2011-05-20 Enrica Casucci <enr...@apple.com>
+
+ Reviewed by David Kilzer.
+
+ Add delegate methods about focus and blur to all elements.
+ https://bugs.webkit.org/show_bug.cgi?id=61218
+
+ We want to have delegates for these events for all the elements, not only the form elements.
+ The patch changes the name of the methods in a way that is not form element specific.
+
+ * WebCoreSupport/WebChromeClient.h:
+ * WebCoreSupport/WebChromeClient.mm:
+ (WebChromeClient::elementDidFocus):
+ (WebChromeClient::elementDidBlur):
+ * WebView/WebUIDelegatePrivate.h:
+
2011-05-20 Simon Fraser <simon.fra...@apple.com>
Reviewed by Sam Weinig.
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h (86987 => 86988)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h 2011-05-20 22:18:58 UTC (rev 86987)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.h 2011-05-20 22:26:37 UTC (rev 86988)
@@ -147,8 +147,8 @@
virtual void formStateDidChange(const WebCore::Node*) { }
- virtual void formDidFocus(const WebCore::Node*);
- virtual void formDidBlur(const WebCore::Node*);
+ virtual void elementDidFocus(const WebCore::Node*);
+ virtual void elementDidBlur(const WebCore::Node*);
#if USE(ACCELERATED_COMPOSITING)
virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*);
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm (86987 => 86988)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm 2011-05-20 22:18:58 UTC (rev 86987)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm 2011-05-20 22:26:37 UTC (rev 86988)
@@ -846,12 +846,12 @@
return [[m_webView _UIDelegateForwarder] webView:m_webView generateReplacementFile:path];
}
-void WebChromeClient::formDidFocus(const WebCore::Node* node)
+void WebChromeClient::elementDidFocus(const WebCore::Node* node)
{
CallUIDelegate(m_webView, @selector(webView:formDidFocusNode:), kit(const_cast<WebCore::Node*>(node)));
}
-void WebChromeClient::formDidBlur(const WebCore::Node* node)
+void WebChromeClient::elementDidBlur(const WebCore::Node* node)
{
CallUIDelegate(m_webView, @selector(webView:formDidBlurNode:), kit(const_cast<WebCore::Node*>(node)));
}
Modified: trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h (86987 => 86988)
--- trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h 2011-05-20 22:18:58 UTC (rev 86987)
+++ trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h 2011-05-20 22:26:37 UTC (rev 86988)
@@ -223,8 +223,8 @@
frame:(WebFrame *)frame
listener:(id<WebGeolocationPolicyListener>)listener;
-- (void)webView:(WebView *)sender formDidFocusNode:(DOMNode *)node;
-- (void)webView:(WebView *)sender formDidBlurNode:(DOMNode *)node;
+- (void)webView:(WebView *)sender elementDidFocusNode:(DOMNode *)node;
+- (void)webView:(WebView *)sender elementDidBlurNode:(DOMNode *)node;
/*!
@method webView:printFrame: