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

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

Issue 153233002: *** DO NOT LAND *** Remove regions support, keeping a bare minimum to support "region-based"... (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 LayoutRectRecorder recorder(*this); 236 LayoutRectRecorder recorder(*this);
237 237
238 if (updateLogicalWidthAndColumnWidth()) 238 if (updateLogicalWidthAndColumnWidth())
239 relayoutChildren = true; 239 relayoutChildren = true;
240 240
241 LayoutUnit previousHeight = logicalHeight(); 241 LayoutUnit previousHeight = logicalHeight();
242 setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight()) ; 242 setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight()) ;
243 243
244 LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransfo rm() || hasReflection() || style()->isFlippedBlocksWritingMode()); 244 LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransfo rm() || hasReflection() || style()->isFlippedBlocksWritingMode());
245 245
246 // Regions changing widths can force us to relayout our children.
247 RenderFlowThread* flowThread = flowThreadContainingBlock(); 246 RenderFlowThread* flowThread = flowThreadContainingBlock();
248 if (logicalWidthChangedInRegions(flowThread))
249 relayoutChildren = true;
250 if (updateRegionsAndShapesLogicalSize(flowThread)) 247 if (updateRegionsAndShapesLogicalSize(flowThread))
251 relayoutChildren = true; 248 relayoutChildren = true;
252 249
253 m_numberOfInFlowChildrenOnFirstLine = -1; 250 m_numberOfInFlowChildrenOnFirstLine = -1;
254 251
255 RenderBlock::startDelayUpdateScrollInfo(); 252 RenderBlock::startDelayUpdateScrollInfo();
256 253
257 prepareOrderIteratorAndMargins(); 254 prepareOrderIteratorAndMargins();
258 255
259 ChildFrameRects oldChildRects; 256 ChildFrameRects oldChildRects;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 LayoutUnit RenderFlexibleBox::computeMainAxisExtentForChild(RenderBox* child, Si zeType sizeType, const Length& size) 437 LayoutUnit RenderFlexibleBox::computeMainAxisExtentForChild(RenderBox* child, Si zeType sizeType, const Length& size)
441 { 438 {
442 // FIXME: This is wrong for orthogonal flows. It should use the flexbox's wr iting-mode, not the child's in order 439 // FIXME: This is wrong for orthogonal flows. It should use the flexbox's wr iting-mode, not the child's in order
443 // to figure out the logical height/width. 440 // to figure out the logical height/width.
444 if (isColumnFlow()) { 441 if (isColumnFlow()) {
445 // We don't have to check for "auto" here - computeContentLogicalHeight will just return -1 for that case anyway. 442 // We don't have to check for "auto" here - computeContentLogicalHeight will just return -1 for that case anyway.
446 if (size.isIntrinsic()) 443 if (size.isIntrinsic())
447 child->layoutIfNeeded(); 444 child->layoutIfNeeded();
448 return child->computeContentLogicalHeight(size, child->logicalHeight() - child->borderAndPaddingLogicalHeight()); 445 return child->computeContentLogicalHeight(size, child->logicalHeight() - child->borderAndPaddingLogicalHeight());
449 } 446 }
450 // FIXME: Figure out how this should work for regions and pass in the approp riate values. 447 return child->computeLogicalWidthUsing(sizeType, size, contentLogicalWidth() , this) - child->borderAndPaddingLogicalWidth();
451 RenderRegion* region = 0;
452 return child->computeLogicalWidthInRegionUsing(sizeType, size, contentLogica lWidth(), this, region) - child->borderAndPaddingLogicalWidth();
453 } 448 }
454 449
455 WritingMode RenderFlexibleBox::transformedWritingMode() const 450 WritingMode RenderFlexibleBox::transformedWritingMode() const
456 { 451 {
457 WritingMode mode = style()->writingMode(); 452 WritingMode mode = style()->writingMode();
458 if (!isColumnFlow()) 453 if (!isColumnFlow())
459 return mode; 454 return mode;
460 455
461 switch (mode) { 456 switch (mode) {
462 case TopToBottomWritingMode: 457 case TopToBottomWritingMode:
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 } 1007 }
1013 1008
1014 void RenderFlexibleBox::prepareChildForPositionedLayout(RenderBox* child, Layout Unit mainAxisOffset, LayoutUnit crossAxisOffset, PositionedLayoutMode layoutMode ) 1009 void RenderFlexibleBox::prepareChildForPositionedLayout(RenderBox* child, Layout Unit mainAxisOffset, LayoutUnit crossAxisOffset, PositionedLayoutMode layoutMode )
1015 { 1010 {
1016 ASSERT(child->isOutOfFlowPositioned()); 1011 ASSERT(child->isOutOfFlowPositioned());
1017 child->containingBlock()->insertPositionedObject(child); 1012 child->containingBlock()->insertPositionedObject(child);
1018 RenderLayer* childLayer = child->layer(); 1013 RenderLayer* childLayer = child->layer();
1019 LayoutUnit inlinePosition = isColumnFlow() ? crossAxisOffset : mainAxisOffse t; 1014 LayoutUnit inlinePosition = isColumnFlow() ? crossAxisOffset : mainAxisOffse t;
1020 if (layoutMode == FlipForRowReverse && style()->flexDirection() == FlowRowRe verse) 1015 if (layoutMode == FlipForRowReverse && style()->flexDirection() == FlowRowRe verse)
1021 inlinePosition = mainAxisExtent() - mainAxisOffset; 1016 inlinePosition = mainAxisExtent() - mainAxisOffset;
1022 childLayer->setStaticInlinePosition(inlinePosition); // FIXME: Not right for regions. 1017 childLayer->setStaticInlinePosition(inlinePosition);
1023 1018
1024 LayoutUnit staticBlockPosition = isColumnFlow() ? mainAxisOffset : crossAxis Offset; 1019 LayoutUnit staticBlockPosition = isColumnFlow() ? mainAxisOffset : crossAxis Offset;
1025 if (childLayer->staticBlockPosition() != staticBlockPosition) { 1020 if (childLayer->staticBlockPosition() != staticBlockPosition) {
1026 childLayer->setStaticBlockPosition(staticBlockPosition); 1021 childLayer->setStaticBlockPosition(staticBlockPosition);
1027 if (child->style()->hasStaticBlockPosition(style()->isHorizontalWritingM ode())) 1022 if (child->style()->hasStaticBlockPosition(style()->isHorizontalWritingM ode()))
1028 child->setChildNeedsLayout(MarkOnlyThis); 1023 child->setChildNeedsLayout(MarkOnlyThis);
1029 } 1024 }
1030 } 1025 }
1031 1026
1032 ItemPosition RenderFlexibleBox::alignmentForChild(RenderBox* child) const 1027 ItemPosition RenderFlexibleBox::alignmentForChild(RenderBox* child) const
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 if (desiredLogicalHeight != child->logicalHeight()) { 1347 if (desiredLogicalHeight != child->logicalHeight()) {
1353 child->setOverrideLogicalContentHeight(desiredLogicalHeight - ch ild->borderAndPaddingLogicalHeight()); 1348 child->setOverrideLogicalContentHeight(desiredLogicalHeight - ch ild->borderAndPaddingLogicalHeight());
1354 child->setLogicalHeight(0); 1349 child->setLogicalHeight(0);
1355 child->forceChildLayout(); 1350 child->forceChildLayout();
1356 } 1351 }
1357 } 1352 }
1358 } else if (isColumnFlow() && child->style()->logicalWidth().isAuto()) { 1353 } else if (isColumnFlow() && child->style()->logicalWidth().isAuto()) {
1359 // FIXME: If the child doesn't have orthogonal flow, then it already has an override width set, so use it. 1354 // FIXME: If the child doesn't have orthogonal flow, then it already has an override width set, so use it.
1360 if (hasOrthogonalFlow(child)) { 1355 if (hasOrthogonalFlow(child)) {
1361 LayoutUnit childWidth = std::max<LayoutUnit>(0, lineCrossAxisExtent - crossAxisMarginExtentForChild(child)); 1356 LayoutUnit childWidth = std::max<LayoutUnit>(0, lineCrossAxisExtent - crossAxisMarginExtentForChild(child));
1362 childWidth = child->constrainLogicalWidthInRegionByMinMax(childWidth , childWidth, this); 1357 childWidth = child->constrainLogicalWidthByMinMax(childWidth, childW idth, this);
1363 1358
1364 if (childWidth != child->logicalWidth()) { 1359 if (childWidth != child->logicalWidth()) {
1365 child->setOverrideLogicalContentWidth(childWidth - child->border AndPaddingLogicalWidth()); 1360 child->setOverrideLogicalContentWidth(childWidth - child->border AndPaddingLogicalWidth());
1366 child->forceChildLayout(); 1361 child->forceChildLayout();
1367 } 1362 }
1368 } 1363 }
1369 } 1364 }
1370 } 1365 }
1371 1366
1372 void RenderFlexibleBox::flipForRightToLeftColumn() 1367 void RenderFlexibleBox::flipForRightToLeftColumn()
(...skipping 22 matching lines...) Expand all
1395 ASSERT(child); 1390 ASSERT(child);
1396 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1391 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1397 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1392 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1398 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1393 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1399 adjustAlignmentForChild(child, newOffset - originalOffset); 1394 adjustAlignmentForChild(child, newOffset - originalOffset);
1400 } 1395 }
1401 } 1396 }
1402 } 1397 }
1403 1398
1404 } 1399 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderDeprecatedFlexibleBox.cpp ('k') | Source/core/rendering/RenderFlowThread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698