summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/platform/graphics/android/Layer.h19
-rw-r--r--Source/WebCore/platform/graphics/android/LayerAndroid.cpp9
-rw-r--r--Source/WebCore/platform/graphics/android/LayerAndroid.h11
-rw-r--r--Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.cpp5
-rw-r--r--Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.h16
-rw-r--r--Source/WebKit/android/nav/FindCanvas.cpp2
-rw-r--r--Source/WebKit/android/nav/FindCanvas.h4
-rw-r--r--Source/WebKit/android/nav/WebView.cpp3
8 files changed, 41 insertions, 28 deletions
diff --git a/Source/WebCore/platform/graphics/android/Layer.h b/Source/WebCore/platform/graphics/android/Layer.h
index 6450fde..107c457 100644
--- a/Source/WebCore/platform/graphics/android/Layer.h
+++ b/Source/WebCore/platform/graphics/android/Layer.h
@@ -122,14 +122,17 @@ private:
kInheritFromRootTransform_Flag = 0x01
};
- Layer* fParent;
- SkScalar m_opacity;
- SkSize m_size;
- SkPoint m_position;
- SkPoint m_anchorPoint;
- SkMatrix fMatrix;
- SkMatrix fChildrenMatrix;
- uint32_t fFlags;
+ Layer* fParent;
+ SkScalar m_opacity;
+ SkSize m_size;
+ // The position of the origin of the layer, relative to the parent layer.
+ SkPoint m_position;
+ // The point in the layer used as the origin for local transformations,
+ // expressed as a fraction of the layer size.
+ SkPoint m_anchorPoint;
+ SkMatrix fMatrix;
+ SkMatrix fChildrenMatrix;
+ uint32_t fFlags;
SkTDArray<Layer*> m_children;
diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
index 17e466f..a39614f 100644
--- a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp
@@ -267,7 +267,7 @@ void LayerAndroid::removeAnimationsForKeyframes(const String& name)
}
// We only use the bounding rect of the layer as mask...
-// TODO: use a real mask?
+// FIXME: use a real mask?
void LayerAndroid::setMaskLayer(LayerAndroid* layer)
{
if (layer)
@@ -546,7 +546,7 @@ void LayerAndroid::updatePositions()
if (!m_isFixed) {
// turn our fields into a matrix.
//
- // TODO: this should happen in the caller, and we should remove these
+ // FIXME: this should happen in the caller, and we should remove these
// fields from our subclass
SkMatrix matrix;
GLUtils::toSkMatrix(matrix, m_transform);
@@ -943,6 +943,11 @@ SkRect LayerAndroid::subtractLayers(const SkRect& visibleRect) const
{
SkRect result;
if (m_recordingPicture) {
+ // FIXME: This seems wrong. localToGlobal() applies the full local transform,
+ // se surely we should operate globalMatrix on size(), not bounds() with
+ // the position removed? Perhaps we never noticed the bug because most
+ // layers don't use a local transform?
+ // See http://b/5338388
SkRect globalRect = bounds();
globalRect.offset(-getPosition()); // localToGlobal adds in position
SkMatrix globalMatrix;
diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.h b/Source/WebCore/platform/graphics/android/LayerAndroid.h
index 6aca993..8078762 100644
--- a/Source/WebCore/platform/graphics/android/LayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/LayerAndroid.h
@@ -109,6 +109,10 @@ 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();
@@ -189,9 +193,10 @@ public:
SkPicture* picture() const { return m_recordingPicture; }
- // remove layers bounds from visible rectangle to show what can be
- // scrolled into view; returns original minus layer bounds in global space.
- SkRect subtractLayers(const SkRect& visibleRect) const;
+ // Given a rect in global space, subtracts from it the bounds of this layer
+ // and of all of its children. Returns the bounding rectangle of the result,
+ // in global space.
+ SkRect subtractLayers(const SkRect&) const;
void dumpLayers(FILE*, int indentLevel) const;
void dumpToLog() const;
diff --git a/Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.cpp
index ca8f03c..2bb8b5c 100644
--- a/Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.cpp
@@ -18,10 +18,7 @@ bool ScrollableLayerAndroid::scrollTo(int x, int y)
if (newX == scrollBounds.fLeft && newY == scrollBounds.fTop)
return false;
- SkScalar diffX = newX - scrollBounds.fLeft;
- SkScalar diffY = newY - scrollBounds.fTop;
- const SkPoint& pos = getPosition();
- setPosition(pos.fX - diffX, pos.fY - diffY);
+ setPosition(m_scrollLimits.fLeft - newX, m_scrollLimits.fTop - newY);
return true;
}
diff --git a/Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.h b/Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.h
index c3fdecd..b59b4e1 100644
--- a/Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/ScrollableLayerAndroid.h
@@ -42,15 +42,16 @@ public:
virtual LayerAndroid* copy() const { return new ScrollableLayerAndroid(*this); }
- // Returns true if the content position has changed.
- bool scrollTo(int dx, int dy);
+ // Scrolls to the given position in the layer.
+ // Returns whether or not any scrolling was required.
+ bool scrollTo(int x, int y);
- // Fills the rect with the current scroll offset and the maximum scroll.
+ // Fills the rect with the current scroll offset and the maximum scroll offset.
// fLeft = scrollX
// fTop = scrollY
- // fRight = maxX
- // fBottom = maxY
- void getScrollRect(SkIRect* out) const;
+ // fRight = maxScrollX
+ // fBottom = maxScrollY
+ void getScrollRect(SkIRect*) const;
void setScrollLimits(float x, float y, float width, float height)
{
@@ -61,6 +62,9 @@ public:
friend LayerAndroid* android::deserializeLayer(SkStream* stream);
private:
+ // The position of the visible area of the layer, relative to the parent
+ // layer. This is fixed during scrolling. We acheive scrolling by modifying
+ // the position of the layer.
SkRect m_scrollLimits;
};
diff --git a/Source/WebKit/android/nav/FindCanvas.cpp b/Source/WebKit/android/nav/FindCanvas.cpp
index 38fb71e..ca3cfba 100644
--- a/Source/WebKit/android/nav/FindCanvas.cpp
+++ b/Source/WebKit/android/nav/FindCanvas.cpp
@@ -598,7 +598,7 @@ void FindOnPage::draw(SkCanvas* canvas, LayerAndroid* layer, IntRect* inval) {
unsigned numberOfMatches = m_matches->size();
if (numberOfMatches > 1
&& numberOfMatches < MAX_NUMBER_OF_MATCHES_TO_DRAW) {
- for(unsigned i = 0; i < numberOfMatches; i++) {
+ for (unsigned i = 0; i < numberOfMatches; i++) {
// The current match has already been drawn
if (i == m_findIndex)
continue;
diff --git a/Source/WebKit/android/nav/FindCanvas.h b/Source/WebKit/android/nav/FindCanvas.h
index f693a3f..994ff17 100644
--- a/Source/WebKit/android/nav/FindCanvas.h
+++ b/Source/WebKit/android/nav/FindCanvas.h
@@ -54,9 +54,9 @@ public:
SkPicture* getPicture() const { return m_picture; }
// This will make a copy of the region, and increase the ref count on the
// SkPicture. If this MatchInfo already had one, unref it.
+ void set(const SkRegion& region, SkPicture* pic, int layerId);
bool isInLayer() const { return m_layerId >= 0; }
int layerId() const { return m_layerId; }
- void set(const SkRegion& region, SkPicture* pic, int layerId);
private:
MatchInfo& operator=(MatchInfo& src);
SkRegion m_location;
@@ -141,7 +141,7 @@ public:
const SkPaint& paint) {
}
- void drawLayers(LayerAndroid* );
+ void drawLayers(LayerAndroid*);
int found() const { return mNumFound; }
void setLayerId(int layerId) { mLayerId = layerId; }
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index 209cc04..101e206 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -105,8 +105,7 @@ class WebView
public:
enum FrameCachePermission {
DontAllowNewer,
- AllowNewer,
- AllowNewest
+ AllowNewer
};
enum DrawExtras { // keep this in sync with WebView.java