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 30 matching lines...) Expand all Loading... |
41 | 41 |
42 COMPILE_ASSERT(sizeof(FloatingObject) == sizeof(SameSizeAsFloatingObject), Float
ingObject_should_stay_small); | 42 COMPILE_ASSERT(sizeof(FloatingObject) == sizeof(SameSizeAsFloatingObject), Float
ingObject_should_stay_small); |
43 | 43 |
44 FloatingObject::FloatingObject(RenderBox* renderer) | 44 FloatingObject::FloatingObject(RenderBox* 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 #ifndef NDEBUG | 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(RenderBox* 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 #ifndef NDEBUG | 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(RenderBox* 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); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 } | 303 } |
304 | 304 |
305 void FloatingObjects::addPlacedObject(FloatingObject* floatingObject) | 305 void FloatingObjects::addPlacedObject(FloatingObject* floatingObject) |
306 { | 306 { |
307 ASSERT(!floatingObject->isInPlacedTree()); | 307 ASSERT(!floatingObject->isInPlacedTree()); |
308 | 308 |
309 floatingObject->setIsPlaced(true); | 309 floatingObject->setIsPlaced(true); |
310 if (m_placedFloatsTree.isInitialized()) | 310 if (m_placedFloatsTree.isInitialized()) |
311 m_placedFloatsTree.add(intervalForFloatingObject(floatingObject)); | 311 m_placedFloatsTree.add(intervalForFloatingObject(floatingObject)); |
312 | 312 |
313 #ifndef NDEBUG | 313 #if ENABLE(ASSERT) |
314 floatingObject->setIsInPlacedTree(true); | 314 floatingObject->setIsInPlacedTree(true); |
315 #endif | 315 #endif |
316 markLowestFloatLogicalBottomCacheAsDirty(); | 316 markLowestFloatLogicalBottomCacheAsDirty(); |
317 } | 317 } |
318 | 318 |
319 void FloatingObjects::removePlacedObject(FloatingObject* floatingObject) | 319 void FloatingObjects::removePlacedObject(FloatingObject* floatingObject) |
320 { | 320 { |
321 ASSERT(floatingObject->isPlaced() && floatingObject->isInPlacedTree()); | 321 ASSERT(floatingObject->isPlaced() && floatingObject->isInPlacedTree()); |
322 | 322 |
323 if (m_placedFloatsTree.isInitialized()) { | 323 if (m_placedFloatsTree.isInitialized()) { |
324 bool removed = m_placedFloatsTree.remove(intervalForFloatingObject(float
ingObject)); | 324 bool removed = m_placedFloatsTree.remove(intervalForFloatingObject(float
ingObject)); |
325 ASSERT_UNUSED(removed, removed); | 325 ASSERT_UNUSED(removed, removed); |
326 } | 326 } |
327 | 327 |
328 floatingObject->setIsPlaced(false); | 328 floatingObject->setIsPlaced(false); |
329 #ifndef NDEBUG | 329 #if ENABLE(ASSERT) |
330 floatingObject->setIsInPlacedTree(false); | 330 floatingObject->setIsInPlacedTree(false); |
331 #endif | 331 #endif |
332 markLowestFloatLogicalBottomCacheAsDirty(); | 332 markLowestFloatLogicalBottomCacheAsDirty(); |
333 } | 333 } |
334 | 334 |
335 FloatingObject* FloatingObjects::add(PassOwnPtr<FloatingObject> floatingObject) | 335 FloatingObject* FloatingObjects::add(PassOwnPtr<FloatingObject> floatingObject) |
336 { | 336 { |
337 FloatingObject* newObject = floatingObject.leakPtr(); | 337 FloatingObject* newObject = floatingObject.leakPtr(); |
338 increaseObjectsCount(newObject->type()); | 338 increaseObjectsCount(newObject->type()); |
339 m_set.add(adoptPtr(newObject)); | 339 m_set.add(adoptPtr(newObject)); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 } | 536 } |
537 | 537 |
538 String ValueToString<FloatingObject*>::string(const FloatingObject* floatingObje
ct) | 538 String ValueToString<FloatingObject*>::string(const FloatingObject* floatingObje
ct) |
539 { | 539 { |
540 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr
ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating
Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped
MaxY()); | 540 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr
ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating
Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped
MaxY()); |
541 } | 541 } |
542 #endif | 542 #endif |
543 | 543 |
544 | 544 |
545 } // namespace WebCore | 545 } // namespace WebCore |
OLD | NEW |