summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.h6
-rw-r--r--Source/WebCore/platform/graphics/android/layers/CanvasLayer.h2
-rw-r--r--Source/WebCore/platform/graphics/android/layers/FixedBackgroundLayerAndroid.h2
-rw-r--r--Source/WebCore/platform/graphics/android/layers/IFrameContentLayerAndroid.h2
-rw-r--r--Source/WebCore/platform/graphics/android/layers/IFrameLayerAndroid.h2
-rw-r--r--Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp76
-rw-r--r--Source/WebCore/platform/graphics/android/layers/LayerAndroid.h18
-rw-r--r--Source/WebCore/platform/graphics/android/layers/ScrollableLayerAndroid.h2
-rw-r--r--Source/WebKit/android/nav/WebView.cpp35
9 files changed, 31 insertions, 114 deletions
diff --git a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.h b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.h
index 7c755ae..afe1c35 100644
--- a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.h
@@ -37,7 +37,7 @@ class RenderStyle;
class BaseLayerAndroid : public LayerAndroid {
public:
BaseLayerAndroid(LayerContent* content);
- virtual SubclassType subclassType() { return LayerAndroid::BaseLayer; }
+ virtual SubclassType subclassType() const { return LayerAndroid::BaseLayer; }
virtual void getLocalTransform(SkMatrix* matrix) const;
virtual const TransformationMatrix* drawTransform() const { return 0; }
virtual bool needsTexture() { return content(); }
@@ -55,7 +55,7 @@ private:
class ForegroundBaseLayerAndroid : public LayerAndroid {
public:
ForegroundBaseLayerAndroid(LayerContent* content);
- virtual SubclassType subclassType() { return LayerAndroid::ForegroundBaseLayer; }
+ virtual SubclassType subclassType() const { return LayerAndroid::ForegroundBaseLayer; }
virtual bool needsTexture() { return false; }
};
@@ -66,7 +66,7 @@ public:
FixedBackgroundImageLayerAndroid(const FixedBackgroundImageLayerAndroid& layer);
virtual LayerAndroid* copy() const { return new FixedBackgroundImageLayerAndroid(*this); }
virtual bool needsTexture() { return true; }
- virtual SubclassType subclassType() { return LayerAndroid::FixedBackgroundImageLayer; }
+ virtual SubclassType subclassType() const { return LayerAndroid::FixedBackgroundImageLayer; }
virtual bool drawGL(bool layerTilesDisabled);
private:
diff --git a/Source/WebCore/platform/graphics/android/layers/CanvasLayer.h b/Source/WebCore/platform/graphics/android/layers/CanvasLayer.h
index 2bfed1e..c719451 100644
--- a/Source/WebCore/platform/graphics/android/layers/CanvasLayer.h
+++ b/Source/WebCore/platform/graphics/android/layers/CanvasLayer.h
@@ -46,7 +46,7 @@ public:
virtual ~CanvasLayer();
virtual LayerAndroid* copy() const { return new CanvasLayer(*this); }
- virtual SubclassType subclassType() { return LayerAndroid::CanvasLayer; }
+ virtual SubclassType subclassType() const { return LayerAndroid::CanvasLayer; }
virtual void clearDirtyRegion();
virtual bool drawGL(bool layerTilesDisabled);
diff --git a/Source/WebCore/platform/graphics/android/layers/FixedBackgroundLayerAndroid.h b/Source/WebCore/platform/graphics/android/layers/FixedBackgroundLayerAndroid.h
index 6c8f42c..72afa35 100644
--- a/Source/WebCore/platform/graphics/android/layers/FixedBackgroundLayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/layers/FixedBackgroundLayerAndroid.h
@@ -39,7 +39,7 @@ public:
virtual bool isFixedBackground() const { return true; }
- virtual SubclassType subclassType() { return LayerAndroid::FixedBackgroundLayer; }
+ virtual SubclassType subclassType() const { return LayerAndroid::FixedBackgroundLayer; }
};
}
diff --git a/Source/WebCore/platform/graphics/android/layers/IFrameContentLayerAndroid.h b/Source/WebCore/platform/graphics/android/layers/IFrameContentLayerAndroid.h
index 64b2d06..1a8c21c 100644
--- a/Source/WebCore/platform/graphics/android/layers/IFrameContentLayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/layers/IFrameContentLayerAndroid.h
@@ -52,7 +52,7 @@ public:
virtual bool isIFrameContent() const { return true; }
virtual LayerAndroid* copy() const { return new IFrameContentLayerAndroid(*this); }
- virtual SubclassType subclassType() { return LayerAndroid::IFrameContentLayer; }
+ virtual SubclassType subclassType() const { return LayerAndroid::IFrameContentLayer; }
// Scrolls to the given position in the layer.
// Returns whether or not any scrolling was required.
diff --git a/Source/WebCore/platform/graphics/android/layers/IFrameLayerAndroid.h b/Source/WebCore/platform/graphics/android/layers/IFrameLayerAndroid.h
index e12188a..f2fbf49 100644
--- a/Source/WebCore/platform/graphics/android/layers/IFrameLayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/layers/IFrameLayerAndroid.h
@@ -48,7 +48,7 @@ public:
virtual bool isIFrame() const { return true; }
virtual LayerAndroid* copy() const { return new IFrameLayerAndroid(*this); }
- virtual SubclassType subclassType() { return LayerAndroid::IFrameLayer; }
+ virtual SubclassType subclassType() const { return LayerAndroid::IFrameLayer; }
virtual IFrameLayerAndroid* updatePosition(SkRect viewport,
IFrameLayerAndroid* parentIframeLayer);
diff --git a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp
index 73ae26f..feb2d99 100644
--- a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.cpp
@@ -337,61 +337,6 @@ FloatPoint LayerAndroid::translation() const
return p;
}
-SkRect LayerAndroid::bounds() const
-{
- SkRect rect;
- bounds(&rect);
- return rect;
-}
-
-void LayerAndroid::bounds(SkRect* rect) const
-{
- const SkPoint& pos = this->getPosition();
- const SkSize& size = this->getSize();
-
- // The returned rect has the translation applied
- // FIXME: apply the full transform to the rect,
- // and fix the text selection accordingly
- FloatPoint p(pos.fX, pos.fY);
- p = m_transform.mapPoint(p);
- rect->fLeft = p.x();
- rect->fTop = p.y();
- rect->fRight = p.x() + size.width();
- rect->fBottom = p.y() + size.height();
-}
-
-static bool boundsIsUnique(const SkTDArray<SkRect>& region,
- const SkRect& local)
-{
- for (int i = 0; i < region.count(); i++) {
- if (region[i].contains(local))
- return false;
- }
- return true;
-}
-
-void LayerAndroid::clipArea(SkTDArray<SkRect>* region) const
-{
- SkRect local;
- local.set(0, 0, std::numeric_limits<float>::max(),
- std::numeric_limits<float>::max());
- clipInner(region, local);
-}
-
-void LayerAndroid::clipInner(SkTDArray<SkRect>* region,
- const SkRect& local) const
-{
- SkRect localBounds;
- bounds(&localBounds);
- localBounds.intersect(local);
- if (localBounds.isEmpty())
- return;
- if (m_content && boundsIsUnique(*region, localBounds))
- *region->append() = localBounds;
- for (int i = 0; i < countChildren(); i++)
- getChild(i)->clipInner(region, m_haveClip ? localBounds : local);
-}
-
IFrameLayerAndroid* LayerAndroid::updatePosition(SkRect viewport,
IFrameLayerAndroid* parentIframeLayer)
{
@@ -631,8 +576,8 @@ void LayerAndroid::showLayer(int indent)
"clip (%d, %d, %d, %d) %s %s m_content(%x), pic w: %d h: %d originalLayer: %x %d",
spaces, m_haveClip ? "CLIP LAYER" : "", subclassName().ascii().data(),
subclassType(), uniqueId(), this, m_owningLayer,
- needsTexture() ? "needs a texture" : "no texture",
- m_imageCRC ? "has an image" : "no image",
+ needsTexture() ? "needsTexture" : "",
+ m_imageCRC ? "hasImage" : "",
tr.x(), tr.y(), tr.width(), tr.height(),
visible.x(), visible.y(), visible.width(), visible.height(),
clip.x(), clip.y(), clip.width(), clip.height(),
@@ -786,17 +731,20 @@ int LayerAndroid::setHwAccelerated(bool hwAccelerated)
return flags | onSetHwAccelerated(hwAccelerated);
}
-IntRect LayerAndroid::fullContentArea()
+FloatRect LayerAndroid::fullContentAreaMapped() const
+{
+ FloatRect area(0,0, getWidth(), getHeight());
+ FloatRect globalArea = m_drawTransform.mapRect(area);
+ return globalArea;
+}
+
+IntRect LayerAndroid::fullContentArea() const
{
- IntRect area;
- area.setX(0);
- area.setY(0);
- area.setWidth(getSize().width());
- area.setHeight(getSize().height());
+ IntRect area(0,0, getWidth(), getHeight());
return area;
}
-IntRect LayerAndroid::visibleContentArea(bool force3dContentVisible)
+IntRect LayerAndroid::visibleContentArea(bool force3dContentVisible) const
{
IntRect area = fullContentArea();
if (subclassType() == LayerAndroid::FixedBackgroundImageLayer)
diff --git a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.h b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.h
index 687f146..c7c795f 100644
--- a/Source/WebCore/platform/graphics/android/layers/LayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/layers/LayerAndroid.h
@@ -132,16 +132,14 @@ public:
void setBackfaceVisibility(bool value) { m_backfaceVisibility = value; }
void setTransform(const TransformationMatrix& matrix) { m_transform = matrix; }
FloatPoint translation() const;
- // Returns a rect describing the bounds of the layer with the local
- // transformation applied, expressed relative to the parent layer.
- // FIXME: Currently we use only the translation component of the local
- // transformation.
- SkRect bounds() const;
IntRect clippedRect() const;
bool outsideViewport();
- IntRect fullContentArea();
- IntRect visibleContentArea(bool force3dContentVisible = false);
+ // Returns the full area of the layer mapped into global content coordinates
+ FloatRect fullContentAreaMapped() const;
+
+ IntRect fullContentArea() const;
+ IntRect visibleContentArea(bool force3dContentVisible = false) const;
virtual bool needsTexture();
@@ -220,7 +218,6 @@ public:
*/
void updatePositions();
- void clipArea(SkTDArray<SkRect>* region) const;
const LayerAndroid* find(int* xPtr, int* yPtr, SkPicture* root) const;
const LayerAndroid* findById(int uniqueID) const
{
@@ -241,8 +238,6 @@ public:
*/
void setContentsImage(SkBitmapRef* img);
- void bounds(SkRect*) const;
-
virtual LayerAndroid* copy() const { return new LayerAndroid(*this); }
virtual void clearDirtyRegion();
@@ -271,7 +266,7 @@ public:
friend void android::cleanupImageRefs(LayerAndroid* layer);
LayerType type() { return m_type; }
- virtual SubclassType subclassType() { return LayerAndroid::StandardLayer; }
+ virtual SubclassType subclassType() const { return LayerAndroid::StandardLayer; }
bool hasText();
@@ -313,7 +308,6 @@ private:
void copyAnimationStartTimes(LayerAndroid* oldLayer);
bool prepareContext(bool force = false);
- void clipInner(SkTDArray<SkRect>* region, const SkRect& local) const;
// -------------------------------------------------------------------
// Fields to be serialized
diff --git a/Source/WebCore/platform/graphics/android/layers/ScrollableLayerAndroid.h b/Source/WebCore/platform/graphics/android/layers/ScrollableLayerAndroid.h
index 52f5e7e..430f053 100644
--- a/Source/WebCore/platform/graphics/android/layers/ScrollableLayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/layers/ScrollableLayerAndroid.h
@@ -41,7 +41,7 @@ public:
virtual bool contentIsScrollable() const { return true; }
virtual LayerAndroid* copy() const { return new ScrollableLayerAndroid(*this); }
- virtual SubclassType subclassType() { return LayerAndroid::ScrollableLayer; }
+ virtual SubclassType subclassType() const { return LayerAndroid::ScrollableLayer; }
// Scrolls to the given position in the layer.
// Returns whether or not any scrolling was required.
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index a78392b..65d6c8c 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -370,22 +370,18 @@ void updateRectsForGL()
#if USE(ACCELERATED_COMPOSITING)
static const ScrollableLayerAndroid* findScrollableLayer(
const LayerAndroid* parent, int x, int y, SkIRect* foundBounds) {
- SkRect bounds;
- parent->bounds(&bounds);
+ IntRect bounds = enclosingIntRect(parent->fullContentAreaMapped());
+
// Check the parent bounds first; this will clip to within a masking layer's
// bounds.
if (parent->masksToBounds() && !bounds.contains(x, y))
return 0;
- // Move the hit test local to parent.
- x -= bounds.fLeft;
- y -= bounds.fTop;
+
int count = parent->countChildren();
while (count--) {
const LayerAndroid* child = parent->getChild(count);
- const ScrollableLayerAndroid* result = findScrollableLayer(child, x, y,
- foundBounds);
+ const ScrollableLayerAndroid* result = findScrollableLayer(child, x, y, foundBounds);
if (result) {
- foundBounds->offset(bounds.fLeft, bounds.fTop);
if (parent->masksToBounds()) {
if (bounds.width() < foundBounds->width())
foundBounds->fRight = foundBounds->fLeft + bounds.width();
@@ -396,7 +392,7 @@ static const ScrollableLayerAndroid* findScrollableLayer(
}
}
if (parent->contentIsScrollable()) {
- foundBounds->set(0, 0, bounds.width(), bounds.height());
+ foundBounds->set(bounds.x(), bounds.y(), bounds.width(), bounds.height());
return static_cast<const ScrollableLayerAndroid*>(parent);
}
return 0;
@@ -898,25 +894,6 @@ static bool nativeHasContent(JNIEnv *env, jobject obj)
return GET_NATIVE_VIEW(env, obj)->hasContent();
}
-static jobject nativeLayerBounds(JNIEnv* env, jobject obj, jint jlayer)
-{
- SkRect r;
-#if USE(ACCELERATED_COMPOSITING)
- LayerAndroid* layer = (LayerAndroid*) jlayer;
- r = layer->bounds();
-#else
- r.setEmpty();
-#endif
- SkIRect irect;
- r.round(&irect);
- jclass rectClass = env->FindClass("android/graphics/Rect");
- jmethodID init = env->GetMethodID(rectClass, "<init>", "(IIII)V");
- jobject rect = env->NewObject(rectClass, init, irect.fLeft, irect.fTop,
- irect.fRight, irect.fBottom);
- env->DeleteLocalRef(rectClass);
- return rect;
-}
-
static void nativeSetHeightCanMeasure(JNIEnv *env, jobject obj, bool measure)
{
WebView* view = GET_NATIVE_VIEW(env, obj);
@@ -1246,8 +1223,6 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeEvaluateLayersAnimations },
{ "nativeGetSelection", "()Ljava/lang/String;",
(void*) nativeGetSelection },
- { "nativeLayerBounds", "(I)Landroid/graphics/Rect;",
- (void*) nativeLayerBounds },
{ "nativeSetHeightCanMeasure", "(Z)V",
(void*) nativeSetHeightCanMeasure },
{ "nativeSetBaseLayer", "(IIZZ)Z",