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

Side by Side Diff: Source/core/rendering/line/LineWidth.cpp

Issue 209443007: Remove shape-inside support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix Zoltan's comments Created 6 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2013 Adobe Systems Incorporated. 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 * 7 *
8 * 1. Redistributions of source code must retain the above 8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following 9 * copyright notice, this list of conditions and the following
10 * disclaimer. 10 * disclaimer.
(...skipping 25 matching lines...) Expand all
36 namespace WebCore { 36 namespace WebCore {
37 37
38 LineWidth::LineWidth(RenderBlockFlow& block, bool isFirstLine, IndentTextOrNot s houldIndentText) 38 LineWidth::LineWidth(RenderBlockFlow& block, bool isFirstLine, IndentTextOrNot s houldIndentText)
39 : m_block(block) 39 : m_block(block)
40 , m_uncommittedWidth(0) 40 , m_uncommittedWidth(0)
41 , m_committedWidth(0) 41 , m_committedWidth(0)
42 , m_overhangWidth(0) 42 , m_overhangWidth(0)
43 , m_left(0) 43 , m_left(0)
44 , m_right(0) 44 , m_right(0)
45 , m_availableWidth(0) 45 , m_availableWidth(0)
46 , m_segment(0)
47 , m_isFirstLine(isFirstLine) 46 , m_isFirstLine(isFirstLine)
48 , m_shouldIndentText(shouldIndentText) 47 , m_shouldIndentText(shouldIndentText)
49 { 48 {
50 updateCurrentShapeSegment();
51 updateAvailableWidth(); 49 updateAvailableWidth();
52 } 50 }
53 51
54 void LineWidth::updateAvailableWidth(LayoutUnit replacedHeight) 52 void LineWidth::updateAvailableWidth(LayoutUnit replacedHeight)
55 { 53 {
56 LayoutUnit height = m_block.logicalHeight(); 54 LayoutUnit height = m_block.logicalHeight();
57 LayoutUnit logicalHeight = m_block.minLineHeightForReplacedRenderer(m_isFirs tLine, replacedHeight); 55 LayoutUnit logicalHeight = m_block.minLineHeightForReplacedRenderer(m_isFirs tLine, replacedHeight);
58 m_left = m_block.logicalLeftOffsetForLine(height, shouldIndentText(), logica lHeight).toFloat(); 56 m_left = m_block.logicalLeftOffsetForLine(height, shouldIndentText(), logica lHeight).toFloat();
59 m_right = m_block.logicalRightOffsetForLine(height, shouldIndentText(), logi calHeight).toFloat(); 57 m_right = m_block.logicalRightOffsetForLine(height, shouldIndentText(), logi calHeight).toFloat();
60 58
61 if (m_segment) {
62 m_left = std::max<float>(m_segment->logicalLeft, m_left);
63 m_right = std::min<float>(m_segment->logicalRight, m_right);
64 }
65
66 computeAvailableWidthFromLeftAndRight(); 59 computeAvailableWidthFromLeftAndRight();
67 } 60 }
68 61
69 void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(FloatingObject* newFloat ) 62 void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(FloatingObject* newFloat )
70 { 63 {
71 LayoutUnit height = m_block.logicalHeight(); 64 LayoutUnit height = m_block.logicalHeight();
72 if (height < m_block.logicalTopForFloat(newFloat) || height >= m_block.logic alBottomForFloat(newFloat)) 65 if (height < m_block.logicalTopForFloat(newFloat) || height >= m_block.logic alBottomForFloat(newFloat))
73 return; 66 return;
74 67
75 ShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->shapeOutsideInfo( ); 68 ShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->shapeOutsideInfo( );
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 return wrapNextToShapeOutside(isFirstLine); 192 return wrapNextToShapeOutside(isFirstLine);
200 193
201 while (true) { 194 while (true) {
202 floatLogicalBottom = m_block.nextFloatLogicalBottomBelow(lastFloatLogica lBottom, ShapeOutsideFloatShapeOffset); 195 floatLogicalBottom = m_block.nextFloatLogicalBottomBelow(lastFloatLogica lBottom, ShapeOutsideFloatShapeOffset);
203 if (floatLogicalBottom <= lastFloatLogicalBottom) 196 if (floatLogicalBottom <= lastFloatLogicalBottom)
204 break; 197 break;
205 198
206 newLineWidth = availableWidthAtOffset(m_block, floatLogicalBottom, shoul dIndentText(), newLineLeft, newLineRight); 199 newLineWidth = availableWidthAtOffset(m_block, floatLogicalBottom, shoul dIndentText(), newLineLeft, newLineRight);
207 lastFloatLogicalBottom = floatLogicalBottom; 200 lastFloatLogicalBottom = floatLogicalBottom;
208 201
209 if (newLineWidth >= m_uncommittedWidth) { 202 if (newLineWidth >= m_uncommittedWidth)
210 ShapeInsideInfo* shapeInsideInfo = m_block.layoutShapeInsideInfo();
211 if (shapeInsideInfo) {
212 // To safely update our shape segments, the current segment must be the first in this line, so committedWidth has to be 0
213 ASSERT(!m_committedWidth);
214
215 LayoutUnit logicalOffsetFromShapeContainer = m_block.logicalOffs etFromShapeAncestorContainer(&shapeInsideInfo->owner()).height();
216 LayoutUnit lineHeight = m_block.lineHeight(false, m_block.isHori zontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes );
217 shapeInsideInfo->updateSegmentsForLine(lastFloatLogicalBottom + logicalOffsetFromShapeContainer, lineHeight);
218 updateCurrentShapeSegment();
219 updateAvailableWidth();
220 }
221 break; 203 break;
222 }
223 } 204 }
224 updateLineDimension(lastFloatLogicalBottom, newLineWidth, newLineLeft, newLi neRight); 205 updateLineDimension(lastFloatLogicalBottom, newLineWidth, newLineLeft, newLi neRight);
225 } 206 }
226 207
227 void LineWidth::updateCurrentShapeSegment()
228 {
229 if (ShapeInsideInfo* shapeInsideInfo = m_block.layoutShapeInsideInfo())
230 m_segment = shapeInsideInfo->currentSegment();
231 }
232
233 void LineWidth::computeAvailableWidthFromLeftAndRight() 208 void LineWidth::computeAvailableWidthFromLeftAndRight()
234 { 209 {
235 m_availableWidth = max(0.0f, m_right - m_left) + m_overhangWidth; 210 m_availableWidth = max(0.0f, m_right - m_left) + m_overhangWidth;
236 } 211 }
237 212
238 } 213 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698