Modified: trunk/Source/WebCore/ChangeLog (157727 => 157728)
--- trunk/Source/WebCore/ChangeLog 2013-10-21 20:15:29 UTC (rev 157727)
+++ trunk/Source/WebCore/ChangeLog 2013-10-21 20:16:40 UTC (rev 157728)
@@ -1,3 +1,13 @@
+2013-10-21 Tim Horton <timothy_hor...@apple.com>
+
+ Remote Layer Tree: Backing store should take contentsScale into account
+ https://bugs.webkit.org/show_bug.cgi?id=123106
+
+ Reviewed by Simon Fraser.
+
+ * WebCore.exp.in:
+ Export FloatRect::scale.
+
2013-10-21 Andreas Kling <akl...@apple.com>
RenderScrollbarPart doesn't need styleWillChange().
Modified: trunk/Source/WebCore/WebCore.exp.in (157727 => 157728)
--- trunk/Source/WebCore/WebCore.exp.in 2013-10-21 20:15:29 UTC (rev 157727)
+++ trunk/Source/WebCore/WebCore.exp.in 2013-10-21 20:16:40 UTC (rev 157728)
@@ -1201,6 +1201,7 @@
__ZN7WebCore9ClipboardD1Ev
__ZN7WebCore9DOMWindow30dispatchAllPendingUnloadEventsEv
__ZN7WebCore9DOMWindow36dispatchAllPendingBeforeUnloadEventsEv
+__ZN7WebCore9FloatRect5scaleEff
__ZN7WebCore9FloatRectC1ERK6CGRect
__ZN7WebCore9FloatRectC1ERKNS_7IntRectE
__ZN7WebCore9FloatSizeC1ERK6CGSize
Modified: trunk/Source/WebKit2/ChangeLog (157727 => 157728)
--- trunk/Source/WebKit2/ChangeLog 2013-10-21 20:15:29 UTC (rev 157727)
+++ trunk/Source/WebKit2/ChangeLog 2013-10-21 20:16:40 UTC (rev 157728)
@@ -1,3 +1,32 @@
+2013-10-21 Tim Horton <timothy_hor...@apple.com>
+
+ Remote Layer Tree: Backing store should take contentsScale into account
+ https://bugs.webkit.org/show_bug.cgi?id=123106
+
+ Reviewed by Simon Fraser.
+
+ * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+ (PlatformCALayerRemote::ensureBackingStore):
+ (PlatformCALayerRemote::setNeedsDisplay):
+ (PlatformCALayerRemote::setContentsScale):
+ Inform the backing store of the contentsScale, and when it changes.
+
+ * WebProcess/WebPage/mac/RemoteLayerBackingStore.h:
+ (WebKit::RemoteLayerBackingStore::scale): Added.
+ (WebKit::RemoteLayerBackingStore::mapToContentCoordinates): Added.
+ * WebProcess/WebPage/mac/RemoteLayerBackingStore.mm:
+ (RemoteLayerBackingStore::RemoteLayerBackingStore):
+ (RemoteLayerBackingStore::encode):
+ (RemoteLayerBackingStore::decode):
+ (RemoteLayerBackingStore::mapToContentCoordinates):
+ Factor out flipping so we can use it for repaints in multiple places.
+
+ (RemoteLayerBackingStore::setNeedsDisplay):
+ (RemoteLayerBackingStore::display):
+ Create a buffer scaled up by contentsScale, take the scale into account
+ when copying clean bits from the front buffer, and apply the scale before
+ painting into the back buffer.
+
2013-10-21 Gergo Balogh <gery...@inf.u-szeged.hu>
Remove qt from generate-forwarding-headers.pl
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (157727 => 157728)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp 2013-10-21 20:15:29 UTC (rev 157727)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp 2013-10-21 20:16:40 UTC (rev 157728)
@@ -101,21 +101,24 @@
void PlatformCALayerRemote::ensureBackingStore()
{
if (m_properties.backingStore.layer() == this
- && m_properties.backingStore.size() == m_properties.size)
+ && m_properties.backingStore.size() == m_properties.size
+ && m_properties.backingStore.scale() == m_properties.contentsScale)
return;
- m_properties.backingStore = RemoteLayerBackingStore(this, expandedIntSize(m_properties.size));
+ m_properties.backingStore = RemoteLayerBackingStore(this, expandedIntSize(m_properties.size), m_properties.contentsScale);
}
-void PlatformCALayerRemote::setNeedsDisplay(const FloatRect* dirtyRect)
+void PlatformCALayerRemote::setNeedsDisplay(const FloatRect* rect)
{
ensureBackingStore();
- // FIXME: Need to map this through contentsRect/contentsScale/etc.
- if (dirtyRect)
- m_properties.backingStore.setNeedsDisplay(enclosingIntRect(*dirtyRect));
- else
+ if (!rect) {
m_properties.backingStore.setNeedsDisplay();
+ return;
+ }
+
+ // FIXME: Need to map this through contentsRect/etc.
+ m_properties.backingStore.setNeedsDisplay(enclosingIntRect(*rect));
}
void PlatformCALayerRemote::setContentsChanged()
@@ -411,6 +414,8 @@
{
m_properties.contentsScale = value;
m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ContentsScaleChanged);
+
+ ensureBackingStore();
}
TiledBacking* PlatformCALayerRemote::tiledBacking()
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerBackingStore.h (157727 => 157728)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerBackingStore.h 2013-10-21 20:15:29 UTC (rev 157727)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerBackingStore.h 2013-10-21 20:16:40 UTC (rev 157728)
@@ -39,15 +39,16 @@
class RemoteLayerBackingStore {
public:
RemoteLayerBackingStore();
- RemoteLayerBackingStore(PlatformCALayerRemote*, WebCore::IntSize);
+ RemoteLayerBackingStore(PlatformCALayerRemote*, WebCore::IntSize, float scale);
- void setNeedsDisplay(WebCore::IntRect);
+ void setNeedsDisplay(const WebCore::IntRect);
void setNeedsDisplay();
bool display();
ShareableBitmap* bitmap() const { return m_frontBuffer.get(); }
WebCore::IntSize size() const { return m_size; }
+ float scale() const { return m_scale; }
PlatformCALayerRemote* layer() const { return m_layer; }
@@ -55,9 +56,12 @@
static bool decode(CoreIPC::ArgumentDecoder&, RemoteLayerBackingStore&);
private:
+ WebCore::IntRect mapToContentCoordinates(const WebCore::IntRect) const;
+
PlatformCALayerRemote* m_layer;
WebCore::IntSize m_size;
+ float m_scale;
WebCore::Region m_dirtyRegion;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerBackingStore.mm (157727 => 157728)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerBackingStore.mm 2013-10-21 20:15:29 UTC (rev 157727)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerBackingStore.mm 2013-10-21 20:16:40 UTC (rev 157728)
@@ -1,4 +1,4 @@
-/*
+ /*
* Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,9 +37,10 @@
using namespace WebCore;
using namespace WebKit;
-RemoteLayerBackingStore::RemoteLayerBackingStore(PlatformCALayerRemote* layer, IntSize size)
+RemoteLayerBackingStore::RemoteLayerBackingStore(PlatformCALayerRemote* layer, IntSize size, float scale)
: m_layer(layer)
, m_size(size)
+ , m_scale(scale)
{
ASSERT(layer);
}
@@ -56,6 +57,7 @@
encoder << handle;
encoder << m_size;
+ encoder << m_scale;
}
bool RemoteLayerBackingStore::decode(CoreIPC::ArgumentDecoder& decoder, RemoteLayerBackingStore& result)
@@ -68,14 +70,26 @@
if (!decoder.decode(result.m_size))
return false;
+ if (!decoder.decode(result.m_scale))
+ return false;
+
return true;
}
-void RemoteLayerBackingStore::setNeedsDisplay(IntRect rect)
+IntRect RemoteLayerBackingStore::mapToContentCoordinates(const IntRect rect) const
{
- m_dirtyRegion.unite(rect);
+ IntRect flippedRect = rect;
+ if (m_layer->owner()->platformCALayerContentsOrientation() == GraphicsLayer::CompositingCoordinatesBottomUp)
+ flippedRect.setY(m_size.height() - rect.y() - rect.height());
+ return flippedRect;
}
+void RemoteLayerBackingStore::setNeedsDisplay(const IntRect rect)
+{
+ IntRect flippedRect = mapToContentCoordinates(rect);
+ m_dirtyRegion.unite(flippedRect);
+}
+
void RemoteLayerBackingStore::setNeedsDisplay()
{
setNeedsDisplay(IntRect(IntPoint(), m_size));
@@ -94,17 +108,17 @@
if (m_dirtyRegion.isEmpty())
return false;
- m_backBuffer = ShareableBitmap::createShareable(m_size, ShareableBitmap::SupportsAlpha);
- if (!m_frontBuffer)
- m_dirtyRegion.unite(IntRect(IntPoint(), m_size));
+ FloatSize scaledSize = m_size;
+ scaledSize.scale(m_scale);
IntRect layerBounds(IntPoint(), m_size);
+ m_backBuffer = ShareableBitmap::createShareable(expandedIntSize(scaledSize), ShareableBitmap::SupportsAlpha);
+ if (!m_frontBuffer)
+ m_dirtyRegion.unite(layerBounds);
+
if (m_layer->owner()->platformCALayerShowRepaintCounter(m_layer)) {
- IntRect indicatorRect = IntRect(0, 0, 52, 27);
- if (m_layer->owner()->platformCALayerContentsOrientation() == WebCore::GraphicsLayer::CompositingCoordinatesBottomUp)
- indicatorRect.setY(layerBounds.height() - indicatorRect.y() - indicatorRect.height());
-
+ IntRect indicatorRect = mapToContentCoordinates(IntRect(0, 0, 52, 27));
m_dirtyRegion.unite(indicatorRect);
}
@@ -123,15 +137,19 @@
RetainPtr<CGImageRef> frontImage = m_frontBuffer->makeCGImage();
- for (const auto& rect : cleanRegion.rects())
- context->drawNativeImage(frontImage.get(), m_frontBuffer->size(), ColorSpaceDeviceRGB, rect, rect);
+ for (const auto& rect : cleanRegion.rects()) {
+ FloatRect scaledRect = rect;
+ scaledRect.scale(m_scale);
+ context->drawNativeImage(frontImage.get(), m_frontBuffer->size(), ColorSpaceDeviceRGB, scaledRect, scaledRect);
+ }
}
for (const auto& rect : dirtyRects)
rectsToPaint.append(rect);
}
- drawLayerContents(context->platformContext(), m_layer, layerBounds, rectsToPaint, false);
+ context->scale(FloatSize(m_scale, m_scale));
+ drawLayerContents(context->platformContext(), m_layer, FloatRect(FloatPoint(), scaledSize), rectsToPaint, false);
m_dirtyRegion = Region();
m_frontBuffer = m_backBuffer;