Title: [117398] trunk/Source/WebKit/chromium
- Revision
- 117398
- Author
- [email protected]
- Date
- 2012-05-16 22:18:28 -0700 (Wed, 16 May 2012)
Log Message
[chromium] Get text direction at the start and end of selection.
https://bugs.webkit.org/show_bug.cgi?id=86573
Patch by Hao Zheng <[email protected]> on 2012-05-16
Reviewed by Adam Barth.
Add an interface to get text direction at the start and end of
selection for Android, as on Android different selection delimiters
are needed for RTL text. Unlike other platforms, the start and end
delimiters of selection are different, so we need determine the shape
of delimiter based on text direction.
* public/WebWidget.h:
(WebWidget):
(WebKit::WebWidget::selectionTextDirection):
* src/WebViewImpl.cpp:
(WebKit):
(WebKit::WebViewImpl::selectionTextDirection):
* src/WebViewImpl.h:
(WebViewImpl):
Modified Paths
Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (117397 => 117398)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-05-17 05:16:14 UTC (rev 117397)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-05-17 05:18:28 UTC (rev 117398)
@@ -1,3 +1,25 @@
+2012-05-16 Hao Zheng <[email protected]>
+
+ [chromium] Get text direction at the start and end of selection.
+ https://bugs.webkit.org/show_bug.cgi?id=86573
+
+ Reviewed by Adam Barth.
+
+ Add an interface to get text direction at the start and end of
+ selection for Android, as on Android different selection delimiters
+ are needed for RTL text. Unlike other platforms, the start and end
+ delimiters of selection are different, so we need determine the shape
+ of delimiter based on text direction.
+
+ * public/WebWidget.h:
+ (WebWidget):
+ (WebKit::WebWidget::selectionTextDirection):
+ * src/WebViewImpl.cpp:
+ (WebKit):
+ (WebKit::WebViewImpl::selectionTextDirection):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+
2012-05-16 Adam Barth <[email protected]>
[Chromium] Implement WebViewImpl::textInputInfo() for Android
Modified: trunk/Source/WebKit/chromium/public/WebWidget.h (117397 => 117398)
--- trunk/Source/WebKit/chromium/public/WebWidget.h 2012-05-17 05:16:14 UTC (rev 117397)
+++ trunk/Source/WebKit/chromium/public/WebWidget.h 2012-05-17 05:18:28 UTC (rev 117398)
@@ -181,6 +181,10 @@
// If the selection range is empty, it returns the caret bounds.
virtual bool selectionBounds(WebRect& start, WebRect& end) const { return false; }
+ // Returns the text direction at the start and end bounds of the current selection.
+ // If the selection range is empty, it returns false.
+ virtual bool selectionTextDirection(WebTextDirection& start, WebTextDirection& end) const { return false; }
+
// Fetch the current selection range of this WebWidget. If there is no
// selection, it will output a 0-length range with the location at the
// caret. Returns true and fills the out-paramters on success; returns false
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (117397 => 117398)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-05-17 05:16:14 UTC (rev 117397)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-05-17 05:18:28 UTC (rev 117398)
@@ -2034,6 +2034,21 @@
return true;
}
+bool WebViewImpl::selectionTextDirection(WebTextDirection& start, WebTextDirection& end) const
+{
+ const Frame* frame = focusedWebCoreFrame();
+ if (!frame)
+ return false;
+ FrameSelection* selection = frame->selection();
+ if (!selection)
+ return false;
+ if (!selection->toNormalizedRange())
+ return false;
+ start = selection->start().primaryDirection() == RTL ? WebTextDirectionRightToLeft : WebTextDirectionLeftToRight;
+ end = selection->end().primaryDirection() == RTL ? WebTextDirectionRightToLeft : WebTextDirectionLeftToRight;
+ return true;
+}
+
bool WebViewImpl::caretOrSelectionRange(size_t* location, size_t* length)
{
const Frame* focused = focusedWebCoreFrame();
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (117397 => 117398)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.h 2012-05-17 05:16:14 UTC (rev 117397)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h 2012-05-17 05:18:28 UTC (rev 117398)
@@ -148,6 +148,7 @@
virtual WebTextInputInfo textInputInfo();
virtual WebTextInputType textInputType();
virtual bool selectionBounds(WebRect& start, WebRect& end) const;
+ virtual bool selectionTextDirection(WebTextDirection& start, WebTextDirection& end) const;
virtual bool caretOrSelectionRange(size_t* location, size_t* length);
virtual void setTextDirection(WebTextDirection direction);
virtual bool isAcceleratedCompositingActive() const;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes