Title: [146641] trunk/Source/WebKit/blackberry
Revision
146641
Author
[email protected]
Date
2013-03-22 12:34:23 -0700 (Fri, 22 Mar 2013)

Log Message

Check focused node reference when traversing through history
https://bugs.webkit.org/show_bug.cgi?id=113082

Patch by Nima Ghanavatian <[email protected]> on 2013-03-22
Reviewed by Rob Buis.

PR312101
Check if we have a valid node and document before attempting to access its frame and
frame selection. This is causing issues when going back to a page after a redirect
where a stale pointer is used.
Further, the focused node should be changed after the frame is fully loaded.

* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::dispatchDidFinishLoad):
* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::setElementUnfocused):
(BlackBerry::WebKit::InputHandler::restoreViewState):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (146640 => 146641)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-03-22 19:23:45 UTC (rev 146640)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-03-22 19:34:23 UTC (rev 146641)
@@ -1,3 +1,22 @@
+2013-03-22  Nima Ghanavatian  <[email protected]>
+
+        Check focused node reference when traversing through history
+        https://bugs.webkit.org/show_bug.cgi?id=113082
+
+        Reviewed by Rob Buis.
+
+        PR312101
+        Check if we have a valid node and document before attempting to access its frame and
+        frame selection. This is causing issues when going back to a page after a redirect
+        where a stale pointer is used.
+        Further, the focused node should be changed after the frame is fully loaded.
+
+        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+        (WebCore::FrameLoaderClientBlackBerry::dispatchDidFinishLoad):
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::setElementUnfocused):
+        (BlackBerry::WebKit::InputHandler::restoreViewState):
+
 2013-03-22  Genevieve Mak  <[email protected]>
 
         [BlackBerry] Hit Test doesn't need to be active

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp (146640 => 146641)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp	2013-03-22 19:23:45 UTC (rev 146640)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp	2013-03-22 19:34:23 UTC (rev 146641)
@@ -648,6 +648,8 @@
         && !m_webPagePrivate->m_webSettings->isPrivateBrowsingEnabled())
         credentialManager().autofillPasswordForms(m_frame->document()->forms());
 #endif
+
+    m_webPagePrivate->m_inputHandler->focusedNodeChanged();
 }
 
 void FrameLoaderClientBlackBerry::dispatchDidFinishDocumentLoad()

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (146640 => 146641)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-03-22 19:23:45 UTC (rev 146640)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-03-22 19:34:23 UTC (rev 146641)
@@ -856,9 +856,9 @@
     m_webPage->m_client->requestSpellingCheckingOptions(spellCheckingOptionRequest, caretRect, screenOffset, shouldMoveDialog);
 }
 
-void InputHandler::setElementUnfocused(bool refocusOccuring)
+void InputHandler::setElementUnfocused(bool refocusOccuring, bool isFrameUnloading)
 {
-    if (isActiveTextEdit()) {
+    if (isActiveTextEdit() && m_currentFocusElement->attached() && m_currentFocusElement->document()->attached()) {
         FocusLog(Platform::LogLevelInfo, "InputHandler::setElementUnfocused");
 
         // Pass any text into the field to IMF to learn.
@@ -883,8 +883,9 @@
             m_currentFocusElement->renderer()->repaint();
 
         // If the frame selection isn't focused, focus it.
-        if (!m_currentFocusElement->document()->frame()->selection()->isFocused())
-            m_currentFocusElement->document()->frame()->selection()->setFocused(true);
+        FrameSelection* frameSelection = m_currentFocusElement->document()->frame()->selection();
+        if (frameSelection && !frameSelection->isFocused())
+            frameSelection->setFocused(true);
     }
 
     m_spellingHandler->setSpellCheckActive(false);
@@ -2562,7 +2563,6 @@
 void InputHandler::restoreViewState()
 {
     setInputModeEnabled();
-    focusedNodeChanged();
 }
 
 void InputHandler::showTextInputTypeSuggestionBox(bool allowEmptyPrefix)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to