Title: [133503] trunk/Source/WebKit/chromium
- Revision
- 133503
- Author
- [email protected]
- Date
- 2012-11-05 11:10:39 -0800 (Mon, 05 Nov 2012)
Log Message
Expose hit test related methods in public chromium port
https://bugs.webkit.org/show_bug.cgi?id=101204
Patch by Bo Liu <[email protected]> on 2012-11-05
Reviewed by Adam Barth.
The methods are needed in implementating hit test related methods in the
Android WebView API.
The specific methods are:
[Web]HitTestResult::urlElement
[Web]HitTestResult::absoluteImageURL
[Web]HitTestResult::absoluteLinkURL
[Web]HitTestResult::isContentEditable
WebViewImpl::hitTestResultAt
* public/WebHitTestResult.h:
(WebKit):
(WebHitTestResult):
* public/WebView.h:
(WebKit):
(WebView):
* src/WebHitTestResult.cpp:
(WebKit::WebHitTestResult::urlElement):
(WebKit):
(WebKit::WebHitTestResult::absoluteImageURL):
(WebKit::WebHitTestResult::absoluteLinkURL):
(WebKit::WebHitTestResult::isContentEditable):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::hitTestResultAt):
(WebKit):
* src/WebViewImpl.h:
(WebViewImpl):
Modified Paths
Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (133502 => 133503)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-11-05 19:09:55 UTC (rev 133502)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-11-05 19:10:39 UTC (rev 133503)
@@ -1,3 +1,38 @@
+2012-11-05 Bo Liu <[email protected]>
+
+ Expose hit test related methods in public chromium port
+ https://bugs.webkit.org/show_bug.cgi?id=101204
+
+ Reviewed by Adam Barth.
+
+ The methods are needed in implementating hit test related methods in the
+ Android WebView API.
+
+ The specific methods are:
+ [Web]HitTestResult::urlElement
+ [Web]HitTestResult::absoluteImageURL
+ [Web]HitTestResult::absoluteLinkURL
+ [Web]HitTestResult::isContentEditable
+ WebViewImpl::hitTestResultAt
+
+ * public/WebHitTestResult.h:
+ (WebKit):
+ (WebHitTestResult):
+ * public/WebView.h:
+ (WebKit):
+ (WebView):
+ * src/WebHitTestResult.cpp:
+ (WebKit::WebHitTestResult::urlElement):
+ (WebKit):
+ (WebKit::WebHitTestResult::absoluteImageURL):
+ (WebKit::WebHitTestResult::absoluteLinkURL):
+ (WebKit::WebHitTestResult::isContentEditable):
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::hitTestResultAt):
+ (WebKit):
+ * src/WebViewImpl.h:
+ (WebViewImpl):
+
2012-11-05 Alok Priyadarshi <[email protected]>
[chromium] Pass canPaintLCDText to WebContentLayerClient::paintContents
Modified: trunk/Source/WebKit/chromium/public/WebHitTestResult.h (133502 => 133503)
--- trunk/Source/WebKit/chromium/public/WebHitTestResult.h 2012-11-05 19:09:55 UTC (rev 133502)
+++ trunk/Source/WebKit/chromium/public/WebHitTestResult.h 2012-11-05 19:10:39 UTC (rev 133503)
@@ -34,7 +34,9 @@
namespace WebKit {
+class WebElement;
class WebNode;
+class WebURL;
struct WebPoint;
// Properties of a hit test result, i.e. properties of the nodes at a given point
@@ -56,6 +58,19 @@
// Coordinates of the point that was hit. Relative to the node.
WEBKIT_EXPORT WebPoint localPoint() const;
+ // If a link (eg. anchor or area tag) is hit, return the element.
+ // Return null otheriwse.
+ WEBKIT_EXPORT WebElement urlElement() const;
+
+ // If an image is hit, return the image source. Return empty otherwise.
+ WEBKIT_EXPORT WebURL absoluteImageURL() const;
+
+ // If an link is hit, return the link url source. Return empty otherwise.
+ WEBKIT_EXPORT WebURL absoluteLinkURL() const;
+
+ // Return whether an editable input element was hit.
+ WEBKIT_EXPORT bool isContentEditable() const;
+
#if WEBKIT_IMPLEMENTATION
WebHitTestResult(const WebCore::HitTestResult&);
WebHitTestResult& operator=(const WebCore::HitTestResult&);
Modified: trunk/Source/WebKit/chromium/public/WebView.h (133502 => 133503)
--- trunk/Source/WebKit/chromium/public/WebView.h 2012-11-05 19:09:55 UTC (rev 133502)
+++ trunk/Source/WebKit/chromium/public/WebView.h 2012-11-05 19:10:39 UTC (rev 133503)
@@ -48,16 +48,17 @@
class WebFrame;
class WebFrameClient;
class WebGraphicsContext3D;
+class WebHitTestResult;
class WebNode;
class WebPageOverlay;
class WebPermissionClient;
class WebPrerendererClient;
-class WebViewBenchmarkSupport;
class WebRange;
class WebSettings;
class WebSpellCheckClient;
class WebString;
class WebTextFieldDecoratorClient;
+class WebViewBenchmarkSupport;
class WebViewClient;
struct WebActiveWheelFlingParameters;
struct WebMediaPlayerAction;
@@ -313,6 +314,9 @@
// Data exchange -------------------------------------------------------
+ // Do a hit test at given point and return the HitTestResult.
+ virtual WebHitTestResult hitTestResultAt(const WebPoint&) = 0;
+
// Copy to the clipboard the image located at a particular point in the
// WebView (if there is such an image)
virtual void copyImageAt(const WebPoint&) = 0;
Modified: trunk/Source/WebKit/chromium/src/WebHitTestResult.cpp (133502 => 133503)
--- trunk/Source/WebKit/chromium/src/WebHitTestResult.cpp 2012-11-05 19:09:55 UTC (rev 133502)
+++ trunk/Source/WebKit/chromium/src/WebHitTestResult.cpp 2012-11-05 19:10:39 UTC (rev 133503)
@@ -32,8 +32,10 @@
#include "Node.h"
#include "RenderObject.h"
#include "VisiblePosition.h"
+#include "WebElement.h"
#include "WebNode.h"
#include <public/WebPoint.h>
+#include <public/WebURL.h>
using namespace WebCore;
@@ -49,6 +51,26 @@
return roundedIntPoint(m_private->localPoint());
}
+WebElement WebHitTestResult::urlElement() const
+{
+ return WebElement(m_private->URLElement());
+}
+
+WebURL WebHitTestResult::absoluteImageURL() const
+{
+ return m_private->absoluteImageURL();
+}
+
+WebURL WebHitTestResult::absoluteLinkURL() const
+{
+ return m_private->absoluteLinkURL();
+}
+
+bool WebHitTestResult::isContentEditable() const
+{
+ return m_private->isContentEditable();
+}
+
WebHitTestResult::WebHitTestResult(const HitTestResult& result)
{
m_private.reset(new HitTestResult(result));
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (133502 => 133503)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-11-05 19:09:55 UTC (rev 133502)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp 2012-11-05 19:10:39 UTC (rev 133503)
@@ -3151,6 +3151,11 @@
}
}
+WebHitTestResult WebViewImpl::hitTestResultAt(const WebPoint& point)
+{
+ return hitTestResultForWindowPos(point);
+}
+
void WebViewImpl::copyImageAt(const WebPoint& point)
{
if (!m_page)
Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.h (133502 => 133503)
--- trunk/Source/WebKit/chromium/src/WebViewImpl.h 2012-11-05 19:09:55 UTC (rev 133502)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.h 2012-11-05 19:10:39 UTC (rev 133503)
@@ -249,6 +249,7 @@
virtual void performPluginAction(
const WebPluginAction&,
const WebPoint&);
+ virtual WebHitTestResult hitTestResultAt(const WebPoint&);
virtual void copyImageAt(const WebPoint& point);
virtual void dragSourceEndedAt(
const WebPoint& clientPoint,
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes