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 18 matching lines...) Expand all Loading... |
29 #include "core/dom/Document.h" | 29 #include "core/dom/Document.h" |
30 #include "core/dom/Element.h" | 30 #include "core/dom/Element.h" |
31 #include "core/dom/OverflowEvent.h" | 31 #include "core/dom/OverflowEvent.h" |
32 #include "core/dom/shadow/ShadowRoot.h" | 32 #include "core/dom/shadow/ShadowRoot.h" |
33 #include "core/editing/Editor.h" | 33 #include "core/editing/Editor.h" |
34 #include "core/editing/FrameSelection.h" | 34 #include "core/editing/FrameSelection.h" |
35 #include "core/page/Frame.h" | 35 #include "core/page/Frame.h" |
36 #include "core/page/FrameView.h" | 36 #include "core/page/FrameView.h" |
37 #include "core/page/Page.h" | 37 #include "core/page/Page.h" |
38 #include "core/page/Settings.h" | 38 #include "core/page/Settings.h" |
39 #include "core/platform/PODFreeListArena.h" | |
40 #include "core/platform/graphics/FloatQuad.h" | 39 #include "core/platform/graphics/FloatQuad.h" |
41 #include "core/platform/graphics/GraphicsContextStateSaver.h" | 40 #include "core/platform/graphics/GraphicsContextStateSaver.h" |
42 #include "core/platform/graphics/transforms/TransformState.h" | 41 #include "core/platform/graphics/transforms/TransformState.h" |
43 #include "core/rendering/ColumnInfo.h" | 42 #include "core/rendering/ColumnInfo.h" |
44 #include "core/rendering/HitTestLocation.h" | 43 #include "core/rendering/HitTestLocation.h" |
45 #include "core/rendering/HitTestResult.h" | 44 #include "core/rendering/HitTestResult.h" |
46 #include "core/rendering/InlineIterator.h" | 45 #include "core/rendering/InlineIterator.h" |
47 #include "core/rendering/InlineTextBox.h" | 46 #include "core/rendering/InlineTextBox.h" |
48 #include "core/rendering/LayoutRepainter.h" | 47 #include "core/rendering/LayoutRepainter.h" |
49 #include "core/rendering/PaintInfo.h" | 48 #include "core/rendering/PaintInfo.h" |
(...skipping 25 matching lines...) Expand all Loading... |
75 | 74 |
76 struct SameSizeAsRenderBlock : public RenderBox { | 75 struct SameSizeAsRenderBlock : public RenderBox { |
77 void* pointers[2]; | 76 void* pointers[2]; |
78 RenderObjectChildList children; | 77 RenderObjectChildList children; |
79 RenderLineBoxList lineBoxes; | 78 RenderLineBoxList lineBoxes; |
80 uint32_t bitfields; | 79 uint32_t bitfields; |
81 }; | 80 }; |
82 | 81 |
83 COMPILE_ASSERT(sizeof(RenderBlock) == sizeof(SameSizeAsRenderBlock), RenderBlock
_should_stay_small); | 82 COMPILE_ASSERT(sizeof(RenderBlock) == sizeof(SameSizeAsRenderBlock), RenderBlock
_should_stay_small); |
84 | 83 |
85 struct SameSizeAsFloatingObject { | |
86 void* pointers[2]; | |
87 LayoutRect rect; | |
88 int paginationStrut; | |
89 uint32_t bitfields : 8; | |
90 }; | |
91 | |
92 COMPILE_ASSERT(sizeof(RenderBlock::MarginValues) == sizeof(LayoutUnit[4]), Margi
nValues_should_stay_small); | 84 COMPILE_ASSERT(sizeof(RenderBlock::MarginValues) == sizeof(LayoutUnit[4]), Margi
nValues_should_stay_small); |
93 | 85 |
94 struct SameSizeAsMarginInfo { | 86 struct SameSizeAsMarginInfo { |
95 uint32_t bitfields : 16; | 87 uint32_t bitfields : 16; |
96 LayoutUnit margins[2]; | 88 LayoutUnit margins[2]; |
97 }; | 89 }; |
98 | 90 |
99 typedef WTF::HashMap<const RenderBox*, OwnPtr<ColumnInfo> > ColumnInfoMap; | 91 typedef WTF::HashMap<const RenderBox*, OwnPtr<ColumnInfo> > ColumnInfoMap; |
100 static ColumnInfoMap* gColumnInfoMap = 0; | 92 static ColumnInfoMap* gColumnInfoMap = 0; |
101 | 93 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 RenderBlock::RenderBlock(ContainerNode* node) | 185 RenderBlock::RenderBlock(ContainerNode* node) |
194 : RenderBox(node) | 186 : RenderBox(node) |
195 , m_lineHeight(-1) | 187 , m_lineHeight(-1) |
196 , m_hasMarginBeforeQuirk(false) | 188 , m_hasMarginBeforeQuirk(false) |
197 , m_hasMarginAfterQuirk(false) | 189 , m_hasMarginAfterQuirk(false) |
198 , m_beingDestroyed(false) | 190 , m_beingDestroyed(false) |
199 , m_hasMarkupTruncation(false) | 191 , m_hasMarkupTruncation(false) |
200 , m_hasBorderOrPaddingLogicalWidthChanged(false) | 192 , m_hasBorderOrPaddingLogicalWidthChanged(false) |
201 { | 193 { |
202 setChildrenInline(true); | 194 setChildrenInline(true); |
203 COMPILE_ASSERT(sizeof(RenderBlock::FloatingObject) == sizeof(SameSizeAsFloat
ingObject), FloatingObject_should_stay_small); | |
204 COMPILE_ASSERT(sizeof(RenderBlock::MarginInfo) == sizeof(SameSizeAsMarginInf
o), MarginInfo_should_stay_small); | 195 COMPILE_ASSERT(sizeof(RenderBlock::MarginInfo) == sizeof(SameSizeAsMarginInf
o), MarginInfo_should_stay_small); |
205 } | 196 } |
206 | 197 |
207 static void removeBlockFromDescendantAndContainerMaps(RenderBlock* block, Tracke
dDescendantsMap*& descendantMap, TrackedContainerMap*& containerMap) | 198 static void removeBlockFromDescendantAndContainerMaps(RenderBlock* block, Tracke
dDescendantsMap*& descendantMap, TrackedContainerMap*& containerMap) |
208 { | 199 { |
209 if (OwnPtr<TrackedRendererListHashSet> descendantSet = descendantMap->take(b
lock)) { | 200 if (OwnPtr<TrackedRendererListHashSet> descendantSet = descendantMap->take(b
lock)) { |
210 TrackedRendererListHashSet::iterator end = descendantSet->end(); | 201 TrackedRendererListHashSet::iterator end = descendantSet->end(); |
211 for (TrackedRendererListHashSet::iterator descendant = descendantSet->be
gin(); descendant != end; ++descendant) { | 202 for (TrackedRendererListHashSet::iterator descendant = descendantSet->be
gin(); descendant != end; ++descendant) { |
212 TrackedContainerMap::iterator it = containerMap->find(*descendant); | 203 TrackedContainerMap::iterator it = containerMap->find(*descendant); |
213 ASSERT(it != containerMap->end()); | 204 ASSERT(it != containerMap->end()); |
(...skipping 11 matching lines...) Expand all Loading... |
225 RenderBlock::~RenderBlock() | 216 RenderBlock::~RenderBlock() |
226 { | 217 { |
227 if (hasColumns()) | 218 if (hasColumns()) |
228 gColumnInfoMap->take(this); | 219 gColumnInfoMap->take(this); |
229 if (gPercentHeightDescendantsMap) | 220 if (gPercentHeightDescendantsMap) |
230 removeBlockFromDescendantAndContainerMaps(this, gPercentHeightDescendant
sMap, gPercentHeightContainerMap); | 221 removeBlockFromDescendantAndContainerMaps(this, gPercentHeightDescendant
sMap, gPercentHeightContainerMap); |
231 if (gPositionedDescendantsMap) | 222 if (gPositionedDescendantsMap) |
232 removeBlockFromDescendantAndContainerMaps(this, gPositionedDescendantsMa
p, gPositionedContainerMap); | 223 removeBlockFromDescendantAndContainerMaps(this, gPositionedDescendantsMa
p, gPositionedContainerMap); |
233 } | 224 } |
234 | 225 |
235 RenderBlock::FloatingObjects::~FloatingObjects() | |
236 { | |
237 // FIXME: m_set should use OwnPtr instead. | |
238 deleteAllValues(m_set); | |
239 } | |
240 | |
241 RenderBlock* RenderBlock::createAnonymous(Document* document) | 226 RenderBlock* RenderBlock::createAnonymous(Document* document) |
242 { | 227 { |
243 RenderBlock* renderer = new RenderBlock(0); | 228 RenderBlock* renderer = new RenderBlock(0); |
244 renderer->setDocumentForAnonymous(document); | 229 renderer->setDocumentForAnonymous(document); |
245 return renderer; | 230 return renderer; |
246 } | 231 } |
247 | 232 |
248 void RenderBlock::willBeDestroyed() | 233 void RenderBlock::willBeDestroyed() |
249 { | 234 { |
250 // Mark as being destroyed to avoid trouble with merges in removeChild(). | 235 // Mark as being destroyed to avoid trouble with merges in removeChild(). |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 curr = curr->nextSibling(); | 948 curr = curr->nextSibling(); |
964 while (curr && (curr->isInline() || curr->isFloatingOrOutOfFlowPositione
d()) && (curr != boundary)) { | 949 while (curr && (curr->isInline() || curr->isFloatingOrOutOfFlowPositione
d()) && (curr != boundary)) { |
965 inlineRunEnd = curr; | 950 inlineRunEnd = curr; |
966 if (curr->isInline()) | 951 if (curr->isInline()) |
967 sawInline = true; | 952 sawInline = true; |
968 curr = curr->nextSibling(); | 953 curr = curr->nextSibling(); |
969 } | 954 } |
970 } while (!sawInline); | 955 } while (!sawInline); |
971 } | 956 } |
972 | 957 |
973 void RenderBlock::FloatingObjects::clearLineBoxTreePointers() | |
974 { | |
975 // Clear references to originating lines, since the lines are being deleted | |
976 FloatingObjectSetIterator end = m_set.end(); | |
977 for (FloatingObjectSetIterator it = m_set.begin(); it != end; ++it) { | |
978 ASSERT(!((*it)->originatingLine()) || (*it)->originatingLine()->renderer
() == m_renderer); | |
979 (*it)->setOriginatingLine(0); | |
980 } | |
981 } | |
982 | |
983 void RenderBlock::deleteLineBoxTree() | 958 void RenderBlock::deleteLineBoxTree() |
984 { | 959 { |
985 if (containsFloats()) | 960 if (containsFloats()) |
986 m_floatingObjects->clearLineBoxTreePointers(); | 961 m_floatingObjects->clearLineBoxTreePointers(); |
987 m_lineBoxes.deleteLineBoxTree(); | 962 m_lineBoxes.deleteLineBoxTree(); |
988 | 963 |
989 if (AXObjectCache* cache = document()->existingAXObjectCache()) | 964 if (AXObjectCache* cache = document()->existingAXObjectCache()) |
990 cache->recomputeIsIgnored(this); | 965 cache->recomputeIsIgnored(this); |
991 } | 966 } |
992 | 967 |
(...skipping 2901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3894 | 3869 |
3895 void RenderBlock::removeFloatingObjects() | 3870 void RenderBlock::removeFloatingObjects() |
3896 { | 3871 { |
3897 if (!m_floatingObjects) | 3872 if (!m_floatingObjects) |
3898 return; | 3873 return; |
3899 | 3874 |
3900 deleteAllValues(m_floatingObjects->set()); | 3875 deleteAllValues(m_floatingObjects->set()); |
3901 m_floatingObjects->clear(); | 3876 m_floatingObjects->clear(); |
3902 } | 3877 } |
3903 | 3878 |
3904 RenderBlock::FloatingObject* RenderBlock::insertFloatingObject(RenderBox* o) | 3879 FloatingObject* RenderBlock::insertFloatingObject(RenderBox* o) |
3905 { | 3880 { |
3906 ASSERT(o->isFloating()); | 3881 ASSERT(o->isFloating()); |
3907 | 3882 |
3908 // Create the list of special objects if we don't aleady have one | 3883 // Create the list of special objects if we don't aleady have one |
3909 if (!m_floatingObjects) | 3884 if (!m_floatingObjects) |
3910 createFloatingObjects(); | 3885 createFloatingObjects(); |
3911 else { | 3886 else { |
3912 // Don't insert the object again if it's already in the list | 3887 // Don't insert the object again if it's already in the list |
3913 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 3888 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
3914 FloatingObjectSetIterator it = floatingObjectSet.find<RenderBox*, Floati
ngObjectHashTranslator>(o); | 3889 FloatingObjectSetIterator it = floatingObjectSet.find<RenderBox*, Floati
ngObjectHashTranslator>(o); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4248 continue; | 4223 continue; |
4249 | 4224 |
4250 RenderBox* box = toRenderBox(curr); | 4225 RenderBox* box = toRenderBox(curr); |
4251 if (!hasPercentHeightDescendant(box)) | 4226 if (!hasPercentHeightDescendant(box)) |
4252 continue; | 4227 continue; |
4253 | 4228 |
4254 removePercentHeightDescendant(box); | 4229 removePercentHeightDescendant(box); |
4255 } | 4230 } |
4256 } | 4231 } |
4257 | 4232 |
4258 inline static bool rangesIntersect(int floatTop, int floatBottom, int objectTop,
int objectBottom) | |
4259 { | |
4260 if (objectTop >= floatBottom || objectBottom < floatTop) | |
4261 return false; | |
4262 | |
4263 // The top of the object overlaps the float | |
4264 if (objectTop >= floatTop) | |
4265 return true; | |
4266 | |
4267 // The object encloses the float | |
4268 if (objectTop < floatTop && objectBottom > floatBottom) | |
4269 return true; | |
4270 | |
4271 // The bottom of the object overlaps the float | |
4272 if (objectBottom > objectTop && objectBottom > floatTop && objectBottom <= f
loatBottom) | |
4273 return true; | |
4274 | |
4275 return false; | |
4276 } | |
4277 | |
4278 template<> | |
4279 inline bool RenderBlock::ComputeFloatOffsetAdapter<RenderBlock::FloatingObject::
FloatLeft>::updateOffsetIfNeeded(const FloatingObject* floatingObject) | |
4280 { | |
4281 LayoutUnit logicalRight = floatingObject->logicalRight(m_renderer->isHorizon
talWritingMode()); | |
4282 if (logicalRight > m_offset) { | |
4283 m_offset = logicalRight; | |
4284 return true; | |
4285 } | |
4286 return false; | |
4287 } | |
4288 | |
4289 template<> | |
4290 inline bool RenderBlock::ComputeFloatOffsetAdapter<RenderBlock::FloatingObject::
FloatRight>::updateOffsetIfNeeded(const FloatingObject* floatingObject) | |
4291 { | |
4292 LayoutUnit logicalLeft = floatingObject->logicalLeft(m_renderer->isHorizonta
lWritingMode()); | |
4293 if (logicalLeft < m_offset) { | |
4294 m_offset = logicalLeft; | |
4295 return true; | |
4296 } | |
4297 return false; | |
4298 } | |
4299 | |
4300 template <RenderBlock::FloatingObject::Type FloatTypeValue> | |
4301 inline void RenderBlock::ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNee
ded(const IntervalType& interval) | |
4302 { | |
4303 const FloatingObject* floatingObject = interval.data(); | |
4304 if (floatingObject->type() != FloatTypeValue || !rangesIntersect(interval.lo
w(), interval.high(), m_lineTop, m_lineBottom)) | |
4305 return; | |
4306 | |
4307 // Make sure the float hasn't changed since it was added to the placed float
s tree. | |
4308 ASSERT(floatingObject->isPlaced()); | |
4309 ASSERT(interval.low() == floatingObject->pixelSnappedLogicalTop(m_renderer->
isHorizontalWritingMode())); | |
4310 ASSERT(interval.high() == floatingObject->pixelSnappedLogicalBottom(m_render
er->isHorizontalWritingMode())); | |
4311 | |
4312 bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject); | |
4313 if (floatIsNewExtreme) | |
4314 m_outermostFloat = floatingObject; | |
4315 } | |
4316 | |
4317 template <RenderBlock::FloatingObject::Type FloatTypeValue> | |
4318 LayoutUnit RenderBlock::ComputeFloatOffsetAdapter<FloatTypeValue>::getHeightRema
ining() const | |
4319 { | |
4320 return m_outermostFloat ? m_outermostFloat->logicalBottom(m_renderer->isHori
zontalWritingMode()) - m_lineTop : LayoutUnit(1); | |
4321 } | |
4322 | |
4323 LayoutUnit RenderBlock::textIndentOffset() const | 4233 LayoutUnit RenderBlock::textIndentOffset() const |
4324 { | 4234 { |
4325 LayoutUnit cw = 0; | 4235 LayoutUnit cw = 0; |
4326 RenderView* renderView = 0; | 4236 RenderView* renderView = 0; |
4327 if (style()->textIndent().isPercent()) | 4237 if (style()->textIndent().isPercent()) |
4328 cw = containingBlock()->availableLogicalWidth(); | 4238 cw = containingBlock()->availableLogicalWidth(); |
4329 else if (style()->textIndent().isViewportPercentage()) | 4239 else if (style()->textIndent().isViewportPercentage()) |
4330 renderView = view(); | 4240 renderView = view(); |
4331 return minimumValueForLength(style()->textIndent(), cw, renderView); | 4241 return minimumValueForLength(style()->textIndent(), cw, renderView); |
4332 } | 4242 } |
(...skipping 3585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7918 return "RenderBlock (generated)"; | 7828 return "RenderBlock (generated)"; |
7919 if (isRelPositioned()) | 7829 if (isRelPositioned()) |
7920 return "RenderBlock (relative positioned)"; | 7830 return "RenderBlock (relative positioned)"; |
7921 if (isStickyPositioned()) | 7831 if (isStickyPositioned()) |
7922 return "RenderBlock (sticky positioned)"; | 7832 return "RenderBlock (sticky positioned)"; |
7923 if (isRunIn()) | 7833 if (isRunIn()) |
7924 return "RenderBlock (run-in)"; | 7834 return "RenderBlock (run-in)"; |
7925 return "RenderBlock"; | 7835 return "RenderBlock"; |
7926 } | 7836 } |
7927 | 7837 |
7928 inline RenderBlock::FloatingObjects::FloatingObjects(const RenderBlock* renderer
, bool horizontalWritingMode) | |
7929 : m_placedFloatsTree(UninitializedTree) | |
7930 , m_leftObjectsCount(0) | |
7931 , m_rightObjectsCount(0) | |
7932 , m_horizontalWritingMode(horizontalWritingMode) | |
7933 , m_renderer(renderer) | |
7934 { | |
7935 } | |
7936 | |
7937 void RenderBlock::createFloatingObjects() | 7838 void RenderBlock::createFloatingObjects() |
7938 { | 7839 { |
7939 m_floatingObjects = adoptPtr(new FloatingObjects(this, isHorizontalWritingMo
de())); | 7840 m_floatingObjects = adoptPtr(new FloatingObjects(this, isHorizontalWritingMo
de())); |
7940 } | 7841 } |
7941 | 7842 |
7942 inline void RenderBlock::FloatingObjects::clear() | |
7943 { | |
7944 // FIXME: This should call deleteAllValues, except RenderBlock::clearFloats | |
7945 // like to play fast and loose with ownership of these pointers. | |
7946 // If we move to OwnPtr that will fix this ownership oddness. | |
7947 m_set.clear(); | |
7948 m_placedFloatsTree.clear(); | |
7949 m_leftObjectsCount = 0; | |
7950 m_rightObjectsCount = 0; | |
7951 } | |
7952 | |
7953 inline void RenderBlock::FloatingObjects::increaseObjectsCount(FloatingObject::T
ype type) | |
7954 { | |
7955 if (type == FloatingObject::FloatLeft) | |
7956 m_leftObjectsCount++; | |
7957 else | |
7958 m_rightObjectsCount++; | |
7959 } | |
7960 | |
7961 inline void RenderBlock::FloatingObjects::decreaseObjectsCount(FloatingObject::T
ype type) | |
7962 { | |
7963 if (type == FloatingObject::FloatLeft) | |
7964 m_leftObjectsCount--; | |
7965 else | |
7966 m_rightObjectsCount--; | |
7967 } | |
7968 | |
7969 inline RenderBlock::FloatingObjectInterval RenderBlock::FloatingObjects::interva
lForFloatingObject(FloatingObject* floatingObject) | |
7970 { | |
7971 if (m_horizontalWritingMode) | |
7972 return RenderBlock::FloatingObjectInterval(floatingObject->frameRect().p
ixelSnappedY(), floatingObject->frameRect().pixelSnappedMaxY(), floatingObject); | |
7973 return RenderBlock::FloatingObjectInterval(floatingObject->frameRect().pixel
SnappedX(), floatingObject->frameRect().pixelSnappedMaxX(), floatingObject); | |
7974 } | |
7975 | |
7976 void RenderBlock::FloatingObjects::addPlacedObject(FloatingObject* floatingObjec
t) | |
7977 { | |
7978 ASSERT(!floatingObject->isInPlacedTree()); | |
7979 | |
7980 floatingObject->setIsPlaced(true); | |
7981 if (m_placedFloatsTree.isInitialized()) | |
7982 m_placedFloatsTree.add(intervalForFloatingObject(floatingObject)); | |
7983 | |
7984 #ifndef NDEBUG | |
7985 floatingObject->setIsInPlacedTree(true); | |
7986 #endif | |
7987 } | |
7988 | |
7989 void RenderBlock::FloatingObjects::removePlacedObject(FloatingObject* floatingOb
ject) | |
7990 { | |
7991 ASSERT(floatingObject->isPlaced() && floatingObject->isInPlacedTree()); | |
7992 | |
7993 if (m_placedFloatsTree.isInitialized()) { | |
7994 bool removed = m_placedFloatsTree.remove(intervalForFloatingObject(float
ingObject)); | |
7995 ASSERT_UNUSED(removed, removed); | |
7996 } | |
7997 | |
7998 floatingObject->setIsPlaced(false); | |
7999 #ifndef NDEBUG | |
8000 floatingObject->setIsInPlacedTree(false); | |
8001 #endif | |
8002 } | |
8003 | |
8004 inline void RenderBlock::FloatingObjects::add(FloatingObject* floatingObject) | |
8005 { | |
8006 increaseObjectsCount(floatingObject->type()); | |
8007 m_set.add(floatingObject); | |
8008 if (floatingObject->isPlaced()) | |
8009 addPlacedObject(floatingObject); | |
8010 } | |
8011 | |
8012 inline void RenderBlock::FloatingObjects::remove(FloatingObject* floatingObject) | |
8013 { | |
8014 decreaseObjectsCount(floatingObject->type()); | |
8015 m_set.remove(floatingObject); | |
8016 ASSERT(floatingObject->isPlaced() || !floatingObject->isInPlacedTree()); | |
8017 if (floatingObject->isPlaced()) | |
8018 removePlacedObject(floatingObject); | |
8019 } | |
8020 | |
8021 void RenderBlock::FloatingObjects::computePlacedFloatsTree() | |
8022 { | |
8023 ASSERT(!m_placedFloatsTree.isInitialized()); | |
8024 if (m_set.isEmpty()) | |
8025 return; | |
8026 m_placedFloatsTree.initIfNeeded(m_renderer->view()->intervalArena()); | |
8027 FloatingObjectSetIterator it = m_set.begin(); | |
8028 FloatingObjectSetIterator end = m_set.end(); | |
8029 for (; it != end; ++it) { | |
8030 FloatingObject* floatingObject = *it; | |
8031 if (floatingObject->isPlaced()) | |
8032 m_placedFloatsTree.add(intervalForFloatingObject(floatingObject)); | |
8033 } | |
8034 } | |
8035 | |
8036 LayoutUnit RenderBlock::FloatingObjects::logicalLeftOffset(LayoutUnit fixedOffse
t, LayoutUnit logicalTop, LayoutUnit logicalHeight, ShapeOutsideFloatOffsetMode
offsetMode, LayoutUnit *heightRemaining) | |
8037 { | |
8038 LayoutUnit offset = fixedOffset; | |
8039 ComputeFloatOffsetAdapter<FloatingObject::FloatLeft> adapter(m_renderer, rou
ndToInt(logicalTop), roundToInt(logicalTop + logicalHeight), offset); | |
8040 placedFloatsTree().allOverlapsWithAdapter(adapter); | |
8041 | |
8042 if (heightRemaining) | |
8043 *heightRemaining = adapter.getHeightRemaining(); | |
8044 | |
8045 const FloatingObject* outermostFloat = adapter.outermostFloat(); | |
8046 if (offsetMode == ShapeOutsideFloatShapeOffset && outermostFloat) { | |
8047 if (ShapeOutsideInfo* shapeOutside = outermostFloat->renderer()->shapeOu
tsideInfo()) { | |
8048 shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, oute
rmostFloat->logicalTop(m_horizontalWritingMode), logicalHeight); | |
8049 offset += shapeOutside->rightSegmentMarginBoxDelta(); | |
8050 } | |
8051 } | |
8052 | |
8053 return offset; | |
8054 } | |
8055 | |
8056 LayoutUnit RenderBlock::FloatingObjects::logicalRightOffset(LayoutUnit fixedOffs
et, LayoutUnit logicalTop, LayoutUnit logicalHeight, ShapeOutsideFloatOffsetMode
offsetMode, LayoutUnit *heightRemaining) | |
8057 { | |
8058 LayoutUnit offset = fixedOffset; | |
8059 ComputeFloatOffsetAdapter<FloatingObject::FloatRight> adapter(m_renderer, ro
undToInt(logicalTop), roundToInt(logicalTop + logicalHeight), offset); | |
8060 placedFloatsTree().allOverlapsWithAdapter(adapter); | |
8061 | |
8062 if (heightRemaining) | |
8063 *heightRemaining = adapter.getHeightRemaining(); | |
8064 | |
8065 const FloatingObject* outermostFloat = adapter.outermostFloat(); | |
8066 if (offsetMode == ShapeOutsideFloatShapeOffset && outermostFloat) { | |
8067 if (ShapeOutsideInfo* shapeOutside = outermostFloat->renderer()->shapeOu
tsideInfo()) { | |
8068 shapeOutside->computeSegmentsForContainingBlockLine(logicalTop, oute
rmostFloat->logicalTop(m_horizontalWritingMode), logicalHeight); | |
8069 offset += shapeOutside->leftSegmentMarginBoxDelta(); | |
8070 } | |
8071 } | |
8072 | |
8073 return min(fixedOffset, offset); | |
8074 } | |
8075 | |
8076 template <typename CharacterType> | 7843 template <typename CharacterType> |
8077 static inline TextRun constructTextRunInternal(RenderObject* context, const Font
& font, const CharacterType* characters, int length, RenderStyle* style, TextRun
::ExpansionBehavior expansion) | 7844 static inline TextRun constructTextRunInternal(RenderObject* context, const Font
& font, const CharacterType* characters, int length, RenderStyle* style, TextRun
::ExpansionBehavior expansion) |
8078 { | 7845 { |
8079 ASSERT(style); | 7846 ASSERT(style); |
8080 | 7847 |
8081 TextDirection textDirection = LTR; | 7848 TextDirection textDirection = LTR; |
8082 bool directionalOverride = style->rtlOrdering() == VisualOrder; | 7849 bool directionalOverride = style->rtlOrdering() == VisualOrder; |
8083 | 7850 |
8084 TextRun run(characters, length, 0, 0, expansion, textDirection, directionalO
verride); | 7851 TextRun run(characters, length, 0, 0, expansion, textDirection, directionalO
verride); |
8085 if (textRunNeedsRenderingContext(font)) | 7852 if (textRunNeedsRenderingContext(font)) |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8200 } | 7967 } |
8201 } | 7968 } |
8202 | 7969 |
8203 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 7970 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
8204 { | 7971 { |
8205 showRenderObject(); | 7972 showRenderObject(); |
8206 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 7973 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
8207 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 7974 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
8208 } | 7975 } |
8209 | 7976 |
8210 // These helpers are only used by the PODIntervalTree for debugging purposes. | |
8211 String ValueToString<int>::string(const int value) | |
8212 { | |
8213 return String::number(value); | |
8214 } | |
8215 | |
8216 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | |
8217 { | |
8218 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr
ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating
Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped
MaxY()); | |
8219 } | |
8220 | |
8221 | |
8222 #endif | 7977 #endif |
8223 | 7978 |
8224 } // namespace WebCore | 7979 } // namespace WebCore |
OLD | NEW |