| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "FullyClippedStateStack.h" | 6 #include "FullyClippedStateStack.h" |
| 7 | 7 |
| 8 #include "core/dom/ContainerNode.h" | 8 #include "core/dom/ContainerNode.h" |
| 9 #include "core/dom/Node.h" | 9 #include "core/dom/Node.h" |
| 10 #include "core/layout/LayoutBox.h" | 10 #include "core/layout/LayoutBox.h" |
| 11 #include "core/layout/LayoutObject.h" | 11 #include "core/layout/LayoutObject.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 #if ENABLE(ASSERT) | 15 #if ENABLE(ASSERT) |
| 16 static unsigned depthCrossingShadowBoundaries(Node* node) | 16 static unsigned depthCrossingShadowBoundaries(Node* node) |
| 17 { | 17 { |
| 18 unsigned depth = 0; | 18 unsigned depth = 0; |
| 19 for (ContainerNode* parent = node->parentOrShadowHostNode(); parent; parent
= parent->parentOrShadowHostNode()) | 19 for (ContainerNode* parent = node->parentOrShadowHostNode(); parent; parent
= parent->parentOrShadowHostNode()) |
| 20 ++depth; | 20 ++depth; |
| 21 return depth; | 21 return depth; |
| 22 } | 22 } |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 static inline bool fullyClipsContents(Node* node) | 25 static inline bool fullyClipsContents(Node* node) |
| 26 { | 26 { |
| 27 LayoutObject* renderer = node->renderer(); | 27 LayoutObject* renderer = node->layoutObject(); |
| 28 if (!renderer || !renderer->isBox() || !renderer->hasOverflowClip()) | 28 if (!renderer || !renderer->isBox() || !renderer->hasOverflowClip()) |
| 29 return false; | 29 return false; |
| 30 return toLayoutBox(renderer)->size().isEmpty(); | 30 return toLayoutBox(renderer)->size().isEmpty(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 static inline bool ignoresContainerClip(Node* node) | 33 static inline bool ignoresContainerClip(Node* node) |
| 34 { | 34 { |
| 35 LayoutObject* renderer = node->renderer(); | 35 LayoutObject* renderer = node->layoutObject(); |
| 36 if (!renderer || renderer->isText()) | 36 if (!renderer || renderer->isText()) |
| 37 return false; | 37 return false; |
| 38 return renderer->style()->hasOutOfFlowPosition(); | 38 return renderer->style()->hasOutOfFlowPosition(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 FullyClippedStateStack::FullyClippedStateStack() | 41 FullyClippedStateStack::FullyClippedStateStack() |
| 42 { | 42 { |
| 43 } | 43 } |
| 44 | 44 |
| 45 FullyClippedStateStack::~FullyClippedStateStack() | 45 FullyClippedStateStack::~FullyClippedStateStack() |
| (...skipping 28 matching lines...) Expand all Loading... |
| 74 // Call pushFullyClippedState on each node starting with the earliest ancest
or. | 74 // Call pushFullyClippedState on each node starting with the earliest ancest
or. |
| 75 size_t ancestrySize = ancestry.size(); | 75 size_t ancestrySize = ancestry.size(); |
| 76 for (size_t i = 0; i < ancestrySize; ++i) | 76 for (size_t i = 0; i < ancestrySize; ++i) |
| 77 pushFullyClippedState(ancestry[ancestrySize - i - 1]); | 77 pushFullyClippedState(ancestry[ancestrySize - i - 1]); |
| 78 pushFullyClippedState(node); | 78 pushFullyClippedState(node); |
| 79 | 79 |
| 80 ASSERT(size() == 1 + depthCrossingShadowBoundaries(node)); | 80 ASSERT(size() == 1 + depthCrossingShadowBoundaries(node)); |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace blink | 83 } // namespace blink |
| OLD | NEW |