| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 // contribute to overlap as soon as they have been recursively processed | 99 // contribute to overlap as soon as they have been recursively processed |
| 100 // and popped off the stack. | 100 // and popped off the stack. |
| 101 DCHECK_GE(m_overlapStack.size(), 2ul); | 101 DCHECK_GE(m_overlapStack.size(), 2ul); |
| 102 if (isClipped) | 102 if (isClipped) |
| 103 m_overlapStack[m_overlapStack.size() - 2].clipped.add(bounds); | 103 m_overlapStack[m_overlapStack.size() - 2].clipped.add(bounds); |
| 104 else | 104 else |
| 105 m_overlapStack[m_overlapStack.size() - 2].unclipped.add(bounds); | 105 m_overlapStack[m_overlapStack.size() - 2].unclipped.add(bounds); |
| 106 } | 106 } |
| 107 | 107 |
| 108 bool overlapsLayers(const IntRect& bounds, bool isClipped) const { | 108 bool overlapsLayers(const IntRect& bounds, bool isClipped) const { |
| 109 bool clippedOverlap = m_overlapStack.last().clipped.overlapsLayers(bounds); | 109 bool clippedOverlap = m_overlapStack.back().clipped.overlapsLayers(bounds); |
| 110 if (isClipped) | 110 if (isClipped) |
| 111 return clippedOverlap; | 111 return clippedOverlap; |
| 112 // Unclipped is allowed to overlap clipped, but not vice-versa. | 112 // Unclipped is allowed to overlap clipped, but not vice-versa. |
| 113 return clippedOverlap || | 113 return clippedOverlap || |
| 114 m_overlapStack.last().unclipped.overlapsLayers(bounds); | 114 m_overlapStack.back().unclipped.overlapsLayers(bounds); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void beginNewOverlapTestingContext() { | 117 void beginNewOverlapTestingContext() { |
| 118 // This effectively creates a new "clean slate" for overlap state. | 118 // This effectively creates a new "clean slate" for overlap state. |
| 119 // This is used when we know that a subtree or remaining set of | 119 // This is used when we know that a subtree or remaining set of |
| 120 // siblings does not need to check overlap with things behind it. | 120 // siblings does not need to check overlap with things behind it. |
| 121 m_overlapStack.grow(m_overlapStack.size() + 1); | 121 m_overlapStack.grow(m_overlapStack.size() + 1); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void finishCurrentOverlapTestingContext() { | 124 void finishCurrentOverlapTestingContext() { |
| 125 // The overlap information on the top of the stack is still necessary | 125 // The overlap information on the top of the stack is still necessary |
| 126 // for checking overlap of any layers outside this context that may | 126 // for checking overlap of any layers outside this context that may |
| 127 // overlap things from inside this context. Therefore, we must merge | 127 // overlap things from inside this context. Therefore, we must merge |
| 128 // the information from the top of the stack before popping the stack. | 128 // the information from the top of the stack before popping the stack. |
| 129 // | 129 // |
| 130 // FIXME: we may be able to avoid this deep copy by rearranging how | 130 // FIXME: we may be able to avoid this deep copy by rearranging how |
| 131 // overlapMap state is managed. | 131 // overlapMap state is managed. |
| 132 m_overlapStack[m_overlapStack.size() - 2].clipped.unite( | 132 m_overlapStack[m_overlapStack.size() - 2].clipped.unite( |
| 133 m_overlapStack.last().clipped); | 133 m_overlapStack.back().clipped); |
| 134 m_overlapStack[m_overlapStack.size() - 2].unclipped.unite( | 134 m_overlapStack[m_overlapStack.size() - 2].unclipped.unite( |
| 135 m_overlapStack.last().unclipped); | 135 m_overlapStack.back().unclipped); |
| 136 m_overlapStack.pop_back(); | 136 m_overlapStack.pop_back(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 private: | 139 private: |
| 140 Vector<OverlapMapContainers> m_overlapStack; | 140 Vector<OverlapMapContainers> m_overlapStack; |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 class CompositingRequirementsUpdater::RecursionData { | 143 class CompositingRequirementsUpdater::RecursionData { |
| 144 public: | 144 public: |
| 145 explicit RecursionData(PaintLayer* compositingAncestor) | 145 explicit RecursionData(PaintLayer* compositingAncestor) |
| (...skipping 392 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 |