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