| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 if (current == ancestor) | 210 if (current == ancestor) |
| 211 break; | 211 break; |
| 212 } | 212 } |
| 213 | 213 |
| 214 return true; | 214 return true; |
| 215 } | 215 } |
| 216 | 216 |
| 217 void LayoutGeometryMap::pushMappingsToAncestor(const Layer* layer, const Layer*
ancestorLayer) | 217 void LayoutGeometryMap::pushMappingsToAncestor(const Layer* layer, const Layer*
ancestorLayer) |
| 218 { | 218 { |
| 219 const LayoutObject* renderer = layer->renderer(); | 219 const LayoutObject* renderer = layer->layoutObject(); |
| 220 | 220 |
| 221 bool crossDocument = ancestorLayer && layer->renderer()->frame() != ancestor
Layer->renderer()->frame(); | 221 bool crossDocument = ancestorLayer && layer->layoutObject()->frame() != ance
storLayer->layoutObject()->frame(); |
| 222 ASSERT(!crossDocument || m_mapCoordinatesFlags & TraverseDocumentBoundaries)
; | 222 ASSERT(!crossDocument || m_mapCoordinatesFlags & TraverseDocumentBoundaries)
; |
| 223 | 223 |
| 224 // We have to visit all the renderers to detect flipped blocks. This might d
efeat the gains | 224 // We have to visit all the renderers to detect flipped blocks. This might d
efeat the gains |
| 225 // from mapping via layers. | 225 // from mapping via layers. |
| 226 bool canConvertInLayerTree = (ancestorLayer && !crossDocument) ? canMapBetwe
enRenderers(layer->renderer(), ancestorLayer->renderer()) : false; | 226 bool canConvertInLayerTree = (ancestorLayer && !crossDocument) ? canMapBetwe
enRenderers(layer->layoutObject(), ancestorLayer->layoutObject()) : false; |
| 227 | 227 |
| 228 // fprintf(stderr, "LayoutGeometryMap::pushMappingsToAncestor from layer %p t
o layer %p, canConvertInLayerTree=%d\n", layer, ancestorLayer, canConvertInLayer
Tree); | 228 // fprintf(stderr, "LayoutGeometryMap::pushMappingsToAncestor from layer %p t
o layer %p, canConvertInLayerTree=%d\n", layer, ancestorLayer, canConvertInLayer
Tree); |
| 229 | 229 |
| 230 if (canConvertInLayerTree) { | 230 if (canConvertInLayerTree) { |
| 231 LayoutPoint layerOffset; | 231 LayoutPoint layerOffset; |
| 232 layer->convertToLayerCoords(ancestorLayer, layerOffset); | 232 layer->convertToLayerCoords(ancestorLayer, layerOffset); |
| 233 | 233 |
| 234 // The LayoutView must be pushed first. | 234 // The LayoutView must be pushed first. |
| 235 if (!m_mapping.size()) { | 235 if (!m_mapping.size()) { |
| 236 ASSERT(ancestorLayer->renderer()->isLayoutView()); | 236 ASSERT(ancestorLayer->layoutObject()->isLayoutView()); |
| 237 pushMappingsToAncestor(ancestorLayer->renderer(), 0); | 237 pushMappingsToAncestor(ancestorLayer->layoutObject(), 0); |
| 238 } | 238 } |
| 239 | 239 |
| 240 TemporaryChange<size_t> positionChange(m_insertionPosition, m_mapping.si
ze()); | 240 TemporaryChange<size_t> positionChange(m_insertionPosition, m_mapping.si
ze()); |
| 241 bool accumulatingTransform = layer->renderer()->style()->preserves3D() |
| ancestorLayer->renderer()->style()->preserves3D(); | 241 bool accumulatingTransform = layer->layoutObject()->style()->preserves3D
() || ancestorLayer->layoutObject()->style()->preserves3D(); |
| 242 push(renderer, toLayoutSize(layerOffset), accumulatingTransform, /*isNon
Uniform*/ false, /*isFixedPosition*/ false, /*hasTransform*/ false); | 242 push(renderer, toLayoutSize(layerOffset), accumulatingTransform, /*isNon
Uniform*/ false, /*isFixedPosition*/ false, /*hasTransform*/ false); |
| 243 return; | 243 return; |
| 244 } | 244 } |
| 245 const LayoutBoxModelObject* ancestorRenderer = ancestorLayer ? ancestorLayer
->renderer() : 0; | 245 const LayoutBoxModelObject* ancestorRenderer = ancestorLayer ? ancestorLayer
->layoutObject() : 0; |
| 246 pushMappingsToAncestor(renderer, ancestorRenderer); | 246 pushMappingsToAncestor(renderer, ancestorRenderer); |
| 247 } | 247 } |
| 248 | 248 |
| 249 void LayoutGeometryMap::push(const LayoutObject* renderer, const LayoutSize& off
setFromContainer, bool accumulatingTransform, bool isNonUniform, bool isFixedPos
ition, bool hasTransform, LayoutSize offsetForFixedPosition) | 249 void LayoutGeometryMap::push(const LayoutObject* renderer, const LayoutSize& off
setFromContainer, bool accumulatingTransform, bool isNonUniform, bool isFixedPos
ition, bool hasTransform, LayoutSize offsetForFixedPosition) |
| 250 { | 250 { |
| 251 // fprintf(stderr, "LayoutGeometryMap::push %p %d,%d isNonUniform=%d\n", rend
erer, offsetFromContainer.width().toInt(), offsetFromContainer.height().toInt(),
isNonUniform); | 251 // fprintf(stderr, "LayoutGeometryMap::push %p %d,%d isNonUniform=%d\n", rend
erer, offsetFromContainer.width().toInt(), offsetFromContainer.height().toInt(),
isNonUniform); |
| 252 | 252 |
| 253 ASSERT(m_insertionPosition != kNotFound); | 253 ASSERT(m_insertionPosition != kNotFound); |
| 254 ASSERT(!renderer->isLayoutView() || !m_insertionPosition || m_mapCoordinates
Flags & TraverseDocumentBoundaries); | 254 ASSERT(!renderer->isLayoutView() || !m_insertionPosition || m_mapCoordinates
Flags & TraverseDocumentBoundaries); |
| 255 ASSERT(offsetForFixedPosition.isZero() || renderer->isLayoutView()); | 255 ASSERT(offsetForFixedPosition.isZero() || renderer->isLayoutView()); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 ASSERT(m_mapping.size()); | 287 ASSERT(m_mapping.size()); |
| 288 | 288 |
| 289 while (m_mapping.size() && m_mapping.last().m_renderer != ancestorRenderer)
{ | 289 while (m_mapping.size() && m_mapping.last().m_renderer != ancestorRenderer)
{ |
| 290 stepRemoved(m_mapping.last()); | 290 stepRemoved(m_mapping.last()); |
| 291 m_mapping.removeLast(); | 291 m_mapping.removeLast(); |
| 292 } | 292 } |
| 293 } | 293 } |
| 294 | 294 |
| 295 void LayoutGeometryMap::popMappingsToAncestor(const Layer* ancestorLayer) | 295 void LayoutGeometryMap::popMappingsToAncestor(const Layer* ancestorLayer) |
| 296 { | 296 { |
| 297 const LayoutBoxModelObject* ancestorRenderer = ancestorLayer ? ancestorLayer
->renderer() : 0; | 297 const LayoutBoxModelObject* ancestorRenderer = ancestorLayer ? ancestorLayer
->layoutObject() : 0; |
| 298 popMappingsToAncestor(ancestorRenderer); | 298 popMappingsToAncestor(ancestorRenderer); |
| 299 } | 299 } |
| 300 | 300 |
| 301 void LayoutGeometryMap::stepInserted(const LayoutGeometryMapStep& step) | 301 void LayoutGeometryMap::stepInserted(const LayoutGeometryMapStep& step) |
| 302 { | 302 { |
| 303 m_accumulatedOffset += step.m_offset; | 303 m_accumulatedOffset += step.m_offset; |
| 304 | 304 |
| 305 if (step.m_isNonUniform) | 305 if (step.m_isNonUniform) |
| 306 ++m_nonUniformStepsCount; | 306 ++m_nonUniformStepsCount; |
| 307 | 307 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 // If we're not working with multiple LayoutViews, then any view is consider
ed | 341 // If we're not working with multiple LayoutViews, then any view is consider
ed |
| 342 // "topmost" (to preserve original behavior). | 342 // "topmost" (to preserve original behavior). |
| 343 if (!(m_mapCoordinatesFlags & TraverseDocumentBoundaries)) | 343 if (!(m_mapCoordinatesFlags & TraverseDocumentBoundaries)) |
| 344 return true; | 344 return true; |
| 345 | 345 |
| 346 return renderer->frame()->isMainFrame(); | 346 return renderer->frame()->isMainFrame(); |
| 347 } | 347 } |
| 348 #endif | 348 #endif |
| 349 | 349 |
| 350 } // namespace blink | 350 } // namespace blink |
| OLD | NEW |