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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 return; | 338 return; |
339 | 339 |
340 LayoutRect layerBounds = m_owningLayer.boundingBoxForCompositing(); | 340 LayoutRect layerBounds = m_owningLayer.boundingBoxForCompositing(); |
341 | 341 |
342 // FIXME: either move this hack to RenderLayer or find a way to get rid of i
t. Removing it from here | 342 // FIXME: either move this hack to RenderLayer or find a way to get rid of i
t. Removing it from here |
343 // will alow us to get rid of m_compositedBounds. | 343 // will alow us to get rid of m_compositedBounds. |
344 | 344 |
345 // If the element has a transform-origin that has fixed lengths, and the ren
derer has zero size, | 345 // If the element has a transform-origin that has fixed lengths, and the ren
derer has zero size, |
346 // then we need to ensure that the compositing layer has non-zero size so th
at we can apply | 346 // then we need to ensure that the compositing layer has non-zero size so th
at we can apply |
347 // the transform-origin via the GraphicsLayer anchorPoint (which is expresse
d as a fractional value). | 347 // the transform-origin via the GraphicsLayer anchorPoint (which is expresse
d as a fractional value). |
| 348 // FIXME: this code is no longer necessary, remove. |
348 if (layerBounds.isEmpty() && hasNonZeroTransformOrigin(renderer())) { | 349 if (layerBounds.isEmpty() && hasNonZeroTransformOrigin(renderer())) { |
349 layerBounds.setWidth(1); | 350 layerBounds.setWidth(1); |
350 layerBounds.setHeight(1); | 351 layerBounds.setHeight(1); |
351 m_artificiallyInflatedBounds = true; | 352 m_artificiallyInflatedBounds = true; |
352 } else { | 353 } else { |
353 m_artificiallyInflatedBounds = false; | 354 m_artificiallyInflatedBounds = false; |
354 } | 355 } |
355 | 356 |
356 m_compositedBounds = layerBounds; | 357 m_compositedBounds = layerBounds; |
357 } | 358 } |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 // Update properties that depend on layer dimensions | 823 // Update properties that depend on layer dimensions |
823 FloatPoint3D transformOrigin = computeTransformOrigin(IntRect(IntPoint()
, layerBounds.size())); | 824 FloatPoint3D transformOrigin = computeTransformOrigin(IntRect(IntPoint()
, layerBounds.size())); |
824 | 825 |
825 // |transformOrigin| is in the local space of this layer. layerBounds -
relativeCompositingBounds converts to the space of the | 826 // |transformOrigin| is in the local space of this layer. layerBounds -
relativeCompositingBounds converts to the space of the |
826 // compositing bounds relative to the composited ancestor. This does not
apply to the z direction, since the page is 2D. | 827 // compositing bounds relative to the composited ancestor. This does not
apply to the z direction, since the page is 2D. |
827 FloatPoint3D compositedTransformOrigin( | 828 FloatPoint3D compositedTransformOrigin( |
828 layerBounds.x() - relativeCompositingBounds.x() + transformOrigin.x(
), | 829 layerBounds.x() - relativeCompositingBounds.x() + transformOrigin.x(
), |
829 layerBounds.y() - relativeCompositingBounds.y() + transformOrigin.y(
), | 830 layerBounds.y() - relativeCompositingBounds.y() + transformOrigin.y(
), |
830 transformOrigin.z()); | 831 transformOrigin.z()); |
831 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); | 832 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); |
832 | |
833 // Compute the anchor point, which is in the center of the renderer box
unless transform-origin is set. | |
834 // FIXME: get rid of anchor once transformOrigin is plumbed. | |
835 FloatPoint3D anchor( | |
836 relativeCompositingBounds.width() ? compositedTransformOrigin.x() /
relativeCompositingBounds.width() : 0.5f, | |
837 relativeCompositingBounds.height() ? compositedTransformOrigin.y() /
relativeCompositingBounds.height() : 0.5f, | |
838 transformOrigin.z()); | |
839 m_graphicsLayer->setAnchorPoint(anchor); | |
840 } else { | 833 } else { |
841 FloatPoint3D compositedTransformOrigin( | 834 FloatPoint3D compositedTransformOrigin( |
842 relativeCompositingBounds.width() * 0.5f, | 835 relativeCompositingBounds.width() * 0.5f, |
843 relativeCompositingBounds.height() * 0.5f, | 836 relativeCompositingBounds.height() * 0.5f, |
844 0.f); | 837 0.f); |
845 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); | 838 m_graphicsLayer->setTransformOrigin(compositedTransformOrigin); |
846 m_graphicsLayer->setAnchorPoint(FloatPoint3D(0.5f, 0.5f, 0)); | |
847 } | 839 } |
848 } | 840 } |
849 | 841 |
850 void CompositedLayerMapping::updateReflectionLayerGeometry() | 842 void CompositedLayerMapping::updateReflectionLayerGeometry() |
851 { | 843 { |
852 if (!m_owningLayer.reflectionInfo() || !m_owningLayer.reflectionInfo()->refl
ectionLayer()->hasCompositedLayerMapping()) | 844 if (!m_owningLayer.reflectionInfo() || !m_owningLayer.reflectionInfo()->refl
ectionLayer()->hasCompositedLayerMapping()) |
853 return; | 845 return; |
854 | 846 |
855 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLayer.r
eflectionInfo()->reflectionLayer()->compositedLayerMapping(); | 847 CompositedLayerMappingPtr reflectionCompositedLayerMapping = m_owningLayer.r
eflectionInfo()->reflectionLayer()->compositedLayerMapping(); |
856 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLayerU
pdater::ForceUpdate, &m_owningLayer); | 848 reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(GraphicsLayerU
pdater::ForceUpdate, &m_owningLayer); |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1367 return layerChanged; | 1359 return layerChanged; |
1368 } | 1360 } |
1369 | 1361 |
1370 bool CompositedLayerMapping::updateBackgroundLayer(bool needsBackgroundLayer) | 1362 bool CompositedLayerMapping::updateBackgroundLayer(bool needsBackgroundLayer) |
1371 { | 1363 { |
1372 bool layerChanged = false; | 1364 bool layerChanged = false; |
1373 if (needsBackgroundLayer) { | 1365 if (needsBackgroundLayer) { |
1374 if (!m_backgroundLayer) { | 1366 if (!m_backgroundLayer) { |
1375 m_backgroundLayer = createGraphicsLayer(CompositingReasonLayerForBac
kground); | 1367 m_backgroundLayer = createGraphicsLayer(CompositingReasonLayerForBac
kground); |
1376 m_backgroundLayer->setDrawsContent(true); | 1368 m_backgroundLayer->setDrawsContent(true); |
1377 m_backgroundLayer->setAnchorPoint(FloatPoint3D()); | |
1378 m_backgroundLayer->setTransformOrigin(FloatPoint3D()); | 1369 m_backgroundLayer->setTransformOrigin(FloatPoint3D()); |
1379 m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintBackground); | 1370 m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintBackground); |
1380 #if !OS(ANDROID) | 1371 #if !OS(ANDROID) |
1381 m_backgroundLayer->contentLayer()->setDrawCheckerboardForMissingTile
s(true); | 1372 m_backgroundLayer->contentLayer()->setDrawCheckerboardForMissingTile
s(true); |
1382 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(
false); | 1373 m_graphicsLayer->contentLayer()->setDrawCheckerboardForMissingTiles(
false); |
1383 #endif | 1374 #endif |
1384 layerChanged = true; | 1375 layerChanged = true; |
1385 } | 1376 } |
1386 } else { | 1377 } else { |
1387 if (m_backgroundLayer) { | 1378 if (m_backgroundLayer) { |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2255 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { | 2246 } else if (graphicsLayer == m_scrollingContentsLayer.get()) { |
2256 name = "Scrolling Contents Layer"; | 2247 name = "Scrolling Contents Layer"; |
2257 } else { | 2248 } else { |
2258 ASSERT_NOT_REACHED(); | 2249 ASSERT_NOT_REACHED(); |
2259 } | 2250 } |
2260 | 2251 |
2261 return name; | 2252 return name; |
2262 } | 2253 } |
2263 | 2254 |
2264 } // namespace WebCore | 2255 } // namespace WebCore |
OLD | NEW |