Diff
Modified: branches/safari-534.53-branch/Source/WebCore/ChangeLog (100333 => 100334)
--- branches/safari-534.53-branch/Source/WebCore/ChangeLog 2011-11-15 22:53:52 UTC (rev 100333)
+++ branches/safari-534.53-branch/Source/WebCore/ChangeLog 2011-11-15 22:59:04 UTC (rev 100334)
@@ -1,5 +1,90 @@
2011-11-15 Lucas Forschler <lforsch...@apple.com>
+ Merge 91137
+
+ 2011-07-15 Simon Fraser <simon.fra...@apple.com>
+
+ Have GraphicsLayer pull their contentsScale, rather than pushing it onto them
+ https://bugs.webkit.org/show_bug.cgi?id=64643
+
+ Reviewed by Darin Adler.
+
+ RenderLayerBacking would set the contentsScale on GraphicsLayers
+ on creation, and update it when the pageScaleFactor changed. However,
+ RenderLayerBacking doesn't really know what contentsScale is best
+ for a layer, so instead, have GraphicsLayers call back through the
+ GraphicsLayerClient to get the two relevant scale factors, and do
+ their own computation of contentsScale.
+
+ No testable behavior changes.
+
+ * page/Frame.cpp:
+ (WebCore::Frame::pageScaleFactorChanged): No need to pass the scale.
+
+ * platform/graphics/GraphicsLayer.cpp:
+ (WebCore::GraphicsLayer::notePageScaleFactorChangedIncludingDescendants):
+ Recurse through the GraphicsLayer tree, calling pageScaleFactorChanged() on
+ each layer.
+
+ * platform/graphics/GraphicsLayer.h:
+ (WebCore::GraphicsLayer::pageScaleFactorChanged):
+ Remove contentsScale/setContentsScale
+
+ * platform/graphics/GraphicsLayerClient.h:
+ Add methods to fetch the backingScaleFactor() and pageScaleFactor().
+
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::GraphicsLayerCA): m_uncommittedChanges
+ defaults to ContentsScaleChanged so we update contentsScale on
+ the first flush.
+
+ (WebCore::GraphicsLayerCA::setContentsToBackgroundColor):
+ This was the wrong time to call updateContentsRect() and setupContentsLayer();
+ those should be done at commit time, so moved to updateLayerBackgroundColor().
+ (WebCore::GraphicsLayerCA::recursiveCommitChanges): Note whether we
+ have any changes, and call didCommitChangesForLayer() on the client.
+ (WebCore::GraphicsLayerCA::updateLayerBackgroundColor): Code moved to here.
+ (WebCore::clampedContentsScaleForScale): No longer has any hysteresis
+ on the scale, and now just clamps.
+ (WebCore::GraphicsLayerCA::updateContentsScale): Fetch the scales
+ from the client, and multiply them, then clamp.
+ (WebCore::GraphicsLayerCA::requiresTiledLayer): This now takes
+ contentsScale into account when deciding to use tiled layer,
+ so that zooming in will cause layers to start tiling.
+ (WebCore::GraphicsLayerCA::swapFromOrToTiledLayer): Don't call
+ setContentsScale(), but rather updateContentsScale().
+ (WebCore::GraphicsLayerCA::pageScaleFactorChanged): Set the bits
+ for properties that depend on the scale.
+ (WebCore::GraphicsLayerCA::noteChangesForScaleSensitiveProperties):
+ Note that contentsScale needs to be updated. At some point we might also
+ need to dirty other properties.
+ * platform/graphics/ca/GraphicsLayerCA.h: Moved the m_allowTiledLayer
+ bool for better packing. No need for a m_contentsScale member now.
+ * rendering/RenderLayer.cpp: Removed pageScaleFactorChanged().
+ * rendering/RenderLayer.h: Ditto.
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::createPrimaryGraphicsLayer): No need
+ to push the contents scale.
+ (WebCore::RenderLayerBacking::updateForegroundLayer): Ditto.
+ (WebCore::RenderLayerBacking::updateMaskLayer): Ditto.
+ (WebCore::RenderLayerBacking::pageScaleFactor): GraphicsLayerClient method.
+ (WebCore::RenderLayerBacking::backingScaleFactor): GraphicsLayerClient method.
+ (WebCore::RenderLayerBacking::didCommitChangesForLayer): Send through
+ to the compositor.
+ * rendering/RenderLayerBacking.h: GraphicsLayerClient methods.
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::didFlushChangesForLayer): We'll use
+ this later.
+ (WebCore::RenderLayerCompositor::backingScaleFactor): GraphicsLayerClient method.
+ (WebCore::RenderLayerCompositor::pageScaleFactor): Ditto.
+ (WebCore::RenderLayerCompositor::didCommitChangesForLayer): Ditto.
+ (WebCore::RenderLayerCompositor::ensureRootLayer): No need to push the contents scale.
+ (WebCore::RenderLayerCompositor::pageScaleFactorChanged): Just call notePageScaleFactorChangedIncludingDescendants()
+ on the root GraphicsLayer.
+ * rendering/RenderLayerCompositor.h: Added GraphicsLayerClient methods.
+
+2011-11-15 Lucas Forschler <lforsch...@apple.com>
+
Merge 90954
2011-07-13 Simon Fraser <simon.fra...@apple.com>
Modified: branches/safari-534.53-branch/Source/WebCore/page/Frame.cpp (100333 => 100334)
--- branches/safari-534.53-branch/Source/WebCore/page/Frame.cpp 2011-11-15 22:53:52 UTC (rev 100333)
+++ branches/safari-534.53-branch/Source/WebCore/page/Frame.cpp 2011-11-15 22:59:04 UTC (rev 100334)
@@ -1050,7 +1050,7 @@
RenderView* root = contentRenderer();
if (root && root->compositor())
- root->compositor()->pageScaleFactorChanged(scale);
+ root->compositor()->pageScaleFactorChanged();
}
#endif
Modified: branches/safari-534.53-branch/Source/WebCore/platform/graphics/GraphicsLayer.cpp (100333 => 100334)
--- branches/safari-534.53-branch/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2011-11-15 22:53:52 UTC (rev 100333)
+++ branches/safari-534.53-branch/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2011-11-15 22:59:04 UTC (rev 100334)
@@ -222,6 +222,22 @@
}
}
+void GraphicsLayer::notePageScaleFactorChangedIncludingDescendants()
+{
+ pageScaleFactorChanged();
+
+ if (m_maskLayer)
+ m_maskLayer->pageScaleFactorChanged();
+
+ if (m_replicaLayer)
+ m_replicaLayer->notePageScaleFactorChangedIncludingDescendants();
+
+ const Vector<GraphicsLayer*>& childLayers = children();
+ size_t numChildren = childLayers.size();
+ for (size_t i = 0; i < numChildren; ++i)
+ childLayers[i]->notePageScaleFactorChangedIncludingDescendants();
+}
+
void GraphicsLayer::setReplicatedByLayer(GraphicsLayer* layer)
{
if (layer)
Modified: branches/safari-534.53-branch/Source/WebCore/platform/graphics/GraphicsLayer.h (100333 => 100334)
--- branches/safari-534.53-branch/Source/WebCore/platform/graphics/GraphicsLayer.h 2011-11-15 22:53:52 UTC (rev 100333)
+++ branches/safari-534.53-branch/Source/WebCore/platform/graphics/GraphicsLayer.h 2011-11-15 22:59:04 UTC (rev 100334)
@@ -313,11 +313,6 @@
// For hosting this GraphicsLayer in a native layer hierarchy.
virtual PlatformLayer* platformLayer() const { return 0; }
- // Change the scale at which the contents are rendered. Note that contentsScale may not return
- // the same value passed to setContentsScale(), because of clamping and hysteresis.
- virtual float contentsScale() const { return 1; }
- virtual void setContentsScale(float) { }
-
void dumpLayer(TextStream&, int indent = 0, LayerTreeAsTextBehavior = LayerTreeAsTextBehaviorNormal) const;
int repaintCount() const { return m_repaintCount; }
@@ -343,6 +338,9 @@
virtual void distributeOpacity(float);
virtual float accumulatedOpacity() const;
+ virtual void pageScaleFactorChanged() { }
+ void notePageScaleFactorChangedIncludingDescendants();
+
// Some compositing systems may do internal batching to synchronize compositing updates
// with updates drawn into the window. These methods flush internal batched state on this layer
// and descendant layers, and this layer only.
Modified: branches/safari-534.53-branch/Source/WebCore/platform/graphics/GraphicsLayerClient.h (100333 => 100334)
--- branches/safari-534.53-branch/Source/WebCore/platform/graphics/GraphicsLayerClient.h 2011-11-15 22:53:52 UTC (rev 100333)
+++ branches/safari-534.53-branch/Source/WebCore/platform/graphics/GraphicsLayerClient.h 2011-11-15 22:59:04 UTC (rev 100334)
@@ -62,6 +62,12 @@
virtual void notifySyncRequired(const GraphicsLayer*) = 0;
virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& inClip) = 0;
+ virtual void didCommitChangesForLayer(const GraphicsLayer*) const = 0;
+
+ // Multiplier for backing store size, related to high DPI.
+ virtual float backingScaleFactor() const = 0;
+ // Scaling factor of the page.
+ virtual float pageScaleFactor() const = 0;
virtual bool showDebugBorders() const = 0;
virtual bool showRepaintCounter() const = 0;
Modified: branches/safari-534.53-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (100333 => 100334)
--- branches/safari-534.53-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2011-11-15 22:53:52 UTC (rev 100333)
+++ branches/safari-534.53-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2011-11-15 22:59:04 UTC (rev 100334)
@@ -249,9 +249,8 @@
: GraphicsLayer(client)
, m_contentsLayerPurpose(NoContentsLayer)
, m_contentsLayerHasBackgroundColor(false)
- , m_uncommittedChanges(NoChange)
- , m_contentsScale(1)
, m_allowTiledLayer(true)
+ , m_uncommittedChanges(ContentsScaleChanged)
{
m_layer = PlatformCALayer::create(PlatformCALayer::LayerTypeWebLayer, this);
@@ -670,8 +669,6 @@
#ifndef NDEBUG
m_contentsLayer->setName("Background Color Layer");
#endif
- updateContentsRect();
- setupContentsLayer(m_contentsLayer.get());
} else {
m_contentsLayerPurpose = NoContentsLayer;
m_contentsLayer = 0;
@@ -798,6 +795,8 @@
void GraphicsLayerCA::recursiveCommitChanges()
{
+ bool hadChanges = m_uncommittedChanges;
+
commitLayerChangesBeforeSublayers();
if (m_maskLayer)
@@ -817,6 +816,9 @@
static_cast<GraphicsLayerCA*>(m_maskLayer)->commitLayerChangesAfterSublayers();
commitLayerChangesAfterSublayers();
+
+ if (hadChanges && client())
+ client()->didCommitChangesForLayer(this);
}
void GraphicsLayerCA::commitLayerChangesBeforeSublayers()
@@ -1265,6 +1267,9 @@
if (!m_contentsLayer)
return;
+ setupContentsLayer(m_contentsLayer.get());
+ updateContentsRect();
+
if (m_backgroundColorSet)
m_contentsLayer->setBackgroundColor(m_backgroundColor);
else
@@ -1955,31 +1960,13 @@
return (property == AnimatedPropertyBackgroundColor) ? m_contentsLayerClones.get() : primaryLayerClones();
}
-void GraphicsLayerCA::setContentsScale(float scale)
+static float clampedContentsScaleForScale(float scale)
{
- float newScale = clampedContentsScaleForScale(scale);
- if (newScale == m_contentsScale)
- return;
-
- m_contentsScale = newScale;
- noteLayerPropertyChanged(ContentsScaleChanged);
-}
-
-float GraphicsLayerCA::clampedContentsScaleForScale(float scale) const
-{
// Define some limits as a sanity check for the incoming scale value
// those too small to see.
const float maxScale = 10.0f;
const float minScale = 0.01f;
-
- // Avoid very slight scale changes that would be doing extra work for no benefit
- const float maxAllowableDelta = 0.05f;
-
- // Clamp
- float result = max(minScale, min(scale, maxScale));
-
- // If it hasn't changed much, don't do any work
- return ((fabs(result - m_contentsScale) / m_contentsScale) < maxAllowableDelta) ? m_contentsScale : result;
+ return max(minScale, min(scale, maxScale));
}
void GraphicsLayerCA::updateContentsScale()
@@ -1988,7 +1975,12 @@
if (needTiledLayer != m_usingTiledLayer)
swapFromOrToTiledLayer(needTiledLayer);
- m_layer->setContentsScale(m_contentsScale);
+ float backingScaleFactor = m_client ? m_client->backingScaleFactor() : 1;
+ float pageScaleFactor = m_client ? m_client->pageScaleFactor() : 1;
+
+ float contentsScale = clampedContentsScaleForScale(pageScaleFactor * backingScaleFactor);
+
+ m_layer->setContentsScale(contentsScale);
if (drawsContent())
m_layer->setNeedsDisplay();
}
@@ -2041,8 +2033,10 @@
if (!m_drawsContent || !m_allowTiledLayer)
return false;
+ float contentsScale = m_client ? m_client->backingScaleFactor() * m_client->pageScaleFactor() : 1;
+
// FIXME: catch zero-size height or width here (or earlier)?
- return size.width() > cMaxPixelDimension || size.height() > cMaxPixelDimension;
+ return size.width() * contentsScale > cMaxPixelDimension || size.height() * contentsScale > cMaxPixelDimension;
}
void GraphicsLayerCA::swapFromOrToTiledLayer(bool useTiledLayer)
@@ -2051,8 +2045,6 @@
RefPtr<PlatformCALayer> oldLayer = m_layer;
m_layer = PlatformCALayer::create(useTiledLayer ? PlatformCALayer::LayerTypeWebTiledLayer : PlatformCALayer::LayerTypeWebLayer, this);
- m_layer->setContentsScale(m_contentsScale);
-
m_usingTiledLayer = useTiledLayer;
if (useTiledLayer) {
@@ -2085,7 +2077,7 @@
updateContentsOpaque();
updateBackfaceVisibility();
updateLayerBackgroundColor();
-
+ updateContentsScale();
updateOpacityOnLayer();
#ifndef NDEBUG
@@ -2390,6 +2382,16 @@
#endif
}
+void GraphicsLayerCA::pageScaleFactorChanged()
+{
+ noteChangesForScaleSensitiveProperties();
+}
+
+void GraphicsLayerCA::noteChangesForScaleSensitiveProperties()
+{
+ noteLayerPropertyChanged(ContentsScaleChanged);
+}
+
void GraphicsLayerCA::noteSublayersChanged()
{
noteLayerPropertyChanged(ChildrenChanged);
Modified: branches/safari-534.53-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (100333 => 100334)
--- branches/safari-534.53-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2011-11-15 22:53:52 UTC (rev 100333)
+++ branches/safari-534.53-branch/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2011-11-15 22:59:04 UTC (rev 100334)
@@ -56,9 +56,6 @@
virtual PlatformLayer* platformLayer() const;
virtual PlatformCALayer* platformCALayer() const { return primaryLayer(); }
- virtual float contentsScale() const { return m_contentsScale; }
- virtual void setContentsScale(float);
-
virtual bool setChildren(const Vector<GraphicsLayer*>&);
virtual void addChild(GraphicsLayer*);
virtual void addChildAtIndex(GraphicsLayer*, int index);
@@ -118,6 +115,8 @@
virtual void layerDidDisplay(PlatformLayer*);
+ virtual void pageScaleFactorChanged();
+
void recursiveCommitChanges();
virtual void syncCompositingState();
@@ -334,6 +333,7 @@
typedef unsigned LayerChangeFlags;
void noteLayerPropertyChanged(LayerChangeFlags flags);
void noteSublayersChanged();
+ void noteChangesForScaleSensitiveProperties();
void repaintLayerDirtyRects();
@@ -356,6 +356,7 @@
ContentsLayerPurpose m_contentsLayerPurpose;
bool m_contentsLayerHasBackgroundColor : 1;
+ bool m_allowTiledLayer : 1;
RetainPtr<CGImageRef> m_uncorrectedContentsImage;
RetainPtr<CGImageRef> m_pendingContentsImage;
@@ -399,13 +400,9 @@
AnimationsMap m_runningAnimations;
Vector<FloatRect> m_dirtyRects;
+ FloatSize m_pixelAlignmentOffset;
LayerChangeFlags m_uncommittedChanges;
-
- float clampedContentsScaleForScale(float) const;
- float m_contentsScale;
-
- bool m_allowTiledLayer;
};
} // namespace WebCore
Modified: branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayer.cpp (100333 => 100334)
--- branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayer.cpp 2011-11-15 22:53:52 UTC (rev 100333)
+++ branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayer.cpp 2011-11-15 22:59:04 UTC (rev 100334)
@@ -4180,14 +4180,6 @@
m_reflection->setStyle(newStyle.release());
}
-void RenderLayer::pageScaleFactorChanged(float scale)
-{
-#if USE(ACCELERATED_COMPOSITING)
- if (m_backing)
- m_backing->pageScaleFactorChanged(scale);
-#endif
-}
-
} // namespace WebCore
#ifndef NDEBUG
Modified: branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayer.h (100333 => 100334)
--- branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayer.h 2011-11-15 22:53:52 UTC (rev 100333)
+++ branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayer.h 2011-11-15 22:59:04 UTC (rev 100334)
@@ -606,8 +606,6 @@
void setMustOverlapCompositedLayers(bool b) { m_mustOverlapCompositedLayers = b; }
#endif
- void pageScaleFactorChanged(float);
-
friend class RenderLayerBacking;
friend class RenderLayerCompositor;
friend class RenderBoxModelObject;
Modified: branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayerBacking.cpp (100333 => 100334)
--- branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayerBacking.cpp 2011-11-15 22:53:52 UTC (rev 100333)
+++ branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayerBacking.cpp 2011-11-15 22:59:04 UTC (rev 100334)
@@ -114,11 +114,6 @@
#endif
m_graphicsLayer = createGraphicsLayer(layerName);
- ASSERT(renderer());
- ASSERT(renderer()->document());
- ASSERT(renderer()->document()->frame());
- m_graphicsLayer->setContentsScale(pageScaleFactor() * backingScaleFactor());
-
updateLayerOpacity(renderer()->style());
updateLayerTransform(renderer()->style());
}
@@ -650,7 +645,6 @@
m_foregroundLayer = createGraphicsLayer(layerName);
m_foregroundLayer->setDrawsContent(true);
m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground);
- m_foregroundLayer->setContentsScale(pageScaleFactor() * backingScaleFactor());
layerChanged = true;
}
} else if (m_foregroundLayer) {
@@ -673,7 +667,6 @@
m_maskLayer = createGraphicsLayer("Mask");
m_maskLayer->setDrawsContent(true);
m_maskLayer->setPaintingPhase(GraphicsLayerPaintMask);
- m_maskLayer->setContentsScale(pageScaleFactor() * backingScaleFactor());
layerChanged = true;
}
} else if (m_maskLayer) {
@@ -1249,6 +1242,21 @@
}
}
+float RenderLayerBacking::pageScaleFactor() const
+{
+ return compositor()->pageScaleFactor();
+}
+
+float RenderLayerBacking::backingScaleFactor() const
+{
+ return compositor()->backingScaleFactor();
+}
+
+void RenderLayerBacking::didCommitChangesForLayer(const GraphicsLayer*) const
+{
+ compositor()->didFlushChangesForLayer(m_owningLayer);
+}
+
bool RenderLayerBacking::showDebugBorders() const
{
return compositor() ? compositor()->compositorShowDebugBorders() : false;
@@ -1468,39 +1476,6 @@
return ContainerCompositingLayer;
}
-void RenderLayerBacking::pageScaleFactorChanged(float scale)
-{
- float combinedScale = scale * backingScaleFactor();
-
- if (m_graphicsLayer)
- m_graphicsLayer->setContentsScale(combinedScale);
-
- if (m_foregroundLayer)
- m_foregroundLayer->setContentsScale(combinedScale);
-
- if (m_maskLayer)
- m_maskLayer->setContentsScale(combinedScale);
-}
-
-float RenderLayerBacking::pageScaleFactor() const
-{
- Frame* frame = renderer()->document()->frame();
- if (!frame)
- return 1;
- return frame->pageScaleFactor();
-}
-
-float RenderLayerBacking::backingScaleFactor() const
-{
- Frame* frame = renderer()->document()->frame();
- if (!frame)
- return 1;
- Page* page = frame->page();
- if (!page)
- return 1;
- return page->chrome()->scaleFactor();
-}
-
} // namespace WebCore
#endif // USE(ACCELERATED_COMPOSITING)
Modified: branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayerBacking.h (100333 => 100334)
--- branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayerBacking.h 2011-11-15 22:53:52 UTC (rev 100333)
+++ branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayerBacking.h 2011-11-15 22:59:04 UTC (rev 100334)
@@ -128,6 +128,10 @@
virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& clip);
+ virtual float backingScaleFactor() const;
+ virtual float pageScaleFactor() const;
+ virtual void didCommitChangesForLayer(const GraphicsLayer*) const;
+
virtual bool showDebugBorders() const;
virtual bool showRepaintCounter() const;
@@ -136,8 +140,6 @@
// For informative purposes only.
CompositingLayerType compositingLayerType() const;
- void pageScaleFactorChanged(float);
-
GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizontalScrollbar.get(); }
GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVerticalScrollbar.get(); }
GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.get(); }
@@ -193,9 +195,6 @@
static int graphicsLayerToCSSProperty(AnimatedPropertyID);
static AnimatedPropertyID cssToGraphicsLayerProperty(int);
- float pageScaleFactor() const;
- float backingScaleFactor() const;
-
#ifndef NDEBUG
String nameForLayer() const;
#endif
Modified: branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp (100333 => 100334)
--- branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp 2011-11-15 22:53:52 UTC (rev 100333)
+++ branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp 2011-11-15 22:59:04 UTC (rev 100334)
@@ -208,6 +208,10 @@
m_flushingLayers = false;
}
+void RenderLayerCompositor::didFlushChangesForLayer(RenderLayer*)
+{
+}
+
RenderLayerCompositor* RenderLayerCompositor::enclosingCompositorFlushingLayers() const
{
if (!m_renderView->frameView())
@@ -1476,6 +1480,33 @@
}
}
+float RenderLayerCompositor::backingScaleFactor() const
+{
+ Frame* frame = m_renderView->frameView()->frame();
+ if (!frame)
+ return 1;
+ Page* page = frame->page();
+ if (!page)
+ return 1;
+ return page->chrome()->scaleFactor();
+}
+
+float RenderLayerCompositor::pageScaleFactor() const
+{
+ Frame* frame = m_renderView->frameView()->frame();
+ if (!frame)
+ return 1;
+ Page* page = frame->page();
+ if (!page)
+ return 1;
+ return page->mainFrame()->pageScaleFactor();
+}
+
+void RenderLayerCompositor::didCommitChangesForLayer(const GraphicsLayer*) const
+{
+ // Nothing to do here yet.
+}
+
static bool shouldCompositeOverflowControls(ScrollView* view)
{
if (view->platformWidget())
@@ -1561,7 +1592,7 @@
if (!m_rootPlatformLayer) {
m_rootPlatformLayer = GraphicsLayer::create(0);
#ifndef NDEBUG
- m_rootPlatformLayer->setName("Root platform");
+ m_rootPlatformLayer->setName("content root");
#endif
m_rootPlatformLayer->setSize(FloatSize(m_renderView->maxXLayoutOverflow(), m_renderView->maxYLayoutOverflow()));
m_rootPlatformLayer->setPosition(FloatPoint());
@@ -1584,13 +1615,13 @@
// Create a clipping layer if this is an iframe
m_clipLayer = GraphicsLayer::create(this);
#ifndef NDEBUG
- m_clipLayer->setName("iframe Clipping");
+ m_clipLayer->setName("frame clipping");
#endif
m_clipLayer->setMasksToBounds(true);
m_scrollLayer = GraphicsLayer::create(this);
#ifndef NDEBUG
- m_scrollLayer->setName("iframe scrolling");
+ m_scrollLayer->setName("frame scrolling");
#endif
// Hook them up
@@ -1804,32 +1835,15 @@
return false;
}
-void RenderLayerCompositor::pageScaleFactorChanged(float scale, RenderLayer* layer)
+void RenderLayerCompositor::pageScaleFactorChanged()
{
- if (!layer)
- layer = rootRenderLayer();
+ // Start at the RenderView's layer, since that's where the scale is applied.
+ RenderLayer* viewLayer = m_renderView->layer();
+ if (!viewLayer->isComposited())
+ return;
- layer->pageScaleFactorChanged(scale);
-
- if (layer->isStackingContext()) {
- if (Vector<RenderLayer*>* negZOrderList = layer->negZOrderList()) {
- size_t listSize = negZOrderList->size();
- for (size_t i = 0; i < listSize; ++i)
- pageScaleFactorChanged(scale, negZOrderList->at(i));
- }
-
- if (Vector<RenderLayer*>* posZOrderList = layer->posZOrderList()) {
- size_t listSize = posZOrderList->size();
- for (size_t i = 0; i < listSize; ++i)
- pageScaleFactorChanged(scale, posZOrderList->at(i));
- }
- }
-
- if (Vector<RenderLayer*>* normalFlowList = layer->normalFlowList()) {
- size_t listSize = normalFlowList->size();
- for (size_t i = 0; i < listSize; ++i)
- pageScaleFactorChanged(scale, normalFlowList->at(i));
- }
+ if (GraphicsLayer* rootLayer = viewLayer->backing()->graphicsLayer())
+ rootLayer->notePageScaleFactorChangedIncludingDescendants();
}
} // namespace WebCore
Modified: branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayerCompositor.h (100333 => 100334)
--- branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayerCompositor.h 2011-11-15 22:53:52 UTC (rev 100333)
+++ branches/safari-534.53-branch/Source/WebCore/rendering/RenderLayerCompositor.h 2011-11-15 22:59:04 UTC (rev 100334)
@@ -93,6 +93,9 @@
// flushPendingLayerChanges() flushes the entire GraphicsLayer tree, which can cross frame boundaries.
// This call returns the rootmost compositor that is being flushed (including self).
RenderLayerCompositor* enclosingCompositorFlushingLayers() const;
+
+ // Called when the GraphicsLayer for the given RenderLayer has flushed changes inside of flushPendingLayerChanges().
+ void didFlushChangesForLayer(RenderLayer*);
// Rebuild the tree of compositing layers
void updateCompositingLayers(CompositingUpdateType = CompositingUpdateAfterLayoutOrStyleChange, RenderLayer* updateRoot = 0);
@@ -189,7 +192,11 @@
bool compositorShowDebugBorders() const { return m_showDebugBorders; }
bool compositorShowRepaintCounter() const { return m_showRepaintCounter; }
- void pageScaleFactorChanged(float, RenderLayer* = 0);
+ virtual float backingScaleFactor() const;
+ virtual float pageScaleFactor() const;
+ virtual void didCommitChangesForLayer(const GraphicsLayer*) const;
+
+ void pageScaleFactorChanged();
GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizontalScrollbar.get(); }
GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVerticalScrollbar.get(); }
Modified: branches/safari-534.53-branch/Source/WebKit/chromium/ChangeLog (100333 => 100334)
--- branches/safari-534.53-branch/Source/WebKit/chromium/ChangeLog 2011-11-15 22:53:52 UTC (rev 100333)
+++ branches/safari-534.53-branch/Source/WebKit/chromium/ChangeLog 2011-11-15 22:59:04 UTC (rev 100334)
@@ -1,3 +1,20 @@
+2011-11-15 Lucas Forschler <lforsch...@apple.com>
+
+ Merge 91137
+
+ 2011-07-15 Simon Fraser <simon.fra...@apple.com>
+
+ Have GraphicsLayer pull their contentsScale, rather than pushing it onto them
+ https://bugs.webkit.org/show_bug.cgi?id=64643
+
+ Reviewed by Darin Adler.
+
+ Impement new GraphicsLayerClient methods related to contents scale.
+
+ * src/PageOverlay.cpp:
+ (WebKit::OverlayGraphicsLayerClientImpl::backingScaleFactor):
+ (WebKit::OverlayGraphicsLayerClientImpl::pageScaleFactor):
+
2011-10-21 Lucas Forschler <lforsch...@apple.com>
Merge 95226
Modified: branches/safari-534.53-branch/Source/WebKit2/ChangeLog (100333 => 100334)
--- branches/safari-534.53-branch/Source/WebKit2/ChangeLog 2011-11-15 22:53:52 UTC (rev 100333)
+++ branches/safari-534.53-branch/Source/WebKit2/ChangeLog 2011-11-15 22:59:04 UTC (rev 100334)
@@ -1,3 +1,25 @@
+2011-11-15 Lucas Forschler <lforsch...@apple.com>
+
+ Merge 91137
+
+ 2011-07-15 Simon Fraser <simon.fra...@apple.com>
+
+ Have GraphicsLayer pull their contentsScale, rather than pushing it onto them
+ https://bugs.webkit.org/show_bug.cgi?id=64643
+
+ Reviewed by Darin Adler.
+
+ Impement new GraphicsLayerClient methods related to contents scale,
+ and don't push the scale.
+
+ * WebProcess/WebPage/ca/LayerTreeHostCA.cpp:
+ (WebKit::LayerTreeHostCA::initialize):
+ (WebKit::LayerTreeHostCA::backingScaleFactor):
+ (WebKit::LayerTreeHostCA::pageScaleFactor):
+ (WebKit::LayerTreeHostCA::createPageOverlayLayer):
+ * WebProcess/WebPage/ca/LayerTreeHostCA.h:
+ (WebKit::LayerTreeHostCA::didCommitChangesForLayer):
+
2011-10-27 Lucas Forschler <lforsch...@apple.com>
Merge 98526
Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp (100333 => 100334)
--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp 2011-11-15 22:53:52 UTC (rev 100333)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp 2011-11-15 22:59:04 UTC (rev 100334)
@@ -67,7 +67,6 @@
m_nonCompositedContentLayer->setDrawsContent(true);
m_nonCompositedContentLayer->setContentsOpaque(m_webPage->drawsBackground() && !m_webPage->drawsTransparentBackground());
m_nonCompositedContentLayer->setSize(m_webPage->size());
- m_nonCompositedContentLayer->setContentsScale(m_webPage->userSpaceScaleFactor());
if (m_webPage->corePage()->settings()->acceleratedDrawingEnabled())
m_nonCompositedContentLayer->setAcceleratesDrawing(true);
@@ -207,6 +206,16 @@
return m_webPage->corePage()->settings()->showRepaintCounter();
}
+float LayerTreeHostCA::backingScaleFactor() const
+{
+ return m_webPage->userSpaceScaleFactor();
+}
+
+float LayerTreeHostCA::pageScaleFactor() const
+{
+ return 1;
+}
+
void LayerTreeHostCA::performScheduledLayerFlush()
{
{
@@ -253,7 +262,6 @@
m_pageOverlayLayer->setDrawsContent(true);
m_pageOverlayLayer->setSize(m_webPage->size());
- m_pageOverlayLayer->setContentsScale(m_webPage->userSpaceScaleFactor());
m_rootLayer->addChild(m_pageOverlayLayer.get());
}
Modified: branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h (100333 => 100334)
--- branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h 2011-11-15 22:53:52 UTC (rev 100333)
+++ branches/safari-534.53-branch/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h 2011-11-15 22:59:04 UTC (rev 100334)
@@ -74,6 +74,9 @@
virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect);
virtual bool showDebugBorders() const;
virtual bool showRepaintCounter() const;
+ virtual float backingScaleFactor() const;
+ virtual float pageScaleFactor() const;
+ virtual void didCommitChangesForLayer(const WebCore::GraphicsLayer*) const { }
// LayerTreeHostCA
virtual void platformInitialize(LayerTreeContext&) = 0;