summaryrefslogtreecommitdiff
path: root/Source/WebKit/chromium/src/NonCompositedContentHost.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-06-20 13:01:08 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-06-20 13:01:08 +0200
commit49233e234e5c787396cadb2cea33b31ae0cd65c1 (patch)
tree5410cb9a8fd53168bb60d62c54b654d86f03c38d /Source/WebKit/chromium/src/NonCompositedContentHost.cpp
parentb211c645d8ab690f713515dfdc84d80b11c27d2c (diff)
downloadqtwebkit-49233e234e5c787396cadb2cea33b31ae0cd65c1.tar.gz
Imported WebKit commit 3a8c29f35d00659d2ce7a0ccdfa8304f14e82327 (http://svn.webkit.org/repository/webkit/trunk@120813)
New snapshot with Windows build fixes
Diffstat (limited to 'Source/WebKit/chromium/src/NonCompositedContentHost.cpp')
-rw-r--r--Source/WebKit/chromium/src/NonCompositedContentHost.cpp41
1 files changed, 30 insertions, 11 deletions
diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp
index 4cc1c1177..2c37209c6 100644
--- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp
+++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp
@@ -31,13 +31,15 @@
#include "FloatRect.h"
#include "GraphicsLayer.h"
#include "LayerChromium.h"
-#include "LayerPainterChromium.h"
+#include "PlatformContextSkia.h"
+#include "WebViewImpl.h"
#include "cc/CCLayerTreeHost.h"
namespace WebKit {
-NonCompositedContentHost::NonCompositedContentHost(PassOwnPtr<WebCore::LayerPainterChromium> contentPaint)
- : m_contentPaint(contentPaint)
+NonCompositedContentHost::NonCompositedContentHost(WebViewImpl* webView)
+ : m_webView(webView)
+ , m_opaque(true)
, m_showDebugBorders(false)
, m_deviceScaleFactor(1.0)
{
@@ -62,6 +64,12 @@ void NonCompositedContentHost::setBackgroundColor(const WebCore::Color& color)
m_graphicsLayer->platformLayer()->setBackgroundColor(color);
}
+void NonCompositedContentHost::setOpaque(bool opaque)
+{
+ m_opaque = opaque;
+ m_graphicsLayer->platformLayer()->setOpaque(opaque);
+}
+
void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer)
{
m_graphicsLayer->setNeedsDisplay();
@@ -93,7 +101,7 @@ static void reserveScrollbarLayers(WebCore::LayerChromium* layer, WebCore::Layer
layer->setAlwaysReserveTextures(true);
}
-void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, float deviceScale, int layerAdjustX)
+void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, float deviceScale)
{
if (!scrollLayer())
return;
@@ -101,7 +109,8 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize,
bool visibleRectChanged = m_viewportSize != viewportSize;
m_viewportSize = viewportSize;
- scrollLayer()->setScrollPosition(scrollPosition);
+
+ scrollLayer()->setScrollPosition(scrollPosition + toSize(scrollOrigin));
scrollLayer()->setPosition(-scrollPosition);
// Due to the possibility of pinch zoom, the noncomposited layer is always
// assumed to be scrollable.
@@ -110,10 +119,14 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize,
m_graphicsLayer->deviceOrPageScaleFactorChanged();
m_graphicsLayer->setSize(contentsSize);
- m_layerAdjustX = layerAdjustX;
- if (m_graphicsLayer->transform().m41() != m_layerAdjustX) {
+ // In RTL-style pages, the origin of the initial containing block for the
+ // root layer may be positive; translate the layer to avoid negative
+ // coordinates.
+ m_layerAdjust = -toSize(scrollOrigin);
+ if (m_graphicsLayer->transform().m41() != m_layerAdjust.width() || m_graphicsLayer->transform().m42() != m_layerAdjust.height()) {
WebCore::TransformationMatrix transform = m_graphicsLayer->transform();
- transform.setM41(m_layerAdjustX);
+ transform.setM41(m_layerAdjust.width());
+ transform.setM42(m_layerAdjust.height());
m_graphicsLayer->setTransform(transform);
// If a tiled layer is shifted left or right, the content that goes into
@@ -155,10 +168,16 @@ void NonCompositedContentHost::notifySyncRequired(const WebCore::GraphicsLayer*)
void NonCompositedContentHost::paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext& context, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect)
{
- context.translate(-m_layerAdjustX, 0);
+ // On non-android platforms, we want to render text with subpixel antialiasing on the root layer
+ // so long as the root is opaque. On android all text is grayscale.
+#if !OS(ANDROID)
+ if (m_opaque)
+ context.platformContext()->setDrawingToImageBuffer(false);
+#endif
+ context.translate(-m_layerAdjust);
WebCore::IntRect adjustedClipRect = clipRect;
- adjustedClipRect.move(m_layerAdjustX, 0);
- m_contentPaint->paint(context, adjustedClipRect);
+ adjustedClipRect.move(m_layerAdjust);
+ m_webView->paintRootLayer(context, adjustedClipRect);
}
void NonCompositedContentHost::setShowDebugBorders(bool showDebugBorders)