19bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles)/* 29bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 39bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * 49bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without 59bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * modification, are permitted provided that the following conditions 69bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * are met: 79bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * 89bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * 1. Redistributions of source code must retain the above 99bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * copyright notice, this list of conditions and the following 109bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * disclaimer. 119bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * 2. Redistributions in binary form must reproduce the above 129bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * copyright notice, this list of conditions and the following 139bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * disclaimer in the documentation and/or other materials 149bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * provided with the distribution. 159bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * 169bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 179bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 189bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 199bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 209bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 219bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 229bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 239bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 249bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 259bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 269bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 279bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) * OF THE POSSIBILITY OF SUCH DAMAGE. 289bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) */ 299bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 309bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles)#include "config.h" 3109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)#include "core/rendering/line/LineWidth.h" 329bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 33bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)#include "core/rendering/RenderBlock.h" 34bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles)#include "core/rendering/RenderRubyRun.h" 35bfe3590b1806e3ff18f46ee3af5d4b83078f305aTorne (Richard Coles) 36c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink { 379bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 38f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles)LineWidth::LineWidth(RenderBlockFlow& block, bool isFirstLine, IndentTextOrNot shouldIndentText) 399bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) : m_block(block) 409bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) , m_uncommittedWidth(0) 419bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) , m_committedWidth(0) 429bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) , m_overhangWidth(0) 43197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch , m_trailingWhitespaceWidth(0) 449bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) , m_left(0) 459bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) , m_right(0) 469bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) , m_availableWidth(0) 479bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) , m_isFirstLine(isFirstLine) 489bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) , m_shouldIndentText(shouldIndentText) 499bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles){ 509bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) updateAvailableWidth(); 519bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles)} 529bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 539bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles)void LineWidth::updateAvailableWidth(LayoutUnit replacedHeight) 549bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles){ 559bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) LayoutUnit height = m_block.logicalHeight(); 5606f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) LayoutUnit logicalHeight = m_block.minLineHeightForReplacedRenderer(m_isFirstLine, replacedHeight); 57d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) m_left = m_block.logicalLeftOffsetForLine(height, shouldIndentText(), logicalHeight).toFloat(); 58d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) m_right = m_block.logicalRightOffsetForLine(height, shouldIndentText(), logicalHeight).toFloat(); 599bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 609bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) computeAvailableWidthFromLeftAndRight(); 619bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles)} 629bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 639bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles)void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(FloatingObject* newFloat) 649bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles){ 659bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) LayoutUnit height = m_block.logicalHeight(); 66f79f16f17ddc4f842d7b7a38603e280e94be826aTorne (Richard Coles) if (height < m_block.logicalTopForFloat(newFloat) || height >= m_block.logicalBottomForFloat(newFloat)) 679bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) return; 689bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 699e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles) ShapeOutsideDeltas shapeDeltas; 709e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles) if (ShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->shapeOutsideInfo()) { 71d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) LayoutUnit lineHeight = m_block.lineHeight(m_isFirstLine, m_block.isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); 729e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles) shapeDeltas = shapeOutsideInfo->computeDeltasForContainingBlockLine(m_block, *newFloat, m_block.logicalHeight(), lineHeight); 73d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) } 749bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 759bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) if (newFloat->type() == FloatingObject::FloatLeft) { 76d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float newLeft = m_block.logicalRightForFloat(newFloat).toFloat(); 779e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles) if (shapeDeltas.isValid()) { 789e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles) if (shapeDeltas.lineOverlapsShape()) 799e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles) newLeft += shapeDeltas.rightMarginBoxDelta(); 80d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) else // Per the CSS Shapes spec, If the line doesn't overlap the shape, then ignore this shape for this line. 81d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) newLeft = m_left; 82d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) } 839bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) if (shouldIndentText() && m_block.style()->isLeftToRightDirection()) 849bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) newLeft += floorToInt(m_block.textIndentOffset()); 859bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) m_left = std::max<float>(m_left, newLeft); 869bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) } else { 87d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float newRight = m_block.logicalLeftForFloat(newFloat).toFloat(); 889e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles) if (shapeDeltas.isValid()) { 899e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles) if (shapeDeltas.lineOverlapsShape()) 909e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles) newRight += shapeDeltas.leftMarginBoxDelta(); 91d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) else // Per the CSS Shapes spec, If the line doesn't overlap the shape, then ignore this shape for this line. 92d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) newRight = m_right; 93d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) } 949bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) if (shouldIndentText() && !m_block.style()->isLeftToRightDirection()) 959bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) newRight -= floorToInt(m_block.textIndentOffset()); 969bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) m_right = std::min<float>(m_right, newRight); 979bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) } 989bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 999bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) computeAvailableWidthFromLeftAndRight(); 1009bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles)} 1019bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 1029bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles)void LineWidth::commit() 1039bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles){ 1049bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) m_committedWidth += m_uncommittedWidth; 1059bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) m_uncommittedWidth = 0; 1069bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles)} 1079bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 1089bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles)void LineWidth::applyOverhang(RenderRubyRun* rubyRun, RenderObject* startRenderer, RenderObject* endRenderer) 1099bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles){ 1109bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) int startOverhang; 1119bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) int endOverhang; 1129bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) rubyRun->getOverhang(m_isFirstLine, startRenderer, endRenderer, startOverhang, endOverhang); 1139bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 1149bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) startOverhang = std::min<int>(startOverhang, m_committedWidth); 1159bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) m_availableWidth += startOverhang; 1169bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 1179bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) endOverhang = std::max(std::min<int>(endOverhang, m_availableWidth - currentWidth()), 0); 1189bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) m_availableWidth += endOverhang; 1199bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) m_overhangWidth += startOverhang + endOverhang; 1209bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles)} 1219bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 122d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)inline static float availableWidthAtOffset(const RenderBlockFlow& block, const LayoutUnit& offset, bool shouldIndentText, float& newLineLeft, float& newLineRight) 123d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles){ 124d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) newLineLeft = block.logicalLeftOffsetForLine(offset, shouldIndentText).toFloat(); 125d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) newLineRight = block.logicalRightOffsetForLine(offset, shouldIndentText).toFloat(); 126d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) return std::max(0.0f, newLineRight - newLineLeft); 127d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)} 128d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 129d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)inline static float availableWidthAtOffset(const RenderBlockFlow& block, const LayoutUnit& offset, bool shouldIndentText) 130d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles){ 131d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float newLineLeft = block.logicalLeftOffsetForLine(offset, shouldIndentText).toFloat(); 132d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float newLineRight = block.logicalRightOffsetForLine(offset, shouldIndentText).toFloat(); 133d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) return std::max(0.0f, newLineRight - newLineLeft); 134d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)} 135d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 136d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)void LineWidth::updateLineDimension(LayoutUnit newLineTop, LayoutUnit newLineWidth, const float& newLineLeft, const float& newLineRight) 137d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles){ 138d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) if (newLineWidth <= m_availableWidth) 139d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) return; 140d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 141d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) m_block.setLogicalHeight(newLineTop); 142d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) m_availableWidth = newLineWidth + m_overhangWidth; 143d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) m_left = newLineLeft; 144d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) m_right = newLineRight; 145d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)} 146d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 147d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)inline static bool isWholeLineFit(const RenderBlockFlow& block, const LayoutUnit& lineTop, LayoutUnit lineHeight, float uncommittedWidth, bool shouldIndentText) 148d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles){ 149d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) for (LayoutUnit lineBottom = lineTop; lineBottom <= lineTop + lineHeight; lineBottom++) { 150d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) LayoutUnit availableWidthAtBottom = availableWidthAtOffset(block, lineBottom, shouldIndentText); 151d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) if (availableWidthAtBottom < uncommittedWidth) 152d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) return false; 153d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) } 154d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) return true; 155d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)} 156d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 157d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)void LineWidth::wrapNextToShapeOutside(bool isFirstLine) 158d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles){ 159d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) LayoutUnit lineHeight = m_block.lineHeight(isFirstLine, m_block.isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); 160d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) LayoutUnit lineLogicalTop = m_block.logicalHeight(); 161d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) LayoutUnit newLineTop = lineLogicalTop; 162d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) LayoutUnit floatLogicalBottom = m_block.nextFloatLogicalBottomBelow(lineLogicalTop); 163d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 164d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float newLineWidth; 165d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float newLineLeft = m_left; 166d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) float newLineRight = m_right; 167d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) while (true) { 168d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) newLineWidth = availableWidthAtOffset(m_block, newLineTop, shouldIndentText(), newLineLeft, newLineRight); 169d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) if (newLineWidth >= m_uncommittedWidth && isWholeLineFit(m_block, newLineTop, lineHeight, m_uncommittedWidth, shouldIndentText())) 170d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) break; 171d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 172d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) if (newLineTop >= floatLogicalBottom) 173d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) break; 174d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 175d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) newLineTop++; 176d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) } 177d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) updateLineDimension(newLineTop, newLineWidth, newLineLeft, newLineRight); 178d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)} 179d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 180d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles)void LineWidth::fitBelowFloats(bool isFirstLine) 1819bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles){ 1829bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) ASSERT(!m_committedWidth); 1839bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) ASSERT(!fitsOnLine()); 1849bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 1859bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) LayoutUnit floatLogicalBottom; 1869bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) LayoutUnit lastFloatLogicalBottom = m_block.logicalHeight(); 1879bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) float newLineWidth = m_availableWidth; 1889bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) float newLineLeft = m_left; 1899bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) float newLineRight = m_right; 190d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 191d6cdb82654e8f3343a693ca752d5c4cee0324e17Torne (Richard Coles) FloatingObject* lastFloatFromPreviousLine = (m_block.containsFloats() ? m_block.m_floatingObjects->set().last().get() : 0); 192d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) if (lastFloatFromPreviousLine && lastFloatFromPreviousLine->renderer()->shapeOutsideInfo()) 193d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) return wrapNextToShapeOutside(isFirstLine); 194d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) 1959bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) while (true) { 19606f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) floatLogicalBottom = m_block.nextFloatLogicalBottomBelow(lastFloatLogicalBottom, ShapeOutsideFloatShapeOffset); 1979bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) if (floatLogicalBottom <= lastFloatLogicalBottom) 1989bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) break; 1999bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 200d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) newLineWidth = availableWidthAtOffset(m_block, floatLogicalBottom, shouldIndentText(), newLineLeft, newLineRight); 2019bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) lastFloatLogicalBottom = floatLogicalBottom; 2021e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles) 20307a852d8c1953036774d8f3b65d18dcfea3bb4a2Ben Murdoch if (newLineWidth >= m_uncommittedWidth) 2049bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) break; 2059bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) } 206d5428f32f5d1719f774f62e19147104ca245a3abTorne (Richard Coles) updateLineDimension(lastFloatLogicalBottom, newLineWidth, newLineLeft, newLineRight); 2079bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles)} 2089bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 2099bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles)void LineWidth::computeAvailableWidthFromLeftAndRight() 2109bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles){ 2119bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) m_availableWidth = max(0.0f, m_right - m_left) + m_overhangWidth; 2129bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles)} 2139bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles) 2149bbd2f5e390b01907d97ecffde80aa1b06113aacTorne (Richard Coles)} 215