summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCary Clark <cary@android.com>2010-11-19 14:23:02 -0500
committerCary Clark <cary@android.com>2010-11-23 15:58:09 -0500
commiteabb311cd2b57ff80b4cf632078cf078d789b563 (patch)
treeb16e6af4e3b973aa223e113e6d063dd6c0dea08c
parent9a193fae103e41510ec598934ec912e0575c8e19 (diff)
downloadexternal_webkit-eabb311cd2b57ff80b4cf632078cf078d789b563.zip
external_webkit-eabb311cd2b57ff80b4cf632078cf078d789b563.tar.gz
external_webkit-eabb311cd2b57ff80b4cf632078cf078d789b563.tar.bz2
reenable draw extras when GL is turned on
This captures the drawing in the UI thread, then passes the drawing to the tile imaging thread. The draw extras interface now takes an additional rectangle, and each draw extra fills in the inval area formed as that part is drawn. The old extra implementation in GLWebViewState has been removed. The inval portion of the setBaseLayer call has been split out so it can be called directly. bug:3161294 Change-Id: I28d3e6879059770b973e7c0f7c0796909f7359aa
-rw-r--r--WebCore/platform/graphics/android/BaseLayerAndroid.cpp11
-rw-r--r--WebCore/platform/graphics/android/BaseLayerAndroid.h3
-rw-r--r--WebCore/platform/graphics/android/GLWebViewState.cpp48
-rw-r--r--WebCore/platform/graphics/android/GLWebViewState.h10
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.cpp6
-rw-r--r--WebCore/platform/graphics/android/android_graphics.cpp17
-rw-r--r--WebCore/platform/graphics/android/android_graphics.h3
-rw-r--r--WebKit/android/nav/DrawExtra.h3
-rw-r--r--WebKit/android/nav/FindCanvas.cpp12
-rw-r--r--WebKit/android/nav/FindCanvas.h5
-rw-r--r--WebKit/android/nav/SelectText.cpp81
-rw-r--r--WebKit/android/nav/SelectText.h8
-rw-r--r--WebKit/android/nav/WebView.cpp24
13 files changed, 166 insertions, 65 deletions
diff --git a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
index 4d00f1c..7f85899 100644
--- a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp
@@ -95,6 +95,14 @@ void BaseLayerAndroid::setContent(const PictureSet& src)
setSize(src.width(), src.height());
}
+void BaseLayerAndroid::setExtra(SkPicture& src)
+{
+#if USE(ACCELERATED_COMPOSITING)
+ android::Mutex::Autolock lock(m_drawLock);
+#endif
+ m_extra.swap(src);
+}
+
void BaseLayerAndroid::drawCanvas(SkCanvas* canvas)
{
#if USE(ACCELERATED_COMPOSITING)
@@ -102,6 +110,9 @@ void BaseLayerAndroid::drawCanvas(SkCanvas* canvas)
#endif
if (!m_content.isEmpty())
m_content.draw(canvas);
+ // TODO : replace with !m_extra.isEmpty() once such a call exists
+ if (m_extra.width() > 0)
+ m_extra.draw(canvas);
}
#if USE(ACCELERATED_COMPOSITING)
diff --git a/WebCore/platform/graphics/android/BaseLayerAndroid.h b/WebCore/platform/graphics/android/BaseLayerAndroid.h
index 2e0646e..08a601e 100644
--- a/WebCore/platform/graphics/android/BaseLayerAndroid.h
+++ b/WebCore/platform/graphics/android/BaseLayerAndroid.h
@@ -31,6 +31,7 @@
#include "IntRect.h"
#include "PictureSet.h"
#include "SkLayer.h"
+#include "SkPicture.h"
namespace WebCore {
@@ -48,6 +49,7 @@ public:
void setBackgroundColor(Color& color) { m_color = color; }
#endif
void setContent(const android::PictureSet& src);
+ void setExtra(SkPicture& extra);
android::PictureSet* content() { return &m_content; }
// This method will paint using the current PictureSet onto
// the passed canvas. We used it to paint the GL tiles as well as
@@ -67,6 +69,7 @@ private:
Color m_color;
#endif
android::PictureSet m_content;
+ SkPicture m_extra;
SkRect m_previousVisible;
};
diff --git a/WebCore/platform/graphics/android/GLWebViewState.cpp b/WebCore/platform/graphics/android/GLWebViewState.cpp
index d0d054f..145bd89 100644
--- a/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -72,8 +72,6 @@ GLWebViewState::GLWebViewState()
, m_baseLayer(0)
, m_currentPictureCounter(0)
, m_usePageA(true)
- , m_extra(0)
- , m_navLayer(0)
{
m_viewport.setEmpty();
m_viewportTileBounds.setEmpty();
@@ -90,58 +88,48 @@ GLWebViewState::~GLWebViewState()
{
delete m_tiledPageA;
delete m_tiledPageB;
- delete m_navLayer;
#ifdef DEBUG_COUNT
gGLWebViewStateCount--;
#endif
}
-void GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, IntRect& rect)
+void GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, const IntRect& rect)
{
android::Mutex::Autolock lock(m_baseLayerLock);
m_baseLayer = layer;
- m_extra = 0;
- delete m_navLayer;
- m_navLayer = 0;
if (m_baseLayer) {
m_baseLayer->setGLWebViewState(this);
- m_currentPictureCounter++;
-
- if (!rect.isEmpty()) {
- // find which tiles fall within the invalRect and mark them as dirty
- m_tiledPageA->invalidateRect(rect, m_currentPictureCounter);
- m_tiledPageB->invalidateRect(rect, m_currentPictureCounter);
- }
+ inval(rect);
}
}
-void GLWebViewState::setExtra(android::DrawExtra* extra, LayerAndroid* navLayer)
+void GLWebViewState::setExtra(BaseLayerAndroid* layer, SkPicture& picture,
+ const IntRect& rect)
{
android::Mutex::Autolock lock(m_baseLayerLock);
- m_extra = extra;
- delete m_navLayer;
- m_navLayer = navLayer;
- m_currentPictureCounter++;
+ layer->setExtra(picture);
+ if (!rect.isEmpty())
+ inval(rect);
+ else if (!m_lastInval.isEmpty())
+ inval(m_lastInval);
+ m_lastInval = rect;
}
-void GLWebViewState::resetExtra(bool repaint)
+void GLWebViewState::inval(const IntRect& rect)
{
- android::Mutex::Autolock lock(m_baseLayerLock);
- if (m_extra && repaint)
- m_currentPictureCounter++;
- m_extra = 0;
- delete m_navLayer;
- m_navLayer = 0;
+ m_currentPictureCounter++;
+ if (!rect.isEmpty()) {
+ // find which tiles fall within the invalRect and mark them as dirty
+ m_tiledPageA->invalidateRect(rect, m_currentPictureCounter);
+ m_tiledPageB->invalidateRect(rect, m_currentPictureCounter);
+ }
}
unsigned int GLWebViewState::paintBaseLayerContent(SkCanvas* canvas)
{
android::Mutex::Autolock lock(m_baseLayerLock);
- if (m_baseLayer) {
+ if (m_baseLayer)
m_baseLayer->drawCanvas(canvas);
- if (m_extra && m_navLayer)
- m_extra->draw(canvas, m_navLayer);
- }
return m_currentPictureCounter;
}
diff --git a/WebCore/platform/graphics/android/GLWebViewState.h b/WebCore/platform/graphics/android/GLWebViewState.h
index cc1834d..e50c5f4 100644
--- a/WebCore/platform/graphics/android/GLWebViewState.h
+++ b/WebCore/platform/graphics/android/GLWebViewState.h
@@ -167,10 +167,8 @@ public:
void resetTransitionTime() { m_transitionTime = -1; }
unsigned int paintBaseLayerContent(SkCanvas* canvas);
- void setBaseLayer(BaseLayerAndroid* layer, IntRect& rect);
- void setExtra(android::DrawExtra* extra, LayerAndroid* navLayer);
- void resetExtra(bool repaint);
-
+ void setBaseLayer(BaseLayerAndroid* layer, const IntRect& rect);
+ void setExtra(BaseLayerAndroid* , SkPicture& , const IntRect& );
void scheduleUpdate(const double& currentTime, float scale);
TiledPage* frontPage();
@@ -194,6 +192,7 @@ public:
bool hasContent();
private:
+ void inval(const IntRect& rect); // caller must hold m_baseLayerLock
// Delay between scheduling a new page when the scale
// factor changes (i.e. zooming in or out)
@@ -221,8 +220,7 @@ private:
bool m_usePageA;
TiledPage* m_tiledPageA;
TiledPage* m_tiledPageB;
- android::DrawExtra* m_extra;
- LayerAndroid* m_navLayer;
+ SkIRect m_lastInval;
};
} // namespace WebCore
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp
index f443004..0a6d3e2 100644
--- a/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -459,8 +459,10 @@ void LayerAndroid::onDraw(SkCanvas* canvas, SkScalar opacity) {
canvas->restore();
}
}
- if (m_extra)
- m_extra->draw(canvas, this);
+ if (m_extra) {
+ IntRect dummy; // inval area, unused for now
+ m_extra->draw(canvas, this, &dummy);
+ }
#ifdef LAYER_DEBUG
float w = getSize().width();
diff --git a/WebCore/platform/graphics/android/android_graphics.cpp b/WebCore/platform/graphics/android/android_graphics.cpp
index a584f0b..c046858 100644
--- a/WebCore/platform/graphics/android/android_graphics.cpp
+++ b/WebCore/platform/graphics/android/android_graphics.cpp
@@ -40,8 +40,12 @@ namespace android {
// The CSS values for the inner and outer widths may be specified as fractions
#define WIDTH_SCALE 0.0625f // 1/16, to offset the scale in CSSStyleSelector
-void CursorRing::draw(SkCanvas* canvas, LayerAndroid* layer)
+void CursorRing::draw(SkCanvas* canvas, LayerAndroid* layer, IntRect* inval)
{
+ if (!m_lastBounds.isEmpty()) {
+ *inval = m_lastBounds;
+ m_lastBounds = IntRect(0, 0, 0, 0);
+ }
#if USE(ACCELERATED_COMPOSITING)
int layerId = m_node->isInLayer() ? m_frame->layer(m_node)->uniqueId() : -1;
if (layer->uniqueId() != layerId)
@@ -92,6 +96,17 @@ void CursorRing::draw(SkCanvas* canvas, LayerAndroid* layer)
paint.setStrokeWidth(colors.innerWidth() * WIDTH_SCALE);
paint.setColor(inner);
canvas->drawPath(path, paint);
+ SkRect localBounds, globalBounds;
+ localBounds = path.getBounds();
+ float width = std::max(colors.innerWidth(), colors.outerWidth());
+ width *= WIDTH_SCALE;
+ localBounds.inset(-width, -width);
+ const SkMatrix& matrix = canvas->getTotalMatrix();
+ matrix.mapRect(&globalBounds, localBounds);
+ SkIRect globalIBounds;
+ globalBounds.round(&globalIBounds);
+ m_lastBounds = globalIBounds;
+ inval->unite(m_lastBounds);
}
bool CursorRing::setup()
diff --git a/WebCore/platform/graphics/android/android_graphics.h b/WebCore/platform/graphics/android/android_graphics.h
index e147634..9f52a27 100644
--- a/WebCore/platform/graphics/android/android_graphics.h
+++ b/WebCore/platform/graphics/android/android_graphics.h
@@ -53,7 +53,7 @@ class CursorRing : public DrawExtra {
public:
CursorRing(WebViewCore* core) : m_viewImpl(core) {}
virtual ~CursorRing() {}
- virtual void draw(SkCanvas* , LayerAndroid* );
+ virtual void draw(SkCanvas* , LayerAndroid* , IntRect* );
bool setup();
private:
friend class WebView;
@@ -61,6 +61,7 @@ private:
WTF::Vector<IntRect> m_rings;
IntRect m_bounds;
IntRect m_absBounds;
+ IntRect m_lastBounds;
const CachedRoot* m_root;
const CachedFrame* m_frame;
const CachedNode* m_node;
diff --git a/WebKit/android/nav/DrawExtra.h b/WebKit/android/nav/DrawExtra.h
index ca4e87a..6716a65 100644
--- a/WebKit/android/nav/DrawExtra.h
+++ b/WebKit/android/nav/DrawExtra.h
@@ -29,6 +29,7 @@
class SkCanvas;
namespace WebCore {
+ class IntRect;
class LayerAndroid;
}
@@ -39,7 +40,7 @@ namespace android {
class DrawExtra {
public:
virtual ~DrawExtra() {}
- virtual void draw(SkCanvas* , LayerAndroid* ) = 0;
+ virtual void draw(SkCanvas* , LayerAndroid* , IntRect* ) = 0;
};
}
diff --git a/WebKit/android/nav/FindCanvas.cpp b/WebKit/android/nav/FindCanvas.cpp
index 9f59877..e1bfd82 100644
--- a/WebKit/android/nav/FindCanvas.cpp
+++ b/WebKit/android/nav/FindCanvas.cpp
@@ -559,7 +559,11 @@ void FindOnPage::storeCurrentMatchLocation() {
// matches than this, only draw the focused match.
#define MAX_NUMBER_OF_MATCHES_TO_DRAW 101
-void FindOnPage::draw(SkCanvas* canvas, LayerAndroid* layer) {
+void FindOnPage::draw(SkCanvas* canvas, LayerAndroid* layer, IntRect* inval) {
+ if (!m_lastBounds.isEmpty()) {
+ inval->unite(m_lastBounds);
+ m_lastBounds.setEmpty();
+ }
if (!m_hasCurrentLocation || !m_matches || !m_matches->size())
return;
int layerId = layer->uniqueId();
@@ -582,6 +586,12 @@ void FindOnPage::draw(SkCanvas* canvas, LayerAndroid* layer) {
canvas->clipPath(matchPath);
canvas->drawPicture(*matchInfo.getPicture());
canvas->restoreToCount(saveCount);
+ const SkMatrix& matrix = canvas->getTotalMatrix();
+ const SkRect& localBounds = matchPath.getBounds();
+ SkRect globalBounds;
+ matrix.mapRect(&globalBounds, localBounds);
+ globalBounds.round(&m_lastBounds);
+ inval->unite(m_lastBounds);
}
// Draw the rest
unsigned numberOfMatches = m_matches->size();
diff --git a/WebKit/android/nav/FindCanvas.h b/WebKit/android/nav/FindCanvas.h
index cbebfae..76ee1e2 100644
--- a/WebKit/android/nav/FindCanvas.h
+++ b/WebKit/android/nav/FindCanvas.h
@@ -31,6 +31,7 @@
#include "SkBounder.h"
#include "SkCanvas.h"
#include "SkPicture.h"
+#include "SkRect.h"
#include "SkRegion.h"
#include "SkTDArray.h"
@@ -219,13 +220,14 @@ public:
m_matches = 0;
m_hasCurrentLocation = false;
m_isFindPaintSetUp = false;
+ m_lastBounds.setEmpty();
}
virtual ~FindOnPage() { delete m_matches; }
void clearCurrentLocation() { m_hasCurrentLocation = false; }
IntRect currentMatchBounds() const;
int currentMatchIndex() const { return m_findIndex; }
bool currentMatchIsInLayer() const;
- virtual void draw(SkCanvas* , LayerAndroid* );
+ virtual void draw(SkCanvas* , LayerAndroid* , IntRect* );
void findNext(bool forward);
bool isCurrentLocationValid() { return m_hasCurrentLocation; }
void setMatches(WTF::Vector<MatchInfo>* matches);
@@ -245,6 +247,7 @@ private:
// Paint used for the background of our Find matches.
SkPaint m_findBlurPaint;
unsigned m_findIndex;
+ SkIRect m_lastBounds;
};
}
diff --git a/WebKit/android/nav/SelectText.cpp b/WebKit/android/nav/SelectText.cpp
index aa97ff6..6c9646c 100644
--- a/WebKit/android/nav/SelectText.cpp
+++ b/WebKit/android/nav/SelectText.cpp
@@ -305,6 +305,7 @@ public:
// FIXME: the -1/8 below takes care of slop beween the computed gap
// and the actual space width -- it's a rounding error from
// moving from fixed to float and back and could be much smaller.
+ spaceChecker.setBounder(0);
return gap >= minSpaceWidth() - SK_Fixed1 / 8;
}
@@ -1283,7 +1284,7 @@ SelectText::SelectText()
SkRect endDropRect = {-STROKE_OUTSET, CONTROL_HEIGHT,
CONTROL_WIDTH + STROKE_OUTSET, CONTROL_HEIGHT + DROP_HEIGHT};
- canvas = m_endControl.beginRecording(CONTROL_WIDTH, CONTROL_HEIGHT);
+ canvas = m_endControl.beginRecording(CONTROL_WIDTH, CONTROL_HEIGHT + DROP_HEIGHT);
paint.setColor(0xff000000);
paint.setStyle(SkPaint::kFill_Style);
paint.setShader(fillGradient);
@@ -1307,7 +1308,7 @@ SelectText::~SelectText()
m_picture->safeUnref();
}
-void SelectText::draw(SkCanvas* canvas, LayerAndroid* layer)
+void SelectText::draw(SkCanvas* canvas, LayerAndroid* layer, IntRect* inval)
{
if (m_layerId != layer->uniqueId())
return;
@@ -1318,12 +1319,22 @@ void SelectText::draw(SkCanvas* canvas, LayerAndroid* layer)
DBG_NAV_LOGD("m_extendSelection=%d m_drawPointer=%d layer [%d]",
m_extendSelection, m_drawPointer, layer->uniqueId());
if (m_extendSelection)
- drawSelectionRegion(canvas);
+ drawSelectionRegion(canvas, inval);
if (m_drawPointer)
- drawSelectionPointer(canvas);
+ drawSelectionPointer(canvas, inval);
}
-void SelectText::drawSelectionPointer(SkCanvas* canvas)
+static void addInval(IntRect* inval, const SkCanvas* canvas,
+ const SkRect& bounds) {
+ const SkMatrix& matrix = canvas->getTotalMatrix();
+ SkRect transformed;
+ matrix.mapRect(&transformed, bounds);
+ SkIRect iTrans;
+ transformed.round(&iTrans);
+ inval->unite(iTrans);
+}
+
+void SelectText::drawSelectionPointer(SkCanvas* canvas, IntRect* inval)
{
SkPath path;
if (m_extendSelection)
@@ -1348,22 +1359,44 @@ void SelectText::drawSelectionPointer(SkCanvas* canvas)
paint.setColor(SK_ColorWHITE);
canvas->drawPath(path, paint);
}
+ SkRect bounds = path.getBounds();
+ bounds.inset(-SK_Scalar1 * 2, -SK_Scalar1 * 2); // stroke width
+ addInval(inval, canvas, bounds);
canvas->restoreToCount(sc);
}
-void SelectText::drawSelectionRegion(SkCanvas* canvas)
+static void addStart(SkRegion* diff, const SkIRect& rect)
+{
+ SkIRect bounds;
+ bounds.set(rect.fLeft - CONTROL_WIDTH - STROKE_WIDTH,
+ rect.fBottom - STROKE_WIDTH, rect.fLeft + STROKE_WIDTH,
+ rect.fBottom + CONTROL_HEIGHT + DROP_HEIGHT + STROKE_WIDTH);
+ diff->op(bounds, SkRegion::kUnion_Op);
+}
+
+static void addEnd(SkRegion* diff, const SkIRect& rect)
+{
+ SkIRect bounds;
+ bounds.set(rect.fLeft - STROKE_WIDTH, rect.fBottom - STROKE_WIDTH,
+ rect.fLeft + CONTROL_WIDTH + STROKE_WIDTH,
+ rect.fBottom + CONTROL_HEIGHT + DROP_HEIGHT + STROKE_WIDTH);
+ diff->op(bounds, SkRegion::kUnion_Op);
+}
+
+void SelectText::drawSelectionRegion(SkCanvas* canvas, IntRect* inval)
{
if (!m_picture)
return;
- m_selRegion.setEmpty();
SkIRect ivisBounds = m_visibleRect;
ivisBounds.join(m_selStart);
ivisBounds.join(m_selEnd);
- DBG_NAV_LOGD("m_selStart=(%d, %d, %d, %d) m_selEnd=(%d, %d, %d, %d)"
+ DBG_NAV_LOGD("m_selStart=(%d,%d,r=%d,b=%d) m_selEnd=(%d,%d,r=%d,b=%d)"
" ivisBounds=(%d,%d,r=%d,b=%d)",
m_selStart.fLeft, m_selStart.fTop, m_selStart.fRight, m_selStart.fBottom,
m_selEnd.fLeft, m_selEnd.fTop, m_selEnd.fRight, m_selEnd.fBottom,
ivisBounds.fLeft, ivisBounds.fTop, ivisBounds.fRight, ivisBounds.fBottom);
+ SkRegion diff(m_selRegion);
+ m_selRegion.setEmpty();
m_flipped = buildSelection(*m_picture, ivisBounds, m_selStart, m_startBase,
m_selEnd, m_endBase, &m_selRegion);
SkPath path;
@@ -1383,6 +1416,36 @@ void SelectText::drawSelectionRegion(SkCanvas* canvas)
canvas->translate(m_selEnd.fRight, m_selEnd.fBottom);
canvas->drawPicture(m_endControl);
canvas->restore();
+ SkIRect a = diff.getBounds();
+ SkIRect b = m_selRegion.getBounds();
+ diff.op(m_selRegion, SkRegion::kXOR_Op);
+ SkIRect c = diff.getBounds();
+ DBG_NAV_LOGD("old=(%d,%d,r=%d,b=%d) new=(%d,%d,r=%d,b=%d) diff=(%d,%d,r=%d,b=%d)",
+ a.fLeft, a.fTop, a.fRight, a.fBottom, b.fLeft, b.fTop, b.fRight, b.fBottom,
+ c.fLeft, c.fTop, c.fRight, c.fBottom);
+ DBG_NAV_LOGD("lastStart=(%d,%d,r=%d,b=%d) m_lastEnd=(%d,%d,r=%d,b=%d)",
+ m_lastStart.fLeft, m_lastStart.fTop, m_lastStart.fRight, m_lastStart.fBottom,
+ m_lastEnd.fLeft, m_lastEnd.fTop, m_lastEnd.fRight, m_lastEnd.fBottom);
+ if (m_lastStart != m_selStart) {
+ if (!m_lastStart.isEmpty()) {
+ addStart(&diff, m_lastStart);
+ m_lastStart = m_selStart;
+ }
+ addStart(&diff, m_selStart);
+ }
+ if (m_lastEnd != m_selEnd) {
+ if (!m_lastEnd.isEmpty()) {
+ addEnd(&diff, m_lastEnd);
+ m_lastEnd = m_selEnd;
+ }
+ addEnd(&diff, m_selEnd);
+ }
+ SkIRect iBounds = diff.getBounds();
+ DBG_NAV_LOGD("diff=(%d,%d,r=%d,b=%d)",
+ iBounds.fLeft, iBounds.fTop, iBounds.fRight, iBounds.fBottom);
+ SkRect bounds;
+ bounds.set(iBounds);
+ addInval(inval, canvas, bounds);
}
void SelectText::extendSelection(const IntRect& vis, int x, int y)
@@ -1536,7 +1599,9 @@ void SelectText::reset()
{
DBG_NAV_LOG("m_extendSelection=false");
m_selStart.setEmpty();
+ m_lastStart.setEmpty();
m_selEnd.setEmpty();
+ m_lastEnd.setEmpty();
m_extendSelection = false;
m_startSelection = false;
m_picture->safeUnref();
diff --git a/WebKit/android/nav/SelectText.h b/WebKit/android/nav/SelectText.h
index 8247356..32e1728 100644
--- a/WebKit/android/nav/SelectText.h
+++ b/WebKit/android/nav/SelectText.h
@@ -42,7 +42,7 @@ class SelectText : public DrawExtra {
public:
SelectText();
virtual ~SelectText();
- virtual void draw(SkCanvas* , LayerAndroid* );
+ virtual void draw(SkCanvas* , LayerAndroid* , IntRect* );
void extendSelection(const IntRect& vis, int x, int y);
const String getSelection();
bool hitSelection(int x, int y) const;
@@ -60,8 +60,8 @@ public:
int m_selectX;
int m_selectY;
private:
- void drawSelectionPointer(SkCanvas* );
- void drawSelectionRegion(SkCanvas* );
+ void drawSelectionPointer(SkCanvas* , IntRect* );
+ void drawSelectionRegion(SkCanvas* , IntRect* );
static void getSelectionArrow(SkPath* );
void getSelectionCaret(SkPath* );
bool hitCorner(int cx, int cy, int x, int y) const;
@@ -71,6 +71,8 @@ private:
SkIPoint m_startOffset; // difference from global to layer
SkIRect m_selStart;
SkIRect m_selEnd;
+ SkIRect m_lastStart;
+ SkIRect m_lastEnd;
int m_startBase;
int m_endBase;
int m_layerId;
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index 56a1be9..03052ca 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -418,9 +418,6 @@ bool drawGL(WebCore::IntRect& viewRect, float scale, int extras)
if (!m_glWebViewState)
m_glWebViewState = new GLWebViewState();
-#if 0
- m_glWebViewState.resetExtra(false);
-#endif
CachedRoot* root = getFrameCache(AllowNewer);
if (!root) {
DBG_NAV_LOG("!root");
@@ -449,14 +446,17 @@ bool drawGL(WebCore::IntRect& viewRect, float scale, int extras)
unsigned int pic = m_glWebViewState->currentPictureCounter();
-#if 0
+ SkPicture picture;
+ IntRect rect(0, 0, 0, 0);
if (extra) {
- LayerAndroid* mainPicture = new LayerAndroid(m_navPictureUI);
- m_glWebViewState->setExtra(extra, mainPicture);
- } else {
- m_glWebViewState->resetExtra(true);
+ LayerAndroid mainPicture(m_navPictureUI);
+ PictureSet* content = m_baseLayer->content();
+ SkCanvas* canvas = picture.beginRecording(content->width(),
+ content->height());
+ extra->draw(canvas, &mainPicture, &rect);
+ picture.endRecording();
}
-#endif
+ m_glWebViewState->setExtra(m_baseLayer, picture, rect);
SkRect visibleRect;
calcOurContentVisibleRect(&visibleRect);
bool ret = m_baseLayer->drawGL(viewRect, visibleRect, scale);
@@ -510,8 +510,10 @@ PictureSet* draw(SkCanvas* canvas, SkColor bgColor, int extras, bool split)
default:
;
}
- if (extra)
- extra->draw(canvas, &mainPicture);
+ if (extra) {
+ IntRect dummy; // inval area, unused for now
+ extra->draw(canvas, &mainPicture, &dummy);
+ }
#if USE(ACCELERATED_COMPOSITING)
LayerAndroid* compositeLayer = compositeRoot();
if (!compositeLayer)