Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 | 49 |
| 50 void ShapeOutsideInfo::setReferenceBoxLogicalSize(LayoutSize newReferenceBoxLogi calSize) | 50 void ShapeOutsideInfo::setReferenceBoxLogicalSize(LayoutSize newReferenceBoxLogi calSize) |
| 51 { | 51 { |
| 52 bool isHorizontalWritingMode = m_renderer.containingBlock()->style()->isHori zontalWritingMode(); | 52 bool isHorizontalWritingMode = m_renderer.containingBlock()->style()->isHori zontalWritingMode(); |
| 53 switch (referenceBox(*m_renderer.style()->shapeOutside())) { | 53 switch (referenceBox(*m_renderer.style()->shapeOutside())) { |
| 54 case MarginBox: | 54 case MarginBox: |
| 55 if (isHorizontalWritingMode) | 55 if (isHorizontalWritingMode) |
| 56 newReferenceBoxLogicalSize.expand(m_renderer.marginWidth(), m_render er.marginHeight()); | 56 newReferenceBoxLogicalSize.expand(m_renderer.marginWidth(), m_render er.marginHeight()); |
| 57 else | 57 else |
| 58 newReferenceBoxLogicalSize.expand(m_renderer.marginHeight(), m_rende rer.marginWidth()); | 58 newReferenceBoxLogicalSize.expand(m_renderer.marginHeight(), m_rende rer.marginWidth()); |
| 59 if (newReferenceBoxLogicalSize.isEmpty()) { | |
|
bjonesbe
2015/03/16 22:26:34
Sorry I missed this earlier, but in this case you
| |
| 60 newReferenceBoxLogicalSize.setWidth(newReferenceBoxLogicalSize.width ().clamp(0.0)); | |
| 61 newReferenceBoxLogicalSize.setHeight(newReferenceBoxLogicalSize.heig ht().clamp(0.0)); | |
| 62 } | |
| 59 break; | 63 break; |
| 60 case BorderBox: | 64 case BorderBox: |
| 61 break; | 65 break; |
| 62 case PaddingBox: | 66 case PaddingBox: |
| 63 if (isHorizontalWritingMode) | 67 if (isHorizontalWritingMode) |
| 64 newReferenceBoxLogicalSize.shrink(m_renderer.borderWidth(), m_render er.borderHeight()); | 68 newReferenceBoxLogicalSize.shrink(m_renderer.borderWidth(), m_render er.borderHeight()); |
| 65 else | 69 else |
| 66 newReferenceBoxLogicalSize.shrink(m_renderer.borderHeight(), m_rende rer.borderWidth()); | 70 newReferenceBoxLogicalSize.shrink(m_renderer.borderHeight(), m_rende rer.borderWidth()); |
| 67 break; | 71 break; |
| 68 case ContentBox: | 72 case ContentBox: |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 } | 284 } |
| 281 ShapeOutsideDeltas ShapeOutsideInfo::computeDeltasForContainingBlockLine(const L ayoutBlockFlow& containingBlock, const FloatingObject& floatingObject, LayoutUni t lineTop, LayoutUnit lineHeight) | 285 ShapeOutsideDeltas ShapeOutsideInfo::computeDeltasForContainingBlockLine(const L ayoutBlockFlow& containingBlock, const FloatingObject& floatingObject, LayoutUni t lineTop, LayoutUnit lineHeight) |
| 282 { | 286 { |
| 283 ASSERT(lineHeight >= 0); | 287 ASSERT(lineHeight >= 0); |
| 284 | 288 |
| 285 LayoutUnit borderBoxTop = containingBlock.logicalTopForFloat(&floatingObject ) + containingBlock.marginBeforeForChild(m_renderer); | 289 LayoutUnit borderBoxTop = containingBlock.logicalTopForFloat(&floatingObject ) + containingBlock.marginBeforeForChild(m_renderer); |
| 286 LayoutUnit borderBoxLineTop = lineTop - borderBoxTop; | 290 LayoutUnit borderBoxLineTop = lineTop - borderBoxTop; |
| 287 | 291 |
| 288 if (isShapeDirty() || !m_shapeOutsideDeltas.isForLine(borderBoxLineTop, line Height)) { | 292 if (isShapeDirty() || !m_shapeOutsideDeltas.isForLine(borderBoxLineTop, line Height)) { |
| 289 LayoutUnit referenceBoxLineTop = borderBoxLineTop - logicalTopOffset(); | 293 LayoutUnit referenceBoxLineTop = borderBoxLineTop - logicalTopOffset(); |
| 290 LayoutUnit floatMarginBoxWidth = containingBlock.logicalWidthForFloat(&f loatingObject); | 294 LayoutUnit floatMarginBoxWidth = containingBlock.logicalWidthForFloat(&f loatingObject).abs(); |
|
bjonesbe
2015/03/16 22:26:34
This one also needs to clamp to 0, as a float with
| |
| 291 | 295 |
| 292 if (computedShape().lineOverlapsShapeMarginBounds(referenceBoxLineTop, l ineHeight)) { | 296 if (computedShape().lineOverlapsShapeMarginBounds(referenceBoxLineTop, l ineHeight)) { |
| 293 LineSegment segment = computedShape().getExcludedInterval((borderBox LineTop - logicalTopOffset()), std::min(lineHeight, shapeLogicalBottom() - borde rBoxLineTop)); | 297 LineSegment segment = computedShape().getExcludedInterval((borderBox LineTop - logicalTopOffset()), std::min(lineHeight, shapeLogicalBottom() - borde rBoxLineTop)); |
| 294 if (segment.isValid) { | 298 if (segment.isValid) { |
| 295 LayoutUnit logicalLeftMargin = containingBlock.style()->isLeftTo RightDirection() ? containingBlock.marginStartForChild(m_renderer) : containingB lock.marginEndForChild(m_renderer); | 299 LayoutUnit logicalLeftMargin = containingBlock.style()->isLeftTo RightDirection() ? containingBlock.marginStartForChild(m_renderer) : containingB lock.marginEndForChild(m_renderer); |
| 296 LayoutUnit rawLeftMarginBoxDelta = segment.logicalLeft + logical LeftOffset() + logicalLeftMargin; | 300 LayoutUnit rawLeftMarginBoxDelta = segment.logicalLeft + logical LeftOffset() + logicalLeftMargin; |
| 297 LayoutUnit leftMarginBoxDelta = clampTo<LayoutUnit>(rawLeftMargi nBoxDelta, LayoutUnit(), floatMarginBoxWidth); | 301 LayoutUnit leftMarginBoxDelta = clampTo<LayoutUnit>(rawLeftMargi nBoxDelta, LayoutUnit(), floatMarginBoxWidth); |
| 298 | 302 |
| 299 LayoutUnit logicalRightMargin = containingBlock.style()->isLeftT oRightDirection() ? containingBlock.marginEndForChild(m_renderer) : containingBl ock.marginStartForChild(m_renderer); | 303 LayoutUnit logicalRightMargin = containingBlock.style()->isLeftT oRightDirection() ? containingBlock.marginEndForChild(m_renderer) : containingBl ock.marginStartForChild(m_renderer); |
| 300 LayoutUnit rawRightMarginBoxDelta = segment.logicalRight + logic alLeftOffset() - containingBlock.logicalWidthForChild(m_renderer) - logicalRight Margin; | 304 LayoutUnit rawRightMarginBoxDelta = segment.logicalRight + logic alLeftOffset() - containingBlock.logicalWidthForChild(m_renderer) - logicalRight Margin; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 343 } | 347 } |
| 344 | 348 |
| 345 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const | 349 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const |
| 346 { | 350 { |
| 347 if (!m_renderer.style()->isHorizontalWritingMode()) | 351 if (!m_renderer.style()->isHorizontalWritingMode()) |
| 348 return size.transposedSize(); | 352 return size.transposedSize(); |
| 349 return size; | 353 return size; |
| 350 } | 354 } |
| 351 | 355 |
| 352 } // namespace blink | 356 } // namespace blink |
| OLD | NEW |