Title: [134806] trunk/Source/WebCore
- Revision
- 134806
- Author
- [email protected]
- Date
- 2012-11-15 11:39:50 -0800 (Thu, 15 Nov 2012)
Log Message
Remove Node::aboutToUnload and be more explicit about what it was for
https://bugs.webkit.org/show_bug.cgi?id=102357
Patch by Elliott Sprehn <[email protected]> on 2012-11-15
Reviewed by Ryosuke Niwa.
Node::aboutToUnload was confusingly named because it was only called on
the focused node, and it really only existed to support notifying the
embedder that inputs should stop being editable on unload. Instead add
a new method to HTMLInputElement that ends editing and call that
explicitly in the FrameLoader so it's clear what this is about.
No new tests, this is just a refactoring.
* dom/Node.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::endEditing):
New method that handles finishing editing.
* html/HTMLInputElement.h:
(HTMLInputElement):
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::handleBlurEvent):
Use the new method to reduce code duplication.
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::stopLoading):
Be explicit about what this check was for.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (134805 => 134806)
--- trunk/Source/WebCore/ChangeLog 2012-11-15 19:22:49 UTC (rev 134805)
+++ trunk/Source/WebCore/ChangeLog 2012-11-15 19:39:50 UTC (rev 134806)
@@ -1,3 +1,31 @@
+2012-11-15 Elliott Sprehn <[email protected]>
+
+ Remove Node::aboutToUnload and be more explicit about what it was for
+ https://bugs.webkit.org/show_bug.cgi?id=102357
+
+ Reviewed by Ryosuke Niwa.
+
+ Node::aboutToUnload was confusingly named because it was only called on
+ the focused node, and it really only existed to support notifying the
+ embedder that inputs should stop being editable on unload. Instead add
+ a new method to HTMLInputElement that ends editing and call that
+ explicitly in the FrameLoader so it's clear what this is about.
+
+ No new tests, this is just a refactoring.
+
+ * dom/Node.h:
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::endEditing):
+ New method that handles finishing editing.
+ * html/HTMLInputElement.h:
+ (HTMLInputElement):
+ * html/TextFieldInputType.cpp:
+ (WebCore::TextFieldInputType::handleBlurEvent):
+ Use the new method to reduce code duplication.
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::stopLoading):
+ Be explicit about what this check was for.
+
2012-11-15 Tommy Widenflycht <[email protected]>
[chromium] MediaStream API: Add missing WebRTCPeerConnectionHandlerClient::didAddRemoteDataChannel
Modified: trunk/Source/WebCore/dom/Node.h (134805 => 134806)
--- trunk/Source/WebCore/dom/Node.h 2012-11-15 19:22:49 UTC (rev 134805)
+++ trunk/Source/WebCore/dom/Node.h 2012-11-15 19:39:50 UTC (rev 134806)
@@ -311,9 +311,6 @@
virtual void finishParsingChildren() { }
virtual void beginParsingChildren() { }
- // Called on the focused node right before dispatching an unload event.
- virtual void aboutToUnload() { }
-
// For <link> and <style> elements.
virtual bool sheetLoaded() { return true; }
virtual void notifyLoadedSheetAndAllCriticalSubresources(bool /* error loading subresource */) { }
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (134805 => 134806)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2012-11-15 19:22:49 UTC (rev 134805)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2012-11-15 19:39:50 UTC (rev 134806)
@@ -415,16 +415,13 @@
HTMLTextFormControlElement::updateFocusAppearance(restorePreviousSelection);
}
-void HTMLInputElement::aboutToUnload()
+void HTMLInputElement::endEditing()
{
- if (!isTextField() || !focused())
+ if (!isTextField())
return;
- Frame* frame = document()->frame();
- if (!frame)
- return;
-
- frame->editor()->textFieldDidEndEditing(this);
+ if (Frame* frame = document()->frame())
+ frame->editor()->textFieldDidEndEditing(this);
}
bool HTMLInputElement::shouldUseInputMethod()
Modified: trunk/Source/WebCore/html/HTMLInputElement.h (134805 => 134806)
--- trunk/Source/WebCore/html/HTMLInputElement.h 2012-11-15 19:22:49 UTC (rev 134805)
+++ trunk/Source/WebCore/html/HTMLInputElement.h 2012-11-15 19:39:50 UTC (rev 134806)
@@ -287,6 +287,8 @@
virtual const AtomicString& name() const OVERRIDE;
+ void endEditing();
+
static Vector<FileChooserFileInfo> filesFromFileInputFormControlState(const FormControlState&);
virtual void setRangeText(const String& replacement, ExceptionCode&) OVERRIDE;
@@ -320,7 +322,6 @@
virtual bool isEnumeratable() const;
virtual bool supportLabels() const OVERRIDE;
virtual void updateFocusAppearance(bool restorePreviousSelection);
- virtual void aboutToUnload();
virtual bool shouldUseInputMethod();
virtual bool isTextFormControl() const { return isTextField(); }
Modified: trunk/Source/WebCore/html/TextFieldInputType.cpp (134805 => 134806)
--- trunk/Source/WebCore/html/TextFieldInputType.cpp 2012-11-15 19:22:49 UTC (rev 134805)
+++ trunk/Source/WebCore/html/TextFieldInputType.cpp 2012-11-15 19:39:50 UTC (rev 134806)
@@ -193,8 +193,7 @@
void TextFieldInputType::handleBlurEvent()
{
InputType::handleBlurEvent();
- if (Frame* frame = element()->document()->frame())
- frame->editor()->textFieldDidEndEditing(element());
+ element()->endEditing();
}
bool TextFieldInputType::shouldSubmitImplicitly(Event* event)
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (134805 => 134806)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2012-11-15 19:22:49 UTC (rev 134805)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2012-11-15 19:39:50 UTC (rev 134806)
@@ -68,6 +68,7 @@
#include "FrameView.h"
#include "HTMLAnchorElement.h"
#include "HTMLFormElement.h"
+#include "HTMLInputElement.h"
#include "HTMLNames.h"
#include "HTMLObjectElement.h"
#include "HTMLParserIdioms.h"
@@ -399,8 +400,8 @@
if (m_frame->document()) {
if (m_didCallImplicitClose && !m_wasUnloadEventEmitted) {
Node* currentFocusedNode = m_frame->document()->focusedNode();
- if (currentFocusedNode)
- currentFocusedNode->aboutToUnload();
+ if (currentFocusedNode && currentFocusedNode->toInputElement())
+ currentFocusedNode->toInputElement()->endEditing();
if (m_pageDismissalEventBeingDispatched == NoDismissal) {
if (unloadEventPolicy == UnloadEventPolicyUnloadAndPageHide) {
m_pageDismissalEventBeingDispatched = PageHideDismissal;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes