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

Side by Side Diff: Source/core/layout/LayoutFlexibleBox.cpp

Issue 1052363002: Fix a FIXME - correctly calculate the main size when writing modes are involved. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: test should be fixed now Created 5 years, 8 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/css3/flexbox/orthogonal-writing-modes-and-intrinsic-sizing-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) 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 computeLogicalHeight(borderBoxLogicalHeight, logicalTop(), computedValue s); 403 computeLogicalHeight(borderBoxLogicalHeight, logicalTop(), computedValue s);
404 if (computedValues.m_extent == LayoutUnit::max()) 404 if (computedValues.m_extent == LayoutUnit::max())
405 return computedValues.m_extent; 405 return computedValues.m_extent;
406 return std::max(LayoutUnit(0), computedValues.m_extent - borderPaddingAn dScrollbar); 406 return std::max(LayoutUnit(0), computedValues.m_extent - borderPaddingAn dScrollbar);
407 } 407 }
408 return contentLogicalWidth(); 408 return contentLogicalWidth();
409 } 409 }
410 410
411 LayoutUnit LayoutFlexibleBox::computeMainAxisExtentForChild(LayoutBox& child, Si zeType sizeType, const Length& size) 411 LayoutUnit LayoutFlexibleBox::computeMainAxisExtentForChild(LayoutBox& child, Si zeType sizeType, const Length& size)
412 { 412 {
413 // FIXME: This is wrong for orthogonal flows. It should use the flexbox's wr iting-mode, not the child's in order 413 // If we have a horizontal flow, that means the main size is the width.
414 // to figure out the logical height/width. 414 // That's the logical width for horizontal writing modes, and the logical he ight in vertical writing modes.
415 if (isColumnFlow()) { 415 // For a vertical flow, main size is the height, so it's the inverse.
416 // So we need the logical width if we have a horizontal flow and horizontal writing mode, or vertical flow and vertical writing mode.
417 // Otherwise we need the logical height.
418 if (isHorizontalFlow() != child.styleRef().isHorizontalWritingMode()) {
416 // We don't have to check for "auto" here - computeContentLogicalHeight will just return -1 for that case anyway. 419 // We don't have to check for "auto" here - computeContentLogicalHeight will just return -1 for that case anyway.
417 if (size.isIntrinsic()) 420 if (size.isIntrinsic())
418 child.layoutIfNeeded(); 421 child.layoutIfNeeded();
419 return child.computeContentLogicalHeight(size, child.logicalHeight() - c hild.borderAndPaddingLogicalHeight()) + child.scrollbarLogicalHeight(); 422 return child.computeContentLogicalHeight(size, child.logicalHeight() - c hild.borderAndPaddingLogicalHeight()) + child.scrollbarLogicalHeight();
420 } 423 }
421 return child.computeLogicalWidthUsing(sizeType, size, contentLogicalWidth(), this) - child.borderAndPaddingLogicalWidth(); 424 return child.computeLogicalWidthUsing(sizeType, size, contentLogicalWidth(), this) - child.borderAndPaddingLogicalWidth();
422 } 425 }
423 426
424 WritingMode LayoutFlexibleBox::transformedWritingMode() const 427 WritingMode LayoutFlexibleBox::transformedWritingMode() const
425 { 428 {
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 ASSERT(child); 1401 ASSERT(child);
1399 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1402 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1400 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1403 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1401 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1404 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1402 adjustAlignmentForChild(*child, newOffset - originalOffset); 1405 adjustAlignmentForChild(*child, newOffset - originalOffset);
1403 } 1406 }
1404 } 1407 }
1405 } 1408 }
1406 1409
1407 } 1410 }
OLDNEW
« no previous file with comments | « LayoutTests/css3/flexbox/orthogonal-writing-modes-and-intrinsic-sizing-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698