diff options
author | Nicolas Roard <nicolas@android.com> | 2010-03-19 17:10:50 +0000 |
---|---|---|
committer | Nicolas Roard <nicolas@android.com> | 2010-03-24 17:10:22 +0000 |
commit | e93f34788b1f644f8be61a1daf6505c387e6fc3b (patch) | |
tree | cf066349d77f384c8fb9f3e5a815c662a898a574 /WebKit | |
parent | 0471b981593b698f38afb8654f7076898ef56387 (diff) | |
download | external_webkit-e93f34788b1f644f8be61a1daf6505c387e6fc3b.zip external_webkit-e93f34788b1f644f8be61a1daf6505c387e6fc3b.tar.gz external_webkit-e93f34788b1f644f8be61a1daf6505c387e6fc3b.tar.bz2 |
Renders fixed layers with the root canvas matrix. Fix some positioning issues.
Bug:2526966 Bug:1818168
The current rendering code exposes some issues with the fact that we have
fixed layers in the layers hierarchy -- parents transformations are also applied
to the fixed layers, which is not what we want (fixed layers should be applied
on the original canvas, with the original transform -- e.g. toolbar present or not --
but no more).
One previously discussed solution was to move the fixed layers to their own hierarchy;
but doing so would mean to also redo all the z-index management that we already have
in the current system. The simplest way is therefore to use the original matrix (the
canvas' matrix) when we have a fixed layer. The way we do this is by inserting a new
LayerAndroid before the LayerAndroid root, setting the matrix of that new root to be
the canvas' matrix. The drawing is then unaffected, but we can ask skia to draw using
the root's matrix.
The second issue solved in the CL is some positioning troubles; layers may have
different dimensions than their render view, and the previous code was considering that
the views were always drawn at the origin in the layer. By removing the parents layers
transforms, this is not the case anymore, and we therefore need to take the render view
offset into account. Finally there is some additional debug code in LayerAndroid.
Change-Id: Id353ad3dfd9808252643f0e4f0140dde67480719
Diffstat (limited to 'WebKit')
-rw-r--r-- | WebKit/android/nav/WebView.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp index 1155ea2..c83ceea 100644 --- a/WebKit/android/nav/WebView.cpp +++ b/WebKit/android/nav/WebView.cpp @@ -424,6 +424,11 @@ void drawExtras(SkCanvas* canvas, int extras) // before we actually draw m_rootLayer->updateFixedLayersPositions(visible); m_rootLayer->updatePositions(); + // We have to set the canvas' matrix on the root layer + // (to have fixed layers work as intended) + SkAutoCanvasRestore restore(canvas, true); + m_rootLayer->setMatrix(canvas->getTotalMatrix()); + canvas->resetMatrix(); m_rootLayer->draw(canvas); #endif } @@ -1836,8 +1841,14 @@ static void nativeDumpDisplayTree(JNIEnv* env, jobject jwebview, jstring jurl) #if USE(ACCELERATED_COMPOSITING) if (true) { LayerAndroid* rootLayer = view->rootLayer(); - if (rootLayer) + if (rootLayer) { + // We have to set the canvas' matrix on the root layer + // (to have fixed layers work as intended) + SkAutoCanvasRestore restore(&canvas, true); + rootLayer->setMatrix(canvas.getTotalMatrix()); + canvas.resetMatrix(); rootLayer->draw(&canvas); + } } #endif // we're done with the file now |