OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 return; | 332 return; |
333 | 333 |
334 LayoutRect layerBounds = m_owningLayer.boundingBoxForCompositing(); | 334 LayoutRect layerBounds = m_owningLayer.boundingBoxForCompositing(); |
335 | 335 |
336 // FIXME: either move this hack to RenderLayer or find a way to get rid of i
t. Removing it from here | 336 // FIXME: either move this hack to RenderLayer or find a way to get rid of i
t. Removing it from here |
337 // will alow us to get rid of m_compositedBounds. | 337 // will alow us to get rid of m_compositedBounds. |
338 | 338 |
339 // If the element has a transform-origin that has fixed lengths, and the ren
derer has zero size, | 339 // If the element has a transform-origin that has fixed lengths, and the ren
derer has zero size, |
340 // then we need to ensure that the compositing layer has non-zero size so th
at we can apply | 340 // then we need to ensure that the compositing layer has non-zero size so th
at we can apply |
341 // the transform-origin via the GraphicsLayer anchorPoint (which is expresse
d as a fractional value). | 341 // the transform-origin via the GraphicsLayer anchorPoint (which is expresse
d as a fractional value). |
| 342 // FIXME: this code is no longer necessary, remove. |
342 if (layerBounds.isEmpty() && hasNonZeroTransformOrigin(renderer())) { | 343 if (layerBounds.isEmpty() && hasNonZeroTransformOrigin(renderer())) { |
343 layerBounds.setWidth(1); | 344 layerBounds.setWidth(1); |
344 layerBounds.setHeight(1); | 345 layerBounds.setHeight(1); |
345 m_artificiallyInflatedBounds = true; | 346 m_artificiallyInflatedBounds = true; |
346 } else { | 347 } else { |
347 m_artificiallyInflatedBounds = false; | 348 m_artificiallyInflatedBounds = false; |
348 } | 349 } |
349 | 350 |
350 m_compositedBounds = layerBounds; | 351 m_compositedBounds = layerBounds; |
351 } | 352 } |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 // Update properties that depend on layer dimensions | 817 // Update properties that depend on layer dimensions |
817 FloatPoint3D transformOrigin = computeTransformOrigin(IntRect(IntPoint()
, layerBounds.size())); | 818 FloatPoint3D transformOrigin = computeTransformOrigin(IntRect(IntPoint()
, layerBounds.size())); |
818 | 819 |
819 // |transformOrigin| is in the local space of this layer. layerBounds -
relativeCompositingBounds converts to the space of the | 820 // |transformOrigin| is in the local space of this layer. layerBounds -
relativeCompositingBounds converts to the space of the |
820 // compositing bounds relative to the composited ancestor. This does not
apply to the z direction, since the page is 2D. | 821 // compositing bounds relative to the composited ancestor. This does not
apply to the z direction, since the page is 2D. |
821 FloatPoint3D compositedTransformOrigin( | 822 FloatPoint3D compositedTransformOrigin( |
822 layerBounds.x() - relativeCompositingBounds.x() + transformOrigin.x(
), | 823 layerBounds.x() - relativeCompositingBounds.x() + transformOrigin.x(
), |
823 layerBounds.y() - relativeCompositingBounds.y() + transformOrigin.y(
), | 824 layerBounds.y() - relativeCompositingBounds.y() + transformOrigin.y(
), |
824 transformOrigin.z()); | 825 transformOrigin.z()); |
825 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); | 826 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); |
826 | |
827 // Compute the anchor point, which is in the center of the renderer box
unless transform-origin is set. | |
828 // FIXME: get rid of anchor once transformOrigin is plumbed. | |
829 FloatPoint3D anchor( | |
830 relativeCompositingBounds.width() ? compositedTransformOrigin.x() /
relativeCompositingBounds.width() : 0.5f, | |
831 relativeCompositingBounds.height() ? compositedTransformOrigin.y() /
relativeCompositingBounds.height() : 0.5f, | |
832 transformOrigin.z()); | |
833 m_graphicsLayer->setAnchorPoint(anchor); | |
834 } else { | 827 } else { |
835 FloatPoint3D compositedTransformOrigin( | 828 FloatPoint3D compositedTransformOrigin( |
836 relativeCompositingBounds.width() * 0.5f, | 829 relativeCompositingBounds.width() * 0.5f, |
837 relativeCompositingBounds.height() * 0.5f, | 830 relativeCompositingBounds.height() * 0.5f, |
838 0.f); | 831 0.f); |
839 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); | 832 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); |
840 m_graphicsLayer->setAnchorPoint(FloatPoint3D(0.5f, 0.5f, 0)); | |
841 } | 833 } |
842 } | 834 } |
843 | 835 |
844 void CompositedLayerMapping::updateReflectionLayerGeometry() | 836 void CompositedLayerMapping::updateReflectionLayerGeometry() |
845 { | 837 { |
846 if (!m_owningLayer.reflectionInfo() || !m_owningLayer.reflectionInfo()->refl
ectionLayer()->hasCompositedLayerMapping()) | 838 if (!m_owningLayer.reflectionInfo() || !m_owningLayer.reflectionInfo()->refl
ectionLayer()->hasCompositedLayerMapping()) |
847 return; | 839 return; |
848 | 840 |
849 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLayer.r
eflectionInfo()->reflectionLayer()->compositedLayerMapping(); | 841 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLayer.r
eflectionInfo()->reflectionLayer()->compositedLayerMapping(); |
850 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLayerU
pdater::ForceUpdate, &m_owningLayer); | 842 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLayerU
pdater::ForceUpdate, &m_owningLayer); |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 return layerChanged; | 1353 return layerChanged; |
1362 } | 1354 } |
1363 | 1355 |
1364 bool CompositedLayerMapping::updateBackgroundLayer(bool needsBackgroundLayer) | 1356 bool CompositedLayerMapping::updateBackgroundLayer(bool needsBackgroundLayer) |
1365 { | 1357 { |
1366 bool layerChanged = false; | 1358 bool layerChanged = false; |
1367 if (needsBackgroundLayer) { | 1359 if (needsBackgroundLayer) { |
1368 if (!m_backgroundLayer) { | 1360 if (!m_backgroundLayer) { |
1369 m_backgroundLayer = createGraphicsLayer(CompositingReasonLayerForBac
kground); | 1361 m_backgroundLayer = createGraphicsLayer(CompositingReasonLayerForBac
kground); |
1370 m_backgroundLayer->setDrawsContent(true); | 1362 m_backgroundLayer->setDrawsContent(true); |
1371 m_backgroundLayer->setAnchorPoint(FloatPoint3D()); | |
1372 m_backgroundLayer->setTransformOrigin(FloatPoint3D()); | 1363 m_backgroundLayer->setTransformOrigin(FloatPoint3D()); |
1373 m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintBackground); | 1364 m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintBackground); |
1374 #if !OS(ANDROID) | 1365 #if !OS(ANDROID) |
1375 m_backgroundLayer->contentLayer()->setDrawCheckerboardForMissingTile
s(true); | 1366 m_backgroundLayer->contentLayer()->setDrawCheckerboardForMissingTile
s(true); |
1376 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(
false); | 1367 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(
false); |
1377 #endif | 1368 #endif |
1378 layerChanged = true; | 1369 layerChanged = true; |
1379 } | 1370 } |
1380 } else { | 1371 } else { |
1381 if (m_backgroundLayer) { | 1372 if (m_backgroundLayer) { |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2249 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2240 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
2250 name = "Scrolling Contents Layer"; | 2241 name = "Scrolling Contents Layer"; |
2251 } else { | 2242 } else { |
2252 ASSERT_NOT_REACHED(); | 2243 ASSERT_NOT_REACHED(); |
2253 } | 2244 } |
2254 | 2245 |
2255 return name; | 2246 return name; |
2256 } | 2247 } |
2257 | 2248 |
2258 } // namespace WebCore | 2249 } // namespace WebCore |
OLD | NEW |