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

Side by Side Diff: sky/engine/core/rendering/shapes/ShapeOutsideInfo.cpp

Issue 689733003: Remove most of FloatingObject. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « sky/engine/core/rendering/line/LineWidth.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. 2 * Copyright (C) 2012 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 13 matching lines...) Expand all
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 25 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE. 27 * SUCH DAMAGE.
28 */ 28 */
29 29
30 #include "config.h" 30 #include "config.h"
31 #include "core/rendering/shapes/ShapeOutsideInfo.h" 31 #include "core/rendering/shapes/ShapeOutsideInfo.h"
32 32
33 #include "core/inspector/ConsoleMessage.h" 33 #include "core/inspector/ConsoleMessage.h"
34 #include "core/rendering/FloatingObjects.h"
35 #include "core/rendering/RenderBlockFlow.h" 34 #include "core/rendering/RenderBlockFlow.h"
36 #include "core/rendering/RenderBox.h" 35 #include "core/rendering/RenderBox.h"
37 #include "core/rendering/RenderImage.h" 36 #include "core/rendering/RenderImage.h"
38 #include "platform/LengthFunctions.h" 37 #include "platform/LengthFunctions.h"
39 #include "public/platform/Platform.h" 38 #include "public/platform/Platform.h"
40 39
41 namespace blink { 40 namespace blink {
42 41
43 CSSBoxType referenceBox(const ShapeValue& shapeValue) 42 CSSBoxType referenceBox(const ShapeValue& shapeValue)
44 { 43 {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 case ShapeValue::Shape: 232 case ShapeValue::Shape:
234 return shapeValue->shape(); 233 return shapeValue->shape();
235 case ShapeValue::Image: 234 case ShapeValue::Image:
236 return shapeValue->isImageValid(); 235 return shapeValue->isImageValid();
237 case ShapeValue::Box: 236 case ShapeValue::Box:
238 return true; 237 return true;
239 } 238 }
240 239
241 return false; 240 return false;
242 } 241 }
242
243 ShapeOutsideDeltas ShapeOutsideInfo::computeDeltasForContainingBlockLine(const R enderBlockFlow& containingBlock, const FloatingObject& floatingObject, LayoutUni t lineTop, LayoutUnit lineHeight) 243 ShapeOutsideDeltas ShapeOutsideInfo::computeDeltasForContainingBlockLine(const R enderBlockFlow& containingBlock, const FloatingObject& floatingObject, LayoutUni t lineTop, LayoutUnit lineHeight)
244 { 244 {
245 ASSERT(lineHeight >= 0); 245 // FIXME(sky): Remove this.
246 246 return ShapeOutsideDeltas();
247 LayoutUnit borderBoxTop = containingBlock.logicalTopForFloat(&floatingObject ) + containingBlock.marginBeforeForChild(&m_renderer);
248 LayoutUnit borderBoxLineTop = lineTop - borderBoxTop;
249
250 if (isShapeDirty() || !m_shapeOutsideDeltas.isForLine(borderBoxLineTop, line Height)) {
251 LayoutUnit referenceBoxLineTop = borderBoxLineTop - logicalTopOffset();
252 LayoutUnit floatMarginBoxWidth = containingBlock.logicalWidthForFloat(&f loatingObject);
253
254 if (computedShape().lineOverlapsShapeMarginBounds(referenceBoxLineTop, l ineHeight)) {
255 LineSegment segment = computedShape().getExcludedInterval((borderBox LineTop - logicalTopOffset()), std::min(lineHeight, shapeLogicalBottom() - borde rBoxLineTop));
256 if (segment.isValid) {
257 LayoutUnit logicalLeftMargin = containingBlock.style()->isLeftTo RightDirection() ? containingBlock.marginStartForChild(&m_renderer) : containing Block.marginEndForChild(&m_renderer);
258 LayoutUnit rawLeftMarginBoxDelta = segment.logicalLeft + logical LeftOffset() + logicalLeftMargin;
259 LayoutUnit leftMarginBoxDelta = clampTo<LayoutUnit>(rawLeftMargi nBoxDelta, LayoutUnit(), floatMarginBoxWidth);
260
261 LayoutUnit logicalRightMargin = containingBlock.style()->isLeftT oRightDirection() ? containingBlock.marginEndForChild(&m_renderer) : containingB lock.marginStartForChild(&m_renderer);
262 LayoutUnit rawRightMarginBoxDelta = segment.logicalRight + logic alLeftOffset() - containingBlock.logicalWidthForChild(&m_renderer) - logicalRigh tMargin;
263 LayoutUnit rightMarginBoxDelta = clampTo<LayoutUnit>(rawRightMar ginBoxDelta, -floatMarginBoxWidth, LayoutUnit());
264
265 m_shapeOutsideDeltas = ShapeOutsideDeltas(leftMarginBoxDelta, ri ghtMarginBoxDelta, true, borderBoxLineTop, lineHeight);
266 return m_shapeOutsideDeltas;
267 }
268 }
269
270 // Lines that do not overlap the shape should act as if the float
271 // wasn't there for layout purposes. So we set the deltas to remove the
272 // entire width of the float.
273 m_shapeOutsideDeltas = ShapeOutsideDeltas(floatMarginBoxWidth, -floatMar ginBoxWidth, false, borderBoxLineTop, lineHeight);
274 }
275
276 return m_shapeOutsideDeltas;
277 } 247 }
278 248
279 LayoutRect ShapeOutsideInfo::computedShapePhysicalBoundingBox() const 249 LayoutRect ShapeOutsideInfo::computedShapePhysicalBoundingBox() const
280 { 250 {
281 LayoutRect physicalBoundingBox = computedShape().shapeMarginLogicalBoundingB ox(); 251 LayoutRect physicalBoundingBox = computedShape().shapeMarginLogicalBoundingB ox();
282 physicalBoundingBox.setX(physicalBoundingBox.x() + logicalLeftOffset()); 252 physicalBoundingBox.setX(physicalBoundingBox.x() + logicalLeftOffset());
283 253
284 if (m_renderer.style()->isFlippedBlocksWritingMode()) 254 if (m_renderer.style()->isFlippedBlocksWritingMode())
285 physicalBoundingBox.setY(m_renderer.logicalHeight() - physicalBoundingBo x.maxY()); 255 physicalBoundingBox.setY(m_renderer.logicalHeight() - physicalBoundingBo x.maxY());
286 else 256 else
(...skipping 18 matching lines...) Expand all
305 } 275 }
306 276
307 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const 277 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const
308 { 278 {
309 if (!m_renderer.style()->isHorizontalWritingMode()) 279 if (!m_renderer.style()->isHorizontalWritingMode())
310 return size.transposedSize(); 280 return size.transposedSize();
311 return size; 281 return size;
312 } 282 }
313 283
314 } // namespace blink 284 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/line/LineWidth.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698