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

Side by Side Diff: Source/core/rendering/RenderBlockLineLayout.cpp

Issue 13909006: Merge patch for stacked floats with shape-outside from WebKit (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase to reflect movment of WebCore -> core Created 7 years, 8 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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved.
4 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 computeAvailableWidthFromLeftAndRight(); 174 computeAvailableWidthFromLeftAndRight();
175 } 175 }
176 176
177 inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa tingObject* newFloat) 177 inline void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(RenderBlock::Floa tingObject* newFloat)
178 { 178 {
179 LayoutUnit height = m_block->logicalHeight(); 179 LayoutUnit height = m_block->logicalHeight();
180 if (height < m_block->logicalTopForFloat(newFloat) || height >= m_block->log icalBottomForFloat(newFloat)) 180 if (height < m_block->logicalTopForFloat(newFloat) || height >= m_block->log icalBottomForFloat(newFloat))
181 return; 181 return;
182 182
183 #if ENABLE(CSS_EXCLUSIONS) 183 #if ENABLE(CSS_EXCLUSIONS)
Julien - ping for review 2013/04/17 21:20:22 We should probably remove these.
184 // When floats with shape outside are stacked, the floats are positioned bas ed on the bounding box of the shape,
185 // not the shape's contour. Since we computed the width based on the shape c ontour when we added the float,
186 // when we add a subsequent float on the same line, we need to undo the shap e delta in order to position
187 // based on the bounding box. In order to do this, we need to walk back thro ugh the floating object list to find
188 // the first previous float that is on the same side as our newFloat.
189 ExclusionShapeOutsideInfo* previousShapeOutsideInfo = 0;
190 const RenderBlock::FloatingObjectSet& floatingObjectSet = m_block->m_floatin gObjects->set();
191 RenderBlock::FloatingObjectSetIterator it = floatingObjectSet.end();
192 RenderBlock::FloatingObjectSetIterator begin = floatingObjectSet.begin();
193 while (it != begin) {
194 --it;
195 RenderBlock::FloatingObject* previousFloat = *it;
196 if (previousFloat != newFloat && previousFloat->type() == newFloat->type ()) {
197 previousShapeOutsideInfo = previousFloat->renderer()->exclusionShape OutsideInfo();
198 if (previousShapeOutsideInfo) {
199 LayoutUnit lineTopInShapeCoordinates = m_block->logicalHeight() - m_block->logicalTopForFloat(previousFloat) + previousShapeOutsideInfo->shapeLo gicalTop();
200 previousShapeOutsideInfo->computeSegmentsForLine(lineTopInShapeC oordinates, logicalHeightForLine(m_block, m_isFirstLine));
201 }
202 break;
203 }
204 }
205
184 ExclusionShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->exclusio nShapeOutsideInfo(); 206 ExclusionShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->exclusio nShapeOutsideInfo();
185 if (shapeOutsideInfo) 207 if (shapeOutsideInfo)
186 shapeOutsideInfo->computeSegmentsForLine(m_block->logicalHeight() - m_bl ock->logicalTopForFloat(newFloat) + shapeOutsideInfo->shapeLogicalTop(), logical HeightForLine(m_block, m_isFirstLine)); 208 shapeOutsideInfo->computeSegmentsForLine(m_block->logicalHeight() - m_bl ock->logicalTopForFloat(newFloat) + shapeOutsideInfo->shapeLogicalTop(), logical HeightForLine(m_block, m_isFirstLine));
187 #endif 209 #endif
188 210
189 if (newFloat->type() == RenderBlock::FloatingObject::FloatLeft) { 211 if (newFloat->type() == RenderBlock::FloatingObject::FloatLeft) {
190 float newLeft = m_block->logicalRightForFloat(newFloat); 212 float newLeft = m_block->logicalRightForFloat(newFloat);
191 #if ENABLE(CSS_EXCLUSIONS) 213 #if ENABLE(CSS_EXCLUSIONS)
214 if (previousShapeOutsideInfo)
215 newLeft -= previousShapeOutsideInfo->rightSegmentShapeBoundingBoxDel ta();
192 if (shapeOutsideInfo) 216 if (shapeOutsideInfo)
193 newLeft += shapeOutsideInfo->rightSegmentShapeBoundingBoxDelta(); 217 newLeft += shapeOutsideInfo->rightSegmentShapeBoundingBoxDelta();
194 #endif 218 #endif
195 219
196 if (shouldIndentText() && m_block->style()->isLeftToRightDirection()) 220 if (shouldIndentText() && m_block->style()->isLeftToRightDirection())
197 newLeft += floorToInt(m_block->textIndentOffset()); 221 newLeft += floorToInt(m_block->textIndentOffset());
198 m_left = max<float>(m_left, newLeft); 222 m_left = max<float>(m_left, newLeft);
199 } else { 223 } else {
200 float newRight = m_block->logicalLeftForFloat(newFloat); 224 float newRight = m_block->logicalLeftForFloat(newFloat);
201 #if ENABLE(CSS_EXCLUSIONS) 225 #if ENABLE(CSS_EXCLUSIONS)
226 if (previousShapeOutsideInfo)
227 newRight -= previousShapeOutsideInfo->leftSegmentShapeBoundingBoxDel ta();
202 if (shapeOutsideInfo) 228 if (shapeOutsideInfo)
203 newRight += shapeOutsideInfo->leftSegmentShapeBoundingBoxDelta(); 229 newRight += shapeOutsideInfo->leftSegmentShapeBoundingBoxDelta();
204 #endif 230 #endif
205 231
206 if (shouldIndentText() && !m_block->style()->isLeftToRightDirection()) 232 if (shouldIndentText() && !m_block->style()->isLeftToRightDirection())
207 newRight -= floorToInt(m_block->textIndentOffset()); 233 newRight -= floorToInt(m_block->textIndentOffset());
208 m_right = min<float>(m_right, newRight); 234 m_right = min<float>(m_right, newRight);
209 } 235 }
210 236
211 computeAvailableWidthFromLeftAndRight(); 237 computeAvailableWidthFromLeftAndRight();
(...skipping 3202 matching lines...) Expand 10 before | Expand all | Expand 10 after
3414 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache); 3440 lineGridBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, ver ticalPositionCache);
3415 3441
3416 setLineGridBox(lineGridBox); 3442 setLineGridBox(lineGridBox);
3417 3443
3418 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying 3444 // FIXME: If any of the characteristics of the box change compared to the ol d one, then we need to do a deep dirtying
3419 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping 3445 // (similar to what happens when the page height changes). Ideally, though, we only do this if someone is actually snapping
3420 // to this grid. 3446 // to this grid.
3421 } 3447 }
3422 3448
3423 } 3449 }
OLDNEW
« Source/core/rendering/RenderBlock.h ('K') | « Source/core/rendering/RenderBlock.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698