Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: Source/core/rendering/RenderBox.cpp

Issue 176953008: Include the outline into the visual overflow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 statePusher.pop(); 317 statePusher.pop();
318
319 addVisualEffectOverflow();
318 invalidateBackgroundObscurationStatus(); 320 invalidateBackgroundObscurationStatus();
321
319 clearNeedsLayout(); 322 clearNeedsLayout();
320 } 323 }
321 324
322 // More IE extensions. clientWidth and clientHeight represent the interior of a n object 325 // More IE extensions. clientWidth and clientHeight represent the interior of a n object
323 // excluding border and scrollbar. 326 // excluding border and scrollbar.
324 LayoutUnit RenderBox::clientWidth() const 327 LayoutUnit RenderBox::clientWidth() const
325 { 328 {
326 return width() - borderLeft() - borderRight() - verticalScrollbarWidth(); 329 return width() - borderLeft() - borderRight() - verticalScrollbarWidth();
327 } 330 }
328 331
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 RoundedRect clipRoundedRect(0, 0, 0, 0); 1646 RoundedRect clipRoundedRect(0, 0, 0, 0);
1644 bool hasBorderRadius = style()->hasBorderRadius(); 1647 bool hasBorderRadius = style()->hasBorderRadius();
1645 if (hasBorderRadius) 1648 if (hasBorderRadius)
1646 clipRoundedRect = style()->getRoundedInnerBorderFor(LayoutRect(accumulat edOffset, size())); 1649 clipRoundedRect = style()->getRoundedInnerBorderFor(LayoutRect(accumulat edOffset, size()));
1647 1650
1648 if (contentsClipBehavior == SkipContentsClipIfPossible) { 1651 if (contentsClipBehavior == SkipContentsClipIfPossible) {
1649 LayoutRect contentsVisualOverflow = contentsVisualOverflowRect(); 1652 LayoutRect contentsVisualOverflow = contentsVisualOverflowRect();
1650 if (contentsVisualOverflow.isEmpty()) 1653 if (contentsVisualOverflow.isEmpty())
1651 return false; 1654 return false;
1652 1655
1653 // FIXME: Get rid of this slop from here and elsewhere.
1654 // Instead, properly include the outline in visual overflow.
1655 if (RenderView* view = this->view())
1656 contentsVisualOverflow.inflate(view->maximalOutlineSize());
1657
1658 LayoutRect conservativeClipRect = clipRect; 1656 LayoutRect conservativeClipRect = clipRect;
1659 if (hasBorderRadius) 1657 if (hasBorderRadius)
1660 conservativeClipRect.intersect(clipRoundedRect.radiusCenterRect()); 1658 conservativeClipRect.intersect(clipRoundedRect.radiusCenterRect());
1661 conservativeClipRect.moveBy(-accumulatedOffset); 1659 conservativeClipRect.moveBy(-accumulatedOffset);
1662 if (hasLayer()) 1660 if (hasLayer())
1663 conservativeClipRect.move(scrolledContentOffset()); 1661 conservativeClipRect.move(scrolledContentOffset());
1664 if (conservativeClipRect.contains(contentsVisualOverflow)) 1662 if (conservativeClipRect.contains(contentsVisualOverflow))
1665 return false; 1663 return false;
1666 } 1664 }
1667 1665
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1997 1995
1998 LayoutRect r = visualOverflowRect(); 1996 LayoutRect r = visualOverflowRect();
1999 1997
2000 RenderView* v = view(); 1998 RenderView* v = view();
2001 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && v) { 1999 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && v) {
2002 // FIXME: layoutDelta needs to be applied in parts before/after transfor ms and 2000 // FIXME: layoutDelta needs to be applied in parts before/after transfor ms and
2003 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 2001 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308
2004 r.move(v->layoutDelta()); 2002 r.move(v->layoutDelta());
2005 } 2003 }
2006 2004
2007 if (style()) {
2008 // We have to use maximalOutlineSize() because a child might have an out line
2009 // that projects outside of our overflowRect.
2010 if (v) {
2011 ASSERT(style()->outlineSize() <= v->maximalOutlineSize());
2012 r.inflate(v->maximalOutlineSize());
2013 }
2014 }
2015
2016 computeRectForRepaint(repaintContainer, r); 2005 computeRectForRepaint(repaintContainer, r);
2017 return r; 2006 return r;
2018 } 2007 }
2019 2008
2020 void RenderBox::computeRectForRepaint(const RenderLayerModelObject* repaintConta iner, LayoutRect& rect, bool fixed) const 2009 void RenderBox::computeRectForRepaint(const RenderLayerModelObject* repaintConta iner, LayoutRect& rect, bool fixed) const
2021 { 2010 {
2022 // The rect we compute at each step is shifted by our x/y offset in the pare nt container's coordinate space. 2011 // The rect we compute at each step is shifted by our x/y offset in the pare nt container's coordinate space.
2023 // Only when we cross a writing mode boundary will we have to possibly flipF orWritingMode (to convert into a more appropriate 2012 // Only when we cross a writing mode boundary will we have to possibly flipF orWritingMode (to convert into a more appropriate
2024 // offset corner for the enclosing container). This allows for a fully RL o r BT document to repaint 2013 // offset corner for the enclosing container). This allows for a fully RL o r BT document to repaint
2025 // properly even during layout, since the rect remains flipped all the way u ntil the end. 2014 // properly even during layout, since the rect remains flipped all the way u ntil the end.
(...skipping 2118 matching lines...) Expand 10 before | Expand all | Expand 10 after
4144 return style()->width().isAuto(); 4133 return style()->width().isAuto();
4145 } 4134 }
4146 4135
4147 bool RenderBox::avoidsFloats() const 4136 bool RenderBox::avoidsFloats() const
4148 { 4137 {
4149 return isReplaced() || hasOverflowClip() || isHR() || isLegend() || isWritin gModeRoot() || isFlexItemIncludingDeprecated(); 4138 return isReplaced() || hasOverflowClip() || isHR() || isLegend() || isWritin gModeRoot() || isFlexItemIncludingDeprecated();
4150 } 4139 }
4151 4140
4152 void RenderBox::addVisualEffectOverflow() 4141 void RenderBox::addVisualEffectOverflow()
4153 { 4142 {
4154 if (!style()->boxShadow() && !style()->hasBorderImageOutsets()) 4143 if (!style()->boxShadow() && !style()->hasBorderImageOutsets() && !style()-> hasOutline())
4155 return; 4144 return;
4156 4145
4157 bool isFlipped = style()->isFlippedBlocksWritingMode(); 4146 bool isFlipped = style()->isFlippedBlocksWritingMode();
4158 bool isHorizontal = isHorizontalWritingMode(); 4147 bool isHorizontal = isHorizontalWritingMode();
4159 4148
4160 LayoutRect borderBox = borderBoxRect(); 4149 LayoutRect borderBox = borderBoxRect();
4161 LayoutUnit overflowMinX = borderBox.x(); 4150 LayoutUnit overflowMinX = borderBox.x();
4162 LayoutUnit overflowMaxX = borderBox.maxX(); 4151 LayoutUnit overflowMaxX = borderBox.maxX();
4163 LayoutUnit overflowMinY = borderBox.y(); 4152 LayoutUnit overflowMinY = borderBox.y();
4164 LayoutUnit overflowMaxY = borderBox.maxY(); 4153 LayoutUnit overflowMaxY = borderBox.maxY();
(...skipping 18 matching lines...) Expand all
4183 LayoutBoxExtent borderOutsets = style()->borderImageOutsets(); 4172 LayoutBoxExtent borderOutsets = style()->borderImageOutsets();
4184 4173
4185 // In flipped blocks writing modes, the physical sides are inverted. For example in vertical-rl, the right 4174 // In flipped blocks writing modes, the physical sides are inverted. For example in vertical-rl, the right
4186 // border is at the lower x coordinate value. 4175 // border is at the lower x coordinate value.
4187 overflowMinX = min(overflowMinX, borderBox.x() - ((!isFlipped || isHoriz ontal) ? borderOutsets.left() : borderOutsets.right())); 4176 overflowMinX = min(overflowMinX, borderBox.x() - ((!isFlipped || isHoriz ontal) ? borderOutsets.left() : borderOutsets.right()));
4188 overflowMaxX = max(overflowMaxX, borderBox.maxX() + ((!isFlipped || isHo rizontal) ? borderOutsets.right() : borderOutsets.left())); 4177 overflowMaxX = max(overflowMaxX, borderBox.maxX() + ((!isFlipped || isHo rizontal) ? borderOutsets.right() : borderOutsets.left()));
4189 overflowMinY = min(overflowMinY, borderBox.y() - ((!isFlipped || !isHori zontal) ? borderOutsets.top() : borderOutsets.bottom())); 4178 overflowMinY = min(overflowMinY, borderBox.y() - ((!isFlipped || !isHori zontal) ? borderOutsets.top() : borderOutsets.bottom()));
4190 overflowMaxY = max(overflowMaxY, borderBox.maxY() + ((!isFlipped || !isH orizontal) ? borderOutsets.bottom() : borderOutsets.top())); 4179 overflowMaxY = max(overflowMaxY, borderBox.maxY() + ((!isFlipped || !isH orizontal) ? borderOutsets.bottom() : borderOutsets.top()));
4191 } 4180 }
4192 4181
4193 // Add in the final overflow with shadows and outsets combined. 4182 if (style()->hasOutline()) {
4183 unsigned short outlineSize = style()->outlineSize();
4184
4185 overflowMinX = min(overflowMinX, borderBox.x() - outlineSize);
4186 overflowMaxX = max(overflowMaxX, borderBox.maxX() + outlineSize);
4187 overflowMinY = min(overflowMinY, borderBox.y() - outlineSize);
4188 overflowMaxY = max(overflowMaxY, borderBox.maxY() + outlineSize);
4189 }
4190
4191 // Add in the final overflow with shadows, outsets and outline combined.
4194 LayoutRect visualEffectOverflow(overflowMinX, overflowMinY, overflowMaxX - o verflowMinX, overflowMaxY - overflowMinY); 4192 LayoutRect visualEffectOverflow(overflowMinX, overflowMinY, overflowMaxX - o verflowMinX, overflowMaxY - overflowMinY);
4195 addVisualOverflow(visualEffectOverflow); 4193 addVisualOverflow(visualEffectOverflow);
4196 } 4194 }
4197 4195
4198 void RenderBox::addOverflowFromChild(RenderBox* child, const LayoutSize& delta) 4196 void RenderBox::addOverflowFromChild(RenderBox* child, const LayoutSize& delta)
4199 { 4197 {
4200 // Never allow flow threads to propagate overflow up to a parent. 4198 // Never allow flow threads to propagate overflow up to a parent.
4201 if (child->isRenderFlowThread()) 4199 if (child->isRenderFlowThread())
4202 return; 4200 return;
4203 4201
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
4692 return 0; 4690 return 0;
4693 4691
4694 if (!layoutState && !flowThreadContainingBlock()) 4692 if (!layoutState && !flowThreadContainingBlock())
4695 return 0; 4693 return 0;
4696 4694
4697 RenderBlock* containerBlock = containingBlock(); 4695 RenderBlock* containerBlock = containingBlock();
4698 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4696 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4699 } 4697 }
4700 4698
4701 } // namespace WebCore 4699 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698