summaryrefslogtreecommitdiffstats
path: root/WebCore
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore')
-rw-r--r--WebCore/bindings/v8/V8Proxy.cpp6
-rw-r--r--WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp20
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.cpp81
-rw-r--r--WebCore/platform/graphics/android/LayerAndroid.h57
-rw-r--r--WebCore/platform/graphics/android/android_graphics.cpp99
-rw-r--r--WebCore/platform/graphics/android/android_graphics.h38
6 files changed, 211 insertions, 90 deletions
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
index 9b1fff5..d13289e 100644
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ b/WebCore/bindings/v8/V8Proxy.cpp
@@ -818,10 +818,13 @@ bool V8Proxy::sourceLineNumber(int& result)
frameSourceLine = v8::Local<v8::Function>::Cast(v8UtilityContext->Global()->Get(v8::String::New("frameSourceLine")));
if (frameSourceLine.IsEmpty())
return false;
+#if 0
+ // TODO(andreip): re-enable this after experimenting with partial snapshots
v8::Handle<v8::Value> value = v8::Debug::Call(frameSourceLine);
if (value.IsEmpty())
return false;
result = value->Int32Value();
+#endif
return true;
}
@@ -836,10 +839,13 @@ bool V8Proxy::sourceName(String& result)
frameSourceName = v8::Local<v8::Function>::Cast(v8UtilityContext->Global()->Get(v8::String::New("frameSourceName")));
if (frameSourceName.IsEmpty())
return false;
+#if 0
+ // TODO(andreip): re-enable this after experimenting with partial snapshots
v8::Handle<v8::Value> value = v8::Debug::Call(frameSourceName);
if (value.IsEmpty())
return false;
result = toWebCoreString(value);
+#endif
return true;
}
diff --git a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
index be275a8..fd1c91a 100644
--- a/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -230,7 +230,13 @@ void GraphicsLayerAndroid::updateFixedPosition()
top = convertLength(view->style()->top());
right = convertLength(view->style()->right());
bottom = convertLength(view->style()->bottom());
- m_contentLayer->setFixedPosition(left, top, right, bottom);
+ // We need to pass the size of the element to compute the final fixed
+ // position -- we can't use the layer's size as it could possibly differs.
+ // We also have to use the visible overflow and not just the size,
+ // as some child elements could be overflowing.
+ int w = view->rightVisibleOverflow() - view->leftVisibleOverflow();
+ int h = view->bottomVisibleOverflow() - view->topVisibleOverflow();
+ m_contentLayer->setFixedPosition(left, top, right, bottom, w, h);
}
}
}
@@ -319,11 +325,9 @@ void GraphicsLayerAndroid::setMasksToBounds(bool masksToBounds)
void GraphicsLayerAndroid::setDrawsContent(bool drawsContent)
{
GraphicsLayer::setDrawsContent(drawsContent);
- m_contentLayer->setDrawsContent(m_drawsContent);
if (m_drawsContent) {
m_haveContents = true;
- m_contentLayer->setHaveContents(true);
setNeedsDisplay();
}
askForSync();
@@ -351,8 +355,6 @@ void GraphicsLayerAndroid::setContentsOpaque(bool opaque)
LOG("(%x) setContentsOpaque (%d)", this, opaque);
GraphicsLayer::setContentsOpaque(opaque);
m_haveContents = true;
- m_contentLayer->setHaveContents(true);
- m_contentLayer->setDrawsContent(true);
askForSync();
}
@@ -431,8 +433,6 @@ bool GraphicsLayerAndroid::repaint(const FloatRect& rect)
this, rect.x(), rect.y(), rect.width(), rect.height(),
gPaused, m_needsRepaint, m_haveContents);
- m_contentLayer->setDrawsContent(true);
-
if (!gPaused && m_haveContents && m_needsRepaint) {
SkAutoPictureRecord arp(m_contentLayer->recordContext(), m_size.width(), m_size.height());
SkCanvas* recordingCanvas = arp.getRecordingCanvas();
@@ -796,16 +796,12 @@ void GraphicsLayerAndroid::setContentsToImage(Image* image)
TLOG("(%x) setContentsToImage", this, image);
if (image) {
m_haveContents = true;
- m_contentLayer->setHaveContents(true);
- m_contentLayer->setDrawsContent(true);
- m_contentLayer->setHaveImage(true);
if (!m_haveImage) {
m_haveImage = true;
setNeedsDisplay();
askForSync();
}
- } else
- m_contentLayer->setHaveImage(false);
+ }
}
PlatformLayer* GraphicsLayerAndroid::platformLayer() const
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp
index 2dc8a05..0dedd64 100644
--- a/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -4,8 +4,11 @@
#if USE(ACCELERATED_COMPOSITING)
#include "AndroidAnimation.h"
-#include "FindCanvas.h"
+#include "DrawExtra.h"
+#include "SkCanvas.h"
#include "SkDrawFilter.h"
+#include "SkPaint.h"
+#include "SkPicture.h"
#include <wtf/CurrentTime.h>
#define LAYER_DEBUG // Add diagonals for debugging
@@ -43,14 +46,11 @@ class OpacityDrawFilter : public SkDrawFilter {
LayerAndroid::LayerAndroid(bool isRootLayer) : SkLayer(),
m_isRootLayer(isRootLayer),
- m_haveContents(false),
- m_drawsContent(true),
- m_haveImage(false),
m_haveClip(false),
m_doRotation(false),
m_isFixed(false),
m_recordingPicture(0),
- m_findOnPage(0),
+ m_extra(0),
m_uniqueId(++gUniqueId)
{
m_angleTransform = 0;
@@ -63,11 +63,8 @@ LayerAndroid::LayerAndroid(bool isRootLayer) : SkLayer(),
LayerAndroid::LayerAndroid(const LayerAndroid& layer) : SkLayer(layer),
m_isRootLayer(layer.m_isRootLayer),
- m_haveContents(layer.m_haveContents),
- m_drawsContent(layer.m_drawsContent),
- m_haveImage(layer.m_haveImage),
m_haveClip(layer.m_haveClip),
- m_findOnPage(0),
+ m_extra(0), // deliberately not copied
m_uniqueId(layer.m_uniqueId)
{
m_doRotation = layer.m_doRotation;
@@ -82,6 +79,8 @@ LayerAndroid::LayerAndroid(const LayerAndroid& layer) : SkLayer(layer),
m_fixedTop = layer.m_fixedTop;
m_fixedRight = layer.m_fixedRight;
m_fixedBottom = layer.m_fixedBottom;
+ m_fixedWidth = layer.m_fixedWidth;
+ m_fixedHeight = layer.m_fixedHeight;
m_recordingPicture = layer.m_recordingPicture;
SkSafeRef(m_recordingPicture);
@@ -96,6 +95,23 @@ LayerAndroid::LayerAndroid(const LayerAndroid& layer) : SkLayer(layer),
gDebugLayerAndroidInstances++;
}
+LayerAndroid::LayerAndroid(SkPicture* picture) : SkLayer(),
+ m_isRootLayer(true),
+ m_haveClip(false),
+ m_doRotation(false),
+ m_isFixed(false),
+ m_recordingPicture(picture),
+ m_extra(0),
+ m_uniqueId(-1)
+{
+ m_angleTransform = 0;
+ m_translation.set(0, 0);
+ m_scale.set(1, 1);
+ m_backgroundColor = 0;
+ SkSafeRef(m_recordingPicture);
+ gDebugLayerAndroidInstances++;
+}
+
LayerAndroid::~LayerAndroid()
{
removeChildren();
@@ -151,13 +167,6 @@ void LayerAndroid::removeAnimation(const String& name)
m_animations.remove(name);
}
-void LayerAndroid::setDrawsContent(bool drawsContent)
-{
- m_drawsContent = drawsContent;
- for (int i = 0; i < countChildren(); i++)
- getChild(i)->setDrawsContent(drawsContent);
-}
-
// We only use the bounding rect of the layer as mask...
// TODO: use a real mask?
void LayerAndroid::setMaskLayer(LayerAndroid* layer)
@@ -174,8 +183,6 @@ void LayerAndroid::setMasksToBounds(bool masksToBounds)
void LayerAndroid::setBackgroundColor(SkColor color)
{
m_backgroundColor = color;
- setHaveContents(true);
- setDrawsContent(true);
}
static int gDebugChildLevel;
@@ -236,13 +243,6 @@ const LayerAndroid* LayerAndroid::find(int x, int y) const
return 0;
}
-void LayerAndroid::setClip(SkCanvas* canvas)
-{
- SkRect clip;
- bounds(&clip);
- canvas->clipRect(clip);
-}
-
///////////////////////////////////////////////////////////////////////////////
void LayerAndroid::updatePositions(const SkRect& viewport) {
@@ -259,12 +259,12 @@ void LayerAndroid::updatePositions(const SkRect& viewport) {
if (m_fixedLeft.defined())
x = dx + m_fixedLeft.calcFloatValue(w);
else if (m_fixedRight.defined())
- x = dx + w - m_fixedRight.calcFloatValue(w) - getSize().width();
+ x = dx + w - m_fixedRight.calcFloatValue(w) - m_fixedWidth;
if (m_fixedTop.defined())
y = dy + m_fixedTop.calcFloatValue(h);
else if (m_fixedBottom.defined())
- y = dy + h - m_fixedBottom.calcFloatValue(h) - getSize().height();
+ y = dy + h - m_fixedBottom.calcFloatValue(h) - m_fixedHeight;
this->setPosition(x, y);
matrix.reset();
@@ -283,13 +283,8 @@ void LayerAndroid::updatePositions(const SkRect& viewport) {
// now apply it to our children
int count = this->countChildren();
- if (count > 0) {
- SkRect tmp = viewport;
- // adjust the viewport by our (the parent) position
- tmp.offset(-this->getPosition());
- for (int i = 0; i < count; i++) {
- this->getChild(i)->updatePositions(tmp);
- }
+ for (int i = 0; i < count; i++) {
+ this->getChild(i)->updatePositions(viewport);
}
}
@@ -300,7 +295,7 @@ void LayerAndroid::onDraw(SkCanvas* canvas, SkScalar opacity) {
canvas->clipRect(r);
}
- if (!m_haveImage && !m_drawsContent && !m_isRootLayer)
+ if (!m_isRootLayer)
return;
if (!prepareContext())
@@ -314,6 +309,8 @@ void LayerAndroid::onDraw(SkCanvas* canvas, SkScalar opacity) {
canvas->setDrawFilter(new OpacityDrawFilter(canvasOpacity));
m_recordingPicture->draw(canvas);
+ if (m_extra)
+ m_extra->draw(canvas, this);
#ifdef LAYER_DEBUG
float w = getSize().width();
@@ -339,9 +336,6 @@ SkPicture* LayerAndroid::recordContext()
bool LayerAndroid::prepareContext(bool force)
{
- if (!m_haveContents)
- return false;
-
if (!m_isRootLayer) {
if (force || !m_recordingPicture
|| (m_recordingPicture
@@ -443,9 +437,6 @@ void LayerAndroid::dumpLayers(FILE* file, int indentLevel) const
writeln(file, indentLevel, "{");
writeHexVal(file, indentLevel + 1, "layer", (int)this);
- writeIntVal(file, indentLevel + 1, "haveContents", m_haveContents);
- writeIntVal(file, indentLevel + 1, "drawsContent", m_drawsContent);
- writeIntVal(file, indentLevel + 1, "haveImage", m_haveImage);
writeIntVal(file, indentLevel + 1, "clipRect", m_haveClip);
writeFloatVal(file, indentLevel + 1, "opacity", getOpacity());
@@ -462,6 +453,8 @@ void LayerAndroid::dumpLayers(FILE* file, int indentLevel) const
writeLength(file, indentLevel + 1, "fixedTop", m_fixedTop);
writeLength(file, indentLevel + 1, "fixedRight", m_fixedRight);
writeLength(file, indentLevel + 1, "fixedBottom", m_fixedBottom);
+ writeIntVal(file, indentLevel + 1, "fixedWidth", m_fixedWidth);
+ writeIntVal(file, indentLevel + 1, "fixedHeight", m_fixedHeight);
if (countChildren()) {
writeln(file, indentLevel + 1, "children = [");
@@ -487,11 +480,11 @@ const LayerAndroid* LayerAndroid::findById(int match) const
return 0;
}
-void LayerAndroid::setFindOnPage(FindOnPage* findOnPage)
+void LayerAndroid::setExtra(DrawExtra* extra)
{
- m_findOnPage = findOnPage;
+ m_extra = extra;
for (int i = 0; i < countChildren(); i++)
- getChild(i)->setFindOnPage(findOnPage);
+ getChild(i)->setExtra(extra);
}
} // namespace WebCore
diff --git a/WebCore/platform/graphics/android/LayerAndroid.h b/WebCore/platform/graphics/android/LayerAndroid.h
index d3f2357..4f8a5fe 100644
--- a/WebCore/platform/graphics/android/LayerAndroid.h
+++ b/WebCore/platform/graphics/android/LayerAndroid.h
@@ -25,11 +25,16 @@
#include "StringHash.h"
#include <wtf/HashMap.h>
-class FindOnPage;
class SkCanvas;
class SkMatrix;
class SkPicture;
+namespace android {
+class DrawExtra;
+}
+
+using namespace android;
+
struct SkLength {
enum SkLengthType { Undefined, Auto, Relative, Percent, Fixed, Static, Intrinsic, MinIntrinsic };
SkLengthType type;
@@ -64,6 +69,7 @@ class LayerAndroid : public SkLayer {
public:
LayerAndroid(bool isRootLayer);
LayerAndroid(const LayerAndroid& layer);
+ LayerAndroid(SkPicture* );
virtual ~LayerAndroid();
static int instancesCount();
@@ -82,28 +88,28 @@ public:
rect.offset(m_translation.fX, m_translation.fY);
return rect;
}
- void setFixedPosition(SkLength left, SkLength top, SkLength right, SkLength bottom) {
+ void setFixedPosition(SkLength left, // CSS left property
+ SkLength top, // CSS top property
+ SkLength right, // CSS right property
+ SkLength bottom, // CSS bottom property
+ int width, // visible overflow width
+ int height) { // visible overflow height
m_fixedLeft = left;
m_fixedTop = top;
m_fixedRight = right;
m_fixedBottom = bottom;
+ m_fixedWidth = width;
+ m_fixedHeight = height;
m_isFixed = true;
}
void setBackgroundColor(SkColor color);
- void setHaveContents(bool haveContents) { m_haveContents = haveContents; }
- void setHaveImage(bool haveImage) { m_haveImage = haveImage; }
- void setDrawsContent(bool drawsContent);
- void setFindOnPage(FindOnPage* findOnPage);
void setMaskLayer(LayerAndroid*);
void setMasksToBounds(bool);
+
void setIsRootLayer(bool isRootLayer) { m_isRootLayer = isRootLayer; }
- bool prepareContext(bool force = false);
- void startRecording();
- void stopRecording();
SkPicture* recordContext();
- void setClip(SkCanvas* clip);
void addAnimation(PassRefPtr<AndroidAnimation> anim);
void removeAnimation(const String& name);
@@ -131,20 +137,19 @@ public:
LayerAndroid* getChild(int index) const {
return static_cast<LayerAndroid*>(this->INHERITED::getChild(index));
}
- bool haveClip() const { return m_haveClip; }
+ void setExtra(DrawExtra* extra); // does not assign ownership
int uniqueId() const { return m_uniqueId; }
protected:
virtual void onDraw(SkCanvas*, SkScalar opacity);
private:
+ bool prepareContext(bool force = false);
bool boundsIsUnique(SkTDArray<SkRect>* region, const SkRect& local) const;
void clipInner(SkTDArray<SkRect>* region, const SkRect& local) const;
bool m_isRootLayer;
- bool m_haveContents;
bool m_drawsContent;
- bool m_haveImage;
bool m_haveClip;
bool m_doRotation;
bool m_isFixed;
@@ -154,6 +159,9 @@ private:
SkLength m_fixedTop;
SkLength m_fixedRight;
SkLength m_fixedBottom;
+ int m_fixedWidth;
+ int m_fixedHeight;
+
SkPoint m_translation;
SkPoint m_scale;
SkScalar m_angleTransform;
@@ -163,7 +171,7 @@ private:
typedef HashMap<String, RefPtr<AndroidAnimation> > KeyframesMap;
KeyframesMap m_animations;
- FindOnPage* m_findOnPage;
+ DrawExtra* m_extra;
int m_uniqueId;
typedef SkLayer INHERITED;
@@ -171,6 +179,27 @@ private:
}
+#else
+
+class SkPicture;
+
+namespace WebCore {
+
+class LayerAndroid {
+public:
+ LayerAndroid(SkPicture* picture) :
+ m_recordingPicture(picture), // does not assign ownership
+ m_uniqueId(-1)
+ {}
+ SkPicture* picture() const { return m_recordingPicture; }
+ int uniqueId() const { return m_uniqueId; }
+private:
+ SkPicture* m_recordingPicture;
+ int m_uniqueId;
+};
+
+}
+
#endif // USE(ACCELERATED_COMPOSITING)
#endif // LayerAndroid_h
diff --git a/WebCore/platform/graphics/android/android_graphics.cpp b/WebCore/platform/graphics/android/android_graphics.cpp
index af88b8c..fafd3df 100644
--- a/WebCore/platform/graphics/android/android_graphics.cpp
+++ b/WebCore/platform/graphics/android/android_graphics.cpp
@@ -23,13 +23,18 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
+#include "CachedPrefix.h"
#include "android_graphics.h"
+#include "CachedRoot.h"
#include "IntRect.h"
+#include "LayerAndroid.h"
#include "SkCanvas.h"
#include "SkCornerPathEffect.h"
#include "SkPath.h"
#include "SkRegion.h"
+#include "WebViewCore.h"
+
+namespace android {
///////////////////////////////////////////////////////////////////////////////
@@ -56,15 +61,26 @@ const static SkColor cursorPressedColors[] = {
#define CURSOR_RING_INNER_DIAMETER SkFixedToScalar(SkIntToFixed(3)>>1) // 3/2 == 1.5
#define CURSOR_RING_OUTER_OUTSET 2 // used to inflate rects added to region
-void CursorRing::DrawRing(SkCanvas* canvas,
- const Vector<WebCore::IntRect>& rects, Flavor flavor)
+void CursorRing::draw(SkCanvas* canvas, LayerAndroid* layer)
{
- unsigned rectCount = rects.size();
- SkRegion rgn;
- SkPath path;
+#if USE(ACCELERATED_COMPOSITING)
+ int layerId = m_node->isInLayer() ? m_frame->layer(m_node)->uniqueId() : -1;
+ if (layer->uniqueId() != layerId)
+ return;
+#endif
+ if (canvas->quickReject(m_bounds, SkCanvas::kAA_EdgeType)) {
+ DBG_NAV_LOGD("canvas->quickReject cursorNode=%d (nodePointer=%p)"
+ " bounds=(%d,%d,w=%d,h=%d)", m_node->index(), m_node->nodePointer(),
+ m_bounds.x(), m_bounds.y(), m_bounds.width(), m_bounds.height());
+ m_followedLink = false;
+ return;
+ }
+ unsigned rectCount = m_rings.size();
+ SkRegion rgn;
+ SkPath path;
for (unsigned i = 0; i < rectCount; i++)
{
- SkRect r(rects[i]);
+ SkRect r(m_rings[i]);
SkIRect ir;
r.round(&ir);
@@ -76,15 +92,76 @@ void CursorRing::DrawRing(SkCanvas* canvas,
SkPaint paint;
paint.setAntiAlias(true);
paint.setPathEffect(new SkCornerPathEffect(CURSOR_RING_ROUNDEDNESS))->unref();
- if (flavor >= NORMAL_ANIMATING) { // pressed
- paint.setColor(cursorPressedColors[flavor - NORMAL_ANIMATING]);
+ if (m_flavor >= NORMAL_ANIMATING) { // pressed
+ paint.setColor(cursorPressedColors[m_flavor - NORMAL_ANIMATING]);
canvas->drawPath(path, paint);
}
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(CURSOR_RING_OUTER_DIAMETER);
- paint.setColor(cursorOuterColors[flavor]);
+ paint.setColor(cursorOuterColors[m_flavor]);
canvas->drawPath(path, paint);
paint.setStrokeWidth(CURSOR_RING_INNER_DIAMETER);
- paint.setColor(cursorInnerColors[flavor]);
+ paint.setColor(cursorInnerColors[m_flavor]);
canvas->drawPath(path, paint);
}
+
+bool CursorRing::setup()
+{
+ m_node->localCursorRings(m_frame, &m_rings);
+ if (!m_rings.size()) {
+ DBG_NAV_LOG("!rings.size()");
+ m_viewImpl->m_hasCursorBounds = false;
+ return false;
+ }
+ m_isButton = false;
+ m_viewImpl->gButtonMutex.lock();
+ // If this is a button drawn by us (rather than webkit) do not draw the
+ // cursor ring, since its cursor will be shown by a change in what we draw.
+ // Should be in sync with recordButtons, since that will be called
+ // before this.
+ if (m_viewImpl->m_buttons.size() > 0) {
+ WebCore::Node* cursorPointer = (WebCore::Node*) m_node->nodePointer();
+ Container* end = m_viewImpl->m_buttons.end();
+ for (Container* ptr = m_viewImpl->m_buttons.begin(); ptr != end; ptr++) {
+ if (ptr->matches(cursorPointer)) {
+ m_isButton = true;
+ break;
+ }
+ }
+ }
+ m_viewImpl->gButtonMutex.unlock();
+ m_bounds = m_node->localBounds(m_frame);
+ m_viewImpl->updateCursorBounds(m_root, m_frame, m_node);
+
+ bool useHitBounds = m_node->useHitBounds();
+ if (useHitBounds)
+ m_bounds = m_node->localHitBounds(m_frame);
+ if (useHitBounds || m_node->useBounds()) {
+ m_rings.clear();
+ m_rings.append(m_bounds);
+ }
+ m_bounds.inflate(SkScalarCeil(CURSOR_RING_OUTER_DIAMETER));
+ if (!m_node->hasCursorRing() || (m_node->isPlugin() && m_node->isFocus()))
+ return false;
+ m_flavor = NORMAL_FLAVOR;
+ if (!m_isButton) {
+ m_flavor = m_node->isSyntheticLink() ? FAKE_FLAVOR : NORMAL_FLAVOR;
+ if (m_followedLink) {
+ m_flavor = static_cast<Flavor>(m_flavor + NORMAL_ANIMATING);
+ }
+#if DEBUG_NAV_UI
+ const WebCore::IntRect& ring = m_rings[0];
+ DBG_NAV_LOGD("cursorNode=%d (nodePointer=%p) flavor=%s rings=%d"
+ " (%d, %d, %d, %d) isPlugin=%s",
+ m_node->index(), m_node->nodePointer(),
+ m_flavor == FAKE_FLAVOR ? "FAKE_FLAVOR" :
+ m_flavor == NORMAL_ANIMATING ? "NORMAL_ANIMATING" :
+ m_flavor == FAKE_ANIMATING ? "FAKE_ANIMATING" : "NORMAL_FLAVOR",
+ m_rings.size(), ring.x(), ring.y(), ring.width(), ring.height(),
+ m_node->isPlugin() ? "true" : "false");
+#endif
+ }
+ return true;
+}
+
+}
diff --git a/WebCore/platform/graphics/android/android_graphics.h b/WebCore/platform/graphics/android/android_graphics.h
index a286e3a..dbf1978 100644
--- a/WebCore/platform/graphics/android/android_graphics.h
+++ b/WebCore/platform/graphics/android/android_graphics.h
@@ -26,18 +26,23 @@
#ifndef android_graphics_DEFINED
#define android_graphics_DEFINED
-#include "wtf/Vector.h"
-
+#include "DrawExtra.h"
+#include "IntRect.h"
#include "SkTypes.h"
-
-class SkCanvas;
+#include "wtf/Vector.h"
namespace WebCore {
- class IntRect;
class GraphicsContext;
}
-SkCanvas* android_gc2canvas(WebCore::GraphicsContext* gc);
+SkCanvas* android_gc2canvas(GraphicsContext* gc);
+
+namespace android {
+
+class CachedFrame;
+class CachedNode;
+class CachedRoot;
+class WebViewCore;
// Data and methods for cursor rings
@@ -47,7 +52,7 @@ SkCanvas* android_gc2canvas(WebCore::GraphicsContext* gc);
// used to inval rectangle enclosing pressed state of ring
#define CURSOR_RING_OUTER_DIAMETER SkFixedToScalar(SkIntToFixed(13)>>2) // 13/4 == 3.25
-struct CursorRing {
+class CursorRing : public DrawExtra {
public:
enum Flavor {
NORMAL_FLAVOR,
@@ -57,8 +62,23 @@ public:
ANIMATING_COUNT = 2
};
- static void DrawRing(SkCanvas* ,
- const Vector<WebCore::IntRect>& rects, Flavor );
+ CursorRing(WebViewCore* core) : m_viewImpl(core) {}
+ virtual ~CursorRing() {}
+ virtual void draw(SkCanvas* , LayerAndroid* );
+ bool setup();
+private:
+ friend class WebView;
+ WebViewCore* m_viewImpl; // copy for convenience
+ WTF::Vector<IntRect> m_rings;
+ IntRect m_bounds;
+ const CachedRoot* m_root;
+ const CachedFrame* m_frame;
+ const CachedNode* m_node;
+ Flavor m_flavor;
+ bool m_followedLink;
+ bool m_isButton;
};
+}
+
#endif