Commit 3ca54288 authored by chrishtr@chromium.org's avatar chrishtr@chromium.org

Remove anchorPoint from WebLayer and GraphicsLayer.

TBR=abarth
BUG=372837

Review URL: https://codereview.chromium.org/311273008

git-svn-id: svn://svn.chromium.org/blink/trunk@175827 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 0826c34c
crbug.com/372837 compositing/geometry/bounds-ignores-hidden-composited-descendant.html [ NeedsRebaseline ]
crbug.com/372837 virtual/softwarecompositing/geometry/bounds-ignores-hidden-composited-descendant.html [ NeedsRebaseline ]
# This directly has manual tests that don't have to run with run-webkit-tests
crbug.com/359838 http/tests/ManualTests/ [ Skip ]
......
......@@ -8,7 +8,6 @@
(children 1
(GraphicsLayer
(position 100.00 100.00)
(anchor 0.50 0.75)
(transformOrigin 50.00 150.00)
(bounds 100.00 200.00)
(drawsContent 1)
......
......@@ -10,7 +10,6 @@
(children 2
(GraphicsLayer
(position 80.00 80.00)
(anchor 0.60 0.60)
(transformOrigin 75.00 75.00)
(bounds 125.00 125.00)
(drawsContent 1)
......
......@@ -10,7 +10,6 @@
(children 2
(GraphicsLayer
(position 205.00 205.00)
(anchor 0.78 0.78)
(transformOrigin 175.00 175.00)
(bounds 225.00 225.00)
(drawsContent 1)
......
......@@ -10,7 +10,6 @@
(children 2
(GraphicsLayer
(position 105.00 105.00)
(anchor 0.60 0.60)
(transformOrigin 75.00 75.00)
(bounds 125.00 125.00)
(drawsContent 1)
......
......@@ -6,7 +6,6 @@
(bounds 785.00 600.00)
(children 2
(GraphicsLayer
(anchor 0.00 0.00)
(transformOrigin 0.00 0.00)
(bounds 785.00 600.00)
(contentsOpaque 1)
......
......@@ -8,7 +8,6 @@
(children 1
(GraphicsLayer
(position 58.00 8.00)
(anchor 0.25 0.50)
(transformOrigin 50.00 50.00)
(bounds 200.00 100.00)
(drawsContent 1)
......
......@@ -9,14 +9,12 @@
(children 2
(GraphicsLayer
(position 10.00 10.00)
(anchor -0.02 -0.04)
(transformOrigin -10.00 -10.00)
(bounds 540.00 240.00)
(drawsContent 1)
)
(GraphicsLayer
(position 10.00 260.00)
(anchor -0.20 -0.20)
(transformOrigin -10.00 -10.00)
(bounds 50.00 50.00)
(contentsOpaque 1)
......
......@@ -9,7 +9,6 @@
(drawsContent 1)
(children 3
(GraphicsLayer
(anchor 0.10 0.20)
(transformOrigin 50.00 50.00)
(bounds 500.00 250.00)
(drawsContent 1)
......@@ -24,7 +23,6 @@
(children 2
(GraphicsLayer
(position 0.00 250.00)
(anchor 0.33 0.33)
(transformOrigin 50.00 50.00)
(bounds 150.00 150.00)
(drawsContent 1)
......
......@@ -9,7 +9,6 @@
(children 1
(GraphicsLayer
(position 10.00 10.00)
(anchor -0.20 -0.20)
(transformOrigin -10.00 -10.00)
(bounds 50.00 50.00)
(contentsOpaque 1)
......
......@@ -10,7 +10,6 @@ Test CSS clip with composited layers. Left and right sides should look the same.
(children 2
(GraphicsLayer
(position 25.00 35.00)
(anchor 0.50 0.44)
(transformOrigin 45.00 35.00)
(bounds 90.00 80.00)
(contentsOpaque 1)
......
......@@ -15,7 +15,6 @@
(children 1
(GraphicsLayer
(position 35.00 10.00)
(anchor 0.74 0.50)
(transformOrigin 145.00 50.00)
(bounds 195.00 100.00)
(drawsContent 1)
......
......@@ -9,7 +9,6 @@
(children 1
(GraphicsLayer
(position 210.00 23.00)
(anchor 0.64 0.64)
(transformOrigin 90.00 90.00)
(bounds 140.00 140.00)
(drawsContent 1)
......
......@@ -8,7 +8,6 @@
(children 2
(GraphicsLayer
(position 108.00 113.00)
(anchor 1.11 -0.39)
(transformOrigin 284.50 -100.00)
(bounds 256.00 256.00)
(contentsOpaque 1)
......
......@@ -9,7 +9,6 @@
(GraphicsLayer
(children 2
(GraphicsLayer
(anchor 1.56 0.00)
(transformOrigin 400.00 0.00)
(bounds 256.00 256.00)
(contentsOpaque 1)
......
......@@ -8,7 +8,6 @@
(children 2
(GraphicsLayer
(position 23.00 8.00)
(anchor 1.47 0.00)
(transformOrigin 377.00 0.00)
(bounds 256.00 256.00)
(contentsOpaque 1)
......
......@@ -13,7 +13,6 @@
(children 2
(GraphicsLayer
(position 15.00 0.00)
(anchor 1.47 0.00)
(transformOrigin 377.00 0.00)
(bounds 256.00 256.00)
(contentsOpaque 1)
......
......@@ -15,7 +15,6 @@
(transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [-0.25 -0.25 1.00 -0.01] [0.00 0.00 0.00 1.00])
(children 1
(GraphicsLayer
(anchor 50.00 50.00)
(transformOrigin 50.00 50.00)
(bounds 1.00 1.00)
(shouldFlattenTransform 0)
......@@ -92,7 +91,6 @@ After:
(transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [-0.25 -0.25 1.00 -0.01] [0.00 0.00 0.00 1.00])
(children 1
(GraphicsLayer
(anchor 50.00 50.00)
(transformOrigin 50.00 50.00)
(bounds 1.00 1.00)
(shouldFlattenTransform 0)
......
......@@ -11,7 +11,6 @@
(children 2
(GraphicsLayer
(position 8.00 8.00)
(anchor 0.00 0.00)
(transformOrigin 0.00 0.00)
(bounds 160.00 90.00)
(contentsOpaque 1)
......
......@@ -8,7 +8,6 @@
(children 1
(GraphicsLayer
(position 30.00 30.00)
(anchor 0.48 0.48)
(transformOrigin 120.00 120.00)
(bounds 250.00 250.00)
(drawsContent 1)
......
......@@ -8,7 +8,6 @@
(children 1
(GraphicsLayer
(position 50.00 50.00)
(anchor 0.67 0.67)
(transformOrigin 100.00 100.00)
(bounds 150.00 150.00)
(drawsContent 1)
......@@ -37,7 +36,6 @@
(children 1
(GraphicsLayer
(position 50.00 50.00)
(anchor 0.67 0.67)
(transformOrigin 100.00 100.00)
(bounds 150.00 150.00)
(drawsContent 1)
......
......@@ -8,7 +8,6 @@
(children 1
(GraphicsLayer
(position 101.00 100.00)
(anchor 0.00 0.00)
(transformOrigin 0.00 0.00)
(bounds 14.00 14.00)
(drawsContent 1)
......
......@@ -4,7 +4,7 @@
(bounds 785.00 600.00)
(children 2
(GraphicsLayer
(anchor 0.00 0.00)
(transformOrigin 0.00 0.00)
(bounds 785.00 600.00)
(contentsOpaque 1)
(drawsContent 1)
......
......@@ -4,7 +4,7 @@
(bounds 785.00 600.00)
(children 2
(GraphicsLayer
(anchor 0.00 0.00)
(transformOrigin 0.00 0.00)
(bounds 785.00 600.00)
(contentsOpaque 1)
(drawsContent 1)
......
......@@ -10,14 +10,12 @@
(children 2
(GraphicsLayer
(position 10.00 10.00)
(anchor -0.02 -0.05)
(transformOrigin -10.00 -10.00)
(bounds 590.00 210.00)
(drawsContent 1)
)
(GraphicsLayer
(position 10.00 260.00)
(anchor -0.02 -0.05)
(transformOrigin -10.00 -10.00)
(bounds 590.00 210.00)
(drawsContent 1)
......
......@@ -10,14 +10,12 @@
(children 2
(GraphicsLayer
(position 10.00 10.00)
(anchor -0.02 -0.05)
(transformOrigin -10.00 -10.00)
(bounds 590.00 210.00)
(drawsContent 1)
)
(GraphicsLayer
(position 10.00 260.00)
(anchor -0.02 -0.05)
(transformOrigin -10.00 -10.00)
(bounds 590.00 210.00)
(drawsContent 1)
......
......@@ -7,7 +7,7 @@
(bounds 785.00 600.00)
(children 2
(GraphicsLayer
(anchor 0.00 0.00)
(transformOrigin 0.00 0.00)
(bounds 785.00 600.00)
(contentsOpaque 1)
(drawsContent 1)
......
......@@ -6,7 +6,6 @@
(bounds 785.00 600.00)
(children 2
(GraphicsLayer
(anchor 0.00 0.00)
(transformOrigin 0.00 0.00)
(bounds 785.00 600.00)
(contentsOpaque 1)
......
......@@ -7,7 +7,7 @@
(bounds 785.00 600.00)
(children 2
(GraphicsLayer
(anchor 0.00 0.00)
(transformOrigin 0.00 0.00)
(bounds 785.00 600.00)
(contentsOpaque 1)
(drawsContent 1)
......
......@@ -6,7 +6,6 @@
(bounds 785.00 600.00)
(children 2
(GraphicsLayer
(anchor 0.00 0.00)
(transformOrigin 0.00 0.00)
(bounds 785.00 600.00)
(contentsOpaque 1)
......
......@@ -6,7 +6,6 @@
(bounds 785.00 600.00)
(children 2
(GraphicsLayer
(anchor 0.00 0.00)
(transformOrigin 0.00 0.00)
(bounds 785.00 600.00)
(contentsOpaque 1)
......
......@@ -10,7 +10,6 @@
(children 2
(GraphicsLayer
(position 80.00 80.00)
(anchor 0.60 0.60)
(transformOrigin 75.00 75.00)
(bounds 125.00 125.00)
(drawsContent 1)
......
......@@ -9,7 +9,6 @@
(drawsContent 1)
(children 3
(GraphicsLayer
(anchor 0.10 0.20)
(transformOrigin 50.00 50.00)
(bounds 500.00 250.00)
(drawsContent 1)
......@@ -24,7 +23,6 @@
(children 2
(GraphicsLayer
(position 0.00 250.00)
(anchor 0.33 0.33)
(transformOrigin 50.00 50.00)
(bounds 150.00 150.00)
(drawsContent 1)
......
......@@ -9,7 +9,6 @@
(GraphicsLayer
(children 2
(GraphicsLayer
(anchor 1.56 0.00)
(transformOrigin 400.00 0.00)
(bounds 256.00 256.00)
(contentsOpaque 1)
......
......@@ -15,7 +15,6 @@
(transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [-0.25 -0.25 1.00 -0.01] [0.00 0.00 0.00 1.00])
(children 1
(GraphicsLayer
(anchor 50.00 50.00)
(transformOrigin 50.00 50.00)
(bounds 1.00 1.00)
(shouldFlattenTransform 0)
......@@ -92,7 +91,6 @@ After:
(transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [-0.25 -0.25 1.00 -0.01] [0.00 0.00 0.00 1.00])
(children 1
(GraphicsLayer
(anchor 50.00 50.00)
(transformOrigin 50.00 50.00)
(bounds 1.00 1.00)
(shouldFlattenTransform 0)
......
......@@ -119,10 +119,17 @@ static PassRefPtr<TypeBuilder::LayerTree::Layer> buildObjectForLayer(GraphicsLay
for (size_t i = 0; i < WTF_ARRAY_LENGTH(flattenedMatrix); ++i)
transformArray->addItem(flattenedMatrix[i]);
layerObject->setTransform(transformArray);
const FloatPoint3D& anchor = graphicsLayer->anchorPoint();
layerObject->setAnchorX(anchor.x());
layerObject->setAnchorY(anchor.y());
layerObject->setAnchorZ(anchor.z());
const FloatPoint3D& transformOrigin = graphicsLayer->transformOrigin();
// FIXME: rename these to setTransformOrigin*
if (webLayer->bounds().width > 0)
layerObject->setAnchorX(transformOrigin.x() / webLayer->bounds().width);
else
layerObject->setAnchorX(0.0);
if (webLayer->bounds().height > 0)
layerObject->setAnchorY(transformOrigin.y() / webLayer->bounds().height);
else
layerObject->setAnchorY(0.0);
layerObject->setAnchorZ(transformOrigin.z());
}
RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::ScrollRect> > scrollRects = buildScrollRectsForLayer(graphicsLayer);
if (scrollRects)
......
......@@ -339,6 +339,7 @@ void CompositedLayerMapping::updateCompositedBounds(GraphicsLayerUpdater::Update
// If the element has a transform-origin that has fixed lengths, and the renderer has zero size,
// then we need to ensure that the compositing layer has non-zero size so that we can apply
// the transform-origin via the GraphicsLayer anchorPoint (which is expressed as a fractional value).
// FIXME: this code is no longer necessary, remove.
if (layerBounds.isEmpty() && hasNonZeroTransformOrigin(renderer())) {
layerBounds.setWidth(1);
layerBounds.setHeight(1);
......@@ -823,21 +824,12 @@ void CompositedLayerMapping::updateTransformGeometry(const IntPoint& snappedOffs
layerBounds.y() - relativeCompositingBounds.y() + transformOrigin.y(),
transformOrigin.z());
m_graphicsLayer->setTransformOrigin(compositedTransformOrigin);
// Compute the anchor point, which is in the center of the renderer box unless transform-origin is set.
// FIXME: get rid of anchor once transformOrigin is plumbed.
FloatPoint3D anchor(
relativeCompositingBounds.width() ? compositedTransformOrigin.x() / relativeCompositingBounds.width() : 0.5f,
relativeCompositingBounds.height() ? compositedTransformOrigin.y() / relativeCompositingBounds.height() : 0.5f,
transformOrigin.z());
m_graphicsLayer->setAnchorPoint(anchor);
} else {
FloatPoint3D compositedTransformOrigin(
relativeCompositingBounds.width() * 0.5f,
relativeCompositingBounds.height() * 0.5f,
0.f);
m_graphicsLayer->setTransformOrigin(compositedTransformOrigin);
m_graphicsLayer->setAnchorPoint(FloatPoint3D(0.5f, 0.5f, 0));
}
}
......@@ -1368,7 +1360,6 @@ bool CompositedLayerMapping::updateBackgroundLayer(bool needsBackgroundLayer)
if (!m_backgroundLayer) {
m_backgroundLayer = createGraphicsLayer(CompositingReasonLayerForBackground);
m_backgroundLayer->setDrawsContent(true);
m_backgroundLayer->setAnchorPoint(FloatPoint3D());
m_backgroundLayer->setTransformOrigin(FloatPoint3D());
m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintBackground);
#if !OS(ANDROID)
......
......@@ -79,11 +79,11 @@ PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, G
GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client)
: m_client(client)
, m_anchorPoint(0.5f, 0.5f, 0)
, m_backgroundColor(Color::transparent)
, m_opacity(1)
, m_zPosition(0)
, m_blendMode(blink::WebBlendModeNormal)
, m_hasTransformOrigin(false)
, m_contentsOpaque(false)
, m_shouldFlattenTransform(true)
, m_backfaceVisibility(true)
......@@ -450,7 +450,6 @@ void GraphicsLayer::setupContentsLayer(WebLayer* contentsLayer)
m_contentsLayer->setWebLayerClient(this);
m_contentsLayer->setTransformOrigin(FloatPoint3D());
m_contentsLayer->setAnchorPoint(FloatPoint(0, 0));
m_contentsLayer->setUseParentBackfaceVisibility(true);
// It is necessary to call setDrawsContent as soon as we receive the new contentsLayer, for
......@@ -564,9 +563,7 @@ void GraphicsLayer::dumpProperties(TextStream& ts, int indent, LayerTreeFlags fl
ts << "(bounds origin " << m_boundsOrigin.x() << " " << m_boundsOrigin.y() << ")\n";
}
if (m_anchorPoint != FloatPoint3D(0.5f, 0.5f, 0)) {
writeIndent(ts, indent + 1);
ts << "(anchor " << m_anchorPoint.x() << " " << m_anchorPoint.y() << ")\n";
if (m_hasTransformOrigin && m_transformOrigin != FloatPoint3D(m_size.width() * 0.5f, m_size.height() * 0.5f, 0)) {
writeIndent(ts, indent + 1);
ts << "(transformOrigin " << m_transformOrigin.x() << " " << m_transformOrigin.y() << ")\n";
}
......@@ -807,13 +804,6 @@ void GraphicsLayer::setPosition(const FloatPoint& point)
platformLayer()->setPosition(m_position);
}
void GraphicsLayer::setAnchorPoint(const FloatPoint3D& point)
{
m_anchorPoint = point;
platformLayer()->setAnchorPoint(FloatPoint(m_anchorPoint.x(), m_anchorPoint.y()));
platformLayer()->setAnchorPointZ(m_anchorPoint.z());
}
void GraphicsLayer::setSize(const FloatSize& size)
{
// We are receiving negative sizes here that cause assertions to fail in the compositor. Clamp them to 0 to
......@@ -840,6 +830,7 @@ void GraphicsLayer::setTransform(const TransformationMatrix& transform)
void GraphicsLayer::setTransformOrigin(const FloatPoint3D& transformOrigin)
{
m_hasTransformOrigin = true;
m_transformOrigin = transformOrigin;
platformLayer()->setTransformOrigin(transformOrigin);
}
......
......@@ -147,12 +147,6 @@ public:
const FloatPoint& position() const { return m_position; }
void setPosition(const FloatPoint&);
// Anchor point: (0, 0) is top left, (1, 1) is bottom right. The anchor point
// affects the origin of the transforms.
// DEPRECATED, to be removed soon.
const FloatPoint3D& anchorPoint() const { return m_anchorPoint; }
void setAnchorPoint(const FloatPoint3D&);
const FloatPoint3D& transformOrigin() const { return m_transformOrigin; }
void setTransformOrigin(const FloatPoint3D&);
......@@ -340,7 +334,6 @@ private:
// Position is relative to the parent GraphicsLayer
FloatPoint m_position;
FloatPoint3D m_anchorPoint;
FloatSize m_size;
FloatPoint m_boundsOrigin;
......@@ -355,6 +348,7 @@ private:
FilterOperations m_filters;
bool m_hasTransformOrigin : 1;
bool m_contentsOpaque : 1;
bool m_shouldFlattenTransform: 1;
bool m_backfaceVisibility : 1;
......
......@@ -74,7 +74,6 @@ LinkHighlight::LinkHighlight(Node* node, WebViewImpl* owningWebViewImpl)
WebCompositorSupport* compositorSupport = Platform::current()->compositorSupport();
m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this));
m_clipLayer = adoptPtr(compositorSupport->createLayer());
m_clipLayer->setAnchorPoint(WebFloatPoint());
m_clipLayer->setTransformOrigin(WebFloatPoint3D());
m_clipLayer->addChild(m_contentLayer->layer());
m_contentLayer->layer()->setAnimationDelegate(this);
......
......@@ -69,12 +69,6 @@ public:
virtual void removeFromParent() = 0;
virtual void removeAllChildren() = 0;
virtual void setAnchorPoint(const WebFloatPoint&) = 0;
virtual WebFloatPoint anchorPoint() const = 0;
virtual void setAnchorPointZ(float) = 0;
virtual float anchorPointZ() const = 0;
virtual void setBounds(const WebSize&) = 0;
virtual WebSize bounds() const = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment