summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2012-04-06 15:16:28 -0700
committerNicolas Roard <nicolasroard@google.com>2012-04-24 11:54:25 -0700
commita15d30f54c6edc68da7e82c198b5916dd023ac4d (patch)
tree6f7040096043ac04a72600144a51a274f1096b2f /Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp
parent492bcfac9fc25b61f44811050fb0cfe827eb6a08 (diff)
downloadexternal_webkit-a15d30f54c6edc68da7e82c198b5916dd023ac4d.zip
external_webkit-a15d30f54c6edc68da7e82c198b5916dd023ac4d.tar.gz
external_webkit-a15d30f54c6edc68da7e82c198b5916dd023ac4d.tar.bz2
CSS Background image implementation
bug:1352305 Change-Id: Id9caaae9b9442729110b52c75004f634d8284db4
Diffstat (limited to 'Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp44
1 files changed, 42 insertions, 2 deletions
diff --git a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp
index ce520b4..bc3b04b 100644
--- a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp
@@ -30,6 +30,7 @@
#include "BaseLayerAndroid.h"
#include "AndroidLog.h"
+#include "FixedPositioning.h"
#include "GLWebViewState.h"
#include "LayerContent.h"
@@ -42,8 +43,10 @@ BaseLayerAndroid::BaseLayerAndroid(LayerContent* content)
: LayerAndroid((RenderLayer*)0)
, m_color(Color::white)
{
- setContent(content);
- setSize(content->width(), content->height());
+ if (content) {
+ setContent(content);
+ setSize(content->width(), content->height());
+ }
m_uniqueId = BASE_UNIQUE_ID;
}
@@ -66,4 +69,41 @@ IFrameLayerAndroid* BaseLayerAndroid::updatePosition(SkRect viewport,
return LayerAndroid::updatePosition(viewport, parentIframeLayer);
}
+ForegroundBaseLayerAndroid::ForegroundBaseLayerAndroid(LayerContent* content)
+ : LayerAndroid((RenderLayer*)0)
+{
+ setIntrinsicallyComposited(true);
+}
+
+FixedBackgroundBaseLayerAndroid::FixedBackgroundBaseLayerAndroid(LayerContent* content)
+ : LayerAndroid((RenderLayer*)0)
+{
+ if (content) {
+ setContent(content);
+ setSize(content->width(), content->height());
+ }
+ setIntrinsicallyComposited(true);
+
+ // TODO: add support for fixed positioning attributes
+ SkRect viewRect;
+ SkLength left, top, right, bottom;
+ left.setFixedValue(0);
+ top.setFixedValue(0);
+ right.setAuto();
+ bottom.setAuto();
+ SkLength marginLeft, marginTop, marginRight, marginBottom;
+ marginLeft.setAuto();
+ marginTop.setAuto();
+ marginRight.setAuto();
+ marginBottom.setAuto();
+
+ viewRect.set(0, 0, content->width(), content->height());
+ FixedPositioning* fixedPosition = new FixedPositioning(this);
+ setFixedPosition(fixedPosition);
+ fixedPosition->setFixedPosition(left, top, right, bottom,
+ marginLeft, marginTop,
+ marginRight, marginBottom,
+ IntPoint(0, 0), viewRect);
+}
+
} // namespace WebCore