diff options
author | Nicolas Roard <nicolasroard@google.com> | 2012-03-07 16:13:39 -0800 |
---|---|---|
committer | Nicolas Roard <nicolasroard@google.com> | 2012-03-08 11:41:31 -0800 |
commit | ce76304e955cb279f6f237a84c0ba4fd40a2b2ba (patch) | |
tree | aa30a37cb34c8096ae33dd512c2da9fac86cb06d /Source/WebKit | |
parent | 47b8a953ab1b71113b605fd84489f63938bd7dd7 (diff) | |
download | external_webkit-ce76304e955cb279f6f237a84c0ba4fd40a2b2ba.zip external_webkit-ce76304e955cb279f6f237a84c0ba4fd40a2b2ba.tar.gz external_webkit-ce76304e955cb279f6f237a84c0ba4fd40a2b2ba.tar.bz2 |
Change the way we apply fixed position to layers
With the latest refactoring we lost the possibility of having a layer
other than LayerAndroid be fixed positioned. This CL remove the
FixedLayerAndroid class (rename it into FixedPositioning) of the
hierarchy, and use delegation to apply fixed position.
Change-Id: Ib291fcaefe6a4431849ccfe2cf458fac6cac58aa
Diffstat (limited to 'Source/WebKit')
-rw-r--r-- | Source/WebKit/android/jni/ViewStateSerializer.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/Source/WebKit/android/jni/ViewStateSerializer.cpp b/Source/WebKit/android/jni/ViewStateSerializer.cpp index d2fe900..a96b6b4 100644 --- a/Source/WebKit/android/jni/ViewStateSerializer.cpp +++ b/Source/WebKit/android/jni/ViewStateSerializer.cpp @@ -27,7 +27,7 @@ #include "BaseLayerAndroid.h" #include "CreateJavaOutputStreamAdaptor.h" -#include "FixedLayerAndroid.h" +#include "FixedPositioning.h" #include "ImagesManager.h" #include "IFrameContentLayerAndroid.h" #include "IFrameLayerAndroid.h" @@ -287,19 +287,19 @@ void serializeLayer(LayerAndroid* layer, SkWStream* stream) // those fields anymore. Let's keep the current serialization format for // now and output blank fields... not great, but probably better than // dealing with multiple versions. - if (layer->isFixed()) { - FixedLayerAndroid* fixedLayer = static_cast<FixedLayerAndroid*>(layer); - writeSkLength(stream, fixedLayer->m_fixedLeft); - writeSkLength(stream, fixedLayer->m_fixedTop); - writeSkLength(stream, fixedLayer->m_fixedRight); - writeSkLength(stream, fixedLayer->m_fixedBottom); - writeSkLength(stream, fixedLayer->m_fixedMarginLeft); - writeSkLength(stream, fixedLayer->m_fixedMarginTop); - writeSkLength(stream, fixedLayer->m_fixedMarginRight); - writeSkLength(stream, fixedLayer->m_fixedMarginBottom); - writeSkRect(stream, fixedLayer->m_fixedRect); - stream->write32(fixedLayer->m_renderLayerPos.x()); - stream->write32(fixedLayer->m_renderLayerPos.y()); + if (layer->fixedPosition()) { + FixedPositioning* fixedPosition = layer->fixedPosition(); + writeSkLength(stream, fixedPosition->m_fixedLeft); + writeSkLength(stream, fixedPosition->m_fixedTop); + writeSkLength(stream, fixedPosition->m_fixedRight); + writeSkLength(stream, fixedPosition->m_fixedBottom); + writeSkLength(stream, fixedPosition->m_fixedMarginLeft); + writeSkLength(stream, fixedPosition->m_fixedMarginTop); + writeSkLength(stream, fixedPosition->m_fixedMarginRight); + writeSkLength(stream, fixedPosition->m_fixedMarginBottom); + writeSkRect(stream, fixedPosition->m_fixedRect); + stream->write32(fixedPosition->m_renderLayerPos.x()); + stream->write32(fixedPosition->m_renderLayerPos.y()); } else { SkLength length; SkRect rect; @@ -403,21 +403,21 @@ LayerAndroid* deserializeLayer(int version, SkStream* stream) } if (isFixed) { - FixedLayerAndroid* fixedLayer = new FixedLayerAndroid(*layer); - layer->unref(); - layer = fixedLayer; - - fixedLayer->m_fixedLeft = readSkLength(stream); - fixedLayer->m_fixedTop = readSkLength(stream); - fixedLayer->m_fixedRight = readSkLength(stream); - fixedLayer->m_fixedBottom = readSkLength(stream); - fixedLayer->m_fixedMarginLeft = readSkLength(stream); - fixedLayer->m_fixedMarginTop = readSkLength(stream); - fixedLayer->m_fixedMarginRight = readSkLength(stream); - fixedLayer->m_fixedMarginBottom = readSkLength(stream); - fixedLayer->m_fixedRect = readSkRect(stream); - fixedLayer->m_renderLayerPos.setX(stream->readS32()); - fixedLayer->m_renderLayerPos.setY(stream->readS32()); + FixedPositioning* fixedPosition = new FixedPositioning(layer); + + fixedPosition->m_fixedLeft = readSkLength(stream); + fixedPosition->m_fixedTop = readSkLength(stream); + fixedPosition->m_fixedRight = readSkLength(stream); + fixedPosition->m_fixedBottom = readSkLength(stream); + fixedPosition->m_fixedMarginLeft = readSkLength(stream); + fixedPosition->m_fixedMarginTop = readSkLength(stream); + fixedPosition->m_fixedMarginRight = readSkLength(stream); + fixedPosition->m_fixedMarginBottom = readSkLength(stream); + fixedPosition->m_fixedRect = readSkRect(stream); + fixedPosition->m_renderLayerPos.setX(stream->readS32()); + fixedPosition->m_renderLayerPos.setY(stream->readS32()); + + layer->setFixedPosition(fixedPosition); } else { // Not a fixed element, bypass the values in the stream readSkLength(stream); // fixedLeft |