summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2012-05-04 16:06:30 -0700
committerNicolas Roard <nicolasroard@google.com>2012-05-08 18:02:56 -0700
commit576098317db607e1d3b32a0e53d2551ea0e7ef21 (patch)
tree144b1667bb6f1d4ef0e1c2ec02d4049d4558571a /Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
parent35caaaf726b8b17cec92747a1fe42dba44d6b775 (diff)
downloadexternal_webkit-576098317db607e1d3b32a0e53d2551ea0e7ef21.zip
external_webkit-576098317db607e1d3b32a0e53d2551ea0e7ef21.tar.gz
external_webkit-576098317db607e1d3b32a0e53d2551ea0e7ef21.tar.bz2
Complete implementation fixed background
- extract image for body background (a lot more memory-friendly) - implement tiling / repeat - handles background color bug:1352305 Change-Id: I0efa27e09416e3c3848a4a53ced650cbb3d9f7ce
Diffstat (limited to 'Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp61
1 files changed, 12 insertions, 49 deletions
diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
index 8b30d9d..06bb767 100644
--- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -25,6 +25,7 @@
#include "AndroidAnimation.h"
#include "AndroidLog.h"
#include "Animation.h"
+#include "BaseLayerAndroid.h"
#include "CachedImage.h"
#include "CanvasLayer.h"
#include "FixedBackgroundLayerAndroid.h"
@@ -90,22 +91,6 @@ PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client)
return new GraphicsLayerAndroid(client);
}
-SkLength convertLength(Length len)
-{
- SkLength length;
- length.type = SkLength::Undefined;
- length.value = 0;
- if (len.type() == WebCore::Percent) {
- length.type = SkLength::Percent;
- length.value = len.percent();
- }
- if (len.type() == WebCore::Fixed) {
- length.type = SkLength::Fixed;
- length.value = len.value();
- }
- return length;
-}
-
static RenderLayer* renderLayerFromClient(GraphicsLayerClient* client)
{
return client ? client->owningLayer() : 0;
@@ -248,17 +233,17 @@ void GraphicsLayerAndroid::updatePositionedLayers()
m_contentLayer->setAbsolutePosition(false);
// We need to get the passed CSS properties for the element
SkLength left, top, right, bottom;
- left = convertLength(view->style()->left());
- top = convertLength(view->style()->top());
- right = convertLength(view->style()->right());
- bottom = convertLength(view->style()->bottom());
+ left = SkLength::convertLength(view->style()->left());
+ top = SkLength::convertLength(view->style()->top());
+ right = SkLength::convertLength(view->style()->right());
+ bottom = SkLength::convertLength(view->style()->bottom());
// We also need to get the margin...
SkLength marginLeft, marginTop, marginRight, marginBottom;
- marginLeft = convertLength(view->style()->marginLeft());
- marginTop = convertLength(view->style()->marginTop());
- marginRight = convertLength(view->style()->marginRight());
- marginBottom = convertLength(view->style()->marginBottom());
+ marginLeft = SkLength::convertLength(view->style()->marginLeft());
+ marginTop = SkLength::convertLength(view->style()->marginTop());
+ marginRight = SkLength::convertLength(view->style()->marginRight());
+ marginBottom = SkLength::convertLength(view->style()->marginBottom());
// In order to compute the fixed element's position, we need the width
// and height of the element when bottom or right is defined.
@@ -603,29 +588,15 @@ void GraphicsLayerAndroid::updateFixedBackgroundLayers() {
// Grab the background image and create a layer for it
// the layer will be fixed positioned.
- // TODO: if there's a background color, we don't honor it.
FillLayer* layers = view->style()->accessBackgroundLayers();
StyleImage* styleImage = layers->image();
if (styleImage->isCachedImage()) {
CachedImage* cachedImage = static_cast<StyleCachedImage*>(styleImage)->cachedImage();
Image* image = cachedImage->image();
if (image) {
- m_fixedBackgroundLayer = new LayerAndroid(renderLayer);
- m_fixedBackgroundLayer->setContentsImage(image->nativeImageForCurrentFrame());
- m_fixedBackgroundLayer->setSize(image->width(), image->height());
-
- FixedPositioning* fixedPosition = new FixedPositioning(m_fixedBackgroundLayer);
- SkRect viewRect;
- SkLength left, top, right, bottom;
- left = convertLength(view->style()->backgroundXPosition());
- top = convertLength(view->style()->backgroundYPosition());
- right.setAuto();
- bottom.setAuto();
- SkLength marginLeft, marginTop, marginRight, marginBottom;
- marginLeft.setAuto();
- marginTop.setAuto();
- marginRight.setAuto();
- marginBottom.setAuto();
+ m_fixedBackgroundLayer = new FixedBackgroundImageLayerAndroid(view->style(),
+ view->width(),
+ view->height());
Color color = view->style()->visitedDependentColor(CSSPropertyBackgroundColor);
SkColor skiaColor = SkColorSetARGB(color.alpha(),
@@ -633,14 +604,6 @@ void GraphicsLayerAndroid::updateFixedBackgroundLayers() {
color.green(),
color.blue());
m_fixedBackgroundLayer->setBackgroundColor(skiaColor);
-
- viewRect.set(0, 0, view->width(), view->height());
- fixedPosition->setFixedPosition(left, top, right, bottom,
- marginLeft, marginTop,
- marginRight, marginBottom,
- IntPoint(0, 0), viewRect);
-
- m_fixedBackgroundLayer->setFixedPosition(fixedPosition);
}
}