[BlackBerry] Eliminate invalid clipping for content editable selections
authormifenton@rim.com <mifenton@rim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Feb 2013 21:41:53 +0000 (21:41 +0000)
committermifenton@rim.com <mifenton@rim.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 22 Feb 2013 21:41:53 +0000 (21:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=110630

Reviewed by Rob Buis.

PR 284629.

Remove selection clipping for content editable
fields as the bounds aren't valid and cause
clipping based on starting node rather than the
union of nodes.

Reviewed Internally by Nima Ghanavatian.

* WebKitSupport/InputHandler.cpp:
(BlackBerry::WebKit::InputHandler::updateFormState):
* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::clippingRectForVisibleContent):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143786 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp
Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp

index abe7869..ea5693f 100644 (file)
@@ -1,3 +1,24 @@
+2013-02-22  Mike Fenton  <mifenton@rim.com>
+
+        [BlackBerry] Eliminate invalid clipping for content editable selections
+        https://bugs.webkit.org/show_bug.cgi?id=110630
+
+        Reviewed by Rob Buis.
+
+        PR 284629.
+
+        Remove selection clipping for content editable
+        fields as the bounds aren't valid and cause
+        clipping based on starting node rather than the
+        union of nodes.
+
+        Reviewed Internally by Nima Ghanavatian.
+
+        * WebKitSupport/InputHandler.cpp:
+        (BlackBerry::WebKit::InputHandler::updateFormState):
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::SelectionHandler::clippingRectForVisibleContent):
+
 2013-02-22  Tiancheng Jiang  <tijiang@rim.com>
 
         [BlackBerry]Adjust fatfinger detection rect size
index 2384e50..59d1fa7 100644 (file)
@@ -1218,11 +1218,17 @@ WebCore::IntRect InputHandler::boundingBoxForInputField()
         return WebCore::IntRect();
 
     // type="search" can have a 'X', so take the inner block bounding box to not include it.
-    if (HTMLInputElement* element = m_currentFocusElement->toInputElement())
+    if (HTMLInputElement* element = m_currentFocusElement->toInputElement()) {
         if (element->isSearchField())
             return element->innerBlockElement()->renderer()->absoluteBoundingBoxRect();
+        return m_currentFocusElement->renderer()->absoluteBoundingBoxRect();
+    }
+
+    if (m_currentFocusElement->hasTagName(HTMLNames::textareaTag))
+        return m_currentFocusElement->renderer()->absoluteBoundingBoxRect();
 
-    return m_currentFocusElement->renderer()->absoluteBoundingBoxRect();
+    // Content Editable can't rely on the bounding box since it isn't fixed.
+    return WebCore::IntRect();
 }
 
 void InputHandler::ensureFocusTextElementVisible(CaretScrollType scrollType)
index 5e32cc8..3111334 100644 (file)
@@ -107,7 +107,7 @@ WebCore::IntRect SelectionHandler::clippingRectForVisibleContent() const
 {
     // Get the containing content rect for the frame.
     Frame* frame = m_webPage->focusedOrMainFrame();
-    WebCore::IntRect clipRect = WebCore::IntRect(WebCore::IntPoint(0, 0), m_webPage->contentsSize());
+    WebCore::IntRect clipRect = WebCore::IntRect(WebCore::IntPoint(0, 0), frame->view()->contentsSize());
     if (frame != m_webPage->mainFrame()) {
         clipRect = m_webPage->getRecursiveVisibleWindowRect(frame->view(), true /* no clip to main frame window */);
         clipRect = m_webPage->m_mainFrame->view()->windowToContents(clipRect);