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 { |
505 LayoutUnit logicalRight = m_renderer->logicalRightForFloat(floatingObject); | 503 LayoutUnit logicalRight = m_renderer->logicalRightForFloat(floatingObject); |
506 if (ShapeOutsideInfo* shapeOutside = shapeInfoForFloat(floatingObject, m_ren
derer, m_lineTop, m_lineBottom)) { | 504 if (ShapeOutsideInfo* shapeOutside = shapeInfoForFloat(*floatingObject, *m_r
enderer, m_lineTop, m_lineBottom)) { |
507 if (!shapeOutside->lineOverlapsShape()) | 505 if (!shapeOutside->lineOverlapsShape()) |
508 return false; | 506 return false; |
509 | 507 |
510 logicalRight += shapeOutside->rightMarginBoxDelta(); | 508 logicalRight += shapeOutside->rightMarginBoxDelta(); |
511 } | 509 } |
512 if (logicalRight > m_offset) { | 510 if (logicalRight > m_offset) { |
513 m_offset = logicalRight; | 511 m_offset = logicalRight; |
514 return true; | 512 return true; |
515 } | 513 } |
516 | 514 |
517 return false; | 515 return false; |
518 } | 516 } |
519 | 517 |
520 template<> | 518 template<> |
521 inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::
updateOffsetIfNeeded(const FloatingObject* floatingObject) | 519 inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::
updateOffsetIfNeeded(const FloatingObject* floatingObject) |
522 { | 520 { |
523 LayoutUnit logicalLeft = m_renderer->logicalLeftForFloat(floatingObject); | 521 LayoutUnit logicalLeft = m_renderer->logicalLeftForFloat(floatingObject); |
524 if (ShapeOutsideInfo* shapeOutside = shapeInfoForFloat(floatingObject, m_ren
derer, m_lineTop, m_lineBottom)) { | 522 if (ShapeOutsideInfo* shapeOutside = shapeInfoForFloat(*floatingObject, *m_r
enderer, m_lineTop, m_lineBottom)) { |
525 if (!shapeOutside->lineOverlapsShape()) | 523 if (!shapeOutside->lineOverlapsShape()) |
526 return false; | 524 return false; |
527 | 525 |
528 logicalLeft += shapeOutside->leftMarginBoxDelta(); | 526 logicalLeft += shapeOutside->leftMarginBoxDelta(); |
529 } | 527 } |
530 if (logicalLeft < m_offset) { | 528 if (logicalLeft < m_offset) { |
531 m_offset = logicalLeft; | 529 m_offset = logicalLeft; |
532 return true; | 530 return true; |
533 } | 531 } |
534 | 532 |
535 return false; | 533 return false; |
536 } | 534 } |
537 | 535 |
538 #ifndef NDEBUG | 536 #ifndef NDEBUG |
539 // These helpers are only used by the PODIntervalTree for debugging purposes. | 537 // These helpers are only used by the PODIntervalTree for debugging purposes. |
540 String ValueToString<int>::string(const int value) | 538 String ValueToString<int>::string(const int value) |
541 { | 539 { |
542 return String::number(value); | 540 return String::number(value); |
543 } | 541 } |
544 | 542 |
545 String ValueToString<FloatingObject*>::string(const FloatingObject* floatingObje
ct) | 543 String ValueToString<FloatingObject*>::string(const FloatingObject* floatingObje
ct) |
546 { | 544 { |
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()); | 545 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 } | 546 } |
549 #endif | 547 #endif |
550 | 548 |
551 | 549 |
552 } // namespace WebCore | 550 } // namespace WebCore |
OLD | NEW |