OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 relayoutChildren = true; | 335 relayoutChildren = true; |
336 | 336 |
337 rebuildFloatsFromIntruding(); | 337 rebuildFloatsFromIntruding(); |
338 | 338 |
339 bool pageLogicalHeightChanged = false; | 339 bool pageLogicalHeightChanged = false; |
340 bool hasSpecifiedPageLogicalHeight = false; | 340 bool hasSpecifiedPageLogicalHeight = false; |
341 checkForPaginationLogicalHeightChange(pageLogicalHeight, pageLogicalHeightCh anged, hasSpecifiedPageLogicalHeight); | 341 checkForPaginationLogicalHeightChange(pageLogicalHeight, pageLogicalHeightCh anged, hasSpecifiedPageLogicalHeight); |
342 | 342 |
343 LayoutStateMaintainer statePusher(*this, locationOffset(), pageLogicalHeight , pageLogicalHeightChanged, columnInfo()); | 343 LayoutStateMaintainer statePusher(*this, locationOffset(), pageLogicalHeight , pageLogicalHeightChanged, columnInfo()); |
344 | 344 |
345 // Regions changing widths can force us to relayout our children. | |
346 RenderFlowThread* flowThread = flowThreadContainingBlock(); | |
347 if (updateRegionsAndShapesLogicalSize(flowThread)) | |
348 relayoutChildren = true; | |
349 | |
350 // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg, to track | 345 // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg, to track |
351 // our current maximal positive and negative margins. These values are used when we | 346 // our current maximal positive and negative margins. These values are used when we |
352 // are collapsed with adjacent blocks, so for example, if you have block A a nd B | 347 // are collapsed with adjacent blocks, so for example, if you have block A a nd B |
353 // collapsing together, then you'd take the maximal positive margin from bot h A and B | 348 // collapsing together, then you'd take the maximal positive margin from bot h A and B |
354 // and subtract it from the maximal negative margin from both A and B to get the | 349 // and subtract it from the maximal negative margin from both A and B to get the |
355 // true collapsed margin. This algorithm is recursive, so when we finish lay out() | 350 // true collapsed margin. This algorithm is recursive, so when we finish lay out() |
356 // our block knows its current maximal positive/negative values. | 351 // our block knows its current maximal positive/negative values. |
357 // | 352 // |
358 // Start out by setting our margin values to our current margins. Table cell s have | 353 // Start out by setting our margin values to our current margins. Table cell s have |
359 // no margins, so we don't fill in the values for table cells. | 354 // no margins, so we don't fill in the values for table cells. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
434 } | 429 } |
435 } | 430 } |
436 } | 431 } |
437 | 432 |
438 bool heightChanged = (previousHeight != newHeight); | 433 bool heightChanged = (previousHeight != newHeight); |
439 if (heightChanged) | 434 if (heightChanged) |
440 relayoutChildren = true; | 435 relayoutChildren = true; |
441 | 436 |
442 layoutPositionedObjects(relayoutChildren || isRoot(), oldLeft != logicalLeft () ? ForcedLayoutAfterContainingBlockMoved : DefaultLayout); | 437 layoutPositionedObjects(relayoutChildren || isRoot(), oldLeft != logicalLeft () ? ForcedLayoutAfterContainingBlockMoved : DefaultLayout); |
443 | 438 |
444 updateRegionsAndShapesAfterChildLayout(flowThread, heightChanged); | 439 updateRegionsAndShapesAfterChildLayout(flowThreadContainingBlock(), heightCh anged); |
Bem Jones-Bey (adobe)
2014/03/27 00:09:47
As mentioned before, this should just be computeRe
| |
445 | 440 |
446 // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway). | 441 // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway). |
447 computeOverflow(oldClientAfterEdge); | 442 computeOverflow(oldClientAfterEdge); |
448 | 443 |
449 m_descendantsWithFloatsMarkedForLayout = false; | 444 m_descendantsWithFloatsMarkedForLayout = false; |
450 return true; | 445 return true; |
451 } | 446 } |
452 | 447 |
453 void RenderBlockFlow::determineLogicalLeftPositionForChild(RenderBox* child, App lyLayoutDeltaMode applyDelta) | 448 void RenderBlockFlow::determineLogicalLeftPositionForChild(RenderBox* child, App lyLayoutDeltaMode applyDelta) |
454 { | 449 { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
606 | 601 |
607 // We are no longer at the top of the block if we encounter a non-empty chil d. | 602 // We are no longer at the top of the block if we encounter a non-empty chil d. |
608 // This has to be done after checking for clear, so that margins can be rese t if a clear occurred. | 603 // This has to be done after checking for clear, so that margins can be rese t if a clear occurred. |
609 if (marginInfo.atBeforeSideOfBlock() && !childIsSelfCollapsing) | 604 if (marginInfo.atBeforeSideOfBlock() && !childIsSelfCollapsing) |
610 marginInfo.setAtBeforeSideOfBlock(false); | 605 marginInfo.setAtBeforeSideOfBlock(false); |
611 | 606 |
612 // Now place the child in the correct left position | 607 // Now place the child in the correct left position |
613 determineLogicalLeftPositionForChild(child, ApplyLayoutDelta); | 608 determineLogicalLeftPositionForChild(child, ApplyLayoutDelta); |
614 | 609 |
615 LayoutSize childOffset = child->location() - oldRect.location(); | 610 LayoutSize childOffset = child->location() - oldRect.location(); |
616 relayoutShapeDescendantIfMoved(childRenderBlock, childOffset); | |
617 | 611 |
618 // Update our height now that the child has been placed in the correct posit ion. | 612 // Update our height now that the child has been placed in the correct posit ion. |
619 setLogicalHeight(logicalHeight() + logicalHeightForChild(child)); | 613 setLogicalHeight(logicalHeight() + logicalHeightForChild(child)); |
620 if (mustSeparateMarginAfterForChild(child)) { | 614 if (mustSeparateMarginAfterForChild(child)) { |
621 setLogicalHeight(logicalHeight() + marginAfterForChild(child)); | 615 setLogicalHeight(logicalHeight() + marginAfterForChild(child)); |
622 marginInfo.clearMargin(); | 616 marginInfo.clearMargin(); |
623 } | 617 } |
624 // If the child has overhanging floats that intrude into following siblings (or possibly out | 618 // If the child has overhanging floats that intrude into following siblings (or possibly out |
625 // of this block), then the parent gets notified of the floats now. | 619 // of this block), then the parent gets notified of the floats now. |
626 if (childRenderBlockFlow && childRenderBlockFlow->containsFloats()) | 620 if (childRenderBlockFlow && childRenderBlockFlow->containsFloats()) |
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2136 right -= textIndentOffset(); | 2130 right -= textIndentOffset(); |
2137 | 2131 |
2138 return right; | 2132 return right; |
2139 } | 2133 } |
2140 | 2134 |
2141 LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject * floatingObject, LayoutUnit logicalTopOffset) const | 2135 LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject * floatingObject, LayoutUnit logicalTopOffset) const |
2142 { | 2136 { |
2143 RenderBox* childBox = floatingObject->renderer(); | 2137 RenderBox* childBox = floatingObject->renderer(); |
2144 LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(); // Constant pa rt of left offset. | 2138 LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(); // Constant pa rt of left offset. |
2145 LayoutUnit logicalRightOffset; // Constant part of right offset. | 2139 LayoutUnit logicalRightOffset; // Constant part of right offset. |
2146 // FIXME Bug 102948: This only works for shape outside directly set on this block. | 2140 logicalRightOffset = logicalRightOffsetForContent(); |
2147 ShapeInsideInfo* shapeInsideInfo = this->layoutShapeInsideInfo(); | |
2148 // FIXME: Implement behavior for right floats. | |
2149 if (shapeInsideInfo) { | |
2150 LayoutSize floatLogicalSize = logicalSizeForFloat(floatingObject); | |
2151 // floatingObject's logicalSize doesn't contain the actual height at thi s point, so we need to calculate it | |
2152 floatLogicalSize.setHeight(logicalHeightForChild(childBox) + marginBefor eForChild(childBox) + marginAfterForChild(childBox)); | |
2153 | |
2154 // FIXME: If the float doesn't fit in the shape we should push it under the content box | |
2155 logicalTopOffset = shapeInsideInfo->computeFirstFitPositionForFloat(floa tLogicalSize); | |
2156 if (logicalHeight() > logicalTopOffset) | |
2157 logicalTopOffset = logicalHeight(); | |
2158 | |
2159 SegmentList segments = shapeInsideInfo->computeSegmentsForLine(logicalTo pOffset, floatLogicalSize.height()); | |
2160 // FIXME: Add support for shapes with multiple segments. | |
2161 if (segments.size() >= 1) { | |
2162 // The segment offsets are relative to the content box. | |
2163 logicalRightOffset = logicalLeftOffset + segments[0].logicalRight; | |
2164 logicalLeftOffset += segments[0].logicalLeft; | |
2165 } | |
2166 } else { | |
2167 logicalRightOffset = logicalRightOffsetForContent(); | |
2168 } | |
2169 | 2141 |
2170 LayoutUnit floatLogicalWidth = min(logicalWidthForFloat(floatingObject), log icalRightOffset - logicalLeftOffset); // The width we look for. | 2142 LayoutUnit floatLogicalWidth = min(logicalWidthForFloat(floatingObject), log icalRightOffset - logicalLeftOffset); // The width we look for. |
2171 | 2143 |
2172 LayoutUnit floatLogicalLeft; | 2144 LayoutUnit floatLogicalLeft; |
2173 | 2145 |
2174 bool insideFlowThread = flowThreadContainingBlock(); | 2146 bool insideFlowThread = flowThreadContainingBlock(); |
2175 | 2147 |
2176 if (childBox->style()->floating() == LeftFloat) { | 2148 if (childBox->style()->floating() == LeftFloat) { |
2177 LayoutUnit heightRemainingLeft = 1; | 2149 LayoutUnit heightRemainingLeft = 1; |
2178 LayoutUnit heightRemainingRight = 1; | 2150 LayoutUnit heightRemainingRight = 1; |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2818 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() | 2790 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() |
2819 { | 2791 { |
2820 if (m_rareData) | 2792 if (m_rareData) |
2821 return *m_rareData; | 2793 return *m_rareData; |
2822 | 2794 |
2823 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); | 2795 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
2824 return *m_rareData; | 2796 return *m_rareData; |
2825 } | 2797 } |
2826 | 2798 |
2827 } // namespace WebCore | 2799 } // namespace WebCore |
OLD | NEW |