Commit d1cd7014 authored by chrishtr@chromium.org's avatar chrishtr@chromium.org

Never include ancestorLayer transform when testing for overlap.

Also clean up unused option parameters to DPL::boundingBoxForCompositing.

BUG=460195

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

git-svn-id: svn://svn.chromium.org/blink/trunk@201324 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 4daf0990
{
"bounds": [800, 600],
"children": [
{
"bounds": [800, 600],
"contentsOpaque": true,
"drawsContent": true,
"children": [
{
"bounds": [300, 100],
"drawsContent": true,
"children": [
{
"bounds": [300, 100],
"children": [
{
"bounds": [300, 100],
"children": [
{
"children": [
{
"bounds": [300, 100],
"children": [
{
"bounds": [300, 100],
"drawsContent": true,
"backgroundColor": "#FFFF00",
"children": [
{
"position": [8, 8],
"bounds": [284, 84],
"drawsContent": true,
"backgroundColor": "#FFFF00"
}
]
}
]
}
]
}
]
}
]
}
]
},
{
"bounds": [300, 100],
"contentsOpaque": true,
"drawsContent": true,
"backgroundColor": "#D3D3D3",
"transform": [
[1, 0, 0, 0],
[0, 1, 0, 0],
[0, 0, 1, 0],
[151, 0, 0, 1]
]
}
]
}
]
}
--------
Frame: '<!--framePath //<!--frame0-->-->'
--------
{
"bounds": [300, 100],
"children": [
{
"bounds": [300, 100],
"drawsContent": true,
"backgroundColor": "#FFFF00",
"children": [
{
"position": [8, 8],
"bounds": [284, 84],
"drawsContent": true,
"backgroundColor": "#FFFF00"
}
]
}
]
}
<!doctype HTML>
<style>
body {
margin: 0;
}
</style>
<iframe style="width:300px;height:100px;border:0;margin:0" src="data:text/html,<body style='transform:translateZ(0);background:yellow'>">
</iframe>
<div style="border:0; margin:0; width:300px;height:100px; -webkit-filter: drop-shadow(red 0 0 0); position: absolute; top: 0px; left: 0px; transform: translateX(151px); background: lightgray;">
</div>
<script src="../fast/repaint/resources/text-based-repaint.js"></script>
<script>
function repaintTest() { }
onload = runRepaintTest;
</script>
\ No newline at end of file
......@@ -2123,10 +2123,12 @@ LayoutRect DeprecatedPaintLayer::fragmentsBoundingBox(const DeprecatedPaintLayer
LayoutRect DeprecatedPaintLayer::boundingBoxForCompositingOverlapTest() const
{
return overlapBoundsIncludeChildren() ? boundingBoxForCompositing() : fragmentsBoundingBox(this);
// Apply NeverIncludeTransformForAncestorLayer, because the geometry map in CompositingInputsUpdater will take care of applying the
// transform of |this| (== the ancestorLayer argument to boundingBoxForCompositing).
return overlapBoundsIncludeChildren() ? boundingBoxForCompositing(this, NeverIncludeTransformForAncestorLayer) : fragmentsBoundingBox(this);
}
static void expandRectForReflectionAndStackingChildren(const DeprecatedPaintLayer* ancestorLayer, DeprecatedPaintLayer::CalculateBoundsOptions options, LayoutRect& result)
static void expandRectForReflectionAndStackingChildren(const DeprecatedPaintLayer* ancestorLayer, LayoutRect& result)
{
if (ancestorLayer->reflectionInfo() && !ancestorLayer->reflectionInfo()->reflectionLayer()->hasCompositedDeprecatedPaintLayerMapping())
result.unite(ancestorLayer->reflectionInfo()->reflectionLayer()->boundingBoxForCompositing(ancestorLayer));
......@@ -2144,9 +2146,9 @@ static void expandRectForReflectionAndStackingChildren(const DeprecatedPaintLaye
// for this Layer. For example, the bounds of squashed Layers
// will be included in the computation of the appropriate squashing
// GraphicsLayer.
if (options != DeprecatedPaintLayer::ApplyBoundsChickenEggHacks && node->layer()->compositingState() != NotComposited)
if (node->layer()->compositingState() != NotComposited)
continue;
result.unite(node->layer()->boundingBoxForCompositing(ancestorLayer, options));
result.unite(node->layer()->boundingBoxForCompositing(ancestorLayer));
}
}
......@@ -2157,7 +2159,7 @@ LayoutRect DeprecatedPaintLayer::physicalBoundingBoxIncludingReflectionAndStacki
const_cast<DeprecatedPaintLayer*>(this)->stackingNode()->updateLayerListsIfNeeded();
expandRectForReflectionAndStackingChildren(this, DoNotApplyBoundsChickenEggHacks, result);
expandRectForReflectionAndStackingChildren(this, result);
result.moveBy(offsetFromRoot);
return result;
......@@ -2199,9 +2201,9 @@ LayoutRect DeprecatedPaintLayer::boundingBoxForCompositing(const DeprecatedPaint
// children of the parent, that need to be included in reflected composited bounds.
// Fix this by including composited bounds of stacking children of the reflected Layer.
if (hasCompositedDeprecatedPaintLayerMapping() && parent() && parent()->reflectionInfo() && parent()->reflectionInfo()->reflectionLayer() == this)
expandRectForReflectionAndStackingChildren(parent(), options, result);
expandRectForReflectionAndStackingChildren(parent(), result);
else
expandRectForReflectionAndStackingChildren(this, options, result);
expandRectForReflectionAndStackingChildren(this, result);
// FIXME: We can optimize the size of the composited layers, by not enlarging
// filtered areas with the outsets if we know that the filter is going to render in hardware.
......@@ -2209,7 +2211,7 @@ LayoutRect DeprecatedPaintLayer::boundingBoxForCompositing(const DeprecatedPaint
result.expand(m_layoutObject->style()->filterOutsets());
}
if (transform() && (paintsWithTransform(GlobalPaintNormalPhase) || options == ApplyBoundsChickenEggHacks))
if (transform() && paintsWithTransform(GlobalPaintNormalPhase) && (this != ancestorLayer || options == MaybeIncludeTransformForAncestorLayer))
result = transform()->mapRect(result);
if (enclosingPaginationLayer()) {
......
......@@ -250,11 +250,13 @@ public:
// We can't rely on the children's positions if this layer has a filter that could have moved the children's pixels around.
bool overlapBoundsIncludeChildren() const { return hasFilter() && layoutObject()->style()->filter().hasFilterThatMovesPixels(); }
// MaybeIncludeTransformForAncestorLayer means that a transform on |ancestorLayer| may be applied to the bounding box,
// in particular if paintsWithTransform() is true.
enum CalculateBoundsOptions {
ApplyBoundsChickenEggHacks,
DoNotApplyBoundsChickenEggHacks,
MaybeIncludeTransformForAncestorLayer,
NeverIncludeTransformForAncestorLayer,
};
LayoutRect boundingBoxForCompositing(const DeprecatedPaintLayer* ancestorLayer = 0, CalculateBoundsOptions = DoNotApplyBoundsChickenEggHacks) const;
LayoutRect boundingBoxForCompositing(const DeprecatedPaintLayer* ancestorLayer = 0, CalculateBoundsOptions = MaybeIncludeTransformForAncestorLayer) const;
LayoutUnit staticInlinePosition() const { return m_staticInlinePosition; }
LayoutUnit staticBlockPosition() const { return m_staticBlockPosition; }
......
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