| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2014 Google Inc. All rights reserved. | 3 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "core/paint/PaintLayer.h" | 31 #include "core/paint/PaintLayer.h" |
| 32 #include "core/paint/PaintLayerStackingNode.h" | 32 #include "core/paint/PaintLayerStackingNode.h" |
| 33 #include "core/paint/PaintLayerStackingNodeIterator.h" | 33 #include "core/paint/PaintLayerStackingNodeIterator.h" |
| 34 #include "platform/instrumentation/tracing/TraceEvent.h" | 34 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 class OverlapMapContainer { | 38 class OverlapMapContainer { |
| 39 public: | 39 public: |
| 40 void add(const IntRect& bounds) { | 40 void add(const IntRect& bounds) { |
| 41 m_layerRects.append(bounds); | 41 m_layerRects.push_back(bounds); |
| 42 m_boundingBox.unite(bounds); | 42 m_boundingBox.unite(bounds); |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool overlapsLayers(const IntRect& bounds) const { | 45 bool overlapsLayers(const IntRect& bounds) const { |
| 46 // Checking with the bounding box will quickly reject cases when | 46 // Checking with the bounding box will quickly reject cases when |
| 47 // layers are created for lists of items going in one direction and | 47 // layers are created for lists of items going in one direction and |
| 48 // never overlap with each other. | 48 // never overlap with each other. |
| 49 if (!bounds.intersects(m_boundingBox)) | 49 if (!bounds.intersects(m_boundingBox)) |
| 50 return false; | 50 return false; |
| 51 for (unsigned i = 0; i < m_layerRects.size(); i++) { | 51 for (unsigned i = 0; i < m_layerRects.size(); i++) { |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 if (currentRecursionData.m_hasCompositedScrollingAncestor) { | 314 if (currentRecursionData.m_hasCompositedScrollingAncestor) { |
| 315 Vector<size_t> unclippedDescendantsToRemove; | 315 Vector<size_t> unclippedDescendantsToRemove; |
| 316 for (size_t i = 0; i < unclippedDescendants.size(); i++) { | 316 for (size_t i = 0; i < unclippedDescendants.size(); i++) { |
| 317 PaintLayer* unclippedDescendant = unclippedDescendants.at(i); | 317 PaintLayer* unclippedDescendant = unclippedDescendants.at(i); |
| 318 // If we've reached the containing block of one of the unclipped | 318 // If we've reached the containing block of one of the unclipped |
| 319 // descendants, that element is no longer relevant to whether or not we | 319 // descendants, that element is no longer relevant to whether or not we |
| 320 // should opt in. Unfortunately we can't easily remove from the list | 320 // should opt in. Unfortunately we can't easily remove from the list |
| 321 // while we're iterating, so we have to store it for later removal. | 321 // while we're iterating, so we have to store it for later removal. |
| 322 if (unclippedDescendant->layoutObject()->containingBlock() == | 322 if (unclippedDescendant->layoutObject()->containingBlock() == |
| 323 layer->layoutObject()) { | 323 layer->layoutObject()) { |
| 324 unclippedDescendantsToRemove.append(i); | 324 unclippedDescendantsToRemove.push_back(i); |
| 325 continue; | 325 continue; |
| 326 } | 326 } |
| 327 if (layer->scrollsWithRespectTo(unclippedDescendant)) | 327 if (layer->scrollsWithRespectTo(unclippedDescendant)) |
| 328 reasonsToComposite |= CompositingReasonAssumedOverlap; | 328 reasonsToComposite |= CompositingReasonAssumedOverlap; |
| 329 } | 329 } |
| 330 | 330 |
| 331 // Remove irrelevant unclipped descendants in reverse order so our stored | 331 // Remove irrelevant unclipped descendants in reverse order so our stored |
| 332 // indices remain valid. | 332 // indices remain valid. |
| 333 for (size_t i = 0; i < unclippedDescendantsToRemove.size(); i++) { | 333 for (size_t i = 0; i < unclippedDescendantsToRemove.size(); i++) { |
| 334 unclippedDescendants.remove(unclippedDescendantsToRemove.at( | 334 unclippedDescendants.remove(unclippedDescendantsToRemove.at( |
| 335 unclippedDescendantsToRemove.size() - i - 1)); | 335 unclippedDescendantsToRemove.size() - i - 1)); |
| 336 } | 336 } |
| 337 | 337 |
| 338 if (reasonsToComposite & CompositingReasonOutOfFlowClipping) { | 338 if (reasonsToComposite & CompositingReasonOutOfFlowClipping) { |
| 339 // TODO(schenney): We only need to promote when the clipParent is not a | 339 // TODO(schenney): We only need to promote when the clipParent is not a |
| 340 // descendant of the ancestor scroller, which we do not check for here. | 340 // descendant of the ancestor scroller, which we do not check for here. |
| 341 // Hence we might be promoting needlessly. | 341 // Hence we might be promoting needlessly. |
| 342 unclippedDescendants.append(layer); | 342 unclippedDescendants.push_back(layer); |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 | 345 |
| 346 const IntRect& absBounds = hasCompositedScrollingAncestor | 346 const IntRect& absBounds = hasCompositedScrollingAncestor |
| 347 ? layer->unclippedAbsoluteBoundingBox() | 347 ? layer->unclippedAbsoluteBoundingBox() |
| 348 : layer->clippedAbsoluteBoundingBox(); | 348 : layer->clippedAbsoluteBoundingBox(); |
| 349 absoluteDescendantBoundingBox = absBounds; | 349 absoluteDescendantBoundingBox = absBounds; |
| 350 if (currentRecursionData.m_testingOverlap && | 350 if (currentRecursionData.m_testingOverlap && |
| 351 !requiresCompositingOrSquashing(directReasons)) { | 351 !requiresCompositingOrSquashing(directReasons)) { |
| 352 bool overlaps = | 352 bool overlaps = |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 descendantHas3DTransform |= | 538 descendantHas3DTransform |= |
| 539 anyDescendantHas3DTransform || layer->has3DTransform(); | 539 anyDescendantHas3DTransform || layer->has3DTransform(); |
| 540 } | 540 } |
| 541 | 541 |
| 542 // At this point we have finished collecting all reasons to composite this | 542 // At this point we have finished collecting all reasons to composite this |
| 543 // layer. | 543 // layer. |
| 544 layer->setCompositingReasons(reasonsToComposite); | 544 layer->setCompositingReasons(reasonsToComposite); |
| 545 } | 545 } |
| 546 | 546 |
| 547 } // namespace blink | 547 } // namespace blink |
| OLD | NEW |