| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 void RenderGeometryMap::mapToContainer(TransformState& transformState, const Ren
derLayerModelObject* container) const | 50 void RenderGeometryMap::mapToContainer(TransformState& transformState, const Ren
derLayerModelObject* container) const |
| 51 { | 51 { |
| 52 // If the mapping includes something like columns, we have to go via rendere
rs. | 52 // If the mapping includes something like columns, we have to go via rendere
rs. |
| 53 if (hasNonUniformStep()) { | 53 if (hasNonUniformStep()) { |
| 54 m_mapping.last().m_renderer->mapLocalToContainer(container, transformSta
te, ApplyContainerFlip | m_mapCoordinatesFlags); | 54 m_mapping.last().m_renderer->mapLocalToContainer(container, transformSta
te, ApplyContainerFlip | m_mapCoordinatesFlags); |
| 55 transformState.flatten(); | 55 transformState.flatten(); |
| 56 return; | 56 return; |
| 57 } | 57 } |
| 58 | 58 |
| 59 bool inFixed = false; | 59 bool inFixed = false; |
| 60 #if ASSERT_ENABLED | 60 #if ENABLE(ASSERT) |
| 61 bool foundContainer = !container || (m_mapping.size() && m_mapping[0].m_rend
erer == container); | 61 bool foundContainer = !container || (m_mapping.size() && m_mapping[0].m_rend
erer == container); |
| 62 #endif | 62 #endif |
| 63 | 63 |
| 64 for (int i = m_mapping.size() - 1; i >= 0; --i) { | 64 for (int i = m_mapping.size() - 1; i >= 0; --i) { |
| 65 const RenderGeometryMapStep& currentStep = m_mapping[i]; | 65 const RenderGeometryMapStep& currentStep = m_mapping[i]; |
| 66 | 66 |
| 67 // If container is the root RenderView (step 0) we want to apply its fix
ed position offset. | 67 // If container is the root RenderView (step 0) we want to apply its fix
ed position offset. |
| 68 if (i > 0 && currentStep.m_renderer == container) { | 68 if (i > 0 && currentStep.m_renderer == container) { |
| 69 #if ASSERT_ENABLED | 69 #if ENABLE(ASSERT) |
| 70 foundContainer = true; | 70 foundContainer = true; |
| 71 #endif | 71 #endif |
| 72 break; | 72 break; |
| 73 } | 73 } |
| 74 | 74 |
| 75 // If this box has a transform, it acts as a fixed position container | 75 // If this box has a transform, it acts as a fixed position container |
| 76 // for fixed descendants, which prevents the propagation of 'fixed' | 76 // for fixed descendants, which prevents the propagation of 'fixed' |
| 77 // unless the layer itself is also fixed position. | 77 // unless the layer itself is also fixed position. |
| 78 if (i && currentStep.m_hasTransform && !currentStep.m_isFixedPosition) | 78 if (i && currentStep.m_hasTransform && !currentStep.m_isFixedPosition) |
| 79 inFixed = false; | 79 inFixed = false; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 109 FloatPoint result; | 109 FloatPoint result; |
| 110 | 110 |
| 111 if (!hasFixedPositionStep() && !hasTransformStep() && !hasNonUniformStep() &
& (!container || (m_mapping.size() && container == m_mapping[0].m_renderer))) | 111 if (!hasFixedPositionStep() && !hasTransformStep() && !hasNonUniformStep() &
& (!container || (m_mapping.size() && container == m_mapping[0].m_renderer))) |
| 112 result = p + m_accumulatedOffset; | 112 result = p + m_accumulatedOffset; |
| 113 else { | 113 else { |
| 114 TransformState transformState(TransformState::ApplyTransformDirection, p
); | 114 TransformState transformState(TransformState::ApplyTransformDirection, p
); |
| 115 mapToContainer(transformState, container); | 115 mapToContainer(transformState, container); |
| 116 result = transformState.lastPlanarPoint(); | 116 result = transformState.lastPlanarPoint(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 #if ASSERT_ENABLED | 119 #if ENABLE(ASSERT) |
| 120 if (m_mapping.size() > 0) { | 120 if (m_mapping.size() > 0) { |
| 121 const RenderObject* lastRenderer = m_mapping.last().m_renderer; | 121 const RenderObject* lastRenderer = m_mapping.last().m_renderer; |
| 122 const RenderLayer* layer = lastRenderer->enclosingLayer(); | 122 const RenderLayer* layer = lastRenderer->enclosingLayer(); |
| 123 | 123 |
| 124 // Bounds for invisible layers are intentionally not calculated, and are | 124 // Bounds for invisible layers are intentionally not calculated, and are |
| 125 // therefore not necessarily expected to be correct here. This is ok, | 125 // therefore not necessarily expected to be correct here. This is ok, |
| 126 // because they will be recomputed if the layer becomes visible. | 126 // because they will be recomputed if the layer becomes visible. |
| 127 if (!layer || !layer->subtreeIsInvisible()) { | 127 if (!layer || !layer->subtreeIsInvisible()) { |
| 128 FloatPoint rendererMappedResult = lastRenderer->localToContainerPoin
t(p, container, m_mapCoordinatesFlags); | 128 FloatPoint rendererMappedResult = lastRenderer->localToContainerPoin
t(p, container, m_mapCoordinatesFlags); |
| 129 | 129 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 155 | 155 |
| 156 if (!hasFixedPositionStep() && !hasTransformStep() && !hasNonUniformStep() &
& (!container || (m_mapping.size() && container == m_mapping[0].m_renderer))) { | 156 if (!hasFixedPositionStep() && !hasTransformStep() && !hasNonUniformStep() &
& (!container || (m_mapping.size() && container == m_mapping[0].m_renderer))) { |
| 157 result = rect; | 157 result = rect; |
| 158 result.move(m_accumulatedOffset); | 158 result.move(m_accumulatedOffset); |
| 159 } else { | 159 } else { |
| 160 TransformState transformState(TransformState::ApplyTransformDirection, r
ect.center(), rect); | 160 TransformState transformState(TransformState::ApplyTransformDirection, r
ect.center(), rect); |
| 161 mapToContainer(transformState, container); | 161 mapToContainer(transformState, container); |
| 162 result = transformState.lastPlanarQuad().boundingBox(); | 162 result = transformState.lastPlanarQuad().boundingBox(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 #if ASSERT_ENABLED | 165 #if ENABLE(ASSERT) |
| 166 if (m_mapping.size() > 0) { | 166 if (m_mapping.size() > 0) { |
| 167 const RenderObject* lastRenderer = m_mapping.last().m_renderer; | 167 const RenderObject* lastRenderer = m_mapping.last().m_renderer; |
| 168 const RenderLayer* layer = lastRenderer->enclosingLayer(); | 168 const RenderLayer* layer = lastRenderer->enclosingLayer(); |
| 169 | 169 |
| 170 // Bounds for invisible layers are intentionally not calculated, and are | 170 // Bounds for invisible layers are intentionally not calculated, and are |
| 171 // therefore not necessarily expected to be correct here. This is ok, | 171 // therefore not necessarily expected to be correct here. This is ok, |
| 172 // because they will be recomputed if the layer becomes visible. | 172 // because they will be recomputed if the layer becomes visible. |
| 173 if (!layer->subtreeIsInvisible() && lastRenderer->style()->visibility()
== VISIBLE) { | 173 if (!layer->subtreeIsInvisible() && lastRenderer->style()->visibility()
== VISIBLE) { |
| 174 FloatRect rendererMappedResult = lastRenderer->localToContainerQuad(
rect, container, m_mapCoordinatesFlags).boundingBox(); | 174 FloatRect rendererMappedResult = lastRenderer->localToContainerQuad(
rect, container, m_mapCoordinatesFlags).boundingBox(); |
| 175 | 175 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 ASSERT(m_transformedStepsCount); | 322 ASSERT(m_transformedStepsCount); |
| 323 --m_transformedStepsCount; | 323 --m_transformedStepsCount; |
| 324 } | 324 } |
| 325 | 325 |
| 326 if (step.m_isFixedPosition) { | 326 if (step.m_isFixedPosition) { |
| 327 ASSERT(m_fixedStepsCount); | 327 ASSERT(m_fixedStepsCount); |
| 328 --m_fixedStepsCount; | 328 --m_fixedStepsCount; |
| 329 } | 329 } |
| 330 } | 330 } |
| 331 | 331 |
| 332 #if ASSERT_ENABLED | 332 #if ENABLE(ASSERT) |
| 333 bool RenderGeometryMap::isTopmostRenderView(const RenderObject* renderer) const | 333 bool RenderGeometryMap::isTopmostRenderView(const RenderObject* renderer) const |
| 334 { | 334 { |
| 335 if (!renderer->isRenderView()) | 335 if (!renderer->isRenderView()) |
| 336 return false; | 336 return false; |
| 337 | 337 |
| 338 // If we're not working with multiple RenderViews, then any view is consider
ed | 338 // If we're not working with multiple RenderViews, then any view is consider
ed |
| 339 // "topmost" (to preserve original behavior). | 339 // "topmost" (to preserve original behavior). |
| 340 if (!(m_mapCoordinatesFlags & TraverseDocumentBoundaries)) | 340 if (!(m_mapCoordinatesFlags & TraverseDocumentBoundaries)) |
| 341 return true; | 341 return true; |
| 342 | 342 |
| 343 return renderer->frame()->isMainFrame(); | 343 return renderer->frame()->isMainFrame(); |
| 344 } | 344 } |
| 345 #endif | 345 #endif |
| 346 | 346 |
| 347 } // namespace WebCore | 347 } // namespace WebCore |
| OLD | NEW |