| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 // Make sure the float hasn't changed since it was added to the placed float
s tree. | 480 // Make sure the float hasn't changed since it was added to the placed float
s tree. |
| 481 ASSERT(floatingObject->isPlaced()); | 481 ASSERT(floatingObject->isPlaced()); |
| 482 ASSERT(interval.low() == m_renderer->pixelSnappedLogicalTopForFloat(floating
Object)); | 482 ASSERT(interval.low() == m_renderer->pixelSnappedLogicalTopForFloat(floating
Object)); |
| 483 ASSERT(interval.high() == m_renderer->pixelSnappedLogicalBottomForFloat(floa
tingObject)); | 483 ASSERT(interval.high() == m_renderer->pixelSnappedLogicalBottomForFloat(floa
tingObject)); |
| 484 | 484 |
| 485 bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject); | 485 bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject); |
| 486 if (floatIsNewExtreme) | 486 if (floatIsNewExtreme) |
| 487 m_outermostFloat = floatingObject; | 487 m_outermostFloat = floatingObject; |
| 488 } | 488 } |
| 489 | 489 |
| 490 static inline ShapeOutsideInfo* shapeInfoForFloat(const FloatingObject* floating
Object, const RenderBlockFlow* containingBlock, LayoutUnit lineTop, LayoutUnit l
ineBottom) | 490 static inline ShapeOutsideInfo* shapeInfoForFloat(const FloatingObject& floating
Object, const RenderBlockFlow& containingBlock, LayoutUnit lineTop, LayoutUnit l
ineBottom) |
| 491 { | 491 { |
| 492 if (floatingObject) { | 492 if (ShapeOutsideInfo* shapeOutside = floatingObject.renderer()->shapeOutside
Info()) { |
| 493 if (ShapeOutsideInfo* shapeOutside = floatingObject->renderer()->shapeOu
tsideInfo()) { | 493 shapeOutside->updateDeltasForContainingBlockLine(containingBlock, floati
ngObject, lineTop, lineBottom - lineTop); |
| 494 shapeOutside->updateDeltasForContainingBlockLine(containingBlock, fl
oatingObject, lineTop, lineBottom - lineTop); | 494 return shapeOutside; |
| 495 return shapeOutside; | |
| 496 } | |
| 497 } | 495 } |
| 498 | 496 |
| 499 return 0; | 497 return 0; |
| 500 } | 498 } |
| 501 | 499 |
| 502 template<> | 500 template<> |
| 503 inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::u
pdateOffsetIfNeeded(const FloatingObject* floatingObject) | 501 inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::u
pdateOffsetIfNeeded(const FloatingObject* floatingObject) |
| 504 { | 502 { |
| 503 ASSERT(floatingObject); |
| 505 LayoutUnit logicalRight = m_renderer->logicalRightForFloat(floatingObject); | 504 LayoutUnit logicalRight = m_renderer->logicalRightForFloat(floatingObject); |
| 506 if (ShapeOutsideInfo* shapeOutside = shapeInfoForFloat(floatingObject, m_ren
derer, m_lineTop, m_lineBottom)) { | 505 if (ShapeOutsideInfo* shapeOutside = shapeInfoForFloat(*floatingObject, *m_r
enderer, m_lineTop, m_lineBottom)) { |
| 507 if (!shapeOutside->lineOverlapsShape()) | 506 if (!shapeOutside->lineOverlapsShape()) |
| 508 return false; | 507 return false; |
| 509 | 508 |
| 510 logicalRight += shapeOutside->rightMarginBoxDelta(); | 509 logicalRight += shapeOutside->rightMarginBoxDelta(); |
| 511 } | 510 } |
| 512 if (logicalRight > m_offset) { | 511 if (logicalRight > m_offset) { |
| 513 m_offset = logicalRight; | 512 m_offset = logicalRight; |
| 514 return true; | 513 return true; |
| 515 } | 514 } |
| 516 | 515 |
| 517 return false; | 516 return false; |
| 518 } | 517 } |
| 519 | 518 |
| 520 template<> | 519 template<> |
| 521 inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::
updateOffsetIfNeeded(const FloatingObject* floatingObject) | 520 inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::
updateOffsetIfNeeded(const FloatingObject* floatingObject) |
| 522 { | 521 { |
| 522 ASSERT(floatingObject); |
| 523 LayoutUnit logicalLeft = m_renderer->logicalLeftForFloat(floatingObject); | 523 LayoutUnit logicalLeft = m_renderer->logicalLeftForFloat(floatingObject); |
| 524 if (ShapeOutsideInfo* shapeOutside = shapeInfoForFloat(floatingObject, m_ren
derer, m_lineTop, m_lineBottom)) { | 524 if (ShapeOutsideInfo* shapeOutside = shapeInfoForFloat(*floatingObject, *m_r
enderer, m_lineTop, m_lineBottom)) { |
| 525 if (!shapeOutside->lineOverlapsShape()) | 525 if (!shapeOutside->lineOverlapsShape()) |
| 526 return false; | 526 return false; |
| 527 | 527 |
| 528 logicalLeft += shapeOutside->leftMarginBoxDelta(); | 528 logicalLeft += shapeOutside->leftMarginBoxDelta(); |
| 529 } | 529 } |
| 530 if (logicalLeft < m_offset) { | 530 if (logicalLeft < m_offset) { |
| 531 m_offset = logicalLeft; | 531 m_offset = logicalLeft; |
| 532 return true; | 532 return true; |
| 533 } | 533 } |
| 534 | 534 |
| 535 return false; | 535 return false; |
| 536 } | 536 } |
| 537 | 537 |
| 538 #ifndef NDEBUG | 538 #ifndef NDEBUG |
| 539 // These helpers are only used by the PODIntervalTree for debugging purposes. | 539 // These helpers are only used by the PODIntervalTree for debugging purposes. |
| 540 String ValueToString<int>::string(const int value) | 540 String ValueToString<int>::string(const int value) |
| 541 { | 541 { |
| 542 return String::number(value); | 542 return String::number(value); |
| 543 } | 543 } |
| 544 | 544 |
| 545 String ValueToString<FloatingObject*>::string(const FloatingObject* floatingObje
ct) | 545 String ValueToString<FloatingObject*>::string(const FloatingObject* floatingObje
ct) |
| 546 { | 546 { |
| 547 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr
ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating
Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped
MaxY()); | 547 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr
ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating
Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped
MaxY()); |
| 548 } | 548 } |
| 549 #endif | 549 #endif |
| 550 | 550 |
| 551 | 551 |
| 552 } // namespace WebCore | 552 } // namespace WebCore |
| OLD | NEW |