summaryrefslogtreecommitdiff
path: root/Source/WebKit/chromium/src/WebRange.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
commit2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch)
tree988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Source/WebKit/chromium/src/WebRange.cpp
parentdd91e772430dc294e3bf478c119ef8d43c0a3358 (diff)
downloadqtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Source/WebKit/chromium/src/WebRange.cpp')
-rw-r--r--Source/WebKit/chromium/src/WebRange.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/Source/WebKit/chromium/src/WebRange.cpp b/Source/WebKit/chromium/src/WebRange.cpp
index 05a421251..be24dd793 100644
--- a/Source/WebKit/chromium/src/WebRange.cpp
+++ b/Source/WebKit/chromium/src/WebRange.cpp
@@ -33,10 +33,12 @@
#include "Document.h"
#include "Frame.h"
+#include "FrameView.h"
#include "Range.h"
#include "TextIterator.h"
#include "WebFrameImpl.h"
#include "WebNode.h"
+#include "platform/WebFloatQuad.h"
#include "platform/WebString.h"
#include <wtf/PassRefPtr.h>
@@ -99,6 +101,27 @@ WebRange WebRange::fromDocumentRange(WebFrame* frame, int start, int length)
return TextIterator::rangeFromLocationAndLength(scope, start, length);
}
+WebVector<WebFloatQuad> WebRange::textQuads() const
+{
+ if (isNull())
+ return WebVector<WebFloatQuad>();
+
+ Frame* frame = m_private->ownerDocument() ? m_private->ownerDocument()->frame() : 0;
+ if (!frame)
+ return WebVector<WebFloatQuad>();
+
+ Vector<FloatQuad> quads;
+ m_private->textQuads(quads);
+ for (unsigned i = 0; i < quads.size(); ++i) {
+ quads[i].setP1(frame->view()->contentsToWindow(roundedIntPoint(quads[i].p1())));
+ quads[i].setP2(frame->view()->contentsToWindow(roundedIntPoint(quads[i].p2())));
+ quads[i].setP3(frame->view()->contentsToWindow(roundedIntPoint(quads[i].p3())));
+ quads[i].setP4(frame->view()->contentsToWindow(roundedIntPoint(quads[i].p4())));
+ }
+
+ return quads;
+}
+
WebRange::WebRange(const WTF::PassRefPtr<WebCore::Range>& range)
: m_private(static_cast<WebRangePrivate*>(range.leakRef()))
{