| 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 |
| 11 * version 2 of the License, or (at your option) any later version. | 11 * version 2 of the License, or (at your option) any later version. |
| 12 * | 12 * |
| 13 * This library is distributed in the hope that it will be useful, | 13 * This library is distributed in the hope that it will be useful, |
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 * Library General Public License for more details. | 16 * Library General Public License for more details. |
| 17 * | 17 * |
| 18 * You should have received a copy of the GNU Library General Public License | 18 * You should have received a copy of the GNU Library General Public License |
| 19 * along with this library; see the file COPYING.LIB. If not, write to | 19 * along with this library; see the file COPYING.LIB. If not, write to |
| 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 21 * Boston, MA 02110-1301, USA. | 21 * Boston, MA 02110-1301, USA. |
| 22 */ | 22 */ |
| 23 | 23 |
| 24 #include "config.h" | 24 #include "config.h" |
| 25 #include "core/layout/FloatingObjects.h" | 25 #include "core/layout/FloatingObjects.h" |
| 26 | 26 |
| 27 #include "core/layout/LayoutBox.h" |
| 27 #include "core/rendering/RenderBlockFlow.h" | 28 #include "core/rendering/RenderBlockFlow.h" |
| 28 #include "core/rendering/RenderBox.h" | |
| 29 #include "core/rendering/RenderView.h" | 29 #include "core/rendering/RenderView.h" |
| 30 | 30 |
| 31 using namespace WTF; | 31 using namespace WTF; |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 struct SameSizeAsFloatingObject { | 35 struct SameSizeAsFloatingObject { |
| 36 void* pointers[2]; | 36 void* pointers[2]; |
| 37 LayoutRect rect; | 37 LayoutRect rect; |
| 38 int paginationStrut; | 38 int paginationStrut; |
| 39 uint32_t bitfields : 8; | 39 uint32_t bitfields : 8; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 static_assert(sizeof(FloatingObject) == sizeof(SameSizeAsFloatingObject), "Float
ingObject should stay small"); | 42 static_assert(sizeof(FloatingObject) == sizeof(SameSizeAsFloatingObject), "Float
ingObject should stay small"); |
| 43 | 43 |
| 44 FloatingObject::FloatingObject(RenderBox* renderer) | 44 FloatingObject::FloatingObject(LayoutBox* renderer) |
| 45 : m_renderer(renderer) | 45 : m_renderer(renderer) |
| 46 , m_originatingLine(0) | 46 , m_originatingLine(0) |
| 47 , m_paginationStrut(0) | 47 , m_paginationStrut(0) |
| 48 , m_shouldPaint(true) | 48 , m_shouldPaint(true) |
| 49 , m_isDescendant(false) | 49 , m_isDescendant(false) |
| 50 , m_isPlaced(false) | 50 , m_isPlaced(false) |
| 51 #if ENABLE(ASSERT) | 51 #if ENABLE(ASSERT) |
| 52 , m_isInPlacedTree(false) | 52 , m_isInPlacedTree(false) |
| 53 #endif | 53 #endif |
| 54 { | 54 { |
| 55 EFloat type = renderer->style()->floating(); | 55 EFloat type = renderer->style()->floating(); |
| 56 ASSERT(type != NoFloat); | 56 ASSERT(type != NoFloat); |
| 57 if (type == LeftFloat) | 57 if (type == LeftFloat) |
| 58 m_type = FloatLeft; | 58 m_type = FloatLeft; |
| 59 else if (type == RightFloat) | 59 else if (type == RightFloat) |
| 60 m_type = FloatRight; | 60 m_type = FloatRight; |
| 61 } | 61 } |
| 62 | 62 |
| 63 FloatingObject::FloatingObject(RenderBox* renderer, Type type, const LayoutRect&
frameRect, bool shouldPaint, bool isDescendant) | 63 FloatingObject::FloatingObject(LayoutBox* renderer, Type type, const LayoutRect&
frameRect, bool shouldPaint, bool isDescendant) |
| 64 : m_renderer(renderer) | 64 : m_renderer(renderer) |
| 65 , m_originatingLine(0) | 65 , m_originatingLine(0) |
| 66 , m_frameRect(frameRect) | 66 , m_frameRect(frameRect) |
| 67 , m_paginationStrut(0) | 67 , m_paginationStrut(0) |
| 68 , m_type(type) | 68 , m_type(type) |
| 69 , m_shouldPaint(shouldPaint) | 69 , m_shouldPaint(shouldPaint) |
| 70 , m_isDescendant(isDescendant) | 70 , m_isDescendant(isDescendant) |
| 71 , m_isPlaced(true) | 71 , m_isPlaced(true) |
| 72 #if ENABLE(ASSERT) | 72 #if ENABLE(ASSERT) |
| 73 , m_isInPlacedTree(false) | 73 , m_isInPlacedTree(false) |
| 74 #endif | 74 #endif |
| 75 { | 75 { |
| 76 } | 76 } |
| 77 | 77 |
| 78 PassOwnPtr<FloatingObject> FloatingObject::create(RenderBox* renderer) | 78 PassOwnPtr<FloatingObject> FloatingObject::create(LayoutBox* renderer) |
| 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 { |
| (...skipping 177 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 RenderBox* renderer = floatingObject->renderer(); | 276 LayoutBox* renderer = floatingObject->renderer(); |
| 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |