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

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

Issue 1549153002: Fix preferred logical widths of orthogonal writing modes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: leviw review Created 4 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // See https://bugs.webkit.org/show_bug.cgi?id=116117 and http://crbug.com/2 40765. 102 // See https://bugs.webkit.org/show_bug.cgi?id=116117 and http://crbug.com/2 40765.
103 float previousMaxContentFlexFraction = -1; 103 float previousMaxContentFlexFraction = -1;
104 for (LayoutBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) { 104 for (LayoutBox* child = firstChildBox(); child; child = child->nextSiblingBo x()) {
105 if (child->isOutOfFlowPositioned()) 105 if (child->isOutOfFlowPositioned())
106 continue; 106 continue;
107 107
108 LayoutUnit margin = marginIntrinsicLogicalWidthForChild(*child); 108 LayoutUnit margin = marginIntrinsicLogicalWidthForChild(*child);
109 109
110 LayoutUnit minPreferredLogicalWidth; 110 LayoutUnit minPreferredLogicalWidth;
111 LayoutUnit maxPreferredLogicalWidth; 111 LayoutUnit maxPreferredLogicalWidth;
112 bool hasOrthogonalWritingMode = child->isHorizontalWritingMode() != isHo rizontalWritingMode(); 112 computeChildPreferredLogicalWidths(*child, minPreferredLogicalWidth, max PreferredLogicalWidth);
113 if (hasOrthogonalWritingMode) {
114 minPreferredLogicalWidth = maxPreferredLogicalWidth = child->compute LogicalHeightWithoutLayout();
115 } else {
116 minPreferredLogicalWidth = child->minPreferredLogicalWidth();
117 maxPreferredLogicalWidth = child->maxPreferredLogicalWidth();
118 }
119 ASSERT(minPreferredLogicalWidth >= 0); 113 ASSERT(minPreferredLogicalWidth >= 0);
120 ASSERT(maxPreferredLogicalWidth >= 0); 114 ASSERT(maxPreferredLogicalWidth >= 0);
121 minPreferredLogicalWidth += margin; 115 minPreferredLogicalWidth += margin;
122 maxPreferredLogicalWidth += margin; 116 maxPreferredLogicalWidth += margin;
123 if (!isColumnFlow()) { 117 if (!isColumnFlow()) {
124 maxLogicalWidth += maxPreferredLogicalWidth; 118 maxLogicalWidth += maxPreferredLogicalWidth;
125 if (isMultiline()) { 119 if (isMultiline()) {
126 // For multiline, the min preferred width is if you put a break between each item. 120 // For multiline, the min preferred width is if you put a break between each item.
127 minLogicalWidth = std::max(minLogicalWidth, minPreferredLogicalW idth); 121 minLogicalWidth = std::max(minLogicalWidth, minPreferredLogicalW idth);
128 } else { 122 } else {
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 ASSERT(child); 1623 ASSERT(child);
1630 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1624 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1631 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1625 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1632 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1626 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1633 adjustAlignmentForChild(*child, newOffset - originalOffset); 1627 adjustAlignmentForChild(*child, newOffset - originalOffset);
1634 } 1628 }
1635 } 1629 }
1636 } 1630 }
1637 1631
1638 } // namespace blink 1632 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698