Chromium Code Reviews| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 LayoutUnit lowestFloatBottom = 0; | 208 LayoutUnit lowestFloatBottom = 0; |
| 209 const FloatingObjectSet& floatingObjectSet = set(); | 209 const FloatingObjectSet& floatingObjectSet = set(); |
| 210 FloatingObjectSetIterator end = floatingObjectSet.end(); | 210 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 211 if (floatType == FloatingObject::FloatLeftRight) { | 211 if (floatType == FloatingObject::FloatLeftRight) { |
| 212 LayoutUnit lowestFloatBottomLeft = 0; | 212 LayoutUnit lowestFloatBottomLeft = 0; |
| 213 LayoutUnit lowestFloatBottomRight = 0; | 213 LayoutUnit lowestFloatBottomRight = 0; |
| 214 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end ; ++it) { | 214 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end ; ++it) { |
| 215 FloatingObject* floatingObject = it->get(); | 215 FloatingObject& floatingObject = it->getReference(); |
| 216 if (floatingObject->isPlaced()) { | 216 if (floatingObject.isPlaced()) { |
| 217 FloatingObject::Type curType = floatingObject->type(); | 217 FloatingObject::Type curType = floatingObject.type(); |
| 218 LayoutUnit curFloatLogicalBottom = m_renderer->logicalBottomForF loat(floatingObject); | 218 LayoutUnit curFloatLogicalBottom = m_renderer->logicalBottomForF loat(floatingObject); |
| 219 if (curType & FloatingObject::FloatLeft) | 219 if (curType & FloatingObject::FloatLeft) |
| 220 lowestFloatBottomLeft = std::max(lowestFloatBottomLeft, curF loatLogicalBottom); | 220 lowestFloatBottomLeft = std::max(lowestFloatBottomLeft, curF loatLogicalBottom); |
| 221 if (curType & FloatingObject::FloatRight) | 221 if (curType & FloatingObject::FloatRight) |
| 222 lowestFloatBottomRight = std::max(lowestFloatBottomRight, cu rFloatLogicalBottom); | 222 lowestFloatBottomRight = std::max(lowestFloatBottomRight, cu rFloatLogicalBottom); |
| 223 } | 223 } |
| 224 } | 224 } |
| 225 lowestFloatBottom = std::max(lowestFloatBottomLeft, lowestFloatBottomRig ht); | 225 lowestFloatBottom = std::max(lowestFloatBottomLeft, lowestFloatBottomRig ht); |
| 226 setCachedLowestFloatLogicalBottom(isInHorizontalWritingMode, FloatingObj ect::FloatLeft, lowestFloatBottomLeft); | 226 setCachedLowestFloatLogicalBottom(isInHorizontalWritingMode, FloatingObj ect::FloatLeft, lowestFloatBottomLeft); |
| 227 setCachedLowestFloatLogicalBottom(isInHorizontalWritingMode, FloatingObj ect::FloatRight, lowestFloatBottomRight); | 227 setCachedLowestFloatLogicalBottom(isInHorizontalWritingMode, FloatingObj ect::FloatRight, lowestFloatBottomRight); |
| 228 } else { | 228 } else { |
| 229 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end ; ++it) { | 229 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end ; ++it) { |
| 230 FloatingObject* floatingObject = it->get(); | 230 FloatingObject& floatingObject = it->getReference(); |
| 231 if (floatingObject->isPlaced() && floatingObject->type() == floatTyp e) | 231 if (floatingObject.isPlaced() && floatingObject.type() == floatType) |
| 232 lowestFloatBottom = std::max(lowestFloatBottom, m_renderer->logi calBottomForFloat(floatingObject)); | 232 lowestFloatBottom = std::max(lowestFloatBottom, m_renderer->logi calBottomForFloat(floatingObject)); |
| 233 } | 233 } |
| 234 setCachedLowestFloatLogicalBottom(isInHorizontalWritingMode, floatType, lowestFloatBottom); | 234 setCachedLowestFloatLogicalBottom(isInHorizontalWritingMode, floatType, lowestFloatBottom); |
| 235 } | 235 } |
| 236 | 236 |
| 237 return lowestFloatBottom; | 237 return lowestFloatBottom; |
| 238 } | 238 } |
| 239 | 239 |
| 240 bool FloatingObjects::hasLowestFloatLogicalBottomCached(bool isHorizontal, Float ingObject::Type type) const | 240 bool FloatingObjects::hasLowestFloatLogicalBottomCached(bool isHorizontal, Float ingObject::Type type) const |
| 241 { | 241 { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 // The bottom of the object overlaps the float | 431 // The bottom of the object overlaps the float |
| 432 if (objectBottom > objectTop && objectBottom > floatTop && objectBottom <= f loatBottom) | 432 if (objectBottom > objectTop && objectBottom > floatTop && objectBottom <= f loatBottom) |
| 433 return true; | 433 return true; |
| 434 | 434 |
| 435 return false; | 435 return false; |
| 436 } | 436 } |
| 437 | 437 |
| 438 template<> | 438 template<> |
| 439 inline bool ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatLeft>:: updateOffsetIfNeeded(const FloatingObject& floatingObject) | 439 inline bool ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatLeft>:: updateOffsetIfNeeded(const FloatingObject& floatingObject) |
| 440 { | 440 { |
| 441 LayoutUnit logicalRight = m_renderer->logicalRightForFloat(&floatingObject); | 441 LayoutUnit logicalRight = m_renderer->logicalRightForFloat(floatingObject); |
| 442 if (logicalRight > m_offset) { | 442 if (logicalRight > m_offset) { |
| 443 m_offset = logicalRight; | 443 m_offset = logicalRight; |
| 444 return true; | 444 return true; |
| 445 } | 445 } |
| 446 return false; | 446 return false; |
| 447 } | 447 } |
| 448 | 448 |
| 449 template<> | 449 template<> |
| 450 inline bool ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatRight>: :updateOffsetIfNeeded(const FloatingObject& floatingObject) | 450 inline bool ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatRight>: :updateOffsetIfNeeded(const FloatingObject& floatingObject) |
| 451 { | 451 { |
| 452 LayoutUnit logicalLeft = m_renderer->logicalLeftForFloat(&floatingObject); | 452 LayoutUnit logicalLeft = m_renderer->logicalLeftForFloat(floatingObject); |
| 453 if (logicalLeft < m_offset) { | 453 if (logicalLeft < m_offset) { |
| 454 m_offset = logicalLeft; | 454 m_offset = logicalLeft; |
| 455 return true; | 455 return true; |
| 456 } | 456 } |
| 457 return false; | 457 return false; |
| 458 } | 458 } |
| 459 | 459 |
| 460 template <FloatingObject::Type FloatTypeValue> | 460 template <FloatingObject::Type FloatTypeValue> |
| 461 LayoutUnit ComputeFloatOffsetForFloatLayoutAdapter<FloatTypeValue>::heightRemain ing() const | 461 LayoutUnit ComputeFloatOffsetForFloatLayoutAdapter<FloatTypeValue>::heightRemain ing() const |
| 462 { | 462 { |
| 463 return this->m_outermostFloat ? this->m_renderer->logicalBottomForFloat(this ->m_outermostFloat) - this->m_lineTop : LayoutUnit(1); | 463 return this->m_outermostFloat ? this->m_renderer->logicalBottomForFloat(*(th is->m_outermostFloat)) - this->m_lineTop : LayoutUnit(1); |
| 464 } | 464 } |
| 465 | 465 |
| 466 template <FloatingObject::Type FloatTypeValue> | 466 template <FloatingObject::Type FloatTypeValue> |
| 467 inline void ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded(const Int ervalType& interval) | 467 inline void ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded(const Int ervalType& interval) |
| 468 { | 468 { |
| 469 const FloatingObject* floatingObject = interval.data(); | 469 const FloatingObject* floatingObject = interval.data(); |
| 470 if (floatingObject->type() != FloatTypeValue || !rangesIntersect(interval.lo w(), interval.high(), m_lineTop, m_lineBottom)) | 470 if (floatingObject->type() != FloatTypeValue || !rangesIntersect(interval.lo w(), interval.high(), m_lineTop, m_lineBottom)) |
| 471 return; | 471 return; |
| 472 | 472 |
| 473 // Make sure the float hasn't changed since it was added to the placed float s tree. | 473 // Make sure the float hasn't changed since it was added to the placed float s tree. |
| 474 ASSERT(floatingObject->isPlaced()); | 474 ASSERT(floatingObject->isPlaced()); |
| 475 ASSERT(interval.low() == m_renderer->pixelSnappedLogicalTopForFloat(floating Object)); | 475 ASSERT(interval.low() == m_renderer->pixelSnappedLogicalTopForFloat(*floatin gObject)); |
|
Julien - ping for review
2015/03/16 15:27:54
It seems like |floatingObject| should be a referen
Sunil Ratnu
2015/03/17 11:31:19
Done.
| |
| 476 ASSERT(interval.high() == m_renderer->pixelSnappedLogicalBottomForFloat(floa tingObject)); | 476 ASSERT(interval.high() == m_renderer->pixelSnappedLogicalBottomForFloat(*flo atingObject)); |
| 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.layoutObject()->shapeOut sideInfo()) { | 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.layoutObject()->shapeOut sideInfo()) { | 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; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 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 |