summaryrefslogtreecommitdiffstats
path: root/WebKit/android/nav/SelectText.h
diff options
context:
space:
mode:
authorCary Clark <cary@android.com>2010-06-04 16:40:26 -0400
committerCary Clark <cary@android.com>2010-06-25 14:06:03 -0400
commita3054d2b31d3e00563e3865d398ef93d25b8b2e0 (patch)
tree70a4dd37f57f289b097fc480b0e45b2883636b00 /WebKit/android/nav/SelectText.h
parent20572c3409d0c4745fc376a256a720c3b9a2af98 (diff)
downloadexternal_webkit-a3054d2b31d3e00563e3865d398ef93d25b8b2e0.zip
external_webkit-a3054d2b31d3e00563e3865d398ef93d25b8b2e0.tar.gz
external_webkit-a3054d2b31d3e00563e3865d398ef93d25b8b2e0.tar.bz2
Refactor find and select dialogs
SelectText now permits incremental extension of the selection using either touch or trackball data. SelectText adds word selection and select all interfaces. SelectText has been rewritten to do a better job of finding space characters and selecting text outside of the visible window. Companion changes in frameworks/base and packages/apps/Browser Change-Id: I917a14124a41a3c9bd72ffa48fe36e55e7c4e543 http://b/2626451
Diffstat (limited to 'WebKit/android/nav/SelectText.h')
-rw-r--r--WebKit/android/nav/SelectText.h50
1 files changed, 26 insertions, 24 deletions
diff --git a/WebKit/android/nav/SelectText.h b/WebKit/android/nav/SelectText.h
index 2e17a74..00b9ca9 100644
--- a/WebKit/android/nav/SelectText.h
+++ b/WebKit/android/nav/SelectText.h
@@ -29,6 +29,7 @@
#include "DrawExtra.h"
#include "IntRect.h"
#include "PlatformString.h"
+#include "SkPath.h"
class SkPicture;
struct SkIRect;
@@ -38,45 +39,46 @@ namespace android {
class CachedRoot;
-class CopyPaste {
-public:
- static void buildSelection(const SkPicture& , const SkIRect& area,
- const SkIRect& selStart, const SkIRect& selEnd, SkRegion* region);
- static SkIRect findClosest(const SkPicture& , const SkIRect& area,
- int x, int y);
- static String text(const SkPicture& , const SkIRect& area,
- const SkRegion& );
-};
-
class SelectText : public DrawExtra {
public:
- SelectText() {
- m_selStart.setEmpty();
- m_selEnd.setEmpty();
- }
+ SelectText();
virtual void draw(SkCanvas* , LayerAndroid* );
+ void extendSelection(const SkPicture* , int x, int y);
const String getSelection();
- void moveSelection(const SkPicture* , int x, int y, bool extendSelection);
+ bool hitSelection(int x, int y) const;
+ void moveSelection(const SkPicture* , int x, int y);
+ void reset();
+ void selectAll(const SkPicture* );
+ int selectionX() const;
+ int selectionY() const;
void setDrawPointer(bool drawPointer) { m_drawPointer = drawPointer; }
- void setDrawRegion(bool drawRegion) { m_drawRegion = drawRegion; }
+ void setExtendSelection(bool extend) { m_extendSelection = extend; }
void setVisibleRect(const IntRect& rect) { m_visibleRect = rect; }
+ bool startSelection(int x, int y);
+ bool wordSelection(const SkPicture* picture);
+public:
+ float m_inverseScale; // inverse scale, x, y used for drawing select path
+ int m_selectX;
+ int m_selectY;
private:
- friend class WebView;
void drawSelectionPointer(SkCanvas* );
void drawSelectionRegion(SkCanvas* );
static void getSelectionArrow(SkPath* );
void getSelectionCaret(SkPath* );
+ bool hitCorner(int cx, int cy, int x, int y) const;
+ void swapAsNeeded();
+ SkIPoint m_original; // computed start of extend selection
SkIRect m_selStart;
SkIRect m_selEnd;
- SkIRect m_visibleRect;
- SkRegion m_selRegion;
+ SkIRect m_visibleRect; // constrains picture computations to visible area
+ SkRegion m_selRegion; // computed from sel start, end
+ SkPicture m_startControl;
+ SkPicture m_endControl;
const SkPicture* m_picture;
- float m_inverseScale;
- int m_selectX;
- int m_selectY;
- bool m_drawRegion;
bool m_drawPointer;
- bool m_extendSelection;
+ bool m_extendSelection; // false when trackball is moving pointer
+ bool m_hitTopLeft;
+ bool m_startSelection;
};
}