diff options
| author | Cary Clark <cary@android.com> | 2010-02-23 10:46:08 -0500 |
|---|---|---|
| committer | Cary Clark <cary@android.com> | 2010-02-24 16:04:13 -0500 |
| commit | 87962ce00229855c098ba12cee8d5c015a835289 (patch) | |
| tree | c6e9990575cad9cc687cf0c79573c13ac4d02f1b /WebKit/android/nav/SelectText.h | |
| parent | 4175d59b46f96005f0c64978b1a94e3fe60f1e8e (diff) | |
| download | external_webkit-87962ce00229855c098ba12cee8d5c015a835289.zip external_webkit-87962ce00229855c098ba12cee8d5c015a835289.tar.gz external_webkit-87962ce00229855c098ba12cee8d5c015a835289.tar.bz2 | |
refactor drawing to support layers
Drawing elements that appear atop or below layers need to be
drawn both in the proper order and with the correct canvas to
respect clipping and the matrix.
Drawing the find results, text selection, or the cursor ring,
interleaves with any layers that may be drawn. The main picture
is treated as owned by a LayerAndroid so each component can
decide when to draw.
This change leave the main picture in WebViewCore.cpp, and
draws everything else in WebView.cpp -- in the future, additional
refactoring can put all drawing in one place.
The logic of what to draw is still in WebView.java, but the
actual drawing calls are now triggered inside the layer code.
Android.mk
- Add rule to trigger building without layers from buildspec.mk.
LayerAndroid.*
- Replace FindOnPage reference with abstract DrawExtra class to
draw adornments in the layers' canvas context.
- Add a LayerAndroid constructor to create a dummy layer with a
SkPicture* and a uniqueId==-1 so that extras can detect when
they are drawn by the main picture.
android_graphics.*
- Move cursor ring drawing out of WebView.cpp to here.
- Separate cursor ring setup from actual drawing.
- Get the cursor ring metrics in local coordinates.
ChromeClientAndroid.cpp
- Fix compiler warnings.
WebViewCore.*
- Move updateCursorBounds from WebView.cpp. This permits it to
be called from CursorRing::setup.
CachedFrame.*
CachedNode.*
CachedLayer.*
- Add local bounds getters.
CachedRoot.h
- Move class FindCanvas to the android namespace.
DrawExtra.h
- Add an abstract class called by LayerAndroid to optionally
draw extra elements in its canvas context.
FindCanvas.*
SelectText.*
- Refactor drawing to draw in layers context.
WebView.cpp
- Move drawing from WebView.java.
- Remove selection code to SelectText.cpp.
- Use inverseScale to simplify viewPort metrics.
- Simplify layer root so java doesn't need to know about it.
Requires companion change in frameworks/base
http://b/2457316
http://b/2454127
http://b/2454149
Diffstat (limited to 'WebKit/android/nav/SelectText.h')
| -rw-r--r-- | WebKit/android/nav/SelectText.h | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/WebKit/android/nav/SelectText.h b/WebKit/android/nav/SelectText.h index 32d8311..8174046 100644 --- a/WebKit/android/nav/SelectText.h +++ b/WebKit/android/nav/SelectText.h @@ -26,21 +26,59 @@ #ifndef SELECT_TEXT_H #define SELECT_TEXT_H +#include "DrawExtra.h" +#include "IntRect.h" #include "PlatformString.h" class SkPicture; struct SkIRect; -struct SkIPoint; class SkRegion; +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 WebCore::String text(const SkPicture& , const SkIRect& area, + static String text(const SkPicture& , const SkIRect& area, const SkRegion& ); }; +class SelectText : public DrawExtra { +public: + SelectText() { + m_selStart.setEmpty(); + m_selEnd.setEmpty(); + } + virtual void draw(SkCanvas* , LayerAndroid* ); + const String getSelection(); + void moveSelection(const SkPicture* , int x, int y, bool extendSelection); + void setDrawPointer(bool drawPointer) { m_drawPointer = drawPointer; } + void setDrawRegion(bool drawRegion) { m_drawRegion = drawRegion; } + void setVisibleRect(const IntRect& rect) { m_visibleRect = rect; } +private: + friend class WebView; + void drawSelectionPointer(SkCanvas* ); + void drawSelectionRegion(SkCanvas* ); + static void getSelectionArrow(SkPath* ); + void getSelectionCaret(SkPath* ); + SkIRect m_selStart; + SkIRect m_selEnd; + SkIRect m_visibleRect; + SkRegion m_selRegion; + const SkPicture* m_picture; + float m_inverseScale; + int m_selectX; + int m_selectY; + bool m_drawRegion; + bool m_drawPointer; + bool m_extendSelection; +}; + +} + #endif |
