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 4190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4201 // overflow if we are clipping our own overflow. | 4201 // overflow if we are clipping our own overflow. |
4202 if (child->hasSelfPaintingLayer() || hasOverflowClip()) | 4202 if (child->hasSelfPaintingLayer() || hasOverflowClip()) |
4203 return; | 4203 return; |
4204 LayoutRect childVisualOverflowRect = child->visualOverflowRectForPropagation (style()); | 4204 LayoutRect childVisualOverflowRect = child->visualOverflowRectForPropagation (style()); |
4205 childVisualOverflowRect.move(delta); | 4205 childVisualOverflowRect.move(delta); |
4206 addVisualOverflow(childVisualOverflowRect); | 4206 addVisualOverflow(childVisualOverflowRect); |
4207 } | 4207 } |
4208 | 4208 |
4209 void RenderBox::addLayoutOverflow(const LayoutRect& rect) | 4209 void RenderBox::addLayoutOverflow(const LayoutRect& rect) |
4210 { | 4210 { |
4211 LayoutRect clientBox = clientBoxRect(); | 4211 LayoutRect clientBox = noOverflowRect(); |
4212 if (clientBox.contains(rect) || rect.isEmpty()) | 4212 if (clientBox.contains(rect) || rect.isEmpty()) |
4213 return; | 4213 return; |
4214 | 4214 |
4215 // For overflow clip objects, we don't want to propagate overflow into unrea chable areas. | 4215 // For overflow clip objects, we don't want to propagate overflow into unrea chable areas. |
4216 LayoutRect overflowRect(rect); | 4216 LayoutRect overflowRect(rect); |
4217 if (hasOverflowClip() || isRenderView()) { | 4217 if (hasOverflowClip() || isRenderView()) { |
4218 // Overflow is in the block's coordinate space and thus is flipped for h orizontal-bt and vertical-rl | 4218 // Overflow is in the block's coordinate space and thus is flipped for h orizontal-bt and vertical-rl |
4219 // writing modes. At this stage that is actually a simplification, sinc e we can treat horizontal-tb/bt as the same | 4219 // writing modes. At this stage that is actually a simplification, sinc e we can treat horizontal-tb/bt as the same |
4220 // and vertical-lr/rl as the same. | 4220 // and vertical-lr/rl as the same. |
4221 bool hasTopOverflow = !style()->isLeftToRightDirection() && !isHorizonta lWritingMode(); | 4221 bool hasTopOverflow = !style()->isLeftToRightDirection() && !isHorizonta lWritingMode(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4256 m_overflow->addLayoutOverflow(overflowRect); | 4256 m_overflow->addLayoutOverflow(overflowRect); |
4257 } | 4257 } |
4258 | 4258 |
4259 void RenderBox::addVisualOverflow(const LayoutRect& rect) | 4259 void RenderBox::addVisualOverflow(const LayoutRect& rect) |
4260 { | 4260 { |
4261 LayoutRect borderBox = borderBoxRect(); | 4261 LayoutRect borderBox = borderBoxRect(); |
4262 if (borderBox.contains(rect) || rect.isEmpty()) | 4262 if (borderBox.contains(rect) || rect.isEmpty()) |
4263 return; | 4263 return; |
4264 | 4264 |
4265 if (!m_overflow) | 4265 if (!m_overflow) |
4266 m_overflow = adoptPtr(new RenderOverflow(clientBoxRect(), borderBox)); | 4266 m_overflow = adoptPtr(new RenderOverflow(noOverflowRect(), borderBox)); |
4267 | 4267 |
4268 m_overflow->addVisualOverflow(rect); | 4268 m_overflow->addVisualOverflow(rect); |
4269 } | 4269 } |
4270 | 4270 |
4271 void RenderBox::clearLayoutOverflow() | 4271 void RenderBox::clearLayoutOverflow() |
4272 { | 4272 { |
4273 if (!m_overflow) | 4273 if (!m_overflow) |
4274 return; | 4274 return; |
4275 | 4275 |
4276 if (visualOverflowRect() == borderBoxRect()) { | 4276 LayoutRect noOverflowRect = this->noOverflowRect(); |
4277 if (visualOverflowRect() == noOverflowRect) { | |
4277 m_overflow.clear(); | 4278 m_overflow.clear(); |
4278 return; | 4279 return; |
4279 } | 4280 } |
4280 | 4281 |
4281 m_overflow->setLayoutOverflow(borderBoxRect()); | 4282 m_overflow->setLayoutOverflow(noOverflowRect); |
4282 } | 4283 } |
4283 | 4284 |
4284 inline static bool percentageLogicalHeightIsResolvable(const RenderBox* box) | 4285 inline static bool percentageLogicalHeightIsResolvable(const RenderBox* box) |
4285 { | 4286 { |
4286 return RenderBox::percentageLogicalHeightIsResolvableFromBlock(box->containi ngBlock(), box->isOutOfFlowPositioned()); | 4287 return RenderBox::percentageLogicalHeightIsResolvableFromBlock(box->containi ngBlock(), box->isOutOfFlowPositioned()); |
4287 } | 4288 } |
4288 | 4289 |
4289 bool RenderBox::percentageLogicalHeightIsResolvableFromBlock(const RenderBlock* containingBlock, bool isOutOfFlowPositioned) | 4290 bool RenderBox::percentageLogicalHeightIsResolvableFromBlock(const RenderBlock* containingBlock, bool isOutOfFlowPositioned) |
4290 { | 4291 { |
4291 // In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing | 4292 // In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4450 // We are putting ourselves into our parent's coordinate space. If there is a flipped block mismatch | 4451 // We are putting ourselves into our parent's coordinate space. If there is a flipped block mismatch |
4451 // in a particular axis, then we have to flip the rect along that axis. | 4452 // in a particular axis, then we have to flip the rect along that axis. |
4452 if (style()->writingMode() == RightToLeftWritingMode || parentStyle->writing Mode() == RightToLeftWritingMode) | 4453 if (style()->writingMode() == RightToLeftWritingMode || parentStyle->writing Mode() == RightToLeftWritingMode) |
4453 rect.setX(width() - rect.maxX()); | 4454 rect.setX(width() - rect.maxX()); |
4454 else if (style()->writingMode() == BottomToTopWritingMode || parentStyle->wr itingMode() == BottomToTopWritingMode) | 4455 else if (style()->writingMode() == BottomToTopWritingMode || parentStyle->wr itingMode() == BottomToTopWritingMode) |
4455 rect.setY(height() - rect.maxY()); | 4456 rect.setY(height() - rect.maxY()); |
4456 | 4457 |
4457 return rect; | 4458 return rect; |
4458 } | 4459 } |
4459 | 4460 |
4461 LayoutRect RenderBox::noOverflowRect() const | |
Julien - ping for review
2013/07/24 22:22:28
Not totally satisfied with this name as it doesn't
mstensho (USE GERRIT)
2013/07/25 12:36:39
I'm not impressed by the name myself. :) But yeah,
| |
4462 { | |
4463 // Because of the special coodinate system used for overflow rectangles and many other | |
4464 // rectangles (not quite logical, not quite physical), we need to flip the b lock progression | |
4465 // coordinate in vertical-rl and horizontal-bt writing modes. In other words , the rectangle | |
4466 // returned is physical, except for the block direction progression coordina te (y in horizontal | |
4467 // writing modes, x in vertical writing modes), which is always "logical top ". Apart from the | |
4468 // flipping, this method does the same as clientBoxRect(). | |
4469 | |
4470 LayoutUnit left = borderLeft(); | |
4471 LayoutUnit top = borderTop(); | |
4472 LayoutUnit right = borderRight(); | |
4473 LayoutUnit bottom = borderBottom(); | |
4474 LayoutRect rect(left, top, width() - left - right, height() - top - bottom); | |
4475 flipForWritingMode(rect); | |
4476 // Subtract space occupied by scrollbars. Order is important here: first fli p, then subtract | |
4477 // scrollbars. This may seem backwards and weird, since one would think that a horizontal | |
4478 // scrollbar at the physical bottom in horizontal-bt ought to be at the logi cal top (physical | |
4479 // bottom), between the logical top (physical bottom) border and the logical top (physical | |
4480 // bottom) padding. But this is how the rest of the code expects us to behav e. This is highly | |
4481 // related to https://bugs.webkit.org/show_bug.cgi?id=76129 | |
4482 rect.contract(verticalScrollbarWidth(), horizontalScrollbarHeight()); | |
4483 return rect; | |
4484 } | |
4485 | |
4460 LayoutRect RenderBox::overflowRectForPaintRejection() const | 4486 LayoutRect RenderBox::overflowRectForPaintRejection() const |
4461 { | 4487 { |
4462 LayoutRect overflowRect = visualOverflowRect(); | 4488 LayoutRect overflowRect = visualOverflowRect(); |
4463 if (!m_overflow || !usesCompositedScrolling()) | 4489 if (!m_overflow || !usesCompositedScrolling()) |
4464 return overflowRect; | 4490 return overflowRect; |
4465 | 4491 |
4466 overflowRect.unite(layoutOverflowRect()); | 4492 overflowRect.unite(layoutOverflowRect()); |
4467 overflowRect.move(-scrolledContentOffset()); | 4493 overflowRect.move(-scrolledContentOffset()); |
4468 return overflowRect; | 4494 return overflowRect; |
4469 } | 4495 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4628 } | 4654 } |
4629 | 4655 |
4630 if (didSplitParentAnonymousBoxes) | 4656 if (didSplitParentAnonymousBoxes) |
4631 markBoxForRelayoutAfterSplit(this); | 4657 markBoxForRelayoutAfterSplit(this); |
4632 | 4658 |
4633 ASSERT(beforeChild->parent() == this); | 4659 ASSERT(beforeChild->parent() == this); |
4634 return beforeChild; | 4660 return beforeChild; |
4635 } | 4661 } |
4636 | 4662 |
4637 } // namespace WebCore | 4663 } // namespace WebCore |
OLD | NEW |