| 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 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1511 BackgroundImageGeometry geometry; | 1511 BackgroundImageGeometry geometry; |
| 1512 layerRenderer->calculateBackgroundImageGeometry(curLayer, rendererRe
ct, geometry); | 1512 layerRenderer->calculateBackgroundImageGeometry(curLayer, rendererRe
ct, geometry); |
| 1513 layerRenderer->repaintRectangle(geometry.destRect()); | 1513 layerRenderer->repaintRectangle(geometry.destRect()); |
| 1514 if (geometry.destRect() == rendererRect) | 1514 if (geometry.destRect() == rendererRect) |
| 1515 return true; | 1515 return true; |
| 1516 } | 1516 } |
| 1517 } | 1517 } |
| 1518 return false; | 1518 return false; |
| 1519 } | 1519 } |
| 1520 | 1520 |
| 1521 bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu
latedOffset) | 1521 bool RenderBox::pushContentsClip(PaintInfo& paintInfo, const LayoutPoint& accumu
latedOffset, ContentsClipBehavior contentsClipBehavior) |
| 1522 { | 1522 { |
| 1523 if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == Paint
PhaseSelfOutline || paintInfo.phase == PaintPhaseMask) | 1523 if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == Paint
PhaseSelfOutline || paintInfo.phase == PaintPhaseMask) |
| 1524 return false; | 1524 return false; |
| 1525 | 1525 |
| 1526 bool isControlClip = hasControlClip(); | 1526 bool isControlClip = hasControlClip(); |
| 1527 bool isOverflowClip = hasOverflowClip() && !layer()->isSelfPaintingLayer(); | 1527 bool isOverflowClip = hasOverflowClip() && !layer()->isSelfPaintingLayer(); |
| 1528 | 1528 |
| 1529 if (!isControlClip && !isOverflowClip) | 1529 if (!isControlClip && !isOverflowClip) |
| 1530 return false; | 1530 return false; |
| 1531 | 1531 |
| 1532 LayoutRect clipRect = isControlClip ? controlClipRect(accumulatedOffset) : o
verflowClipRect(accumulatedOffset, paintInfo.renderRegion); |
| 1533 RoundedRect clipRoundedRect(0, 0, 0, 0); |
| 1534 bool hasBorderRadius = style()->hasBorderRadius(); |
| 1535 if (hasBorderRadius) |
| 1536 clipRoundedRect = style()->getRoundedInnerBorderFor(LayoutRect(accumulat
edOffset, size())); |
| 1537 |
| 1538 if (contentsClipBehavior == ContentsClipAutomatic) { |
| 1539 LayoutRect contentsVisualOverflow = contentsVisualOverflowRect(); |
| 1540 if (contentsVisualOverflow.isEmpty()) |
| 1541 return false; |
| 1542 |
| 1543 LayoutRect conservativeClipRect = clipRect; |
| 1544 if (hasBorderRadius) |
| 1545 conservativeClipRect.intersect(clipRoundedRect.enclosedRect()); |
| 1546 conservativeClipRect.moveBy(-accumulatedOffset); |
| 1547 if (hasLayer()) |
| 1548 conservativeClipRect.move(scrolledContentOffset()); |
| 1549 if (conservativeClipRect.contains(contentsVisualOverflow)) |
| 1550 return false; |
| 1551 } |
| 1552 |
| 1532 if (paintInfo.phase == PaintPhaseOutline) | 1553 if (paintInfo.phase == PaintPhaseOutline) |
| 1533 paintInfo.phase = PaintPhaseChildOutlines; | 1554 paintInfo.phase = PaintPhaseChildOutlines; |
| 1534 else if (paintInfo.phase == PaintPhaseChildBlockBackground) { | 1555 else if (paintInfo.phase == PaintPhaseChildBlockBackground) { |
| 1535 paintInfo.phase = PaintPhaseBlockBackground; | 1556 paintInfo.phase = PaintPhaseBlockBackground; |
| 1536 paintObject(paintInfo, accumulatedOffset); | 1557 paintObject(paintInfo, accumulatedOffset); |
| 1537 paintInfo.phase = PaintPhaseChildBlockBackgrounds; | 1558 paintInfo.phase = PaintPhaseChildBlockBackgrounds; |
| 1538 } | 1559 } |
| 1539 IntRect clipRect = pixelSnappedIntRect(isControlClip ? controlClipRect(accum
ulatedOffset) : overflowClipRect(accumulatedOffset, paintInfo.renderRegion)); | |
| 1540 paintInfo.context->save(); | 1560 paintInfo.context->save(); |
| 1541 if (style()->hasBorderRadius()) | 1561 if (hasBorderRadius) |
| 1542 paintInfo.context->clipRoundedRect(style()->getRoundedInnerBorderFor(Lay
outRect(accumulatedOffset, size()))); | 1562 paintInfo.context->clipRoundedRect(clipRoundedRect); |
| 1543 paintInfo.context->clip(clipRect); | 1563 paintInfo.context->clip(pixelSnappedIntRect(clipRect)); |
| 1544 return true; | 1564 return true; |
| 1545 } | 1565 } |
| 1546 | 1566 |
| 1547 void RenderBox::popContentsClip(PaintInfo& paintInfo, PaintPhase originalPhase,
const LayoutPoint& accumulatedOffset) | 1567 void RenderBox::popContentsClip(PaintInfo& paintInfo, PaintPhase originalPhase,
const LayoutPoint& accumulatedOffset) |
| 1548 { | 1568 { |
| 1549 ASSERT(hasControlClip() || (hasOverflowClip() && !layer()->isSelfPaintingLay
er())); | 1569 ASSERT(hasControlClip() || (hasOverflowClip() && !layer()->isSelfPaintingLay
er())); |
| 1550 | 1570 |
| 1551 paintInfo.context->restore(); | 1571 paintInfo.context->restore(); |
| 1552 if (originalPhase == PaintPhaseOutline) { | 1572 if (originalPhase == PaintPhaseOutline) { |
| 1553 paintInfo.phase = PaintPhaseSelfOutline; | 1573 paintInfo.phase = PaintPhaseSelfOutline; |
| (...skipping 2650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4204 | 4224 |
| 4205 // In flipped blocks writing modes, the physical sides are inverted. For
example in vertical-rl, the right | 4225 // In flipped blocks writing modes, the physical sides are inverted. For
example in vertical-rl, the right |
| 4206 // border is at the lower x coordinate value. | 4226 // border is at the lower x coordinate value. |
| 4207 overflowMinX = min(overflowMinX, borderBox.x() - ((!isFlipped || isHoriz
ontal) ? borderOutsets.left() : borderOutsets.right())); | 4227 overflowMinX = min(overflowMinX, borderBox.x() - ((!isFlipped || isHoriz
ontal) ? borderOutsets.left() : borderOutsets.right())); |
| 4208 overflowMaxX = max(overflowMaxX, borderBox.maxX() + ((!isFlipped || isHo
rizontal) ? borderOutsets.right() : borderOutsets.left())); | 4228 overflowMaxX = max(overflowMaxX, borderBox.maxX() + ((!isFlipped || isHo
rizontal) ? borderOutsets.right() : borderOutsets.left())); |
| 4209 overflowMinY = min(overflowMinY, borderBox.y() - ((!isFlipped || !isHori
zontal) ? borderOutsets.top() : borderOutsets.bottom())); | 4229 overflowMinY = min(overflowMinY, borderBox.y() - ((!isFlipped || !isHori
zontal) ? borderOutsets.top() : borderOutsets.bottom())); |
| 4210 overflowMaxY = max(overflowMaxY, borderBox.maxY() + ((!isFlipped || !isH
orizontal) ? borderOutsets.bottom() : borderOutsets.top())); | 4230 overflowMaxY = max(overflowMaxY, borderBox.maxY() + ((!isFlipped || !isH
orizontal) ? borderOutsets.bottom() : borderOutsets.top())); |
| 4211 } | 4231 } |
| 4212 | 4232 |
| 4213 // Add in the final overflow with shadows and outsets combined. | 4233 // Add in the final overflow with shadows and outsets combined. |
| 4214 addVisualOverflow(LayoutRect(overflowMinX, overflowMinY, overflowMaxX - over
flowMinX, overflowMaxY - overflowMinY)); | 4234 LayoutRect visualEffectOverflow(overflowMinX, overflowMinY, overflowMaxX - o
verflowMinX, overflowMaxY - overflowMinY); |
| 4235 addVisualOverflow(visualEffectOverflow); |
| 4215 } | 4236 } |
| 4216 | 4237 |
| 4217 void RenderBox::addOverflowFromChild(RenderBox* child, const LayoutSize& delta) | 4238 void RenderBox::addOverflowFromChild(RenderBox* child, const LayoutSize& delta) |
| 4218 { | 4239 { |
| 4219 // Never allow flow threads to propagate overflow up to a parent. | 4240 // Never allow flow threads to propagate overflow up to a parent. |
| 4220 if (child->isRenderFlowThread()) | 4241 if (child->isRenderFlowThread()) |
| 4221 return; | 4242 return; |
| 4222 | 4243 |
| 4223 // Only propagate layout overflow from the child if the child isn't clipping
its overflow. If it is, then | 4244 // Only propagate layout overflow from the child if the child isn't clipping
its overflow. If it is, then |
| 4224 // its overflow is internal to it, and we don't care about it. layoutOverfl
owRectForPropagation takes care of this | 4245 // its overflow is internal to it, and we don't care about it. layoutOverfl
owRectForPropagation takes care of this |
| 4225 // and just propagates the border box rect instead. | 4246 // and just propagates the border box rect instead. |
| 4226 LayoutRect childLayoutOverflowRect = child->layoutOverflowRectForPropagation
(style()); | 4247 LayoutRect childLayoutOverflowRect = child->layoutOverflowRectForPropagation
(style()); |
| 4227 childLayoutOverflowRect.move(delta); | 4248 childLayoutOverflowRect.move(delta); |
| 4228 addLayoutOverflow(childLayoutOverflowRect); | 4249 addLayoutOverflow(childLayoutOverflowRect); |
| 4229 | 4250 |
| 4230 // Add in visual overflow from the child. Even if the child clips its overf
low, it may still | 4251 // Add in visual overflow from the child. Even if the child clips its overf
low, it may still |
| 4231 // have visual overflow of its own set from box shadows or reflections. It
is unnecessary to propagate this | 4252 // have visual overflow of its own set from box shadows or reflections. It
is unnecessary to propagate this |
| 4232 // overflow if we are clipping our own overflow. | 4253 // overflow if we are clipping our own overflow. |
| 4233 if (child->hasSelfPaintingLayer() || hasOverflowClip()) | 4254 if (child->hasSelfPaintingLayer()) |
| 4234 return; | 4255 return; |
| 4235 LayoutRect childVisualOverflowRect = child->visualOverflowRectForPropagation
(style()); | 4256 LayoutRect childVisualOverflowRect = child->visualOverflowRectForPropagation
(style()); |
| 4236 childVisualOverflowRect.move(delta); | 4257 childVisualOverflowRect.move(delta); |
| 4237 addVisualOverflow(childVisualOverflowRect); | 4258 addContentsVisualOverflow(childVisualOverflowRect); |
| 4238 } | 4259 } |
| 4239 | 4260 |
| 4240 void RenderBox::addLayoutOverflow(const LayoutRect& rect) | 4261 void RenderBox::addLayoutOverflow(const LayoutRect& rect) |
| 4241 { | 4262 { |
| 4242 LayoutRect clientBox = noOverflowRect(); | 4263 LayoutRect clientBox = noOverflowRect(); |
| 4243 if (clientBox.contains(rect) || rect.isEmpty()) | 4264 if (clientBox.contains(rect) || rect.isEmpty()) |
| 4244 return; | 4265 return; |
| 4245 | 4266 |
| 4246 // For overflow clip objects, we don't want to propagate overflow into unrea
chable areas. | 4267 // For overflow clip objects, we don't want to propagate overflow into unrea
chable areas. |
| 4247 LayoutRect overflowRect(rect); | 4268 LayoutRect overflowRect(rect); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4292 LayoutRect borderBox = borderBoxRect(); | 4313 LayoutRect borderBox = borderBoxRect(); |
| 4293 if (borderBox.contains(rect) || rect.isEmpty()) | 4314 if (borderBox.contains(rect) || rect.isEmpty()) |
| 4294 return; | 4315 return; |
| 4295 | 4316 |
| 4296 if (!m_overflow) | 4317 if (!m_overflow) |
| 4297 m_overflow = adoptPtr(new RenderOverflow(noOverflowRect(), borderBox)); | 4318 m_overflow = adoptPtr(new RenderOverflow(noOverflowRect(), borderBox)); |
| 4298 | 4319 |
| 4299 m_overflow->addVisualOverflow(rect); | 4320 m_overflow->addVisualOverflow(rect); |
| 4300 } | 4321 } |
| 4301 | 4322 |
| 4323 void RenderBox::addContentsVisualOverflow(const LayoutRect& rect) |
| 4324 { |
| 4325 if (!hasOverflowClip()) { |
| 4326 addVisualOverflow(rect); |
| 4327 return; |
| 4328 } |
| 4329 |
| 4330 if (rect.isEmpty()) |
| 4331 return; |
| 4332 |
| 4333 if (!m_overflow) |
| 4334 m_overflow = adoptPtr(new RenderOverflow(clientBoxRect(), borderBoxRect(
))); |
| 4335 m_overflow->addContentsVisualOverflow(rect); |
| 4336 } |
| 4337 |
| 4302 void RenderBox::clearLayoutOverflow() | 4338 void RenderBox::clearLayoutOverflow() |
| 4303 { | 4339 { |
| 4304 if (!m_overflow) | 4340 if (!m_overflow) |
| 4305 return; | 4341 return; |
| 4306 | 4342 |
| 4307 if (!hasVisualOverflow()) { | 4343 if (!hasVisualOverflow() && contentsVisualOverflowRect().isEmpty()) { |
| 4308 m_overflow.clear(); | 4344 m_overflow.clear(); |
| 4309 return; | 4345 return; |
| 4310 } | 4346 } |
| 4311 | 4347 |
| 4312 m_overflow->setLayoutOverflow(noOverflowRect()); | 4348 m_overflow->setLayoutOverflow(noOverflowRect()); |
| 4313 } | 4349 } |
| 4314 | 4350 |
| 4315 inline static bool percentageLogicalHeightIsResolvable(const RenderBox* box) | 4351 inline static bool percentageLogicalHeightIsResolvable(const RenderBox* box) |
| 4316 { | 4352 { |
| 4317 return RenderBox::percentageLogicalHeightIsResolvableFromBlock(box->containi
ngBlock(), box->isOutOfFlowPositioned()); | 4353 return RenderBox::percentageLogicalHeightIsResolvableFromBlock(box->containi
ngBlock(), box->isOutOfFlowPositioned()); |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4687 } | 4723 } |
| 4688 | 4724 |
| 4689 if (didSplitParentAnonymousBoxes) | 4725 if (didSplitParentAnonymousBoxes) |
| 4690 markBoxForRelayoutAfterSplit(this); | 4726 markBoxForRelayoutAfterSplit(this); |
| 4691 | 4727 |
| 4692 ASSERT(beforeChild->parent() == this); | 4728 ASSERT(beforeChild->parent() == this); |
| 4693 return beforeChild; | 4729 return beforeChild; |
| 4694 } | 4730 } |
| 4695 | 4731 |
| 4696 } // namespace WebCore | 4732 } // namespace WebCore |
| OLD | NEW |