| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 | 178 |
| 179 ASSERT(m_shape); | 179 ASSERT(m_shape); |
| 180 return *m_shape; | 180 return *m_shape; |
| 181 } | 181 } |
| 182 | 182 |
| 183 inline LayoutUnit borderBeforeInWritingMode(const LayoutBox& layoutBox, WritingM
ode writingMode) | 183 inline LayoutUnit borderBeforeInWritingMode(const LayoutBox& layoutBox, WritingM
ode writingMode) |
| 184 { | 184 { |
| 185 switch (writingMode) { | 185 switch (writingMode) { |
| 186 case TopToBottomWritingMode: return layoutBox.borderTop(); | 186 case TopToBottomWritingMode: return LayoutUnit(layoutBox.borderTop()); |
| 187 case LeftToRightWritingMode: return layoutBox.borderLeft(); | 187 case LeftToRightWritingMode: return LayoutUnit(layoutBox.borderLeft()); |
| 188 case RightToLeftWritingMode: return layoutBox.borderRight(); | 188 case RightToLeftWritingMode: return LayoutUnit(layoutBox.borderRight()); |
| 189 } | 189 } |
| 190 | 190 |
| 191 ASSERT_NOT_REACHED(); | 191 ASSERT_NOT_REACHED(); |
| 192 return layoutBox.borderBefore(); | 192 return LayoutUnit(layoutBox.borderBefore()); |
| 193 } | 193 } |
| 194 | 194 |
| 195 inline LayoutUnit borderAndPaddingBeforeInWritingMode(const LayoutBox& layoutBox
, WritingMode writingMode) | 195 inline LayoutUnit borderAndPaddingBeforeInWritingMode(const LayoutBox& layoutBox
, WritingMode writingMode) |
| 196 { | 196 { |
| 197 switch (writingMode) { | 197 switch (writingMode) { |
| 198 case TopToBottomWritingMode: return layoutBox.borderTop() + layoutBox.paddin
gTop(); | 198 case TopToBottomWritingMode: return layoutBox.borderTop() + layoutBox.paddin
gTop(); |
| 199 case LeftToRightWritingMode: return layoutBox.borderLeft() + layoutBox.paddi
ngLeft(); | 199 case LeftToRightWritingMode: return layoutBox.borderLeft() + layoutBox.paddi
ngLeft(); |
| 200 case RightToLeftWritingMode: return layoutBox.borderRight() + layoutBox.padd
ingRight(); | 200 case RightToLeftWritingMode: return layoutBox.borderRight() + layoutBox.padd
ingRight(); |
| 201 } | 201 } |
| 202 | 202 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 215 } | 215 } |
| 216 | 216 |
| 217 ASSERT_NOT_REACHED(); | 217 ASSERT_NOT_REACHED(); |
| 218 return LayoutUnit(); | 218 return LayoutUnit(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 inline LayoutUnit borderStartWithStyleForWritingMode(const LayoutBox& layoutBox,
const ComputedStyle* style) | 221 inline LayoutUnit borderStartWithStyleForWritingMode(const LayoutBox& layoutBox,
const ComputedStyle* style) |
| 222 { | 222 { |
| 223 if (style->isHorizontalWritingMode()) { | 223 if (style->isHorizontalWritingMode()) { |
| 224 if (style->isLeftToRightDirection()) | 224 if (style->isLeftToRightDirection()) |
| 225 return layoutBox.borderLeft(); | 225 return LayoutUnit(layoutBox.borderLeft()); |
| 226 | 226 |
| 227 return layoutBox.borderRight(); | 227 return LayoutUnit(layoutBox.borderRight()); |
| 228 } | 228 } |
| 229 if (style->isLeftToRightDirection()) | 229 if (style->isLeftToRightDirection()) |
| 230 return layoutBox.borderTop(); | 230 return LayoutUnit(layoutBox.borderTop()); |
| 231 | 231 |
| 232 return layoutBox.borderBottom(); | 232 return LayoutUnit(layoutBox.borderBottom()); |
| 233 } | 233 } |
| 234 | 234 |
| 235 inline LayoutUnit borderAndPaddingStartWithStyleForWritingMode(const LayoutBox&
layoutBox, const ComputedStyle* style) | 235 inline LayoutUnit borderAndPaddingStartWithStyleForWritingMode(const LayoutBox&
layoutBox, const ComputedStyle* style) |
| 236 { | 236 { |
| 237 if (style->isHorizontalWritingMode()) { | 237 if (style->isHorizontalWritingMode()) { |
| 238 if (style->isLeftToRightDirection()) | 238 if (style->isLeftToRightDirection()) |
| 239 return layoutBox.borderLeft() + layoutBox.paddingLeft(); | 239 return layoutBox.borderLeft() + layoutBox.paddingLeft(); |
| 240 | 240 |
| 241 return layoutBox.borderRight() + layoutBox.paddingRight(); | 241 return layoutBox.borderRight() + layoutBox.paddingRight(); |
| 242 } | 242 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 LayoutUnit borderBoxLineTop = lineTop - borderBoxTop; | 287 LayoutUnit borderBoxLineTop = lineTop - borderBoxTop; |
| 288 | 288 |
| 289 if (isShapeDirty() || !m_shapeOutsideDeltas.isForLine(borderBoxLineTop, line
Height)) { | 289 if (isShapeDirty() || !m_shapeOutsideDeltas.isForLine(borderBoxLineTop, line
Height)) { |
| 290 LayoutUnit referenceBoxLineTop = borderBoxLineTop - logicalTopOffset(); | 290 LayoutUnit referenceBoxLineTop = borderBoxLineTop - logicalTopOffset(); |
| 291 LayoutUnit floatMarginBoxWidth = std::max(containingBlock.logicalWidthFo
rFloat(floatingObject), LayoutUnit()); | 291 LayoutUnit floatMarginBoxWidth = std::max(containingBlock.logicalWidthFo
rFloat(floatingObject), LayoutUnit()); |
| 292 | 292 |
| 293 if (computedShape().lineOverlapsShapeMarginBounds(referenceBoxLineTop, l
ineHeight)) { | 293 if (computedShape().lineOverlapsShapeMarginBounds(referenceBoxLineTop, l
ineHeight)) { |
| 294 LineSegment segment = computedShape().getExcludedInterval((borderBox
LineTop - logicalTopOffset()), std::min(lineHeight, shapeLogicalBottom() - borde
rBoxLineTop)); | 294 LineSegment segment = computedShape().getExcludedInterval((borderBox
LineTop - logicalTopOffset()), std::min(lineHeight, shapeLogicalBottom() - borde
rBoxLineTop)); |
| 295 if (segment.isValid) { | 295 if (segment.isValid) { |
| 296 LayoutUnit logicalLeftMargin = containingBlock.style()->isLeftTo
RightDirection() ? containingBlock.marginStartForChild(m_layoutBox) : containing
Block.marginEndForChild(m_layoutBox); | 296 LayoutUnit logicalLeftMargin = containingBlock.style()->isLeftTo
RightDirection() ? containingBlock.marginStartForChild(m_layoutBox) : containing
Block.marginEndForChild(m_layoutBox); |
| 297 LayoutUnit rawLeftMarginBoxDelta = segment.logicalLeft + logical
LeftOffset() + logicalLeftMargin; | 297 LayoutUnit rawLeftMarginBoxDelta(segment.logicalLeft + logicalLe
ftOffset() + logicalLeftMargin); |
| 298 LayoutUnit leftMarginBoxDelta = clampTo<LayoutUnit>(rawLeftMargi
nBoxDelta, LayoutUnit(), floatMarginBoxWidth); | 298 LayoutUnit leftMarginBoxDelta = clampTo<LayoutUnit>(rawLeftMargi
nBoxDelta, LayoutUnit(), floatMarginBoxWidth); |
| 299 | 299 |
| 300 LayoutUnit logicalRightMargin = containingBlock.style()->isLeftT
oRightDirection() ? containingBlock.marginEndForChild(m_layoutBox) : containingB
lock.marginStartForChild(m_layoutBox); | 300 LayoutUnit logicalRightMargin = containingBlock.style()->isLeftT
oRightDirection() ? containingBlock.marginEndForChild(m_layoutBox) : containingB
lock.marginStartForChild(m_layoutBox); |
| 301 LayoutUnit rawRightMarginBoxDelta = segment.logicalRight + logic
alLeftOffset() - containingBlock.logicalWidthForChild(m_layoutBox) - logicalRigh
tMargin; | 301 LayoutUnit rawRightMarginBoxDelta(segment.logicalRight + logical
LeftOffset() - containingBlock.logicalWidthForChild(m_layoutBox) - logicalRightM
argin); |
| 302 LayoutUnit rightMarginBoxDelta = clampTo<LayoutUnit>(rawRightMar
ginBoxDelta, -floatMarginBoxWidth, LayoutUnit()); | 302 LayoutUnit rightMarginBoxDelta = clampTo<LayoutUnit>(rawRightMar
ginBoxDelta, -floatMarginBoxWidth, LayoutUnit()); |
| 303 | 303 |
| 304 m_shapeOutsideDeltas = ShapeOutsideDeltas(leftMarginBoxDelta, ri
ghtMarginBoxDelta, true, borderBoxLineTop, lineHeight); | 304 m_shapeOutsideDeltas = ShapeOutsideDeltas(leftMarginBoxDelta, ri
ghtMarginBoxDelta, true, borderBoxLineTop, lineHeight); |
| 305 return m_shapeOutsideDeltas; | 305 return m_shapeOutsideDeltas; |
| 306 } | 306 } |
| 307 } | 307 } |
| 308 | 308 |
| 309 // Lines that do not overlap the shape should act as if the float | 309 // Lines that do not overlap the shape should act as if the float |
| 310 // wasn't there for layout purposes. So we set the deltas to remove the | 310 // wasn't there for layout purposes. So we set the deltas to remove the |
| 311 // entire width of the float. | 311 // entire width of the float. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 } | 344 } |
| 345 | 345 |
| 346 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const | 346 FloatSize ShapeOutsideInfo::shapeToLayoutObjectSize(FloatSize size) const |
| 347 { | 347 { |
| 348 if (!m_layoutBox.style()->isHorizontalWritingMode()) | 348 if (!m_layoutBox.style()->isHorizontalWritingMode()) |
| 349 return size.transposedSize(); | 349 return size.transposedSize(); |
| 350 return size; | 350 return size; |
| 351 } | 351 } |
| 352 | 352 |
| 353 } // namespace blink | 353 } // namespace blink |
| OLD | NEW |