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

Side by Side Diff: Source/core/rendering/shapes/ShapeOutsideInfo.cpp

Issue 752723004: Use references in RenderBlock and RenderBlockFlow methods (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: cover RenderBlockFlow class as well Created 6 years 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 | « Source/core/rendering/line/LineBreaker.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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 case ShapeValue::Box: 273 case ShapeValue::Box:
274 return true; 274 return true;
275 } 275 }
276 276
277 return false; 277 return false;
278 } 278 }
279 ShapeOutsideDeltas ShapeOutsideInfo::computeDeltasForContainingBlockLine(const R enderBlockFlow& containingBlock, const FloatingObject& floatingObject, LayoutUni t lineTop, LayoutUnit lineHeight) 279 ShapeOutsideDeltas ShapeOutsideInfo::computeDeltasForContainingBlockLine(const R enderBlockFlow& containingBlock, const FloatingObject& floatingObject, LayoutUni t lineTop, LayoutUnit lineHeight)
280 { 280 {
281 ASSERT(lineHeight >= 0); 281 ASSERT(lineHeight >= 0);
282 282
283 LayoutUnit borderBoxTop = containingBlock.logicalTopForFloat(&floatingObject ) + containingBlock.marginBeforeForChild(&m_renderer); 283 LayoutUnit borderBoxTop = containingBlock.logicalTopForFloat(&floatingObject ) + containingBlock.marginBeforeForChild(m_renderer);
284 LayoutUnit borderBoxLineTop = lineTop - borderBoxTop; 284 LayoutUnit borderBoxLineTop = lineTop - borderBoxTop;
285 285
286 if (isShapeDirty() || !m_shapeOutsideDeltas.isForLine(borderBoxLineTop, line Height)) { 286 if (isShapeDirty() || !m_shapeOutsideDeltas.isForLine(borderBoxLineTop, line Height)) {
287 LayoutUnit referenceBoxLineTop = borderBoxLineTop - logicalTopOffset(); 287 LayoutUnit referenceBoxLineTop = borderBoxLineTop - logicalTopOffset();
288 LayoutUnit floatMarginBoxWidth = containingBlock.logicalWidthForFloat(&f loatingObject); 288 LayoutUnit floatMarginBoxWidth = containingBlock.logicalWidthForFloat(&f loatingObject);
289 289
290 if (computedShape().lineOverlapsShapeMarginBounds(referenceBoxLineTop, l ineHeight)) { 290 if (computedShape().lineOverlapsShapeMarginBounds(referenceBoxLineTop, l ineHeight)) {
291 LineSegment segment = computedShape().getExcludedInterval((borderBox LineTop - logicalTopOffset()), std::min(lineHeight, shapeLogicalBottom() - borde rBoxLineTop)); 291 LineSegment segment = computedShape().getExcludedInterval((borderBox LineTop - logicalTopOffset()), std::min(lineHeight, shapeLogicalBottom() - borde rBoxLineTop));
292 if (segment.isValid) { 292 if (segment.isValid) {
293 LayoutUnit logicalLeftMargin = containingBlock.style()->isLeftTo RightDirection() ? containingBlock.marginStartForChild(&m_renderer) : containing Block.marginEndForChild(&m_renderer); 293 LayoutUnit logicalLeftMargin = containingBlock.style()->isLeftTo RightDirection() ? containingBlock.marginStartForChild(m_renderer) : containingB lock.marginEndForChild(m_renderer);
294 LayoutUnit rawLeftMarginBoxDelta = segment.logicalLeft + logical LeftOffset() + logicalLeftMargin; 294 LayoutUnit rawLeftMarginBoxDelta = segment.logicalLeft + logical LeftOffset() + logicalLeftMargin;
295 LayoutUnit leftMarginBoxDelta = clampTo<LayoutUnit>(rawLeftMargi nBoxDelta, LayoutUnit(), floatMarginBoxWidth); 295 LayoutUnit leftMarginBoxDelta = clampTo<LayoutUnit>(rawLeftMargi nBoxDelta, LayoutUnit(), floatMarginBoxWidth);
296 296
297 LayoutUnit logicalRightMargin = containingBlock.style()->isLeftT oRightDirection() ? containingBlock.marginEndForChild(&m_renderer) : containingB lock.marginStartForChild(&m_renderer); 297 LayoutUnit logicalRightMargin = containingBlock.style()->isLeftT oRightDirection() ? containingBlock.marginEndForChild(m_renderer) : containingBl ock.marginStartForChild(m_renderer);
298 LayoutUnit rawRightMarginBoxDelta = segment.logicalRight + logic alLeftOffset() - containingBlock.logicalWidthForChild(&m_renderer) - logicalRigh tMargin; 298 LayoutUnit rawRightMarginBoxDelta = segment.logicalRight + logic alLeftOffset() - containingBlock.logicalWidthForChild(m_renderer) - logicalRight Margin;
299 LayoutUnit rightMarginBoxDelta = clampTo<LayoutUnit>(rawRightMar ginBoxDelta, -floatMarginBoxWidth, LayoutUnit()); 299 LayoutUnit rightMarginBoxDelta = clampTo<LayoutUnit>(rawRightMar ginBoxDelta, -floatMarginBoxWidth, LayoutUnit());
300 300
301 m_shapeOutsideDeltas = ShapeOutsideDeltas(leftMarginBoxDelta, ri ghtMarginBoxDelta, true, borderBoxLineTop, lineHeight); 301 m_shapeOutsideDeltas = ShapeOutsideDeltas(leftMarginBoxDelta, ri ghtMarginBoxDelta, true, borderBoxLineTop, lineHeight);
302 return m_shapeOutsideDeltas; 302 return m_shapeOutsideDeltas;
303 } 303 }
304 } 304 }
305 305
306 // Lines that do not overlap the shape should act as if the float 306 // Lines that do not overlap the shape should act as if the float
307 // wasn't there for layout purposes. So we set the deltas to remove the 307 // wasn't there for layout purposes. So we set the deltas to remove the
308 // entire width of the float. 308 // entire width of the float.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 341 }
342 342
343 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const 343 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const
344 { 344 {
345 if (!m_renderer.style()->isHorizontalWritingMode()) 345 if (!m_renderer.style()->isHorizontalWritingMode())
346 return size.transposedSize(); 346 return size.transposedSize();
347 return size; 347 return size;
348 } 348 }
349 349
350 } // namespace blink 350 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/line/LineBreaker.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698