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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // Note that Type uses bits so you can use FloatLeftRight as a mask to query
for both left and right. | 49 // Note that Type uses bits so you can use FloatLeftRight as a mask to query
for both left and right. |
50 enum Type { FloatLeft = 1, FloatRight = 2, FloatLeftRight = 3 }; | 50 enum Type { FloatLeft = 1, FloatRight = 2, FloatLeftRight = 3 }; |
51 | 51 |
52 static PassOwnPtr<FloatingObject> create(LayoutBox*); | 52 static PassOwnPtr<FloatingObject> create(LayoutBox*); |
53 | 53 |
54 PassOwnPtr<FloatingObject> copyToNewContainer(LayoutSize, bool shouldPaint =
false, bool isDescendant = false) const; | 54 PassOwnPtr<FloatingObject> copyToNewContainer(LayoutSize, bool shouldPaint =
false, bool isDescendant = false) const; |
55 | 55 |
56 PassOwnPtr<FloatingObject> unsafeClone() const; | 56 PassOwnPtr<FloatingObject> unsafeClone() const; |
57 | 57 |
58 Type type() const { return static_cast<Type>(m_type); } | 58 Type type() const { return static_cast<Type>(m_type); } |
59 LayoutBox* renderer() const { return m_renderer; } | 59 LayoutBox* layoutObject() const { return m_renderer; } |
60 | 60 |
61 bool isPlaced() const { return m_isPlaced; } | 61 bool isPlaced() const { return m_isPlaced; } |
62 void setIsPlaced(bool placed = true) { m_isPlaced = placed; } | 62 void setIsPlaced(bool placed = true) { m_isPlaced = placed; } |
63 | 63 |
64 LayoutUnit x() const { ASSERT(isPlaced()); return m_frameRect.x(); } | 64 LayoutUnit x() const { ASSERT(isPlaced()); return m_frameRect.x(); } |
65 LayoutUnit maxX() const { ASSERT(isPlaced()); return m_frameRect.maxX(); } | 65 LayoutUnit maxX() const { ASSERT(isPlaced()); return m_frameRect.maxX(); } |
66 LayoutUnit y() const { ASSERT(isPlaced()); return m_frameRect.y(); } | 66 LayoutUnit y() const { ASSERT(isPlaced()); return m_frameRect.y(); } |
67 LayoutUnit maxY() const { ASSERT(isPlaced()); return m_frameRect.maxY(); } | 67 LayoutUnit maxY() const { ASSERT(isPlaced()); return m_frameRect.maxY(); } |
68 LayoutUnit width() const { return m_frameRect.width(); } | 68 LayoutUnit width() const { return m_frameRect.width(); } |
69 LayoutUnit height() const { return m_frameRect.height(); } | 69 LayoutUnit height() const { return m_frameRect.height(); } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 unsigned m_type : 2; // Type (left or right aligned) | 104 unsigned m_type : 2; // Type (left or right aligned) |
105 unsigned m_shouldPaint : 1; | 105 unsigned m_shouldPaint : 1; |
106 unsigned m_isDescendant : 1; | 106 unsigned m_isDescendant : 1; |
107 unsigned m_isPlaced : 1; | 107 unsigned m_isPlaced : 1; |
108 #if ENABLE(ASSERT) | 108 #if ENABLE(ASSERT) |
109 unsigned m_isInPlacedTree : 1; | 109 unsigned m_isInPlacedTree : 1; |
110 #endif | 110 #endif |
111 }; | 111 }; |
112 | 112 |
113 struct FloatingObjectHashFunctions { | 113 struct FloatingObjectHashFunctions { |
114 static unsigned hash(FloatingObject* key) { return DefaultHash<LayoutBox*>::
Hash::hash(key->renderer()); } | 114 static unsigned hash(FloatingObject* key) { return DefaultHash<LayoutBox*>::
Hash::hash(key->layoutObject()); } |
115 static unsigned hash(const OwnPtr<FloatingObject>& key) { return hash(key.ge
t()); } | 115 static unsigned hash(const OwnPtr<FloatingObject>& key) { return hash(key.ge
t()); } |
116 static unsigned hash(const PassOwnPtr<FloatingObject>& key) { return hash(ke
y.get()); } | 116 static unsigned hash(const PassOwnPtr<FloatingObject>& key) { return hash(ke
y.get()); } |
117 static bool equal(OwnPtr<FloatingObject>& a, FloatingObject* b) { return a->
renderer() == b->renderer(); } | 117 static bool equal(OwnPtr<FloatingObject>& a, FloatingObject* b) { return a->
layoutObject() == b->layoutObject(); } |
118 static bool equal(OwnPtr<FloatingObject>& a, const OwnPtr<FloatingObject>& b
) { return equal(a, b.get()); } | 118 static bool equal(OwnPtr<FloatingObject>& a, const OwnPtr<FloatingObject>& b
) { return equal(a, b.get()); } |
119 static bool equal(OwnPtr<FloatingObject>& a, const PassOwnPtr<FloatingObject
>& b) { return equal(a, b.get()); } | 119 static bool equal(OwnPtr<FloatingObject>& a, const PassOwnPtr<FloatingObject
>& b) { return equal(a, b.get()); } |
120 | 120 |
121 static const bool safeToCompareToEmptyOrDeleted = true; | 121 static const bool safeToCompareToEmptyOrDeleted = true; |
122 }; | 122 }; |
123 struct FloatingObjectHashTranslator { | 123 struct FloatingObjectHashTranslator { |
124 static unsigned hash(LayoutBox* key) { return DefaultHash<LayoutBox*>::Hash:
:hash(key); } | 124 static unsigned hash(LayoutBox* key) { return DefaultHash<LayoutBox*>::Hash:
:hash(key); } |
125 static bool equal(FloatingObject* a, LayoutBox* b) { return a->renderer() ==
b; } | 125 static bool equal(FloatingObject* a, LayoutBox* b) { return a->layoutObject(
) == b; } |
126 static bool equal(const OwnPtr<FloatingObject>& a, LayoutBox* b) { return a-
>renderer() == b; } | 126 static bool equal(const OwnPtr<FloatingObject>& a, LayoutBox* b) { return a-
>layoutObject() == b; } |
127 }; | 127 }; |
128 typedef ListHashSet<OwnPtr<FloatingObject>, 4, FloatingObjectHashFunctions> Floa
tingObjectSet; | 128 typedef ListHashSet<OwnPtr<FloatingObject>, 4, FloatingObjectHashFunctions> Floa
tingObjectSet; |
129 typedef FloatingObjectSet::const_iterator FloatingObjectSetIterator; | 129 typedef FloatingObjectSet::const_iterator FloatingObjectSetIterator; |
130 typedef PODInterval<int, FloatingObject*> FloatingObjectInterval; | 130 typedef PODInterval<int, FloatingObject*> FloatingObjectInterval; |
131 typedef PODIntervalTree<int, FloatingObject*> FloatingObjectTree; | 131 typedef PODIntervalTree<int, FloatingObject*> FloatingObjectTree; |
132 typedef PODFreeListArena<PODRedBlackTree<FloatingObjectInterval>::Node> Interval
Arena; | 132 typedef PODFreeListArena<PODRedBlackTree<FloatingObjectInterval>::Node> Interval
Arena; |
133 typedef HashMap<LayoutBox*, OwnPtr<FloatingObject>> RendererToFloatInfoMap; | 133 typedef HashMap<LayoutBox*, OwnPtr<FloatingObject>> RendererToFloatInfoMap; |
134 | 134 |
135 class FloatingObjects { | 135 class FloatingObjects { |
136 WTF_MAKE_NONCOPYABLE(FloatingObjects); WTF_MAKE_FAST_ALLOCATED; | 136 WTF_MAKE_NONCOPYABLE(FloatingObjects); WTF_MAKE_FAST_ALLOCATED; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 static String string(const int value); | 198 static String string(const int value); |
199 }; | 199 }; |
200 template<> struct ValueToString<FloatingObject*> { | 200 template<> struct ValueToString<FloatingObject*> { |
201 static String string(const FloatingObject*); | 201 static String string(const FloatingObject*); |
202 }; | 202 }; |
203 #endif | 203 #endif |
204 | 204 |
205 } // namespace blink | 205 } // namespace blink |
206 | 206 |
207 #endif // FloatingObjects_h | 207 #endif // FloatingObjects_h |
OLD | NEW |