| 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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 clearNeedsLayout(); | 307 clearNeedsLayout(); |
| 308 return; | 308 return; |
| 309 } | 309 } |
| 310 | 310 |
| 311 LayoutStateMaintainer statePusher(*this, locationOffset()); | 311 LayoutStateMaintainer statePusher(*this, locationOffset()); |
| 312 while (child) { | 312 while (child) { |
| 313 child->layoutIfNeeded(); | 313 child->layoutIfNeeded(); |
| 314 ASSERT(!child->needsLayout()); | 314 ASSERT(!child->needsLayout()); |
| 315 child = child->nextSibling(); | 315 child = child->nextSibling(); |
| 316 } | 316 } |
| 317 |
| 318 m_overflow.clear(); |
| 319 addVisualEffectOverflow(); |
| 320 |
| 317 statePusher.pop(); | 321 statePusher.pop(); |
| 318 invalidateBackgroundObscurationStatus(); | 322 invalidateBackgroundObscurationStatus(); |
| 319 clearNeedsLayout(); | 323 clearNeedsLayout(); |
| 320 } | 324 } |
| 321 | 325 |
| 322 // More IE extensions. clientWidth and clientHeight represent the interior of a
n object | 326 // More IE extensions. clientWidth and clientHeight represent the interior of a
n object |
| 323 // excluding border and scrollbar. | 327 // excluding border and scrollbar. |
| 324 LayoutUnit RenderBox::clientWidth() const | 328 LayoutUnit RenderBox::clientWidth() const |
| 325 { | 329 { |
| 326 return width() - borderLeft() - borderRight() - verticalScrollbarWidth(); | 330 return width() - borderLeft() - borderRight() - verticalScrollbarWidth(); |
| (...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1649 RoundedRect clipRoundedRect(0, 0, 0, 0); | 1653 RoundedRect clipRoundedRect(0, 0, 0, 0); |
| 1650 bool hasBorderRadius = style()->hasBorderRadius(); | 1654 bool hasBorderRadius = style()->hasBorderRadius(); |
| 1651 if (hasBorderRadius) | 1655 if (hasBorderRadius) |
| 1652 clipRoundedRect = style()->getRoundedInnerBorderFor(LayoutRect(accumulat
edOffset, size())); | 1656 clipRoundedRect = style()->getRoundedInnerBorderFor(LayoutRect(accumulat
edOffset, size())); |
| 1653 | 1657 |
| 1654 if (contentsClipBehavior == SkipContentsClipIfPossible) { | 1658 if (contentsClipBehavior == SkipContentsClipIfPossible) { |
| 1655 LayoutRect contentsVisualOverflow = contentsVisualOverflowRect(); | 1659 LayoutRect contentsVisualOverflow = contentsVisualOverflowRect(); |
| 1656 if (contentsVisualOverflow.isEmpty()) | 1660 if (contentsVisualOverflow.isEmpty()) |
| 1657 return false; | 1661 return false; |
| 1658 | 1662 |
| 1659 // FIXME: Get rid of this slop from here and elsewhere. | |
| 1660 // Instead, properly include the outline in visual overflow. | |
| 1661 if (RenderView* view = this->view()) | |
| 1662 contentsVisualOverflow.inflate(view->maximalOutlineSize()); | |
| 1663 | |
| 1664 LayoutRect conservativeClipRect = clipRect; | 1663 LayoutRect conservativeClipRect = clipRect; |
| 1665 if (hasBorderRadius) | 1664 if (hasBorderRadius) |
| 1666 conservativeClipRect.intersect(clipRoundedRect.radiusCenterRect()); | 1665 conservativeClipRect.intersect(clipRoundedRect.radiusCenterRect()); |
| 1667 conservativeClipRect.moveBy(-accumulatedOffset); | 1666 conservativeClipRect.moveBy(-accumulatedOffset); |
| 1668 if (hasLayer()) | 1667 if (hasLayer()) |
| 1669 conservativeClipRect.move(scrolledContentOffset()); | 1668 conservativeClipRect.move(scrolledContentOffset()); |
| 1670 if (conservativeClipRect.contains(contentsVisualOverflow)) | 1669 if (conservativeClipRect.contains(contentsVisualOverflow)) |
| 1671 return false; | 1670 return false; |
| 1672 } | 1671 } |
| 1673 | 1672 |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2003 | 2002 |
| 2004 LayoutRect r = visualOverflowRect(); | 2003 LayoutRect r = visualOverflowRect(); |
| 2005 | 2004 |
| 2006 RenderView* v = view(); | 2005 RenderView* v = view(); |
| 2007 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && v) { | 2006 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && v) { |
| 2008 // FIXME: layoutDelta needs to be applied in parts before/after transfor
ms and | 2007 // FIXME: layoutDelta needs to be applied in parts before/after transfor
ms and |
| 2009 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 | 2008 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 |
| 2010 r.move(v->layoutDelta()); | 2009 r.move(v->layoutDelta()); |
| 2011 } | 2010 } |
| 2012 | 2011 |
| 2013 if (style()) { | |
| 2014 // We have to use maximalOutlineSize() because a child might have an out
line | |
| 2015 // that projects outside of our overflowRect. | |
| 2016 if (v) { | |
| 2017 ASSERT(style()->outlineSize() <= v->maximalOutlineSize()); | |
| 2018 r.inflate(v->maximalOutlineSize()); | |
| 2019 } | |
| 2020 } | |
| 2021 | |
| 2022 computeRectForRepaint(repaintContainer, r); | 2012 computeRectForRepaint(repaintContainer, r); |
| 2023 return r; | 2013 return r; |
| 2024 } | 2014 } |
| 2025 | 2015 |
| 2026 void RenderBox::computeRectForRepaint(const RenderLayerModelObject* repaintConta
iner, LayoutRect& rect, bool fixed) const | 2016 void RenderBox::computeRectForRepaint(const RenderLayerModelObject* repaintConta
iner, LayoutRect& rect, bool fixed) const |
| 2027 { | 2017 { |
| 2028 // The rect we compute at each step is shifted by our x/y offset in the pare
nt container's coordinate space. | 2018 // The rect we compute at each step is shifted by our x/y offset in the pare
nt container's coordinate space. |
| 2029 // Only when we cross a writing mode boundary will we have to possibly flipF
orWritingMode (to convert into a more appropriate | 2019 // Only when we cross a writing mode boundary will we have to possibly flipF
orWritingMode (to convert into a more appropriate |
| 2030 // offset corner for the enclosing container). This allows for a fully RL o
r BT document to repaint | 2020 // offset corner for the enclosing container). This allows for a fully RL o
r BT document to repaint |
| 2031 // properly even during layout, since the rect remains flipped all the way u
ntil the end. | 2021 // properly even during layout, since the rect remains flipped all the way u
ntil the end. |
| (...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4153 { | 4143 { |
| 4154 ASSERT(!needsLayout()); | 4144 ASSERT(!needsLayout()); |
| 4155 // If fragmentation height has changed, we need to lay out. No need to enter
the renderer if it | 4145 // If fragmentation height has changed, we need to lay out. No need to enter
the renderer if it |
| 4156 // is childless, though. | 4146 // is childless, though. |
| 4157 if (view()->layoutState()->pageLogicalHeightChanged() && firstChild()) | 4147 if (view()->layoutState()->pageLogicalHeightChanged() && firstChild()) |
| 4158 layoutScope.setChildNeedsLayout(this); | 4148 layoutScope.setChildNeedsLayout(this); |
| 4159 } | 4149 } |
| 4160 | 4150 |
| 4161 void RenderBox::addVisualEffectOverflow() | 4151 void RenderBox::addVisualEffectOverflow() |
| 4162 { | 4152 { |
| 4163 if (!style()->boxShadow() && !style()->hasBorderImageOutsets()) | 4153 if (!style()->boxShadow() && !style()->hasBorderImageOutsets() && !style()->
hasOutline()) |
| 4164 return; | 4154 return; |
| 4165 | 4155 |
| 4166 bool isFlipped = style()->isFlippedBlocksWritingMode(); | 4156 bool isFlipped = style()->isFlippedBlocksWritingMode(); |
| 4167 bool isHorizontal = isHorizontalWritingMode(); | 4157 bool isHorizontal = isHorizontalWritingMode(); |
| 4168 | 4158 |
| 4169 LayoutRect borderBox = borderBoxRect(); | 4159 LayoutRect borderBox = borderBoxRect(); |
| 4170 LayoutUnit overflowMinX = borderBox.x(); | 4160 LayoutUnit overflowMinX = borderBox.x(); |
| 4171 LayoutUnit overflowMaxX = borderBox.maxX(); | 4161 LayoutUnit overflowMaxX = borderBox.maxX(); |
| 4172 LayoutUnit overflowMinY = borderBox.y(); | 4162 LayoutUnit overflowMinY = borderBox.y(); |
| 4173 LayoutUnit overflowMaxY = borderBox.maxY(); | 4163 LayoutUnit overflowMaxY = borderBox.maxY(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 4192 LayoutBoxExtent borderOutsets = style()->borderImageOutsets(); | 4182 LayoutBoxExtent borderOutsets = style()->borderImageOutsets(); |
| 4193 | 4183 |
| 4194 // In flipped blocks writing modes, the physical sides are inverted. For
example in vertical-rl, the right | 4184 // In flipped blocks writing modes, the physical sides are inverted. For
example in vertical-rl, the right |
| 4195 // border is at the lower x coordinate value. | 4185 // border is at the lower x coordinate value. |
| 4196 overflowMinX = min(overflowMinX, borderBox.x() - ((!isFlipped || isHoriz
ontal) ? borderOutsets.left() : borderOutsets.right())); | 4186 overflowMinX = min(overflowMinX, borderBox.x() - ((!isFlipped || isHoriz
ontal) ? borderOutsets.left() : borderOutsets.right())); |
| 4197 overflowMaxX = max(overflowMaxX, borderBox.maxX() + ((!isFlipped || isHo
rizontal) ? borderOutsets.right() : borderOutsets.left())); | 4187 overflowMaxX = max(overflowMaxX, borderBox.maxX() + ((!isFlipped || isHo
rizontal) ? borderOutsets.right() : borderOutsets.left())); |
| 4198 overflowMinY = min(overflowMinY, borderBox.y() - ((!isFlipped || !isHori
zontal) ? borderOutsets.top() : borderOutsets.bottom())); | 4188 overflowMinY = min(overflowMinY, borderBox.y() - ((!isFlipped || !isHori
zontal) ? borderOutsets.top() : borderOutsets.bottom())); |
| 4199 overflowMaxY = max(overflowMaxY, borderBox.maxY() + ((!isFlipped || !isH
orizontal) ? borderOutsets.bottom() : borderOutsets.top())); | 4189 overflowMaxY = max(overflowMaxY, borderBox.maxY() + ((!isFlipped || !isH
orizontal) ? borderOutsets.bottom() : borderOutsets.top())); |
| 4200 } | 4190 } |
| 4201 | 4191 |
| 4202 // Add in the final overflow with shadows and outsets combined. | 4192 if (style()->hasOutline()) { |
| 4193 LayoutUnit outlineSize = style()->outlineSize(); |
| 4194 |
| 4195 overflowMinX = min(overflowMinX, borderBox.x() - outlineSize); |
| 4196 overflowMaxX = max(overflowMaxX, borderBox.maxX() + outlineSize); |
| 4197 overflowMinY = min(overflowMinY, borderBox.y() - outlineSize); |
| 4198 overflowMaxY = max(overflowMaxY, borderBox.maxY() + outlineSize); |
| 4199 } |
| 4200 |
| 4201 // Add in the final overflow with shadows, outsets and outline combined. |
| 4203 LayoutRect visualEffectOverflow(overflowMinX, overflowMinY, overflowMaxX - o
verflowMinX, overflowMaxY - overflowMinY); | 4202 LayoutRect visualEffectOverflow(overflowMinX, overflowMinY, overflowMaxX - o
verflowMinX, overflowMaxY - overflowMinY); |
| 4204 addVisualOverflow(visualEffectOverflow); | 4203 addVisualOverflow(visualEffectOverflow); |
| 4205 } | 4204 } |
| 4206 | 4205 |
| 4207 void RenderBox::addOverflowFromChild(RenderBox* child, const LayoutSize& delta) | 4206 void RenderBox::addOverflowFromChild(RenderBox* child, const LayoutSize& delta) |
| 4208 { | 4207 { |
| 4209 // Never allow flow threads to propagate overflow up to a parent. | 4208 // Never allow flow threads to propagate overflow up to a parent. |
| 4210 if (child->isRenderFlowThread()) | 4209 if (child->isRenderFlowThread()) |
| 4211 return; | 4210 return; |
| 4212 | 4211 |
| (...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4705 return 0; | 4704 return 0; |
| 4706 | 4705 |
| 4707 if (!layoutState && !flowThreadContainingBlock()) | 4706 if (!layoutState && !flowThreadContainingBlock()) |
| 4708 return 0; | 4707 return 0; |
| 4709 | 4708 |
| 4710 RenderBlock* containerBlock = containingBlock(); | 4709 RenderBlock* containerBlock = containingBlock(); |
| 4711 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); | 4710 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); |
| 4712 } | 4711 } |
| 4713 | 4712 |
| 4714 } // namespace WebCore | 4713 } // namespace WebCore |
| OLD | NEW |