Chromium Code Reviews| 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 4140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4151 // overflow if we are clipping our own overflow. | 4151 // overflow if we are clipping our own overflow. |
| 4152 if (child->hasSelfPaintingLayer() || hasOverflowClip()) | 4152 if (child->hasSelfPaintingLayer() || hasOverflowClip()) |
| 4153 return; | 4153 return; |
| 4154 LayoutRect childVisualOverflowRect = child->visualOverflowRectForPropagation (style()); | 4154 LayoutRect childVisualOverflowRect = child->visualOverflowRectForPropagation (style()); |
| 4155 childVisualOverflowRect.move(delta); | 4155 childVisualOverflowRect.move(delta); |
| 4156 addVisualOverflow(childVisualOverflowRect); | 4156 addVisualOverflow(childVisualOverflowRect); |
| 4157 } | 4157 } |
| 4158 | 4158 |
| 4159 void RenderBox::addLayoutOverflow(const LayoutRect& rect) | 4159 void RenderBox::addLayoutOverflow(const LayoutRect& rect) |
| 4160 { | 4160 { |
| 4161 LayoutRect clientBox = clientBoxRect(); | 4161 LayoutRect clientBox = noOverflowRect(); |
| 4162 if (clientBox.contains(rect) || rect.isEmpty()) | 4162 if (clientBox.contains(rect) || rect.isEmpty()) |
| 4163 return; | 4163 return; |
| 4164 | 4164 |
| 4165 // For overflow clip objects, we don't want to propagate overflow into unrea chable areas. | 4165 // For overflow clip objects, we don't want to propagate overflow into unrea chable areas. |
| 4166 LayoutRect overflowRect(rect); | 4166 LayoutRect overflowRect(rect); |
| 4167 if (hasOverflowClip() || isRenderView()) { | 4167 if (hasOverflowClip() || isRenderView()) { |
| 4168 // Overflow is in the block's coordinate space and thus is flipped for h orizontal-bt and vertical-rl | 4168 // Overflow is in the block's coordinate space and thus is flipped for h orizontal-bt and vertical-rl |
| 4169 // writing modes. At this stage that is actually a simplification, sinc e we can treat horizontal-tb/bt as the same | 4169 // writing modes. At this stage that is actually a simplification, sinc e we can treat horizontal-tb/bt as the same |
| 4170 // and vertical-lr/rl as the same. | 4170 // and vertical-lr/rl as the same. |
| 4171 bool hasTopOverflow = !style()->isLeftToRightDirection() && !isHorizonta lWritingMode(); | 4171 bool hasTopOverflow = !style()->isLeftToRightDirection() && !isHorizonta lWritingMode(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4206 m_overflow->addLayoutOverflow(overflowRect); | 4206 m_overflow->addLayoutOverflow(overflowRect); |
| 4207 } | 4207 } |
| 4208 | 4208 |
| 4209 void RenderBox::addVisualOverflow(const LayoutRect& rect) | 4209 void RenderBox::addVisualOverflow(const LayoutRect& rect) |
| 4210 { | 4210 { |
| 4211 LayoutRect borderBox = borderBoxRect(); | 4211 LayoutRect borderBox = borderBoxRect(); |
| 4212 if (borderBox.contains(rect) || rect.isEmpty()) | 4212 if (borderBox.contains(rect) || rect.isEmpty()) |
| 4213 return; | 4213 return; |
| 4214 | 4214 |
| 4215 if (!m_overflow) | 4215 if (!m_overflow) |
| 4216 m_overflow = adoptPtr(new RenderOverflow(clientBoxRect(), borderBox)); | 4216 m_overflow = adoptPtr(new RenderOverflow(noOverflowRect(), borderBox)); |
| 4217 | 4217 |
| 4218 m_overflow->addVisualOverflow(rect); | 4218 m_overflow->addVisualOverflow(rect); |
| 4219 } | 4219 } |
| 4220 | 4220 |
| 4221 void RenderBox::clearLayoutOverflow() | 4221 void RenderBox::clearLayoutOverflow() |
| 4222 { | 4222 { |
| 4223 if (!m_overflow) | 4223 if (!m_overflow) |
| 4224 return; | 4224 return; |
| 4225 | 4225 |
| 4226 if (visualOverflowRect() == borderBoxRect()) { | 4226 if (visualOverflowRect() == borderBoxRect()) { |
| 4227 m_overflow.clear(); | 4227 m_overflow.clear(); |
| 4228 return; | 4228 return; |
| 4229 } | 4229 } |
| 4230 | 4230 |
| 4231 m_overflow->setLayoutOverflow(borderBoxRect()); | 4231 m_overflow->setLayoutOverflow(borderBoxRect()); |
|
jbroman
2013/07/16 01:19:05
This should be noOverflowRect() as well.
mstensho (USE GERRIT)
2013/07/17 13:39:36
Done.
| |
| 4232 } | 4232 } |
| 4233 | 4233 |
| 4234 inline static bool percentageLogicalHeightIsResolvable(const RenderBox* box) | 4234 inline static bool percentageLogicalHeightIsResolvable(const RenderBox* box) |
| 4235 { | 4235 { |
| 4236 return RenderBox::percentageLogicalHeightIsResolvableFromBlock(box->containi ngBlock(), box->isOutOfFlowPositioned()); | 4236 return RenderBox::percentageLogicalHeightIsResolvableFromBlock(box->containi ngBlock(), box->isOutOfFlowPositioned()); |
| 4237 } | 4237 } |
| 4238 | 4238 |
| 4239 bool RenderBox::percentageLogicalHeightIsResolvableFromBlock(const RenderBlock* containingBlock, bool isOutOfFlowPositioned) | 4239 bool RenderBox::percentageLogicalHeightIsResolvableFromBlock(const RenderBlock* containingBlock, bool isOutOfFlowPositioned) |
| 4240 { | 4240 { |
| 4241 // In quirks mode, blocks with auto height are skipped, and we keep looking for an enclosing | 4241 // 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... | |
| 4400 // We are putting ourselves into our parent's coordinate space. If there is a flipped block mismatch | 4400 // We are putting ourselves into our parent's coordinate space. If there is a flipped block mismatch |
| 4401 // in a particular axis, then we have to flip the rect along that axis. | 4401 // in a particular axis, then we have to flip the rect along that axis. |
| 4402 if (style()->writingMode() == RightToLeftWritingMode || parentStyle->writing Mode() == RightToLeftWritingMode) | 4402 if (style()->writingMode() == RightToLeftWritingMode || parentStyle->writing Mode() == RightToLeftWritingMode) |
| 4403 rect.setX(width() - rect.maxX()); | 4403 rect.setX(width() - rect.maxX()); |
| 4404 else if (style()->writingMode() == BottomToTopWritingMode || parentStyle->wr itingMode() == BottomToTopWritingMode) | 4404 else if (style()->writingMode() == BottomToTopWritingMode || parentStyle->wr itingMode() == BottomToTopWritingMode) |
| 4405 rect.setY(height() - rect.maxY()); | 4405 rect.setY(height() - rect.maxY()); |
| 4406 | 4406 |
| 4407 return rect; | 4407 return rect; |
| 4408 } | 4408 } |
| 4409 | 4409 |
| 4410 LayoutRect RenderBox::noOverflowRect() const | |
| 4411 { | |
| 4412 // Because of the special coodinate system used for overflow rectangles (not quite logical, not | |
| 4413 // quite physical), we need to flip the block progression coordinate in vert ical-rl and | |
| 4414 // horizontal-bt writing modes. Apart from that, this method does the same a s clientBoxRect(). | |
| 4415 | |
| 4416 LayoutUnit left = borderLeft(); | |
| 4417 LayoutUnit top = borderTop(); | |
| 4418 LayoutUnit right = borderRight(); | |
| 4419 LayoutUnit bottom = borderBottom(); | |
| 4420 // Calculate physical padding box. | |
|
Julien - ping for review
2013/07/15 23:50:33
I don't think this comment adds much.
mstensho (USE GERRIT)
2013/07/17 13:39:36
Done.
| |
| 4421 LayoutRect rect(left, top, width() - left - right, height() - top - bottom); | |
|
Julien - ping for review
2013/07/15 23:50:33
This is very much:
LayoutRect physicalBorderBoxRe
jbroman
2013/07/16 01:19:05
Comment-on-a-comment: the border box is the rect t
mstensho (USE GERRIT)
2013/07/17 13:39:36
A good method to use here would be paddingBoxRect(
| |
| 4422 // Flip block progression axis if writing mode is vertical-rl or horizontal- bt. | |
|
Julien - ping for review
2013/07/15 23:50:33
Same comment about not adding much (it repeats wha
mstensho (USE GERRIT)
2013/07/17 13:39:36
Done.
| |
| 4423 flipForWritingMode(rect); | |
| 4424 // Subtract space occupied by scrollbars. They are at their physical edge in this coordinate | |
|
mstensho (USE GERRIT)
2013/07/17 13:39:36
Raising an issue myself. :)
I didn't understand th
| |
| 4425 // system, so order is important here: first flip, then subtract scrollbars. | |
| 4426 rect.contract(verticalScrollbarWidth(), horizontalScrollbarHeight()); | |
| 4427 return rect; | |
| 4428 } | |
| 4429 | |
| 4410 LayoutRect RenderBox::overflowRectForPaintRejection() const | 4430 LayoutRect RenderBox::overflowRectForPaintRejection() const |
| 4411 { | 4431 { |
| 4412 LayoutRect overflowRect = visualOverflowRect(); | 4432 LayoutRect overflowRect = visualOverflowRect(); |
| 4413 if (!m_overflow || !usesCompositedScrolling()) | 4433 if (!m_overflow || !usesCompositedScrolling()) |
| 4414 return overflowRect; | 4434 return overflowRect; |
| 4415 | 4435 |
| 4416 overflowRect.unite(layoutOverflowRect()); | 4436 overflowRect.unite(layoutOverflowRect()); |
| 4417 overflowRect.move(-scrolledContentOffset()); | 4437 overflowRect.move(-scrolledContentOffset()); |
| 4418 return overflowRect; | 4438 return overflowRect; |
| 4419 } | 4439 } |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4594 | 4614 |
| 4595 void RenderBox::reportStaticMembersMemoryUsage(MemoryInstrumentation* memoryInst rumentation) | 4615 void RenderBox::reportStaticMembersMemoryUsage(MemoryInstrumentation* memoryInst rumentation) |
| 4596 { | 4616 { |
| 4597 memoryInstrumentation->addRootObject(gOverrideHeightMap, WebCoreMemoryTypes: :RenderingStructures); | 4617 memoryInstrumentation->addRootObject(gOverrideHeightMap, WebCoreMemoryTypes: :RenderingStructures); |
| 4598 memoryInstrumentation->addRootObject(gOverrideWidthMap, WebCoreMemoryTypes:: RenderingStructures); | 4618 memoryInstrumentation->addRootObject(gOverrideWidthMap, WebCoreMemoryTypes:: RenderingStructures); |
| 4599 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalHeightMa p, WebCoreMemoryTypes::RenderingStructures); | 4619 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalHeightMa p, WebCoreMemoryTypes::RenderingStructures); |
| 4600 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalWidthMap , WebCoreMemoryTypes::RenderingStructures); | 4620 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalWidthMap , WebCoreMemoryTypes::RenderingStructures); |
| 4601 } | 4621 } |
| 4602 | 4622 |
| 4603 } // namespace WebCore | 4623 } // namespace WebCore |
| OLD | NEW |