OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 const LayoutBlockFlow& blockFlow = toLayoutBlockFlow(object); | 106 const LayoutBlockFlow& blockFlow = toLayoutBlockFlow(object); |
107 return !blockFlow.createsNewFormattingContext() && | 107 return !blockFlow.createsNewFormattingContext() && |
108 !blockFlow.hasTransformRelatedProperty() && | 108 !blockFlow.hasTransformRelatedProperty() && |
109 blockFlow.getPaginationBreakability() != LayoutBox::ForbidBreaks && | 109 blockFlow.getPaginationBreakability() != LayoutBox::ForbidBreaks && |
110 !isMultiColumnContainer(blockFlow); | 110 !isMultiColumnContainer(blockFlow); |
111 } | 111 } |
112 | 112 |
113 static inline bool hasAnyColumnSpanners( | 113 static inline bool hasAnyColumnSpanners( |
114 const LayoutMultiColumnFlowThread& flowThread) { | 114 const LayoutMultiColumnFlowThread& flowThread) { |
115 LayoutBox* firstBox = flowThread.firstMultiColumnBox(); | 115 LayoutBox* firstBox = flowThread.firstMultiColumnBox(); |
116 return firstBox && (firstBox != flowThread.lastMultiColumnBox() || | 116 return firstBox && |
117 firstBox->isLayoutMultiColumnSpannerPlaceholder()); | 117 (firstBox != flowThread.lastMultiColumnBox() || |
| 118 firstBox->isLayoutMultiColumnSpannerPlaceholder()); |
118 } | 119 } |
119 | 120 |
120 // Find the next layout object that has the multicol container in its containing | 121 // Find the next layout object that has the multicol container in its containing |
121 // block chain, skipping nested multicol containers. | 122 // block chain, skipping nested multicol containers. |
122 static LayoutObject* nextInPreOrderAfterChildrenSkippingOutOfFlow( | 123 static LayoutObject* nextInPreOrderAfterChildrenSkippingOutOfFlow( |
123 LayoutMultiColumnFlowThread* flowThread, | 124 LayoutMultiColumnFlowThread* flowThread, |
124 LayoutObject* descendant) { | 125 LayoutObject* descendant) { |
125 ASSERT(descendant->isDescendantOf(flowThread)); | 126 ASSERT(descendant->isDescendantOf(flowThread)); |
126 LayoutObject* object = descendant->nextInPreOrderAfterChildren(flowThread); | 127 LayoutObject* object = descendant->nextInPreOrderAfterChildren(flowThread); |
127 while (object) { | 128 while (object) { |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 const LayoutPoint& visualPoint) const { | 416 const LayoutPoint& visualPoint) const { |
416 LayoutUnit blockOffset = | 417 LayoutUnit blockOffset = |
417 isHorizontalWritingMode() ? visualPoint.y() : visualPoint.x(); | 418 isHorizontalWritingMode() ? visualPoint.y() : visualPoint.x(); |
418 const LayoutMultiColumnSet* columnSet = nullptr; | 419 const LayoutMultiColumnSet* columnSet = nullptr; |
419 for (const LayoutMultiColumnSet* candidate = firstMultiColumnSet(); candidate; | 420 for (const LayoutMultiColumnSet* candidate = firstMultiColumnSet(); candidate; |
420 candidate = candidate->nextSiblingMultiColumnSet()) { | 421 candidate = candidate->nextSiblingMultiColumnSet()) { |
421 columnSet = candidate; | 422 columnSet = candidate; |
422 if (candidate->logicalBottom() > blockOffset) | 423 if (candidate->logicalBottom() > blockOffset) |
423 break; | 424 break; |
424 } | 425 } |
425 return columnSet | 426 return columnSet ? columnSet->visualPointToFlowThreadPoint(toLayoutPoint( |
426 ? columnSet->visualPointToFlowThreadPoint(toLayoutPoint( | 427 visualPoint + location() - columnSet->location())) |
427 visualPoint + location() - columnSet->location())) | 428 : visualPoint; |
428 : visualPoint; | |
429 } | 429 } |
430 | 430 |
431 int LayoutMultiColumnFlowThread::inlineBlockBaseline( | 431 int LayoutMultiColumnFlowThread::inlineBlockBaseline( |
432 LineDirectionMode lineDirection) const { | 432 LineDirectionMode lineDirection) const { |
433 LayoutUnit baselineInFlowThread = | 433 LayoutUnit baselineInFlowThread = |
434 LayoutUnit(LayoutFlowThread::inlineBlockBaseline(lineDirection)); | 434 LayoutUnit(LayoutFlowThread::inlineBlockBaseline(lineDirection)); |
435 LayoutMultiColumnSet* columnSet = | 435 LayoutMultiColumnSet* columnSet = |
436 columnSetAtBlockOffset(baselineInFlowThread, AssociateWithLatterPage); | 436 columnSetAtBlockOffset(baselineInFlowThread, AssociateWithLatterPage); |
437 if (!columnSet) | 437 if (!columnSet) |
438 return baselineInFlowThread.toInt(); | 438 return baselineInFlowThread.toInt(); |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 unsigned computedColumnCount = max<int>(1, columnStyle->columnCount()); | 717 unsigned computedColumnCount = max<int>(1, columnStyle->columnCount()); |
718 | 718 |
719 ASSERT(!columnStyle->hasAutoColumnCount() || | 719 ASSERT(!columnStyle->hasAutoColumnCount() || |
720 !columnStyle->hasAutoColumnWidth()); | 720 !columnStyle->hasAutoColumnWidth()); |
721 if (columnStyle->hasAutoColumnWidth() && !columnStyle->hasAutoColumnCount()) { | 721 if (columnStyle->hasAutoColumnWidth() && !columnStyle->hasAutoColumnCount()) { |
722 count = computedColumnCount; | 722 count = computedColumnCount; |
723 width = ((availableWidth - ((count - 1) * columnGap)) / count) | 723 width = ((availableWidth - ((count - 1) * columnGap)) / count) |
724 .clampNegativeToZero(); | 724 .clampNegativeToZero(); |
725 } else if (!columnStyle->hasAutoColumnWidth() && | 725 } else if (!columnStyle->hasAutoColumnWidth() && |
726 columnStyle->hasAutoColumnCount()) { | 726 columnStyle->hasAutoColumnCount()) { |
727 count = std::max(LayoutUnit(1), (availableWidth + columnGap) / | 727 count = std::max(LayoutUnit(1), |
728 (computedColumnWidth + columnGap)) | 728 (availableWidth + columnGap) / |
| 729 (computedColumnWidth + columnGap)) |
729 .toUnsigned(); | 730 .toUnsigned(); |
730 width = ((availableWidth + columnGap) / count) - columnGap; | 731 width = ((availableWidth + columnGap) / count) - columnGap; |
731 } else { | 732 } else { |
732 count = std::max(std::min(LayoutUnit(computedColumnCount), | 733 count = std::max(std::min(LayoutUnit(computedColumnCount), |
733 (availableWidth + columnGap) / | 734 (availableWidth + columnGap) / |
734 (computedColumnWidth + columnGap)), | 735 (computedColumnWidth + columnGap)), |
735 LayoutUnit(1)) | 736 LayoutUnit(1)) |
736 .toUnsigned(); | 737 .toUnsigned(); |
737 width = ((availableWidth + columnGap) / count) - columnGap; | 738 width = ((availableWidth + columnGap) / count) - columnGap; |
738 } | 739 } |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1369 const { | 1370 const { |
1370 return MultiColumnLayoutState(m_lastSetWorkedOn); | 1371 return MultiColumnLayoutState(m_lastSetWorkedOn); |
1371 } | 1372 } |
1372 | 1373 |
1373 void LayoutMultiColumnFlowThread::restoreMultiColumnLayoutState( | 1374 void LayoutMultiColumnFlowThread::restoreMultiColumnLayoutState( |
1374 const MultiColumnLayoutState& state) { | 1375 const MultiColumnLayoutState& state) { |
1375 m_lastSetWorkedOn = state.columnSet(); | 1376 m_lastSetWorkedOn = state.columnSet(); |
1376 } | 1377 } |
1377 | 1378 |
1378 } // namespace blink | 1379 } // namespace blink |
OLD | NEW |