Diff
Modified: trunk/Source/WebKit/blackberry/Api/WebPageClient.h (125066 => 125067)
--- trunk/Source/WebKit/blackberry/Api/WebPageClient.h 2012-08-08 19:11:37 UTC (rev 125066)
+++ trunk/Source/WebKit/blackberry/Api/WebPageClient.h 2012-08-08 19:14:05 UTC (rev 125067)
@@ -26,7 +26,6 @@
#include <BlackBerryPlatformInputEvents.h>
#include <BlackBerryPlatformNavigationType.h>
#include <BlackBerryPlatformPrimitives.h>
-#include <imf/events.h>
#include <interaction/ScrollViewBase.h>
#include <vector>
@@ -145,7 +144,7 @@
virtual void showVirtualKeyboard(bool) = 0;
- virtual void requestSpellingCheckingOptions(const imf_sp_text_t&) = 0;
+ virtual void requestSpellingSuggestionsForString(unsigned start, unsigned end) = 0;
virtual int32_t checkSpellingOfStringAsync(wchar_t* text, int length) = 0;
virtual void notifySelectionDetailsChanged(const Platform::IntRect& start, const Platform::IntRect& end, const Platform::IntRectRegion&, bool overrideTouchHandling = false) = 0;
Modified: trunk/Source/WebKit/blackberry/ChangeLog (125066 => 125067)
--- trunk/Source/WebKit/blackberry/ChangeLog 2012-08-08 19:11:37 UTC (rev 125066)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2012-08-08 19:14:05 UTC (rev 125067)
@@ -1,3 +1,23 @@
+2012-08-08 Sheriff Bot <webkit.review....@gmail.com>
+
+ Unreviewed, rolling out r124887.
+ http://trac.webkit.org/changeset/124887
+ https://bugs.webkit.org/show_bug.cgi?id=93504
+
+ Dependent API being removed. (Requested by mfenton on
+ #webkit).
+
+ * Api/WebPageClient.h:
+ * WebKitSupport/InputHandler.cpp:
+ * WebKitSupport/InputHandler.h:
+ (InputHandler):
+ * WebKitSupport/TouchEventHandler.cpp:
+ (BlackBerry::WebKit::TouchEventHandler::handleTouchPoint):
+ (BlackBerry::WebKit::TouchEventHandler::spellCheck):
+ (WebKit):
+ * WebKitSupport/TouchEventHandler.h:
+ (TouchEventHandler):
+
2012-08-08 Ed Baker <edba...@rim.com>
[BlackBerry] Add relayout after updating fixed reported size
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (125066 => 125067)
--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp 2012-08-08 19:11:37 UTC (rev 125066)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp 2012-08-08 19:14:05 UTC (rev 125067)
@@ -50,7 +50,6 @@
#include "RenderText.h"
#include "RenderTextControl.h"
#include "RenderWidget.h"
-#include "RenderedDocumentMarker.h"
#include "ScopePointer.h"
#include "SelectPopupClient.h"
#include "SelectionHandler.h"
@@ -65,11 +64,11 @@
#include <BlackBerryPlatformLog.h>
#include <BlackBerryPlatformMisc.h>
#include <BlackBerryPlatformSettings.h>
+#include <imf/events.h>
#include <sys/keycodes.h>
#define ENABLE_INPUT_LOG 0
#define ENABLE_FOCUS_LOG 0
-#define ENABLE_SPELLING_LOG 0
static const unsigned MaxLearnTextDataSize = 500;
@@ -88,12 +87,6 @@
#define FocusLog(severity, format, ...)
#endif // ENABLE_FOCUS_LOG
-#if ENABLE_SPELLING_LOG
-#define SpellingLog(severity, format, ...) logAlways(severity, format, ## __VA_ARGS__)
-#else
-#define SpellingLog(severity, format, ...)
-#endif // ENABLE_SPELLING_LOG
-
namespace BlackBerry {
namespace WebKit {
@@ -655,52 +648,6 @@
return 0;
}
-bool InputHandler::shouldRequestSpellCheckingOptionsForPoint(Platform::IntPoint& point, const Element* touchedElement, imf_sp_text_t& spellCheckingOptionRequest)
-{
- if (!isActiveTextEdit() || touchedElement != m_currentFocusElement)
- return false;
-
- LayoutPoint contentPos(m_webPage->mapFromViewportToContents(point));
- contentPos = DOMSupport::convertPointToFrame(m_webPage->mainFrame(), m_webPage->focusedOrMainFrame(), roundedIntPoint(contentPos));
-
- Document* document = m_currentFocusElement->document();
- ASSERT(document);
-
- RenderedDocumentMarker* marker = document->markers()->renderedMarkerContainingPoint(contentPos, DocumentMarker::Spelling);
- if (!marker)
- return false;
-
- SpellingLog(LogLevelInfo, "InputHandler::shouldRequestSpellCheckingOptionsForPoint Found spelling marker at point %d, %d", point.x(), point.y());
-
- // imf_sp_text_t should be generated in pixel viewport coordinates.
- WebCore::IntRect rect = m_webPage->mapToTransformed(m_webPage->focusedOrMainFrame()->view()->contentsToWindow(enclosingIntRect(marker->renderedRect())));
- m_webPage->clipToTransformedContentsRect(rect);
-
- spellCheckingOptionRequest.text_rect.x = rect.x();
- spellCheckingOptionRequest.text_rect.y = rect.y();
- spellCheckingOptionRequest.text_rect.width = rect.width();
- spellCheckingOptionRequest.text_rect.height = rect.height();
- spellCheckingOptionRequest.text_rect.anchor_x = point.x();
- spellCheckingOptionRequest.text_rect.anchor_y = point.y();
- spellCheckingOptionRequest.startTextPosition = marker->startOffset();
- spellCheckingOptionRequest.endTextPosition = marker->endOffset();
-
- return true;
-}
-
-void InputHandler::requestSpellingCheckingOptions(const imf_sp_text_t& spellCheckingOptionRequest)
-{
- SpellingLog(LogLevelInfo, "InputHandler::requestSpellingCheckingOptions Sending request:\ntext_rect.x = %d\ntext_rect.y = %d" \
- "\ntext_rect.width = %d\ntext_rect.height = %d\ntext_rect.anchor_x = %d\ntext_rect.anchor_y = %d" \
- "\nstartTextPosition = %d\nendTextPosition = %d", spellCheckingOptionRequest.text_rect.x,
- spellCheckingOptionRequest.text_rect.y, spellCheckingOptionRequest.text_rect.width, spellCheckingOptionRequest.text_rect.height,
- spellCheckingOptionRequest.text_rect.anchor_x, spellCheckingOptionRequest.text_rect.anchor_y,
- spellCheckingOptionRequest.startTextPosition, spellCheckingOptionRequest.endTextPosition);
-
- if (spellCheckingOptionRequest.startTextPosition || spellCheckingOptionRequest.endTextPosition)
- m_webPage->m_client->requestSpellingCheckingOptions(spellCheckingOptionRequest);
-}
-
void InputHandler::setElementUnfocused(bool refocusOccuring)
{
if (isActiveTextEdit()) {
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h (125066 => 125067)
--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h 2012-08-08 19:11:37 UTC (rev 125066)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h 2012-08-08 19:14:05 UTC (rev 125067)
@@ -21,7 +21,6 @@
#include <BlackBerryPlatformInputEvents.h>
-#include <imf/events.h>
#include <imf/input_data.h>
#include <map>
#include <wtf/RefPtr.h>
@@ -45,7 +44,6 @@
namespace BlackBerry {
namespace Platform {
-class IntPoint;
class KeyboardEvent;
}
@@ -130,9 +128,6 @@
void spellCheckingRequestProcessed(int32_t transactionId, spannable_string_t*);
void spellCheckingRequestCancelled(int32_t id, bool isSequenceId = false);
- bool shouldRequestSpellCheckingOptionsForPoint(Platform::IntPoint&, const WebCore::Element*, imf_sp_text_t&);
- void requestSpellingCheckingOptions(const imf_sp_text_t&);
-
private:
enum PendingKeyboardStateChange { NoChange, Visible, NotVisible };
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp (125066 => 125067)
--- trunk/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp 2012-08-08 19:11:37 UTC (rev 125066)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp 2012-08-08 19:14:05 UTC (rev 125067)
@@ -41,6 +41,7 @@
#include "RenderLayer.h"
#include "RenderTheme.h"
#include "RenderView.h"
+#include "RenderedDocumentMarker.h"
#include "SelectionHandler.h"
#include "WebPage_p.h"
#include "WebTapHighlight.h"
@@ -212,12 +213,7 @@
}
case Platform::TouchPoint::TouchReleased:
{
- imf_sp_text_t spellCheckOptionRequest;
- bool shouldRequestSpellCheckOptions = false;
-
- if (m_lastFatFingersResult.isTextInput())
- shouldRequestSpellCheckOptions = m_webPage->m_inputHandler->shouldRequestSpellCheckingOptionsForPoint(point.m_pos, m_lastFatFingersResult.nodeAsElementIfApplicable(), spellCheckOptionRequest);
-
+ unsigned spellLength = spellCheck(point);
// Apply any suppressed changes. This does not eliminate the need
// for the show after the handling of fat finger pressed as it may
// have triggered a state change.
@@ -243,8 +239,11 @@
PlatformMouseEvent mouseEvent(adjustedPoint, m_lastScreenPoint, PlatformEvent::MouseReleased, 1, LeftButton, TouchScreen);
m_webPage->handleMouseEvent(mouseEvent);
m_lastFatFingersResult.reset(); // Reset the fat finger result as its no longer valid when a user's finger is not on the screen.
- if (shouldRequestSpellCheckOptions)
- m_webPage->m_inputHandler->requestSpellingCheckingOptions(spellCheckOptionRequest);
+ if (spellLength) {
+ unsigned end = m_webPage->m_inputHandler->caretPosition();
+ unsigned start = end - spellLength;
+ m_webPage->m_client->requestSpellingSuggestionsForString(start, end);
+ }
return true;
}
case Platform::TouchPoint::TouchMoved:
@@ -264,6 +263,31 @@
return false;
}
+unsigned TouchEventHandler::spellCheck(Platform::TouchPoint& touchPoint)
+{
+ Element* elementUnderFatFinger = m_lastFatFingersResult.nodeAsElementIfApplicable();
+ if (!m_lastFatFingersResult.isTextInput() || !elementUnderFatFinger)
+ return 0;
+
+ LayoutPoint contentPos(m_webPage->mapFromViewportToContents(touchPoint.m_pos));
+ contentPos = DOMSupport::convertPointToFrame(m_webPage->mainFrame(), m_webPage->focusedOrMainFrame(), contentPos);
+
+ Document* document = elementUnderFatFinger->document();
+ ASSERT(document);
+ RenderedDocumentMarker* marker = document->markers()->renderedMarkerContainingPoint(contentPos, DocumentMarker::Spelling);
+ if (!marker)
+ return 0;
+
+ IntRect rect = marker->renderedRect();
+ LayoutPoint newContentPos = LayoutPoint(rect.x() + rect.width(), rect.y() + rect.height() / 2);
+ Frame* frame = m_webPage->focusedOrMainFrame();
+ if (frame != m_webPage->mainFrame())
+ newContentPos = m_webPage->mainFrame()->view()->windowToContents(frame->view()->contentsToWindow(newContentPos));
+ m_lastFatFingersResult.m_adjustedPosition = newContentPos;
+ m_lastFatFingersResult.m_positionWasAdjusted = true;
+ return marker->endOffset() - marker->startOffset();
+}
+
void TouchEventHandler::handleFatFingerPressed()
{
if (!m_didCancelTouch) {
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.h (125066 => 125067)
--- trunk/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.h 2012-08-08 19:11:37 UTC (rev 125066)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.h 2012-08-08 19:14:05 UTC (rev 125067)
@@ -45,6 +45,7 @@
void resetLastFatFingersResult() { m_lastFatFingersResult.reset(); }
private:
+ unsigned spellCheck(Platform::TouchPoint&);
void handleFatFingerPressed();
void drawTapHighlight();