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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 case ShapeValue::Shape: | 267 case ShapeValue::Shape: |
268 return shapeValue->shape(); | 268 return shapeValue->shape(); |
269 case ShapeValue::Image: | 269 case ShapeValue::Image: |
270 return shapeValue->isImageValid() && checkShapeImageOrigin(box.document(
), *(shapeValue->image())); | 270 return shapeValue->isImageValid() && checkShapeImageOrigin(box.document(
), *(shapeValue->image())); |
271 case ShapeValue::Box: | 271 case ShapeValue::Box: |
272 return true; | 272 return true; |
273 } | 273 } |
274 | 274 |
275 return false; | 275 return false; |
276 } | 276 } |
277 void ShapeOutsideInfo::updateDeltasForContainingBlockLine(const RenderBlockFlow&
containingBlock, const FloatingObject& floatingObject, LayoutUnit lineTop, Layo
utUnit lineHeight) | 277 ShapeOutsideDeltas ShapeOutsideInfo::computeDeltasForContainingBlockLine(const R
enderBlockFlow& containingBlock, const FloatingObject& floatingObject, LayoutUni
t lineTop, LayoutUnit lineHeight) |
278 { | 278 { |
279 ASSERT(lineHeight >= 0); | 279 ASSERT(lineHeight >= 0); |
280 | 280 |
281 LayoutUnit borderBoxTop = containingBlock.logicalTopForFloat(&floatingObject
) + containingBlock.marginBeforeForChild(&m_renderer); | 281 LayoutUnit borderBoxTop = containingBlock.logicalTopForFloat(&floatingObject
) + containingBlock.marginBeforeForChild(&m_renderer); |
282 LayoutUnit borderBoxLineTop = lineTop - borderBoxTop; | 282 LayoutUnit borderBoxLineTop = lineTop - borderBoxTop; |
283 | 283 |
284 if (isShapeDirty() || m_borderBoxLineTop != borderBoxLineTop || m_lineHeight
!= lineHeight) { | 284 if (isShapeDirty() || !m_shapeOutsideDeltas.isForLine(borderBoxLineTop, line
Height)) { |
285 m_borderBoxLineTop = borderBoxLineTop; | 285 LayoutUnit referenceBoxLineTop = borderBoxLineTop - logicalTopOffset(); |
286 m_referenceBoxLineTop = borderBoxLineTop - logicalTopOffset(); | |
287 m_lineHeight = lineHeight; | |
288 | |
289 LayoutUnit floatMarginBoxWidth = containingBlock.logicalWidthForFloat(&f
loatingObject); | 286 LayoutUnit floatMarginBoxWidth = containingBlock.logicalWidthForFloat(&f
loatingObject); |
290 | 287 |
291 if (lineOverlapsShapeBounds()) { | 288 if (computedShape().lineOverlapsShapeMarginBounds(referenceBoxLineTop, l
ineHeight)) { |
292 LineSegment segment = computedShape().getExcludedInterval((borderBox
LineTop - logicalTopOffset()), std::min(lineHeight, shapeLogicalBottom() - borde
rBoxLineTop)); | 289 LineSegment segment = computedShape().getExcludedInterval((borderBox
LineTop - logicalTopOffset()), std::min(lineHeight, shapeLogicalBottom() - borde
rBoxLineTop)); |
293 if (segment.isValid) { | 290 if (segment.isValid) { |
294 LayoutUnit logicalLeftMargin = containingBlock.style()->isLeftTo
RightDirection() ? containingBlock.marginStartForChild(&m_renderer) : containing
Block.marginEndForChild(&m_renderer); | 291 LayoutUnit logicalLeftMargin = containingBlock.style()->isLeftTo
RightDirection() ? containingBlock.marginStartForChild(&m_renderer) : containing
Block.marginEndForChild(&m_renderer); |
295 LayoutUnit rawLeftMarginBoxDelta = segment.logicalLeft + logical
LeftOffset() + logicalLeftMargin; | 292 LayoutUnit rawLeftMarginBoxDelta = segment.logicalLeft + logical
LeftOffset() + logicalLeftMargin; |
296 m_leftMarginBoxDelta = clampToLayoutUnit(rawLeftMarginBoxDelta,
LayoutUnit(), floatMarginBoxWidth); | 293 LayoutUnit leftMarginBoxDelta = clampTo<LayoutUnit>(rawLeftMargi
nBoxDelta, LayoutUnit(), floatMarginBoxWidth); |
297 | 294 |
298 LayoutUnit logicalRightMargin = containingBlock.style()->isLeftT
oRightDirection() ? containingBlock.marginEndForChild(&m_renderer) : containingB
lock.marginStartForChild(&m_renderer); | 295 LayoutUnit logicalRightMargin = containingBlock.style()->isLeftT
oRightDirection() ? containingBlock.marginEndForChild(&m_renderer) : containingB
lock.marginStartForChild(&m_renderer); |
299 LayoutUnit rawRightMarginBoxDelta = segment.logicalRight + logic
alLeftOffset() - containingBlock.logicalWidthForChild(&m_renderer) - logicalRigh
tMargin; | 296 LayoutUnit rawRightMarginBoxDelta = segment.logicalRight + logic
alLeftOffset() - containingBlock.logicalWidthForChild(&m_renderer) - logicalRigh
tMargin; |
300 m_rightMarginBoxDelta = clampToLayoutUnit(rawRightMarginBoxDelta
, -floatMarginBoxWidth, LayoutUnit()); | 297 LayoutUnit rightMarginBoxDelta = clampTo<LayoutUnit>(rawRightMar
ginBoxDelta, -floatMarginBoxWidth, LayoutUnit()); |
301 m_lineOverlapsShape = true; | 298 |
302 return; | 299 m_shapeOutsideDeltas = ShapeOutsideDeltas(leftMarginBoxDelta, ri
ghtMarginBoxDelta, true, borderBoxLineTop, lineHeight); |
| 300 return m_shapeOutsideDeltas; |
303 } | 301 } |
304 } | 302 } |
305 | 303 |
306 // Lines that do not overlap the shape should act as if the float | 304 // 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 | 305 // wasn't there for layout purposes. So we set the deltas to remove the |
308 // entire width of the float. | 306 // entire width of the float. |
309 m_leftMarginBoxDelta = floatMarginBoxWidth; | 307 m_shapeOutsideDeltas = ShapeOutsideDeltas(floatMarginBoxWidth, -floatMar
ginBoxWidth, false, borderBoxLineTop, lineHeight); |
310 m_rightMarginBoxDelta = -floatMarginBoxWidth; | |
311 m_lineOverlapsShape = false; | |
312 } | 308 } |
| 309 |
| 310 return m_shapeOutsideDeltas; |
313 } | 311 } |
314 | 312 |
315 LayoutRect ShapeOutsideInfo::computedShapePhysicalBoundingBox() const | 313 LayoutRect ShapeOutsideInfo::computedShapePhysicalBoundingBox() const |
316 { | 314 { |
317 LayoutRect physicalBoundingBox = computedShape().shapeMarginLogicalBoundingB
ox(); | 315 LayoutRect physicalBoundingBox = computedShape().shapeMarginLogicalBoundingB
ox(); |
318 physicalBoundingBox.setX(physicalBoundingBox.x() + logicalLeftOffset()); | 316 physicalBoundingBox.setX(physicalBoundingBox.x() + logicalLeftOffset()); |
319 | 317 |
320 if (m_renderer.style()->isFlippedBlocksWritingMode()) | 318 if (m_renderer.style()->isFlippedBlocksWritingMode()) |
321 physicalBoundingBox.setY(m_renderer.logicalHeight() - physicalBoundingBo
x.maxY()); | 319 physicalBoundingBox.setY(m_renderer.logicalHeight() - physicalBoundingBo
x.maxY()); |
322 else | 320 else |
(...skipping 18 matching lines...) Expand all Loading... |
341 } | 339 } |
342 | 340 |
343 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const | 341 FloatSize ShapeOutsideInfo::shapeToRendererSize(FloatSize size) const |
344 { | 342 { |
345 if (!m_renderer.style()->isHorizontalWritingMode()) | 343 if (!m_renderer.style()->isHorizontalWritingMode()) |
346 return size.transposedSize(); | 344 return size.transposedSize(); |
347 return size; | 345 return size; |
348 } | 346 } |
349 | 347 |
350 } // namespace blink | 348 } // namespace blink |
OLD | NEW |