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

Side by Side Diff: sky/engine/core/rendering/RenderFlexibleBox.cpp

Issue 684383002: Delete a ton more dead vertical writing mode code. (Closed) Base URL: git@github.com:domokit/mojo.git@writingmode1
Patch Set: Created 6 years, 1 month 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 void RenderFlexibleBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidt h, LayoutUnit& maxLogicalWidth) const 94 void RenderFlexibleBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidt h, LayoutUnit& maxLogicalWidth) const
95 { 95 {
96 // FIXME: We're ignoring flex-basis here and we shouldn't. We can't start ho noring it though until 96 // FIXME: We're ignoring flex-basis here and we shouldn't. We can't start ho noring it though until
97 // the flex shorthand stops setting it to 0. 97 // the flex shorthand stops setting it to 0.
98 // See https://bugs.webkit.org/show_bug.cgi?id=116117 and http://crbug.com/2 40765. 98 // See https://bugs.webkit.org/show_bug.cgi?id=116117 and http://crbug.com/2 40765.
99 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) { 99 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) {
100 if (child->isOutOfFlowPositioned()) 100 if (child->isOutOfFlowPositioned())
101 continue; 101 continue;
102 102
103 LayoutUnit margin = marginIntrinsicLogicalWidthForChild(child); 103 LayoutUnit margin = marginIntrinsicLogicalWidthForChild(child);
104 bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != isHo rizontalWritingMode(); 104 LayoutUnit minPreferredLogicalWidth = child->minPreferredLogicalWidth();
105 LayoutUnit minPreferredLogicalWidth = hasOrthogonalWritingMode ? child-> logicalHeight() : child->minPreferredLogicalWidth(); 105 LayoutUnit maxPreferredLogicalWidth = child->maxPreferredLogicalWidth();
106 LayoutUnit maxPreferredLogicalWidth = hasOrthogonalWritingMode ? child-> logicalHeight() : child->maxPreferredLogicalWidth();
107 minPreferredLogicalWidth += margin; 106 minPreferredLogicalWidth += margin;
108 maxPreferredLogicalWidth += margin; 107 maxPreferredLogicalWidth += margin;
109 if (!isColumnFlow()) { 108 if (!isColumnFlow()) {
110 maxLogicalWidth += maxPreferredLogicalWidth; 109 maxLogicalWidth += maxPreferredLogicalWidth;
111 if (isMultiline()) { 110 if (isMultiline()) {
112 // For multiline, the min preferred width is if you put a break between each item. 111 // For multiline, the min preferred width is if you put a break between each item.
113 minLogicalWidth = std::max(minLogicalWidth, minPreferredLogicalW idth); 112 minLogicalWidth = std::max(minLogicalWidth, minPreferredLogicalW idth);
114 } else 113 } else
115 minLogicalWidth += minPreferredLogicalWidth; 114 minLogicalWidth += minPreferredLogicalWidth;
116 } else { 115 } else {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 continue; 302 continue;
304 LayoutUnit childLogicalBottom = logicalTopForChild(child) + logicalHeigh tForChild(child) + marginAfterForChild(child); 303 LayoutUnit childLogicalBottom = logicalTopForChild(child) + logicalHeigh tForChild(child) + marginAfterForChild(child);
305 maxChildLogicalBottom = std::max(maxChildLogicalBottom, childLogicalBott om); 304 maxChildLogicalBottom = std::max(maxChildLogicalBottom, childLogicalBott om);
306 } 305 }
307 return std::max(clientLogicalBottom(), maxChildLogicalBottom + paddingAfter( )); 306 return std::max(clientLogicalBottom(), maxChildLogicalBottom + paddingAfter( ));
308 } 307 }
309 308
310 bool RenderFlexibleBox::hasOrthogonalFlow(RenderBox* child) const 309 bool RenderFlexibleBox::hasOrthogonalFlow(RenderBox* child) const
311 { 310 {
312 // FIXME: If the child is a flexbox, then we need to check isHorizontalFlow. 311 // FIXME: If the child is a flexbox, then we need to check isHorizontalFlow.
313 return isHorizontalFlow() != child->isHorizontalWritingMode(); 312 return !isHorizontalFlow();
314 } 313 }
315 314
316 bool RenderFlexibleBox::isColumnFlow() const 315 bool RenderFlexibleBox::isColumnFlow() const
317 { 316 {
318 return style()->isColumnFlexDirection(); 317 return style()->isColumnFlexDirection();
319 } 318 }
320 319
321 bool RenderFlexibleBox::isHorizontalFlow() const 320 bool RenderFlexibleBox::isHorizontalFlow() const
322 { 321 {
323 if (isHorizontalWritingMode()) 322 return !isColumnFlow();
324 return !isColumnFlow();
325 return isColumnFlow();
326 } 323 }
327 324
328 bool RenderFlexibleBox::isLeftToRightFlow() const 325 bool RenderFlexibleBox::isLeftToRightFlow() const
329 { 326 {
330 if (isColumnFlow()) 327 if (isColumnFlow())
331 return true; 328 return true;
332 return style()->isLeftToRightDirection() ^ (style()->flexDirection() == Flow RowReverse); 329 return style()->isLeftToRightDirection() ^ (style()->flexDirection() == Flow RowReverse);
333 } 330 }
334 331
335 bool RenderFlexibleBox::isMultiline() const 332 bool RenderFlexibleBox::isMultiline() const
(...skipping 15 matching lines...) Expand all
351 } 348 }
352 349
353 static inline LayoutUnit constrainedChildIntrinsicContentLogicalHeight(RenderBox * child) 350 static inline LayoutUnit constrainedChildIntrinsicContentLogicalHeight(RenderBox * child)
354 { 351 {
355 LayoutUnit childIntrinsicContentLogicalHeight = child->intrinsicContentLogic alHeight(); 352 LayoutUnit childIntrinsicContentLogicalHeight = child->intrinsicContentLogic alHeight();
356 return child->constrainLogicalHeightByMinMax(childIntrinsicContentLogicalHei ght + child->borderAndPaddingLogicalHeight(), childIntrinsicContentLogicalHeight ); 353 return child->constrainLogicalHeightByMinMax(childIntrinsicContentLogicalHei ght + child->borderAndPaddingLogicalHeight(), childIntrinsicContentLogicalHeight );
357 } 354 }
358 355
359 LayoutUnit RenderFlexibleBox::childIntrinsicHeight(RenderBox* child) const 356 LayoutUnit RenderFlexibleBox::childIntrinsicHeight(RenderBox* child) const
360 { 357 {
361 if (child->isHorizontalWritingMode() && needToStretchChildLogicalHeight(chil d)) 358 if (needToStretchChildLogicalHeight(child))
362 return constrainedChildIntrinsicContentLogicalHeight(child); 359 return constrainedChildIntrinsicContentLogicalHeight(child);
363 return child->height(); 360 return child->height();
364 } 361 }
365 362
366 LayoutUnit RenderFlexibleBox::childIntrinsicWidth(RenderBox* child) const 363 LayoutUnit RenderFlexibleBox::childIntrinsicWidth(RenderBox* child) const
367 { 364 {
368 if (!child->isHorizontalWritingMode() && needToStretchChildLogicalHeight(chi ld)) 365 // FIXME(sky): Remove
369 return constrainedChildIntrinsicContentLogicalHeight(child);
370 return child->width(); 366 return child->width();
371 } 367 }
372 368
373 LayoutUnit RenderFlexibleBox::crossAxisIntrinsicExtentForChild(RenderBox* child) const 369 LayoutUnit RenderFlexibleBox::crossAxisIntrinsicExtentForChild(RenderBox* child) const
374 { 370 {
375 return isHorizontalFlow() ? childIntrinsicHeight(child) : childIntrinsicWidt h(child); 371 return isHorizontalFlow() ? childIntrinsicHeight(child) : childIntrinsicWidt h(child);
376 } 372 }
377 373
378 LayoutUnit RenderFlexibleBox::mainAxisExtentForChild(RenderBox* child) const 374 LayoutUnit RenderFlexibleBox::mainAxisExtentForChild(RenderBox* child) const
379 { 375 {
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 child->setMarginRight(availableAlignmentSpace / 2); 690 child->setMarginRight(availableAlignmentSpace / 2);
695 } 691 }
696 return true; 692 return true;
697 } 693 }
698 bool shouldAdjustTopOrLeft = true; 694 bool shouldAdjustTopOrLeft = true;
699 if (isColumnFlow() && !child->style()->isLeftToRightDirection()) { 695 if (isColumnFlow() && !child->style()->isLeftToRightDirection()) {
700 // For column flows, only make this adjustment if topOrLeft corresponds to the "before" margin, 696 // For column flows, only make this adjustment if topOrLeft corresponds to the "before" margin,
701 // so that flipForRightToLeftColumn will do the right thing. 697 // so that flipForRightToLeftColumn will do the right thing.
702 shouldAdjustTopOrLeft = false; 698 shouldAdjustTopOrLeft = false;
703 } 699 }
704 if (!isColumnFlow() && child->style()->isFlippedBlocksWritingMode()) {
705 // If we are a flipped writing mode, we need to adjust the opposite side . This is only needed
706 // for row flows because this only affects the block-direction axis.
707 shouldAdjustTopOrLeft = false;
708 }
709 700
710 if (topOrLeft.isAuto()) { 701 if (topOrLeft.isAuto()) {
711 if (shouldAdjustTopOrLeft) 702 if (shouldAdjustTopOrLeft)
712 adjustAlignmentForChild(child, availableAlignmentSpace); 703 adjustAlignmentForChild(child, availableAlignmentSpace);
713 704
714 if (isHorizontal) 705 if (isHorizontal)
715 child->setMarginTop(availableAlignmentSpace); 706 child->setMarginTop(availableAlignmentSpace);
716 else 707 else
717 child->setMarginLeft(availableAlignmentSpace); 708 child->setMarginLeft(availableAlignmentSpace);
718 return true; 709 return true;
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 ASSERT(child); 1320 ASSERT(child);
1330 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1321 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1331 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1322 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1332 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1323 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1333 adjustAlignmentForChild(child, newOffset - originalOffset); 1324 adjustAlignmentForChild(child, newOffset - originalOffset);
1334 } 1325 }
1335 } 1326 }
1336 } 1327 }
1337 1328
1338 } 1329 }
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderCombineText.cpp ('k') | sky/engine/core/rendering/RenderGeometryMap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698