OLD | NEW |
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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 int adjustmentHeight = horizontalScrollbarHeight(); | 263 int adjustmentHeight = horizontalScrollbarHeight(); |
264 if (!adjustmentWidth && !adjustmentHeight) | 264 if (!adjustmentWidth && !adjustmentHeight) |
265 return size; | 265 return size; |
266 | 266 |
267 EFlexDirection flexDirection = style()->flexDirection(); | 267 EFlexDirection flexDirection = style()->flexDirection(); |
268 TextDirection textDirection = style()->direction(); | 268 TextDirection textDirection = style()->direction(); |
269 WritingMode writingMode = style()->getWritingMode(); | 269 WritingMode writingMode = style()->getWritingMode(); |
270 | 270 |
271 if (flexDirection == FlowRow) { | 271 if (flexDirection == FlowRow) { |
272 if (textDirection == TextDirection::Rtl) { | 272 if (textDirection == TextDirection::Rtl) { |
273 if (writingMode == TopToBottomWritingMode) | 273 if (blink::isHorizontalWritingMode(writingMode)) |
274 size.expand(adjustmentWidth, 0); | 274 size.expand(adjustmentWidth, 0); |
275 else | 275 else |
276 size.expand(0, adjustmentHeight); | 276 size.expand(0, adjustmentHeight); |
277 } | 277 } |
278 if (writingMode == RightToLeftWritingMode) | 278 if (isFlippedBlocksWritingMode(writingMode)) |
279 size.expand(adjustmentWidth, 0); | 279 size.expand(adjustmentWidth, 0); |
280 } else if (flexDirection == FlowRowReverse) { | 280 } else if (flexDirection == FlowRowReverse) { |
281 if (textDirection == TextDirection::Ltr) { | 281 if (textDirection == TextDirection::Ltr) { |
282 if (writingMode == TopToBottomWritingMode) | 282 if (blink::isHorizontalWritingMode(writingMode)) |
283 size.expand(adjustmentWidth, 0); | 283 size.expand(adjustmentWidth, 0); |
284 else | 284 else |
285 size.expand(0, adjustmentHeight); | 285 size.expand(0, adjustmentHeight); |
286 } | 286 } |
287 if (writingMode == RightToLeftWritingMode) | 287 if (isFlippedBlocksWritingMode(writingMode)) |
288 size.expand(adjustmentWidth, 0); | 288 size.expand(adjustmentWidth, 0); |
289 } else if (flexDirection == FlowColumn) { | 289 } else if (flexDirection == FlowColumn) { |
290 if (writingMode == RightToLeftWritingMode) | 290 if (isFlippedBlocksWritingMode(writingMode)) |
291 size.expand(adjustmentWidth, 0); | 291 size.expand(adjustmentWidth, 0); |
292 } else { | 292 } else { |
293 if (writingMode == TopToBottomWritingMode) | 293 if (blink::isHorizontalWritingMode(writingMode)) |
294 size.expand(0, adjustmentHeight); | 294 size.expand(0, adjustmentHeight); |
295 else if (writingMode == LeftToRightWritingMode) | 295 else if (isFlippedLinesWritingMode(writingMode)) |
296 size.expand(adjustmentWidth, 0); | 296 size.expand(adjustmentWidth, 0); |
297 } | 297 } |
298 return size; | 298 return size; |
299 } | 299 } |
300 | 300 |
301 bool LayoutFlexibleBox::hasTopOverflow() const { | 301 bool LayoutFlexibleBox::hasTopOverflow() const { |
302 EFlexDirection flexDirection = style()->flexDirection(); | 302 EFlexDirection flexDirection = style()->flexDirection(); |
303 if (isHorizontalWritingMode()) | 303 if (isHorizontalWritingMode()) |
304 return flexDirection == FlowColumnReverse; | 304 return flexDirection == FlowColumnReverse; |
305 return flexDirection == | 305 return flexDirection == |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 return style()->isColumnFlexDirection(); | 452 return style()->isColumnFlexDirection(); |
453 } | 453 } |
454 | 454 |
455 bool LayoutFlexibleBox::isHorizontalFlow() const { | 455 bool LayoutFlexibleBox::isHorizontalFlow() const { |
456 if (isHorizontalWritingMode()) | 456 if (isHorizontalWritingMode()) |
457 return !isColumnFlow(); | 457 return !isColumnFlow(); |
458 return isColumnFlow(); | 458 return isColumnFlow(); |
459 } | 459 } |
460 | 460 |
461 bool LayoutFlexibleBox::isLeftToRightFlow() const { | 461 bool LayoutFlexibleBox::isLeftToRightFlow() const { |
462 if (isColumnFlow()) | 462 if (isColumnFlow()) { |
463 return style()->getWritingMode() == TopToBottomWritingMode || | 463 return blink::isHorizontalWritingMode(style()->getWritingMode()) || |
464 style()->getWritingMode() == LeftToRightWritingMode; | 464 isFlippedLinesWritingMode(style()->getWritingMode()); |
| 465 } |
465 return style()->isLeftToRightDirection() ^ | 466 return style()->isLeftToRightDirection() ^ |
466 (style()->flexDirection() == FlowRowReverse); | 467 (style()->flexDirection() == FlowRowReverse); |
467 } | 468 } |
468 | 469 |
469 bool LayoutFlexibleBox::isMultiline() const { | 470 bool LayoutFlexibleBox::isMultiline() const { |
470 return style()->flexWrap() != FlexNoWrap; | 471 return style()->flexWrap() != FlexNoWrap; |
471 } | 472 } |
472 | 473 |
473 Length LayoutFlexibleBox::flexBasisForChild(const LayoutBox& child) const { | 474 Length LayoutFlexibleBox::flexBasisForChild(const LayoutBox& child) const { |
474 Length flexLength = child.style()->flexBasis(); | 475 Length flexLength = child.style()->flexBasis(); |
(...skipping 1707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2182 LayoutUnit originalOffset = | 2183 LayoutUnit originalOffset = |
2183 lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; | 2184 lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; |
2184 LayoutUnit newOffset = | 2185 LayoutUnit newOffset = |
2185 contentExtent - originalOffset - lineCrossAxisExtent; | 2186 contentExtent - originalOffset - lineCrossAxisExtent; |
2186 adjustAlignmentForChild(*flexItem.box, newOffset - originalOffset); | 2187 adjustAlignmentForChild(*flexItem.box, newOffset - originalOffset); |
2187 } | 2188 } |
2188 } | 2189 } |
2189 } | 2190 } |
2190 | 2191 |
2191 } // namespace blink | 2192 } // namespace blink |
OLD | NEW |