| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 { | 79 { |
| 80 OwnPtr<FloatingObject> newObj = adoptPtr(new FloatingObject(renderer)); | 80 OwnPtr<FloatingObject> newObj = adoptPtr(new FloatingObject(renderer)); |
| 81 newObj->setShouldPaint(!renderer->hasSelfPaintingLayer()); // If a layer exi
sts, the float will paint itself. Otherwise someone else will. | 81 newObj->setShouldPaint(!renderer->hasSelfPaintingLayer()); // If a layer exi
sts, the float will paint itself. Otherwise someone else will. |
| 82 newObj->setIsDescendant(true); | 82 newObj->setIsDescendant(true); |
| 83 | 83 |
| 84 return newObj.release(); | 84 return newObj.release(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 PassOwnPtr<FloatingObject> FloatingObject::copyToNewContainer(LayoutSize offset,
bool shouldPaint, bool isDescendant) const | 87 PassOwnPtr<FloatingObject> FloatingObject::copyToNewContainer(LayoutSize offset,
bool shouldPaint, bool isDescendant) const |
| 88 { | 88 { |
| 89 return adoptPtr(new FloatingObject(renderer(), type(), LayoutRect(frameRect(
).location() - offset, frameRect().size()), shouldPaint, isDescendant)); | 89 return adoptPtr(new FloatingObject(layoutObject(), type(), LayoutRect(frameR
ect().location() - offset, frameRect().size()), shouldPaint, isDescendant)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 PassOwnPtr<FloatingObject> FloatingObject::unsafeClone() const | 92 PassOwnPtr<FloatingObject> FloatingObject::unsafeClone() const |
| 93 { | 93 { |
| 94 OwnPtr<FloatingObject> cloneObject = adoptPtr(new FloatingObject(renderer(),
type(), m_frameRect, m_shouldPaint, m_isDescendant)); | 94 OwnPtr<FloatingObject> cloneObject = adoptPtr(new FloatingObject(layoutObjec
t(), type(), m_frameRect, m_shouldPaint, m_isDescendant)); |
| 95 cloneObject->m_paginationStrut = m_paginationStrut; | 95 cloneObject->m_paginationStrut = m_paginationStrut; |
| 96 cloneObject->m_isPlaced = m_isPlaced; | 96 cloneObject->m_isPlaced = m_isPlaced; |
| 97 return cloneObject.release(); | 97 return cloneObject.release(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 template <FloatingObject::Type FloatTypeValue> | 100 template <FloatingObject::Type FloatTypeValue> |
| 101 class ComputeFloatOffsetAdapter { | 101 class ComputeFloatOffsetAdapter { |
| 102 public: | 102 public: |
| 103 typedef FloatingObjectInterval IntervalType; | 103 typedef FloatingObjectInterval IntervalType; |
| 104 | 104 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 161 |
| 162 | 162 |
| 163 FloatingObjects::~FloatingObjects() | 163 FloatingObjects::~FloatingObjects() |
| 164 { | 164 { |
| 165 } | 165 } |
| 166 void FloatingObjects::clearLineBoxTreePointers() | 166 void FloatingObjects::clearLineBoxTreePointers() |
| 167 { | 167 { |
| 168 // Clear references to originating lines, since the lines are being deleted | 168 // Clear references to originating lines, since the lines are being deleted |
| 169 FloatingObjectSetIterator end = m_set.end(); | 169 FloatingObjectSetIterator end = m_set.end(); |
| 170 for (FloatingObjectSetIterator it = m_set.begin(); it != end; ++it) { | 170 for (FloatingObjectSetIterator it = m_set.begin(); it != end; ++it) { |
| 171 ASSERT(!((*it)->originatingLine()) || (*it)->originatingLine()->renderer
() == m_renderer); | 171 ASSERT(!((*it)->originatingLine()) || (*it)->originatingLine()->layoutOb
ject() == m_renderer); |
| 172 (*it)->setOriginatingLine(0); | 172 (*it)->setOriginatingLine(0); |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 | 175 |
| 176 FloatingObjects::FloatingObjects(const LayoutBlockFlow* renderer, bool horizonta
lWritingMode) | 176 FloatingObjects::FloatingObjects(const LayoutBlockFlow* renderer, bool horizonta
lWritingMode) |
| 177 : m_placedFloatsTree(UninitializedTree) | 177 : m_placedFloatsTree(UninitializedTree) |
| 178 , m_leftObjectsCount(0) | 178 , m_leftObjectsCount(0) |
| 179 , m_rightObjectsCount(0) | 179 , m_rightObjectsCount(0) |
| 180 , m_horizontalWritingMode(horizontalWritingMode) | 180 , m_horizontalWritingMode(horizontalWritingMode) |
| 181 , m_renderer(renderer) | 181 , m_renderer(renderer) |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 void FloatingObjects::markLowestFloatLogicalBottomCacheAsDirty() | 266 void FloatingObjects::markLowestFloatLogicalBottomCacheAsDirty() |
| 267 { | 267 { |
| 268 for (size_t i = 0; i < sizeof(m_lowestFloatBottomCache) / sizeof(FloatBottom
CachedValue); ++i) | 268 for (size_t i = 0; i < sizeof(m_lowestFloatBottomCache) / sizeof(FloatBottom
CachedValue); ++i) |
| 269 m_lowestFloatBottomCache[i].dirty = true; | 269 m_lowestFloatBottomCache[i].dirty = true; |
| 270 } | 270 } |
| 271 | 271 |
| 272 void FloatingObjects::moveAllToFloatInfoMap(RendererToFloatInfoMap& map) | 272 void FloatingObjects::moveAllToFloatInfoMap(RendererToFloatInfoMap& map) |
| 273 { | 273 { |
| 274 while (!m_set.isEmpty()) { | 274 while (!m_set.isEmpty()) { |
| 275 OwnPtr<FloatingObject> floatingObject = m_set.takeFirst(); | 275 OwnPtr<FloatingObject> floatingObject = m_set.takeFirst(); |
| 276 LayoutBox* renderer = floatingObject->renderer(); | 276 LayoutBox* renderer = floatingObject->layoutObject(); |
| 277 map.add(renderer, floatingObject.release()); | 277 map.add(renderer, floatingObject.release()); |
| 278 } | 278 } |
| 279 clear(); | 279 clear(); |
| 280 } | 280 } |
| 281 | 281 |
| 282 inline void FloatingObjects::increaseObjectsCount(FloatingObject::Type type) | 282 inline void FloatingObjects::increaseObjectsCount(FloatingObject::Type type) |
| 283 { | 283 { |
| 284 if (type == FloatingObject::FloatLeft) | 284 if (type == FloatingObject::FloatLeft) |
| 285 m_leftObjectsCount++; | 285 m_leftObjectsCount++; |
| 286 else | 286 else |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 | 477 |
| 478 bool floatIsNewExtreme = updateOffsetIfNeeded(*floatingObject); | 478 bool floatIsNewExtreme = updateOffsetIfNeeded(*floatingObject); |
| 479 if (floatIsNewExtreme) | 479 if (floatIsNewExtreme) |
| 480 m_outermostFloat = floatingObject; | 480 m_outermostFloat = floatingObject; |
| 481 } | 481 } |
| 482 | 482 |
| 483 template<> | 483 template<> |
| 484 inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::u
pdateOffsetIfNeeded(const FloatingObject& floatingObject) | 484 inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::u
pdateOffsetIfNeeded(const FloatingObject& floatingObject) |
| 485 { | 485 { |
| 486 LayoutUnit logicalRight = m_renderer->logicalRightForFloat(&floatingObject); | 486 LayoutUnit logicalRight = m_renderer->logicalRightForFloat(&floatingObject); |
| 487 if (ShapeOutsideInfo* shapeOutside = floatingObject.renderer()->shapeOutside
Info()) { | 487 if (ShapeOutsideInfo* shapeOutside = floatingObject.layoutObject()->shapeOut
sideInfo()) { |
| 488 ShapeOutsideDeltas shapeDeltas = shapeOutside->computeDeltasForContainin
gBlockLine(*m_renderer, floatingObject, m_lineTop, m_lineBottom - m_lineTop); | 488 ShapeOutsideDeltas shapeDeltas = shapeOutside->computeDeltasForContainin
gBlockLine(*m_renderer, floatingObject, m_lineTop, m_lineBottom - m_lineTop); |
| 489 if (!shapeDeltas.lineOverlapsShape()) | 489 if (!shapeDeltas.lineOverlapsShape()) |
| 490 return false; | 490 return false; |
| 491 | 491 |
| 492 logicalRight += shapeDeltas.rightMarginBoxDelta(); | 492 logicalRight += shapeDeltas.rightMarginBoxDelta(); |
| 493 } | 493 } |
| 494 if (logicalRight > m_offset) { | 494 if (logicalRight > m_offset) { |
| 495 m_offset = logicalRight; | 495 m_offset = logicalRight; |
| 496 return true; | 496 return true; |
| 497 } | 497 } |
| 498 | 498 |
| 499 return false; | 499 return false; |
| 500 } | 500 } |
| 501 | 501 |
| 502 template<> | 502 template<> |
| 503 inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::
updateOffsetIfNeeded(const FloatingObject& floatingObject) | 503 inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::
updateOffsetIfNeeded(const FloatingObject& floatingObject) |
| 504 { | 504 { |
| 505 LayoutUnit logicalLeft = m_renderer->logicalLeftForFloat(&floatingObject); | 505 LayoutUnit logicalLeft = m_renderer->logicalLeftForFloat(&floatingObject); |
| 506 if (ShapeOutsideInfo* shapeOutside = floatingObject.renderer()->shapeOutside
Info()) { | 506 if (ShapeOutsideInfo* shapeOutside = floatingObject.layoutObject()->shapeOut
sideInfo()) { |
| 507 ShapeOutsideDeltas shapeDeltas = shapeOutside->computeDeltasForContainin
gBlockLine(*m_renderer, floatingObject, m_lineTop, m_lineBottom - m_lineTop); | 507 ShapeOutsideDeltas shapeDeltas = shapeOutside->computeDeltasForContainin
gBlockLine(*m_renderer, floatingObject, m_lineTop, m_lineBottom - m_lineTop); |
| 508 if (!shapeDeltas.lineOverlapsShape()) | 508 if (!shapeDeltas.lineOverlapsShape()) |
| 509 return false; | 509 return false; |
| 510 | 510 |
| 511 logicalLeft += shapeDeltas.leftMarginBoxDelta(); | 511 logicalLeft += shapeDeltas.leftMarginBoxDelta(); |
| 512 } | 512 } |
| 513 if (logicalLeft < m_offset) { | 513 if (logicalLeft < m_offset) { |
| 514 m_offset = logicalLeft; | 514 m_offset = logicalLeft; |
| 515 return true; | 515 return true; |
| 516 } | 516 } |
| 517 | 517 |
| 518 return false; | 518 return false; |
| 519 } | 519 } |
| 520 | 520 |
| 521 #ifndef NDEBUG | 521 #ifndef NDEBUG |
| 522 // These helpers are only used by the PODIntervalTree for debugging purposes. | 522 // These helpers are only used by the PODIntervalTree for debugging purposes. |
| 523 String ValueToString<int>::string(const int value) | 523 String ValueToString<int>::string(const int value) |
| 524 { | 524 { |
| 525 return String::number(value); | 525 return String::number(value); |
| 526 } | 526 } |
| 527 | 527 |
| 528 String ValueToString<FloatingObject*>::string(const FloatingObject* floatingObje
ct) | 528 String ValueToString<FloatingObject*>::string(const FloatingObject* floatingObje
ct) |
| 529 { | 529 { |
| 530 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr
ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating
Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped
MaxY()); | 530 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr
ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating
Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped
MaxY()); |
| 531 } | 531 } |
| 532 #endif | 532 #endif |
| 533 | 533 |
| 534 | 534 |
| 535 } // namespace blink | 535 } // namespace blink |
| OLD | NEW |