| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
| 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
| 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 4114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4125 // is childless, though. | 4125 // is childless, though. |
| 4126 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) | 4126 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) |
| 4127 layoutScope.setChildNeedsLayout(this); | 4127 layoutScope.setChildNeedsLayout(this); |
| 4128 } | 4128 } |
| 4129 | 4129 |
| 4130 void RenderBox::addVisualEffectOverflow() | 4130 void RenderBox::addVisualEffectOverflow() |
| 4131 { | 4131 { |
| 4132 if (!style()->hasVisualOverflowingEffect()) | 4132 if (!style()->hasVisualOverflowingEffect()) |
| 4133 return; | 4133 return; |
| 4134 | 4134 |
| 4135 LayoutRect borderBox = borderBoxRect(); | 4135 // Add in the final overflow with shadows, outsets and outline combined. |
| 4136 LayoutUnit overflowMinX = borderBox.x(); | 4136 LayoutRect visualEffectOverflow = borderBoxRect(); |
| 4137 LayoutUnit overflowMaxX = borderBox.maxX(); | 4137 visualEffectOverflow.expand(computeVisualEffectOverflowExtent()); |
| 4138 LayoutUnit overflowMinY = borderBox.y(); | 4138 addVisualOverflow(visualEffectOverflow); |
| 4139 LayoutUnit overflowMaxY = borderBox.maxY(); | 4139 } |
| 4140 | 4140 |
| 4141 // Compute box-shadow overflow first. | 4141 LayoutBoxExtent RenderBox::computeVisualEffectOverflowExtent() const |
| 4142 { |
| 4143 ASSERT(style()->hasVisualOverflowingEffect()); |
| 4144 |
| 4145 LayoutUnit top; |
| 4146 LayoutUnit right; |
| 4147 LayoutUnit bottom; |
| 4148 LayoutUnit left; |
| 4149 |
| 4142 if (style()->boxShadow()) { | 4150 if (style()->boxShadow()) { |
| 4143 LayoutUnit shadowLeft; | 4151 style()->getBoxShadowExtent(top, right, bottom, left); |
| 4144 LayoutUnit shadowRight; | |
| 4145 LayoutUnit shadowTop; | |
| 4146 LayoutUnit shadowBottom; | |
| 4147 style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadow
Left); | |
| 4148 | 4152 |
| 4149 // Note that box-shadow extent's left and top are negative when extends
to left and top, respectively. | 4153 // Box shadow extent's top and left are negative when extend to left and
top direction, respectively. |
| 4150 overflowMinX = borderBox.x() + shadowLeft; | 4154 // Negate to make them positive. |
| 4151 overflowMaxX = borderBox.maxX() + shadowRight; | 4155 top = -top; |
| 4152 overflowMinY = borderBox.y() + shadowTop; | 4156 left = -left; |
| 4153 overflowMaxY = borderBox.maxY() + shadowBottom; | |
| 4154 } | 4157 } |
| 4155 | 4158 |
| 4156 // Now compute border-image-outset overflow. | |
| 4157 if (style()->hasBorderImageOutsets()) { | 4159 if (style()->hasBorderImageOutsets()) { |
| 4158 LayoutBoxExtent borderOutsets = style()->borderImageOutsets(); | 4160 LayoutBoxExtent borderOutsets = style()->borderImageOutsets(); |
| 4159 | 4161 top = std::max(top, borderOutsets.top()); |
| 4160 overflowMinX = std::min(overflowMinX, borderBox.x() - borderOutsets.left
()); | 4162 right = std::max(right, borderOutsets.right()); |
| 4161 overflowMaxX = std::max(overflowMaxX, borderBox.maxX() + borderOutsets.r
ight()); | 4163 bottom = std::max(bottom, borderOutsets.bottom()); |
| 4162 overflowMinY = std::min(overflowMinY, borderBox.y() - borderOutsets.top(
)); | 4164 left = std::max(left, borderOutsets.left()); |
| 4163 overflowMaxY = std::max(overflowMaxY, borderBox.maxY() + borderOutsets.b
ottom()); | |
| 4164 } | 4165 } |
| 4165 | 4166 |
| 4166 if (style()->hasOutline()) { | 4167 if (style()->hasOutline()) { |
| 4167 LayoutUnit outlineSize = style()->outlineSize(); | 4168 LayoutUnit outlineSize = style()->outlineSize(); |
| 4168 | 4169 top = std::max(top, outlineSize); |
| 4169 overflowMinX = std::min(overflowMinX, borderBox.x() - outlineSize); | 4170 right = std::max(right, outlineSize); |
| 4170 overflowMaxX = std::max(overflowMaxX, borderBox.maxX() + outlineSize); | 4171 bottom = std::max(bottom, outlineSize); |
| 4171 overflowMinY = std::min(overflowMinY, borderBox.y() - outlineSize); | 4172 left = std::max(left, outlineSize); |
| 4172 overflowMaxY = std::max(overflowMaxY, borderBox.maxY() + outlineSize); | |
| 4173 } | 4173 } |
| 4174 | 4174 |
| 4175 // Add in the final overflow with shadows, outsets and outline combined. | 4175 return LayoutBoxExtent(top, right, bottom, left); |
| 4176 LayoutRect visualEffectOverflow(overflowMinX, overflowMinY, overflowMaxX - o
verflowMinX, overflowMaxY - overflowMinY); | |
| 4177 addVisualOverflow(visualEffectOverflow); | |
| 4178 } | 4176 } |
| 4179 | 4177 |
| 4180 void RenderBox::addOverflowFromChild(RenderBox* child, const LayoutSize& delta) | 4178 void RenderBox::addOverflowFromChild(RenderBox* child, const LayoutSize& delta) |
| 4181 { | 4179 { |
| 4182 // Never allow flow threads to propagate overflow up to a parent. | 4180 // Never allow flow threads to propagate overflow up to a parent. |
| 4183 if (child->isRenderFlowThread()) | 4181 if (child->isRenderFlowThread()) |
| 4184 return; | 4182 return; |
| 4185 | 4183 |
| 4186 // Only propagate layout overflow from the child if the child isn't clipping
its overflow. If it is, then | 4184 // Only propagate layout overflow from the child if the child isn't clipping
its overflow. If it is, then |
| 4187 // its overflow is internal to it, and we don't care about it. layoutOverfl
owRectForPropagation takes care of this | 4185 // its overflow is internal to it, and we don't care about it. layoutOverfl
owRectForPropagation takes care of this |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4667 return 0; | 4665 return 0; |
| 4668 | 4666 |
| 4669 if (!layoutState && !flowThreadContainingBlock()) | 4667 if (!layoutState && !flowThreadContainingBlock()) |
| 4670 return 0; | 4668 return 0; |
| 4671 | 4669 |
| 4672 RenderBlock* containerBlock = containingBlock(); | 4670 RenderBlock* containerBlock = containingBlock(); |
| 4673 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); | 4671 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); |
| 4674 } | 4672 } |
| 4675 | 4673 |
| 4676 } // namespace WebCore | 4674 } // namespace WebCore |
| OLD | NEW |