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

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

Issue 1710843003: Ability to return the height of fragmentainer groups that don't yet exist. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp ('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) 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 const MultiColumnFragmentainerGroup& LayoutMultiColumnSet::fragmentainerGroupAtV isualPoint(const LayoutPoint&) const 67 const MultiColumnFragmentainerGroup& LayoutMultiColumnSet::fragmentainerGroupAtV isualPoint(const LayoutPoint&) const
68 { 68 {
69 // FIXME: implement this, once we have support for multiple rows. 69 // FIXME: implement this, once we have support for multiple rows.
70 return m_fragmentainerGroups.first(); 70 return m_fragmentainerGroups.first();
71 } 71 }
72 72
73 LayoutUnit LayoutMultiColumnSet::pageLogicalHeightForOffset(LayoutUnit offsetInF lowThread) const 73 LayoutUnit LayoutMultiColumnSet::pageLogicalHeightForOffset(LayoutUnit offsetInF lowThread) const
74 { 74 {
75 const MultiColumnFragmentainerGroup &lastRow = lastFragmentainerGroup();
76 if (!lastRow.logicalHeight()) {
77 // In the first layout pass of an auto-height multicol container, height isn't set. No need
78 // to perform the series of complicated dance steps below to figure out that we should
79 // simply return 0. Bail now.
80 ASSERT(m_fragmentainerGroups.size() == 1);
81 return LayoutUnit();
82 }
83 if (offsetInFlowThread >= lastRow.logicalTopInFlowThread() + lastRow.logical Height() * usedColumnCount()) {
84 // The offset is outside the bounds of the fragmentainer groups that we have established at
85 // this point. If we're nested inside another fragmentation context, we need to calculate
86 // the height on our own.
87 const LayoutMultiColumnFlowThread* flowThread = multiColumnFlowThread();
88 if (FragmentationContext* enclosingFragmentationContext = flowThread->en closingFragmentationContext()) {
89 // We'd ideally like to translate |offsetInFlowThread| to an offset in the coordinate
90 // space of the enclosing fragmentation context here, but that's har d, since the offset
leviw_travelin_and_unemployed 2016/02/23 18:56:17 Ugh.
91 // is out of bounds. So just use the bottom we have found so far.
92 LayoutUnit enclosingContextBottom = lastRow.blockOffsetInEnclosingFr agmentationContext() + lastRow.logicalHeight();
93 LayoutUnit enclosingFragmentainerHeight = enclosingFragmentationCont ext->fragmentainerLogicalHeightAt(enclosingContextBottom);
94 // Constrain against specified height / max-height.
95 LayoutUnit currentMulticolHeight = logicalTopFromMulticolContentEdge () + lastRow.logicalTop() + lastRow.logicalHeight();
96 LayoutUnit multicolHeightWithExtraRow = currentMulticolHeight + encl osingFragmentainerHeight;
97 multicolHeightWithExtraRow = std::min(multicolHeightWithExtraRow, fl owThread->maxColumnLogicalHeight());
98 return std::max(LayoutUnit(1), multicolHeightWithExtraRow - currentM ulticolHeight);
99 }
100 }
75 return fragmentainerGroupAtFlowThreadOffset(offsetInFlowThread).logicalHeigh t(); 101 return fragmentainerGroupAtFlowThreadOffset(offsetInFlowThread).logicalHeigh t();
76 } 102 }
77 103
78 LayoutUnit LayoutMultiColumnSet::pageRemainingLogicalHeightForOffset(LayoutUnit offsetInFlowThread, PageBoundaryRule pageBoundaryRule) const 104 LayoutUnit LayoutMultiColumnSet::pageRemainingLogicalHeightForOffset(LayoutUnit offsetInFlowThread, PageBoundaryRule pageBoundaryRule) const
79 { 105 {
80 const MultiColumnFragmentainerGroup& row = fragmentainerGroupAtFlowThreadOff set(offsetInFlowThread); 106 const MultiColumnFragmentainerGroup& row = fragmentainerGroupAtFlowThreadOff set(offsetInFlowThread);
81 LayoutUnit pageLogicalHeight = row.logicalHeight(); 107 LayoutUnit pageLogicalHeight = row.logicalHeight();
82 ASSERT(pageLogicalHeight); // It's not allowed to call this method if the he ight is unknown. 108 ASSERT(pageLogicalHeight); // It's not allowed to call this method if the he ight is unknown.
83 LayoutUnit pageLogicalBottom = row.columnLogicalTopForOffset(offsetInFlowThr ead) + pageLogicalHeight; 109 LayoutUnit pageLogicalBottom = row.columnLogicalTopForOffset(offsetInFlowThr ead) + pageLogicalHeight;
84 LayoutUnit remainingLogicalHeight = pageLogicalBottom - offsetInFlowThread; 110 LayoutUnit remainingLogicalHeight = pageLogicalBottom - offsetInFlowThread;
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 452
427 LayoutRect LayoutMultiColumnSet::flowThreadPortionRect() const 453 LayoutRect LayoutMultiColumnSet::flowThreadPortionRect() const
428 { 454 {
429 LayoutRect portionRect(LayoutUnit(), logicalTopInFlowThread(), pageLogicalWi dth(), logicalHeightInFlowThread()); 455 LayoutRect portionRect(LayoutUnit(), logicalTopInFlowThread(), pageLogicalWi dth(), logicalHeightInFlowThread());
430 if (!isHorizontalWritingMode()) 456 if (!isHorizontalWritingMode())
431 return portionRect.transposedRect(); 457 return portionRect.transposedRect();
432 return portionRect; 458 return portionRect;
433 } 459 }
434 460
435 } // namespace blink 461 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698