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

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

Issue 129853005: Fix checkForRepaintDuringLayout do return false when doing repaintAfterLayout. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Created 6 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/rendering/RenderFlexibleBox.h" 32 #include "core/rendering/RenderFlexibleBox.h"
33 33
34 #include <limits> 34 #include "core/rendering/LayoutRectRecorder.h"
35 #include "core/rendering/LayoutRepainter.h" 35 #include "core/rendering/LayoutRepainter.h"
36 #include "core/rendering/RenderLayer.h" 36 #include "core/rendering/RenderLayer.h"
37 #include "core/rendering/RenderView.h" 37 #include "core/rendering/RenderView.h"
38 #include "platform/LengthFunctions.h" 38 #include "platform/LengthFunctions.h"
39 #include "wtf/MathExtras.h" 39 #include "wtf/MathExtras.h"
40 #include <limits>
40 41
41 namespace WebCore { 42 namespace WebCore {
42 43
43 struct RenderFlexibleBox::LineContext { 44 struct RenderFlexibleBox::LineContext {
44 LineContext(LayoutUnit crossAxisOffset, LayoutUnit crossAxisExtent, size_t n umberOfChildren, LayoutUnit maxAscent) 45 LineContext(LayoutUnit crossAxisOffset, LayoutUnit crossAxisExtent, size_t n umberOfChildren, LayoutUnit maxAscent)
45 : crossAxisOffset(crossAxisOffset) 46 : crossAxisOffset(crossAxisOffset)
46 , crossAxisExtent(crossAxisExtent) 47 , crossAxisExtent(crossAxisExtent)
47 , numberOfChildren(numberOfChildren) 48 , numberOfChildren(numberOfChildren)
48 , maxAscent(maxAscent) 49 , maxAscent(maxAscent)
49 { 50 {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 221 }
221 222
222 void RenderFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit) 223 void RenderFlexibleBox::layoutBlock(bool relayoutChildren, LayoutUnit)
223 { 224 {
224 ASSERT(needsLayout()); 225 ASSERT(needsLayout());
225 226
226 if (!relayoutChildren && simplifiedLayout()) 227 if (!relayoutChildren && simplifiedLayout())
227 return; 228 return;
228 229
229 LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); 230 LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
231 LayoutRectRecorder recorder(*this);
230 232
231 if (updateLogicalWidthAndColumnWidth()) 233 if (updateLogicalWidthAndColumnWidth())
232 relayoutChildren = true; 234 relayoutChildren = true;
233 235
234 LayoutUnit previousHeight = logicalHeight(); 236 LayoutUnit previousHeight = logicalHeight();
235 setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight()) ; 237 setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight()) ;
236 238
237 LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransfo rm() || hasReflection() || style()->isFlippedBlocksWritingMode()); 239 LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransfo rm() || hasReflection() || style()->isFlippedBlocksWritingMode());
238 240
239 // Regions changing widths can force us to relayout our children. 241 // Regions changing widths can force us to relayout our children.
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 if (style()->flexDirection() == FlowRowReverse) 1063 if (style()->flexDirection() == FlowRowReverse)
1062 mainAxisOffset += isHorizontalFlow() ? verticalScrollbarWidth() : horizo ntalScrollbarHeight(); 1064 mainAxisOffset += isHorizontalFlow() ? verticalScrollbarWidth() : horizo ntalScrollbarHeight();
1063 1065
1064 LayoutUnit totalMainExtent = mainAxisExtent(); 1066 LayoutUnit totalMainExtent = mainAxisExtent();
1065 LayoutUnit maxAscent = 0, maxDescent = 0; // Used when align-items: baseline . 1067 LayoutUnit maxAscent = 0, maxDescent = 0; // Used when align-items: baseline .
1066 LayoutUnit maxChildCrossAxisExtent = 0; 1068 LayoutUnit maxChildCrossAxisExtent = 0;
1067 size_t seenInFlowPositionedChildren = 0; 1069 size_t seenInFlowPositionedChildren = 0;
1068 bool shouldFlipMainAxis = !isColumnFlow() && !isLeftToRightFlow(); 1070 bool shouldFlipMainAxis = !isColumnFlow() && !isLeftToRightFlow();
1069 for (size_t i = 0; i < children.size(); ++i) { 1071 for (size_t i = 0; i < children.size(); ++i) {
1070 RenderBox* child = children[i]; 1072 RenderBox* child = children[i];
1073 LayoutRectRecorder recorder(*child);
1074
1071 if (child->isOutOfFlowPositioned()) { 1075 if (child->isOutOfFlowPositioned()) {
1072 prepareChildForPositionedLayout(child, mainAxisOffset, crossAxisOffs et, FlipForRowReverse); 1076 prepareChildForPositionedLayout(child, mainAxisOffset, crossAxisOffs et, FlipForRowReverse);
1073 continue; 1077 continue;
1074 } 1078 }
1075 1079
1076 LayoutUnit childPreferredSize = childSizes[i] + mainAxisBorderAndPadding ExtentForChild(child); 1080 LayoutUnit childPreferredSize = childSizes[i] + mainAxisBorderAndPadding ExtentForChild(child);
1077 setLogicalOverrideSize(child, childPreferredSize); 1081 setLogicalOverrideSize(child, childPreferredSize);
1078 if (childPreferredSize != mainAxisExtentForChild(child)) { 1082 if (childPreferredSize != mainAxisExtentForChild(child)) {
1079 child->setChildNeedsLayout(MarkOnlyThis); 1083 child->setChildNeedsLayout(MarkOnlyThis);
1080 } else { 1084 } else {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 // starting from the end of the flexbox. We also don't need to layout anythi ng since we're 1144 // starting from the end of the flexbox. We also don't need to layout anythi ng since we're
1141 // just moving the children to a new position. 1145 // just moving the children to a new position.
1142 size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren( children); 1146 size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren( children);
1143 LayoutUnit mainAxisOffset = logicalHeight() - flowAwareBorderEnd() - flowAwa rePaddingEnd(); 1147 LayoutUnit mainAxisOffset = logicalHeight() - flowAwareBorderEnd() - flowAwa rePaddingEnd();
1144 mainAxisOffset -= initialJustifyContentOffset(availableFreeSpace, style()->j ustifyContent(), numberOfChildrenForJustifyContent); 1148 mainAxisOffset -= initialJustifyContentOffset(availableFreeSpace, style()->j ustifyContent(), numberOfChildrenForJustifyContent);
1145 mainAxisOffset -= isHorizontalFlow() ? verticalScrollbarWidth() : horizontal ScrollbarHeight(); 1149 mainAxisOffset -= isHorizontalFlow() ? verticalScrollbarWidth() : horizontal ScrollbarHeight();
1146 1150
1147 size_t seenInFlowPositionedChildren = 0; 1151 size_t seenInFlowPositionedChildren = 0;
1148 for (size_t i = 0; i < children.size(); ++i) { 1152 for (size_t i = 0; i < children.size(); ++i) {
1149 RenderBox* child = children[i]; 1153 RenderBox* child = children[i];
1154 LayoutRectRecorder recorder(*child);
1155
1150 if (child->isOutOfFlowPositioned()) { 1156 if (child->isOutOfFlowPositioned()) {
1151 child->layer()->setStaticBlockPosition(mainAxisOffset); 1157 child->layer()->setStaticBlockPosition(mainAxisOffset);
1152 continue; 1158 continue;
1153 } 1159 }
1154 mainAxisOffset -= mainAxisExtentForChild(child) + flowAwareMarginEndForC hild(child); 1160 mainAxisOffset -= mainAxisExtentForChild(child) + flowAwareMarginEndForC hild(child);
1155 1161
1156 setFlowAwareLocationForChild(child, LayoutPoint(mainAxisOffset, crossAxi sOffset + flowAwareMarginBeforeForChild(child))); 1162 setFlowAwareLocationForChild(child, LayoutPoint(mainAxisOffset, crossAxi sOffset + flowAwareMarginBeforeForChild(child)));
1157 1163
1158 mainAxisOffset -= flowAwareMarginStartForChild(child); 1164 mainAxisOffset -= flowAwareMarginStartForChild(child);
1159 1165
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 ASSERT(child); 1362 ASSERT(child);
1357 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1363 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1358 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1364 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1359 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1365 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1360 adjustAlignmentForChild(child, newOffset - originalOffset); 1366 adjustAlignmentForChild(child, newOffset - originalOffset);
1361 } 1367 }
1362 } 1368 }
1363 } 1369 }
1364 1370
1365 } 1371 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlockLineLayout.cpp ('k') | Source/core/rendering/RenderFrameSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698