Title: [149629] trunk/Source/WebKit/blackberry
Revision
149629
Author
[email protected]
Date
2013-05-06 12:38:10 -0700 (Mon, 06 May 2013)

Log Message

[BlackBerry] Ensure document is attached before accessing its FrameSelection
https://bugs.webkit.org/show_bug.cgi?id=115565

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

Internally reviewed by Mike Fenton.

PR 312101
We need to make sure that the node and document
are attached before accessing the FrameSelection. This was
handled earlier but not all call paths were covered.

* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::setElementUnfocused):
(BlackBerry::WebKit::InputHandler::isActiveTextEdit):
(WebKit):
* WebKitSupport/InputHandler.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (149628 => 149629)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-05-06 19:37:44 UTC (rev 149628)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-05-06 19:38:10 UTC (rev 149629)
@@ -1,5 +1,25 @@
 2013-05-06  Nima Ghanavatian  <[email protected]>
 
+        [BlackBerry] Ensure document is attached before accessing its FrameSelection
+        https://bugs.webkit.org/show_bug.cgi?id=115565
+
+        Reviewed by Rob Buis.
+
+        Internally reviewed by Mike Fenton.
+
+        PR 312101
+        We need to make sure that the node and document
+        are attached before accessing the FrameSelection. This was
+        handled earlier but not all call paths were covered.
+
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::setElementUnfocused):
+        (BlackBerry::WebKit::InputHandler::isActiveTextEdit):
+        (WebKit):
+        * WebKitSupport/InputHandler.h:
+
+2013-05-06  Nima Ghanavatian  <[email protected]>
+
         [BlackBerry] Do not spellcheck when composition is active.
         https://bugs.webkit.org/show_bug.cgi?id=115562
 

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp (149628 => 149629)


--- trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp	2013-05-06 19:37:44 UTC (rev 149628)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp	2013-05-06 19:38:10 UTC (rev 149629)
@@ -662,6 +662,11 @@
     return position;
 }
 
+bool isElementAndDocumentAttached(const WebCore::Element* element)
+{
+    return element && element->attached() && element->document() && element->document()->attached();
+}
+
 } // DOMSupport
 } // WebKit
 } // BlackBerry

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h (149628 => 149629)


--- trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h	2013-05-06 19:37:44 UTC (rev 149628)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h	2013-05-06 19:38:10 UTC (rev 149629)
@@ -106,6 +106,8 @@
 WebCore::Element* selectionContainerElement(const WebCore::VisibleSelection&);
 BlackBerry::Platform::RequestedHandlePosition elementHandlePositionAttribute(const WebCore::Element*);
 
+bool isElementAndDocumentAttached(const WebCore::Element*);
+
 } // DOMSupport
 } // WebKit
 } // BlackBerry

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (149628 => 149629)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-05-06 19:37:44 UTC (rev 149628)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp	2013-05-06 19:38:10 UTC (rev 149629)
@@ -857,7 +857,7 @@
 
 void InputHandler::setElementUnfocused(bool refocusOccuring)
 {
-    if (isActiveTextEdit() && m_currentFocusElement->attached() && m_currentFocusElement->document()->attached()) {
+    if (isActiveTextEdit() && DOMSupport::isElementAndDocumentAttached(m_currentFocusElement.get())) {
         FocusLog(Platform::LogLevelInfo, "InputHandler::setElementUnfocused");
 
         // Pass any text into the field to IMF to learn.
@@ -918,7 +918,10 @@
     m_inputModeEnabled = active;
 
     // If the frame selection isn't focused, focus it.
-    if (isInputModeEnabled() && isActiveTextEdit() && !m_currentFocusElement->document()->frame()->selection()->isFocused())
+    if (isInputModeEnabled()
+        && isActiveTextEdit()
+        && DOMSupport::isElementAndDocumentAttached(m_currentFocusElement.get())
+        && !m_currentFocusElement->document()->frame()->selection()->isFocused())
         m_currentFocusElement->document()->frame()->selection()->setFocused(true);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to