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

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

Issue 347393007: Fix shadow repaint issue in vertical-rl mode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix bug first. Refactor later. Created 6 years, 5 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
« no previous file with comments | « LayoutTests/fast/box-shadow/shadow-box-resize-writing-mode-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4052 matching lines...) Expand 10 before | Expand all | Expand 10 after
4063 // is childless, though. 4063 // is childless, though.
4064 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild()) 4064 if (view()->layoutState()->pageLogicalHeightChanged() && slowFirstChild())
4065 layoutScope.setChildNeedsLayout(this); 4065 layoutScope.setChildNeedsLayout(this);
4066 } 4066 }
4067 4067
4068 void RenderBox::addVisualEffectOverflow() 4068 void RenderBox::addVisualEffectOverflow()
4069 { 4069 {
4070 if (!style()->boxShadow() && !style()->hasBorderImageOutsets() && !style()-> hasOutline()) 4070 if (!style()->boxShadow() && !style()->hasBorderImageOutsets() && !style()-> hasOutline())
4071 return; 4071 return;
4072 4072
4073 bool isFlipped = style()->isFlippedBlocksWritingMode();
4074 bool isHorizontal = isHorizontalWritingMode();
4075
4076 LayoutRect borderBox = borderBoxRect(); 4073 LayoutRect borderBox = borderBoxRect();
4077 LayoutUnit overflowMinX = borderBox.x(); 4074 LayoutUnit overflowMinX = borderBox.x();
4078 LayoutUnit overflowMaxX = borderBox.maxX(); 4075 LayoutUnit overflowMaxX = borderBox.maxX();
4079 LayoutUnit overflowMinY = borderBox.y(); 4076 LayoutUnit overflowMinY = borderBox.y();
4080 LayoutUnit overflowMaxY = borderBox.maxY(); 4077 LayoutUnit overflowMaxY = borderBox.maxY();
4081 4078
4082 // Compute box-shadow overflow first. 4079 // Compute box-shadow overflow first.
4083 if (style()->boxShadow()) { 4080 if (style()->boxShadow()) {
4084 LayoutUnit shadowLeft; 4081 LayoutUnit shadowLeft;
4085 LayoutUnit shadowRight; 4082 LayoutUnit shadowRight;
4086 LayoutUnit shadowTop; 4083 LayoutUnit shadowTop;
4087 LayoutUnit shadowBottom; 4084 LayoutUnit shadowBottom;
4088 style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadow Left); 4085 style()->getBoxShadowExtent(shadowTop, shadowRight, shadowBottom, shadow Left);
4089 4086
4090 // In flipped blocks writing modes such as vertical-rl, the physical rig ht shadow value is actually at the lower x-coordinate. 4087 // Note that box-shadow extent's left and top are negative when extends to left and top, respectively.
4091 overflowMinX = borderBox.x() + ((!isFlipped || isHorizontal) ? shadowLef t : -shadowRight); 4088 overflowMinX = borderBox.x() + shadowLeft;
4092 overflowMaxX = borderBox.maxX() + ((!isFlipped || isHorizontal) ? shadow Right : -shadowLeft); 4089 overflowMaxX = borderBox.maxX() + shadowRight;
4093 overflowMinY = borderBox.y() + ((!isFlipped || !isHorizontal) ? shadowTo p : -shadowBottom); 4090 overflowMinY = borderBox.y() + shadowTop;
4094 overflowMaxY = borderBox.maxY() + ((!isFlipped || !isHorizontal) ? shado wBottom : -shadowTop); 4091 overflowMaxY = borderBox.maxY() + shadowBottom;
4095 } 4092 }
4096 4093
4097 // Now compute border-image-outset overflow. 4094 // Now compute border-image-outset overflow.
4098 if (style()->hasBorderImageOutsets()) { 4095 if (style()->hasBorderImageOutsets()) {
4099 LayoutBoxExtent borderOutsets = style()->borderImageOutsets(); 4096 LayoutBoxExtent borderOutsets = style()->borderImageOutsets();
4100 4097
4101 // In flipped blocks writing modes, the physical sides are inverted. For example in vertical-rl, the right 4098 overflowMinX = std::min(overflowMinX, borderBox.x() - borderOutsets.left ());
4102 // border is at the lower x coordinate value. 4099 overflowMaxX = std::max(overflowMaxX, borderBox.maxX() + borderOutsets.r ight());
4103 overflowMinX = std::min(overflowMinX, borderBox.x() - ((!isFlipped || is Horizontal) ? borderOutsets.left() : borderOutsets.right())); 4100 overflowMinY = std::min(overflowMinY, borderBox.y() - borderOutsets.top( ));
4104 overflowMaxX = std::max(overflowMaxX, borderBox.maxX() + ((!isFlipped || isHorizontal) ? borderOutsets.right() : borderOutsets.left())); 4101 overflowMaxY = std::max(overflowMaxY, borderBox.maxY() + borderOutsets.b ottom());
4105 overflowMinY = std::min(overflowMinY, borderBox.y() - ((!isFlipped || !i sHorizontal) ? borderOutsets.top() : borderOutsets.bottom()));
4106 overflowMaxY = std::max(overflowMaxY, borderBox.maxY() + ((!isFlipped || !isHorizontal) ? borderOutsets.bottom() : borderOutsets.top()));
4107 } 4102 }
4108 4103
4109 if (style()->hasOutline()) { 4104 if (style()->hasOutline()) {
4110 LayoutUnit outlineSize = style()->outlineSize(); 4105 LayoutUnit outlineSize = style()->outlineSize();
4111 4106
4112 overflowMinX = std::min(overflowMinX, borderBox.x() - outlineSize); 4107 overflowMinX = std::min(overflowMinX, borderBox.x() - outlineSize);
4113 overflowMaxX = std::max(overflowMaxX, borderBox.maxX() + outlineSize); 4108 overflowMaxX = std::max(overflowMaxX, borderBox.maxX() + outlineSize);
4114 overflowMinY = std::min(overflowMinY, borderBox.y() - outlineSize); 4109 overflowMinY = std::min(overflowMinY, borderBox.y() - outlineSize);
4115 overflowMaxY = std::max(overflowMaxY, borderBox.maxY() + outlineSize); 4110 overflowMaxY = std::max(overflowMaxY, borderBox.maxY() + outlineSize);
4116 } 4111 }
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
4610 return 0; 4605 return 0;
4611 4606
4612 if (!layoutState && !flowThreadContainingBlock()) 4607 if (!layoutState && !flowThreadContainingBlock())
4613 return 0; 4608 return 0;
4614 4609
4615 RenderBlock* containerBlock = containingBlock(); 4610 RenderBlock* containerBlock = containingBlock();
4616 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4611 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4617 } 4612 }
4618 4613
4619 } // namespace WebCore 4614 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/box-shadow/shadow-box-resize-writing-mode-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698