| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
| 9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1334 } | 1334 } |
| 1335 | 1335 |
| 1336 // Returns the layer reached on the walk up towards the ancestor. | 1336 // Returns the layer reached on the walk up towards the ancestor. |
| 1337 static inline const RenderLayer* accumulateOffsetTowardsAncestor(const RenderLay
er* layer, const RenderLayer* ancestorLayer, LayoutPoint& location) | 1337 static inline const RenderLayer* accumulateOffsetTowardsAncestor(const RenderLay
er* layer, const RenderLayer* ancestorLayer, LayoutPoint& location) |
| 1338 { | 1338 { |
| 1339 ASSERT(ancestorLayer != layer); | 1339 ASSERT(ancestorLayer != layer); |
| 1340 | 1340 |
| 1341 const RenderLayerModelObject* renderer = layer->renderer(); | 1341 const RenderLayerModelObject* renderer = layer->renderer(); |
| 1342 EPosition position = renderer->style()->position(); | 1342 EPosition position = renderer->style()->position(); |
| 1343 | 1343 |
| 1344 // FIXME: Special casing RenderFlowThread so much for fixed positioning here
is not great. | |
| 1345 RenderFlowThread* fixedFlowThreadContainer = position == FixedPosition ? ren
derer->flowThreadContainingBlock() : 0; | |
| 1346 if (fixedFlowThreadContainer && !fixedFlowThreadContainer->isOutOfFlowPositi
oned()) | |
| 1347 fixedFlowThreadContainer = 0; | |
| 1348 | |
| 1349 // FIXME: Positioning of out-of-flow(fixed, absolute) elements collected in
a RenderFlowThread | 1344 // FIXME: Positioning of out-of-flow(fixed, absolute) elements collected in
a RenderFlowThread |
| 1350 // may need to be revisited in a future patch. | 1345 // may need to be revisited in a future patch. |
| 1351 // If the fixed renderer is inside a RenderFlowThread, we should not compute
location using localToAbsolute, | 1346 // If the fixed renderer is inside a RenderFlowThread, we should not compute
location using localToAbsolute, |
| 1352 // since localToAbsolute maps the coordinates from flow thread to regions co
ordinates and regions can be | 1347 // since localToAbsolute maps the coordinates from flow thread to regions co
ordinates and regions can be |
| 1353 // positioned in a completely different place in the viewport (RenderView). | 1348 // positioned in a completely different place in the viewport (RenderView). |
| 1354 if (position == FixedPosition && !fixedFlowThreadContainer && (!ancestorLaye
r || ancestorLayer == renderer->view()->layer())) { | 1349 if (position == FixedPosition && (!ancestorLayer || ancestorLayer == rendere
r->view()->layer())) { |
| 1355 // If the fixed layer's container is the root, just add in the offset of
the view. We can obtain this by calling | 1350 // If the fixed layer's container is the root, just add in the offset of
the view. We can obtain this by calling |
| 1356 // localToAbsolute() on the RenderView. | 1351 // localToAbsolute() on the RenderView. |
| 1357 FloatPoint absPos = renderer->localToAbsolute(FloatPoint(), IsFixed); | 1352 FloatPoint absPos = renderer->localToAbsolute(FloatPoint(), IsFixed); |
| 1358 location += LayoutSize(absPos.x(), absPos.y()); | 1353 location += LayoutSize(absPos.x(), absPos.y()); |
| 1359 return ancestorLayer; | 1354 return ancestorLayer; |
| 1360 } | 1355 } |
| 1361 | 1356 |
| 1362 // For the fixed positioned elements inside a render flow thread, we should
also skip the code path below | 1357 // For the fixed positioned elements inside a render flow thread, we should
also skip the code path below |
| 1363 // Otherwise, for the case of ancestorLayer == rootLayer and fixed positione
d element child of a transformed | 1358 // Otherwise, for the case of ancestorLayer == rootLayer and fixed positione
d element child of a transformed |
| 1364 // element in render flow thread, we will hit the fixed positioned container
before hitting the ancestor layer. | 1359 // element in render flow thread, we will hit the fixed positioned container
before hitting the ancestor layer. |
| 1365 if (position == FixedPosition && !fixedFlowThreadContainer) { | 1360 if (position == FixedPosition) { |
| 1366 // For a fixed layers, we need to walk up to the root to see if there's
a fixed position container | 1361 // For a fixed layers, we need to walk up to the root to see if there's
a fixed position container |
| 1367 // (e.g. a transformed layer). It's an error to call convertToLayerCoord
s() across a layer with a transform, | 1362 // (e.g. a transformed layer). It's an error to call convertToLayerCoord
s() across a layer with a transform, |
| 1368 // so we should always find the ancestor at or before we find the fixed
position container. | 1363 // so we should always find the ancestor at or before we find the fixed
position container. |
| 1369 RenderLayer* fixedPositionContainerLayer = 0; | 1364 RenderLayer* fixedPositionContainerLayer = 0; |
| 1370 bool foundAncestor = false; | 1365 bool foundAncestor = false; |
| 1371 for (RenderLayer* currLayer = layer->parent(); currLayer; currLayer = cu
rrLayer->parent()) { | 1366 for (RenderLayer* currLayer = layer->parent(); currLayer; currLayer = cu
rrLayer->parent()) { |
| 1372 if (currLayer == ancestorLayer) | 1367 if (currLayer == ancestorLayer) |
| 1373 foundAncestor = true; | 1368 foundAncestor = true; |
| 1374 | 1369 |
| 1375 if (isFixedPositionedContainer(currLayer)) { | 1370 if (isFixedPositionedContainer(currLayer)) { |
| (...skipping 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3696 } | 3691 } |
| 3697 } | 3692 } |
| 3698 | 3693 |
| 3699 void showLayerTree(const blink::RenderObject* renderer) | 3694 void showLayerTree(const blink::RenderObject* renderer) |
| 3700 { | 3695 { |
| 3701 if (!renderer) | 3696 if (!renderer) |
| 3702 return; | 3697 return; |
| 3703 showLayerTree(renderer->enclosingLayer()); | 3698 showLayerTree(renderer->enclosingLayer()); |
| 3704 } | 3699 } |
| 3705 #endif | 3700 #endif |
| OLD | NEW |