Chromium Code Reviews| 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 14 matching lines...) Expand all Loading... | |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "core/rendering/RenderMultiColumnFlowThread.h" | 27 #include "core/rendering/RenderMultiColumnFlowThread.h" |
| 28 | 28 |
| 29 #include "core/rendering/RenderMultiColumnSet.h" | 29 #include "core/rendering/RenderMultiColumnSet.h" |
| 30 #include "core/rendering/RenderMultiColumnSpannerSet.h" | 30 #include "core/rendering/RenderMultiColumnSpannerSet.h" |
| 31 | 31 |
| 32 namespace blink { | 32 namespace blink { |
| 33 | 33 |
| 34 RenderMultiColumnFlowThread::RenderMultiColumnFlowThread() | 34 RenderMultiColumnFlowThread::RenderMultiColumnFlowThread() |
| 35 : m_columnCount(1) | 35 : m_lastSetWorkedOn(0) |
| 36 , m_columnCount(1) | |
| 36 , m_columnHeightAvailable(0) | 37 , m_columnHeightAvailable(0) |
| 37 , m_inBalancingPass(false) | 38 , m_inBalancingPass(false) |
| 38 , m_needsColumnHeightsRecalculation(false) | 39 , m_needsColumnHeightsRecalculation(false) |
| 39 , m_progressionIsInline(true) | 40 , m_progressionIsInline(true) |
| 41 , m_isBeingEvacuated(false) | |
| 40 { | 42 { |
| 41 setFlowThreadState(InsideInFlowThread); | 43 setFlowThreadState(InsideInFlowThread); |
| 42 } | 44 } |
| 43 | 45 |
| 44 RenderMultiColumnFlowThread::~RenderMultiColumnFlowThread() | 46 RenderMultiColumnFlowThread::~RenderMultiColumnFlowThread() |
| 45 { | 47 { |
| 46 } | 48 } |
| 47 | 49 |
| 48 RenderMultiColumnFlowThread* RenderMultiColumnFlowThread::createAnonymous(Docume nt& document, RenderStyle* parentStyle) | 50 RenderMultiColumnFlowThread* RenderMultiColumnFlowThread::createAnonymous(Docume nt& document, RenderStyle* parentStyle) |
| 49 { | 51 { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 ASSERT(!nextSibling()); | 97 ASSERT(!nextSibling()); |
| 96 // Reparent children preceding the flow thread into the flow thread. It's mu lticol content | 98 // Reparent children preceding the flow thread into the flow thread. It's mu lticol content |
| 97 // now. At this point there's obviously nothing after the flow thread, but r enderers (column | 99 // now. At this point there's obviously nothing after the flow thread, but r enderers (column |
| 98 // sets and spanners) will be inserted there as we insert elements into the flow thread. | 100 // sets and spanners) will be inserted there as we insert elements into the flow thread. |
| 99 multicolContainer->moveChildrenTo(this, multicolContainer->firstChild(), thi s, true); | 101 multicolContainer->moveChildrenTo(this, multicolContainer->firstChild(), thi s, true); |
| 100 } | 102 } |
| 101 | 103 |
| 102 void RenderMultiColumnFlowThread::evacuateAndDestroy() | 104 void RenderMultiColumnFlowThread::evacuateAndDestroy() |
| 103 { | 105 { |
| 104 RenderBlockFlow* multicolContainer = multiColumnBlockFlow(); | 106 RenderBlockFlow* multicolContainer = multiColumnBlockFlow(); |
| 107 m_isBeingEvacuated = true; | |
| 105 | 108 |
| 106 // Remove all sets. | 109 // Remove all sets. |
| 107 while (RenderMultiColumnSet* columnSet = firstMultiColumnSet()) | 110 while (RenderMultiColumnSet* columnSet = firstMultiColumnSet()) |
| 108 columnSet->destroy(); | 111 columnSet->destroy(); |
| 109 | 112 |
| 110 ASSERT(!previousSibling()); | 113 ASSERT(!previousSibling()); |
| 111 ASSERT(!nextSibling()); | 114 ASSERT(!nextSibling()); |
| 112 | 115 |
| 113 // Finally we can promote all flow thread's children. Before we move them to the flow thread's | 116 // Finally we can promote all flow thread's children. Before we move them to the flow thread's |
| 114 // container, we need to unregister the flow thread, so that they aren't jus t re-added again to | 117 // container, we need to unregister the flow thread, so that they aren't jus t re-added again to |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 139 } | 142 } |
| 140 | 143 |
| 141 bool RenderMultiColumnFlowThread::needsNewWidth() const | 144 bool RenderMultiColumnFlowThread::needsNewWidth() const |
| 142 { | 145 { |
| 143 LayoutUnit newWidth; | 146 LayoutUnit newWidth; |
| 144 unsigned dummyColumnCount; // We only care if used column-width changes. | 147 unsigned dummyColumnCount; // We only care if used column-width changes. |
| 145 calculateColumnCountAndWidth(newWidth, dummyColumnCount); | 148 calculateColumnCountAndWidth(newWidth, dummyColumnCount); |
| 146 return newWidth != logicalWidth(); | 149 return newWidth != logicalWidth(); |
| 147 } | 150 } |
| 148 | 151 |
| 152 RenderMultiColumnSet* RenderMultiColumnFlowThread::columnSetAtBlockOffset(Layout Unit offset) const | |
| 153 { | |
| 154 if (m_lastSetWorkedOn) { | |
| 155 // Layout in progress. We are calculating the set heights as we speak, s o the column set range | |
| 156 // information is not up-to-date. | |
| 157 return m_lastSetWorkedOn; | |
| 158 } | |
| 159 | |
| 160 ASSERT(!m_regionsInvalidated); | |
| 161 if (offset <= 0) | |
| 162 return m_multiColumnSetList.isEmpty() ? 0 : m_multiColumnSetList.first() ; | |
| 163 | |
| 164 MultiColumnSetSearchAdapter adapter(offset); | |
| 165 m_multiColumnSetIntervalTree.allOverlapsWithAdapter<MultiColumnSetSearchAdap ter>(adapter); | |
| 166 | |
| 167 // If no set was found, the offset is in the flow thread overflow. | |
| 168 if (!adapter.result() && !m_multiColumnSetList.isEmpty()) | |
| 169 return m_multiColumnSetList.last(); | |
| 170 return adapter.result(); | |
| 171 } | |
| 172 | |
| 149 void RenderMultiColumnFlowThread::layoutColumns(bool relayoutChildren, SubtreeLa youtScope& layoutScope) | 173 void RenderMultiColumnFlowThread::layoutColumns(bool relayoutChildren, SubtreeLa youtScope& layoutScope) |
| 150 { | 174 { |
| 151 if (relayoutChildren) | 175 if (relayoutChildren) |
| 152 layoutScope.setChildNeedsLayout(this); | 176 layoutScope.setChildNeedsLayout(this); |
| 153 | 177 |
| 154 if (!needsLayout()) { | 178 if (!needsLayout()) { |
| 155 // Just before the multicol container (our parent RenderBlockFlow) finis hes laying out, it | 179 // Just before the multicol container (our parent RenderBlockFlow) finis hes laying out, it |
| 156 // will call recalculateColumnHeights() on us unconditionally, but we on ly want that method | 180 // will call recalculateColumnHeights() on us unconditionally, but we on ly want that method |
| 157 // to do any work if we actually laid out the flow thread. Otherwise, th e balancing | 181 // to do any work if we actually laid out the flow thread. Otherwise, th e balancing |
| 158 // machinery would kick in needlessly, and trigger additional layout pas ses. Furthermore, we | 182 // machinery would kick in needlessly, and trigger additional layout pas ses. Furthermore, we |
| 159 // actually depend on a proper flowthread layout pass in order to do bal ancing, since it's | 183 // actually depend on a proper flowthread layout pass in order to do bal ancing, since it's |
| 160 // flowthread layout that sets up content runs. | 184 // flowthread layout that sets up content runs. |
| 161 m_needsColumnHeightsRecalculation = false; | 185 m_needsColumnHeightsRecalculation = false; |
| 162 return; | 186 return; |
| 163 } | 187 } |
| 164 | 188 |
| 189 bool hasSpannerOrAutoHeightColumnSet = false; | |
| 165 for (RenderMultiColumnSet* columnSet = firstMultiColumnSet(); columnSet; col umnSet = columnSet->nextSiblingMultiColumnSet()) { | 190 for (RenderMultiColumnSet* columnSet = firstMultiColumnSet(); columnSet; col umnSet = columnSet->nextSiblingMultiColumnSet()) { |
| 166 if (!m_inBalancingPass) { | 191 if (!m_inBalancingPass) { |
| 167 // This is the initial layout pass. We need to reset the column heig ht, because contents | 192 // This is the initial layout pass. We need to reset the column heig ht, because contents |
| 168 // typically have changed. | 193 // typically have changed. |
| 169 columnSet->resetColumnHeight(); | 194 columnSet->resetColumnHeight(); |
| 170 } | 195 } |
| 196 if (!hasSpannerOrAutoHeightColumnSet) | |
| 197 hasSpannerOrAutoHeightColumnSet = columnSet->isRenderMultiColumnSpan nerSet() || columnSet->heightIsAuto(); | |
|
Julien - ping for review
2014/11/26 21:09:01
We usually avoid a branch but using some boolean m
mstensho (USE GERRIT)
2014/11/27 21:20:29
|= is a bit-wise operator (there's no logical ||=
| |
| 171 } | 198 } |
| 172 | 199 |
| 173 invalidateRegions(); | 200 invalidateRegions(); |
| 174 m_needsColumnHeightsRecalculation = heightIsAuto(); | 201 m_needsColumnHeightsRecalculation = hasSpannerOrAutoHeightColumnSet; |
|
Julien - ping for review
2014/11/26 21:09:00
Note that you don't really need hasSpannerOrAutoHe
mstensho (USE GERRIT)
2014/11/27 21:20:29
Doh! :) Done.
| |
| 175 layout(); | 202 layout(); |
| 176 } | 203 } |
| 177 | 204 |
| 178 bool RenderMultiColumnFlowThread::recalculateColumnHeights() | 205 bool RenderMultiColumnFlowThread::recalculateColumnHeights() |
| 179 { | 206 { |
| 180 // All column sets that needed layout have now been laid out, so we can fina lly validate them. | 207 // All column sets that needed layout have now been laid out, so we can fina lly validate them. |
| 181 validateRegions(); | 208 validateRegions(); |
| 182 | 209 |
| 183 if (!m_needsColumnHeightsRecalculation) | 210 if (!m_needsColumnHeightsRecalculation) |
| 184 return false; | 211 return false; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 m_spannerMap.clear(); | 336 m_spannerMap.clear(); |
| 310 // Detach all column sets from the flow thread. Cannot destroy them at this point, since they | 337 // Detach all column sets from the flow thread. Cannot destroy them at this point, since they |
| 311 // are siblings of this object, and there may be pointers to this object's s ibling somewhere | 338 // are siblings of this object, and there may be pointers to this object's s ibling somewhere |
| 312 // further up on the call stack. | 339 // further up on the call stack. |
| 313 for (RenderMultiColumnSet* columnSet = firstMultiColumnSet(); columnSet; col umnSet = columnSet->nextSiblingMultiColumnSet()) | 340 for (RenderMultiColumnSet* columnSet = firstMultiColumnSet(); columnSet; col umnSet = columnSet->nextSiblingMultiColumnSet()) |
| 314 columnSet->detachRegion(); | 341 columnSet->detachRegion(); |
| 315 multiColumnBlockFlow()->resetMultiColumnFlowThread(); | 342 multiColumnBlockFlow()->resetMultiColumnFlowThread(); |
| 316 RenderFlowThread::willBeRemovedFromTree(); | 343 RenderFlowThread::willBeRemovedFromTree(); |
| 317 } | 344 } |
| 318 | 345 |
| 346 bool RenderMultiColumnFlowThread::isColumnSpanner(const RenderObject* descendant ) const | |
| 347 { | |
| 348 ASSERT(descendant->isDescendantOf(this)); | |
| 349 return m_spannerMap.get(descendant); | |
| 350 } | |
| 351 | |
| 352 bool RenderMultiColumnFlowThread::isInsideColumnSpanner(const RenderObject* desc endant) const | |
| 353 { | |
| 354 ASSERT(descendant->isDescendantOf(this)); | |
| 355 return containingColumnSpannerSet(descendant); | |
| 356 } | |
| 357 | |
| 358 LayoutUnit RenderMultiColumnFlowThread::enterColumnSpannerBeforeLayout(RenderBox * renderer, LayoutUnit logicalTop, SubtreeLayoutScope& layoutScope) | |
| 359 { | |
| 360 ASSERT(isColumnSpanner(renderer)); | |
| 361 RenderMultiColumnSpannerSet* spannerSet = m_spannerMap.get(renderer); | |
| 362 | |
| 363 // FIXME: it's really only necessary to mark the spanner set for layout when the height of | |
| 364 // |renderer| changes. | |
| 365 spannerSet->setChildNeedsLayout(MarkOnlyThis, &layoutScope); | |
| 366 | |
| 367 RenderMultiColumnSet* previousSet = spannerSet->previousSiblingMultiColumnSe t(); | |
| 368 if (!previousSet) { | |
| 369 // The first set is entered at the beginning of flow thread layout. If t he first set happens | |
| 370 // to be a spanner, we have nothing more to do here. | |
| 371 return LayoutUnit(); | |
| 372 } | |
| 373 | |
| 374 LayoutUnit logicalTopInFlowThread = renderer->parentBlock()->offsetFromLogic alTopOfFirstPage() + logicalTop; | |
| 375 LayoutUnit adjustment; | |
| 376 if (!previousSet->isRenderMultiColumnSpannerSet() && previousSet->pageLogica lHeight()) { | |
| 377 // Pad flow thread offset to a column boundary, so that contents that's supposed to come | |
| 378 // after the spanner (or the spanner itself) don't bleed into the column preceding the | |
|
Julien - ping for review
2014/11/26 21:09:01
It seems like it's missing an 'any' before content
mstensho (USE GERRIT)
2014/11/27 21:20:29
Your country of residence trumps mine, I guess. Be
| |
| 379 // spanner. | |
| 380 LayoutUnit columnLogicalTopInFlowThread = previousSet->pageLogicalTopFor Offset(logicalTopInFlowThread); | |
| 381 if (columnLogicalTopInFlowThread != logicalTopInFlowThread) { | |
| 382 adjustment = columnLogicalTopInFlowThread + previousSet->pageLogical Height() - logicalTopInFlowThread; | |
| 383 logicalTopInFlowThread += adjustment; | |
| 384 } | |
| 385 } | |
| 386 | |
| 387 if (!previousSet->isRenderMultiColumnSpannerSet()) | |
| 388 previousSet->endFlow(logicalTopInFlowThread); | |
| 389 spannerSet->beginFlow(logicalTopInFlowThread); | |
| 390 | |
| 391 m_lastSetWorkedOn = spannerSet; | |
| 392 return adjustment; | |
| 393 } | |
| 394 | |
| 395 void RenderMultiColumnFlowThread::exitColumnSpannerAfterLayout(RenderBox* render er, LayoutUnit logicalBottom) | |
| 396 { | |
| 397 ASSERT(m_lastSetWorkedOn == m_spannerMap.get(renderer)); | |
| 398 | |
| 399 LayoutUnit logicalBottomInFlowThread = renderer->parentBlock()->offsetFromLo gicalTopOfFirstPage() + logicalBottom; | |
| 400 m_lastSetWorkedOn->endFlow(logicalBottomInFlowThread); | |
| 401 if (RenderMultiColumnSet* nextSet = m_lastSetWorkedOn->nextSiblingMultiColum nSet()) { | |
| 402 m_lastSetWorkedOn = nextSet; | |
| 403 if (!m_lastSetWorkedOn->isRenderMultiColumnSpannerSet()) | |
| 404 m_lastSetWorkedOn->beginFlow(logicalBottomInFlowThread); | |
| 405 } | |
| 406 } | |
| 407 | |
| 319 void RenderMultiColumnFlowThread::flowThreadDescendantWasInserted(RenderObject* descendant) | 408 void RenderMultiColumnFlowThread::flowThreadDescendantWasInserted(RenderObject* descendant) |
| 320 { | 409 { |
| 410 ASSERT(!m_isBeingEvacuated); | |
| 321 // Go through the subtree that was just inserted and create column sets (nee ded by regular | 411 // Go through the subtree that was just inserted and create column sets (nee ded by regular |
| 322 // column content) and spanner sets (one needed by each spanner). | 412 // column content) and spanner sets (one needed by each spanner). |
| 323 for (RenderObject* renderer = descendant; renderer; renderer = renderer->nex tInPreOrder(descendant)) { | 413 for (RenderObject* renderer = descendant; renderer; renderer = renderer->nex tInPreOrder(descendant)) { |
| 324 if (containingColumnSpannerSet(renderer)) | 414 if (containingColumnSpannerSet(renderer)) |
| 325 continue; // Inside a column spanner set. Nothing to do, then. | 415 continue; // Inside a column spanner set. Nothing to do, then. |
| 326 if (descendantIsValidColumnSpanner(renderer)) { | 416 if (descendantIsValidColumnSpanner(renderer)) { |
| 327 // This renderer is a spanner, so it needs to establish a spanner se t. | 417 // This renderer is a spanner, so it needs to establish a spanner se t. |
| 328 createAndInsertSpannerSet(toRenderBox(renderer)); | 418 createAndInsertSpannerSet(toRenderBox(renderer)); |
| 329 continue; | 419 continue; |
| 330 } | 420 } |
| 331 // This renderer is regular column content (i.e. not a spanner). Create a set if necessary. | 421 // This renderer is regular column content (i.e. not a spanner). Create a set if necessary. |
| 332 RenderMultiColumnSet* lastSet = lastMultiColumnSet(); | 422 RenderMultiColumnSet* lastSet = lastMultiColumnSet(); |
| 333 if (!lastSet || lastSet->isRenderMultiColumnSpannerSet()) | 423 if (!lastSet || lastSet->isRenderMultiColumnSpannerSet()) |
| 334 createAndInsertMultiColumnSet(); | 424 createAndInsertMultiColumnSet(); |
| 335 } | 425 } |
| 336 } | 426 } |
| 337 | 427 |
| 428 void RenderMultiColumnFlowThread::flowThreadDescendantWillBeRemoved(RenderObject * descendant) | |
| 429 { | |
| 430 if (m_isBeingEvacuated) | |
| 431 return; | |
| 432 RenderObject* next; | |
| 433 // Remove spanner sets that are no longer needed, and merge column sets arou nd them. | |
| 434 for (RenderObject* renderer = descendant; renderer; renderer = next) { | |
| 435 RenderMultiColumnSpannerSet* spanner = m_spannerMap.get(renderer); | |
| 436 if (!spanner) { | |
| 437 next = renderer->nextInPreOrder(descendant); | |
| 438 continue; | |
| 439 } | |
| 440 next = renderer->nextInPreOrderAfterChildren(descendant); // It's a span ner. Its children are of no interest to us. | |
| 441 if (RenderMultiColumnSet* nextSet = spanner->nextSiblingMultiColumnSet() ) { | |
| 442 RenderMultiColumnSet* previousSet = spanner->previousSiblingMultiCol umnSet(); | |
| 443 if (nextSet && !nextSet->isRenderMultiColumnSpannerSet() | |
| 444 && previousSet && !previousSet->isRenderMultiColumnSpannerSet()) { | |
| 445 // Need to merge two column sets. | |
| 446 nextSet->destroy(); | |
|
Julien - ping for review
2014/11/26 21:09:01
It would be worth checking that nextSet is not in
mstensho (USE GERRIT)
2014/11/27 21:20:29
Done.
Better do it in willBeRemovedFromTree(), th
| |
| 447 previousSet->setNeedsLayout(); | |
|
Julien - ping for review
2014/11/26 21:09:01
What ensures that the exiting content under |nextS
mstensho (USE GERRIT)
2014/11/27 21:20:29
A column set doesn't own / contain / reference any
| |
| 448 invalidateRegions(); | |
| 449 } | |
| 450 } | |
| 451 m_spannerMap.remove(renderer); | |
| 452 spanner->destroy(); | |
| 453 } | |
| 454 } | |
| 455 | |
| 338 void RenderMultiColumnFlowThread::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const | 456 void RenderMultiColumnFlowThread::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const |
| 339 { | 457 { |
| 340 // We simply remain at our intrinsic height. | 458 // We simply remain at our intrinsic height. |
| 341 computedValues.m_extent = logicalHeight; | 459 computedValues.m_extent = logicalHeight; |
| 342 computedValues.m_position = logicalTop; | 460 computedValues.m_position = logicalTop; |
| 343 } | 461 } |
| 344 | 462 |
| 345 void RenderMultiColumnFlowThread::updateLogicalWidth() | 463 void RenderMultiColumnFlowThread::updateLogicalWidth() |
| 346 { | 464 { |
| 347 LayoutUnit columnWidth; | 465 LayoutUnit columnWidth; |
| 348 calculateColumnCountAndWidth(columnWidth, m_columnCount); | 466 calculateColumnCountAndWidth(columnWidth, m_columnCount); |
| 349 setLogicalWidth(columnWidth); | 467 setLogicalWidth(columnWidth); |
| 350 } | 468 } |
| 351 | 469 |
| 352 void RenderMultiColumnFlowThread::layout() | 470 void RenderMultiColumnFlowThread::layout() |
| 353 { | 471 { |
| 472 ASSERT(!m_lastSetWorkedOn); | |
| 473 m_lastSetWorkedOn = firstMultiColumnSet(); | |
| 474 if (m_lastSetWorkedOn) | |
| 475 m_lastSetWorkedOn->beginFlow(LayoutUnit()); | |
| 354 RenderFlowThread::layout(); | 476 RenderFlowThread::layout(); |
| 355 if (RenderMultiColumnSet* lastSet = lastMultiColumnSet()) | 477 if (RenderMultiColumnSet* lastSet = lastMultiColumnSet()) { |
| 478 ASSERT(lastSet == m_lastSetWorkedOn); | |
| 479 lastSet->endFlow(logicalHeight()); | |
| 356 lastSet->expandToEncompassFlowThreadContentsIfNeeded(); | 480 lastSet->expandToEncompassFlowThreadContentsIfNeeded(); |
| 481 } | |
| 482 m_lastSetWorkedOn = 0; | |
| 357 } | 483 } |
| 358 | 484 |
| 359 void RenderMultiColumnFlowThread::setPageBreak(LayoutUnit offset, LayoutUnit spa ceShortage) | 485 void RenderMultiColumnFlowThread::setPageBreak(LayoutUnit offset, LayoutUnit spa ceShortage) |
| 360 { | 486 { |
| 361 // Only positive values are interesting (and allowed) here. Zero space short age may be reported | 487 // Only positive values are interesting (and allowed) here. Zero space short age may be reported |
| 362 // when we're at the top of a column and the element has zero height. Ignore this, and also | 488 // when we're at the top of a column and the element has zero height. Ignore this, and also |
| 363 // ignore any negative values, which may occur when we set an early break in order to honor | 489 // ignore any negative values, which may occur when we set an early break in order to honor |
| 364 // widows in the next column. | 490 // widows in the next column. |
| 365 if (spaceShortage <= 0) | 491 if (spaceShortage <= 0) |
| 366 return; | 492 return; |
| 367 | 493 |
| 368 if (RenderMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) | 494 if (RenderMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) |
| 369 multicolSet->recordSpaceShortage(spaceShortage); | 495 multicolSet->recordSpaceShortage(spaceShortage); |
| 370 } | 496 } |
| 371 | 497 |
| 372 void RenderMultiColumnFlowThread::updateMinimumPageHeight(LayoutUnit offset, Lay outUnit minHeight) | 498 void RenderMultiColumnFlowThread::updateMinimumPageHeight(LayoutUnit offset, Lay outUnit minHeight) |
| 373 { | 499 { |
| 374 if (RenderMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) | 500 if (RenderMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) |
| 375 multicolSet->updateMinimumColumnHeight(minHeight); | 501 multicolSet->updateMinimumColumnHeight(minHeight); |
| 376 } | 502 } |
| 377 | 503 |
| 378 RenderMultiColumnSet* RenderMultiColumnFlowThread::columnSetAtBlockOffset(Layout Unit /*offset*/) const | |
| 379 { | |
| 380 // For now there's only one column set, so this is easy: | |
| 381 return firstMultiColumnSet(); | |
| 382 } | |
| 383 | |
| 384 bool RenderMultiColumnFlowThread::addForcedRegionBreak(LayoutUnit offset, Render Object* /*breakChild*/, bool /*isBefore*/, LayoutUnit* offsetBreakAdjustment) | 504 bool RenderMultiColumnFlowThread::addForcedRegionBreak(LayoutUnit offset, Render Object* /*breakChild*/, bool /*isBefore*/, LayoutUnit* offsetBreakAdjustment) |
| 385 { | 505 { |
| 386 if (RenderMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) { | 506 if (RenderMultiColumnSet* multicolSet = columnSetAtBlockOffset(offset)) { |
| 387 multicolSet->addContentRun(offset); | 507 multicolSet->addContentRun(offset); |
| 388 if (offsetBreakAdjustment) | 508 if (offsetBreakAdjustment) |
| 389 *offsetBreakAdjustment = pageLogicalHeightForOffset(offset) ? pageRe mainingLogicalHeightForOffset(offset, IncludePageBoundary) : LayoutUnit(); | 509 *offsetBreakAdjustment = pageLogicalHeightForOffset(offset) ? pageRe mainingLogicalHeightForOffset(offset, IncludePageBoundary) : LayoutUnit(); |
| 390 return true; | 510 return true; |
| 391 } | 511 } |
| 392 return false; | 512 return false; |
| 393 } | 513 } |
| 394 | 514 |
| 395 bool RenderMultiColumnFlowThread::isPageLogicalHeightKnown() const | 515 bool RenderMultiColumnFlowThread::isPageLogicalHeightKnown() const |
| 396 { | 516 { |
| 397 if (RenderMultiColumnSet* columnSet = lastMultiColumnSet()) | 517 if (RenderMultiColumnSet* columnSet = lastMultiColumnSet()) |
| 398 return columnSet->pageLogicalHeight(); | 518 return columnSet->pageLogicalHeight(); |
| 399 return false; | 519 return false; |
| 400 } | 520 } |
| 401 | 521 |
| 402 } | 522 } |
| OLD | NEW |