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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 #include "wtf/StdLibExtras.h" | 70 #include "wtf/StdLibExtras.h" |
71 #include "wtf/TemporaryChange.h" | 71 #include "wtf/TemporaryChange.h" |
72 | 72 |
73 using namespace WTF; | 73 using namespace WTF; |
74 using namespace Unicode; | 74 using namespace Unicode; |
75 | 75 |
76 namespace blink { | 76 namespace blink { |
77 | 77 |
78 using namespace HTMLNames; | 78 using namespace HTMLNames; |
79 | 79 |
80 struct SameSizeAsRenderBlock : public RenderBox { | 80 struct SameSizeAsRenderBlock : public LayoutBox { |
81 LayoutObjectChildList children; | 81 LayoutObjectChildList children; |
82 RenderLineBoxList lineBoxes; | 82 RenderLineBoxList lineBoxes; |
83 int pageLogicalOffset; | 83 int pageLogicalOffset; |
84 uint32_t bitfields; | 84 uint32_t bitfields; |
85 }; | 85 }; |
86 | 86 |
87 static_assert(sizeof(RenderBlock) == sizeof(SameSizeAsRenderBlock), "RenderBlock
should stay small"); | 87 static_assert(sizeof(RenderBlock) == sizeof(SameSizeAsRenderBlock), "RenderBlock
should stay small"); |
88 | 88 |
89 typedef WTF::HashMap<const RenderBox*, OwnPtr<ColumnInfo> > ColumnInfoMap; | 89 typedef WTF::HashMap<const LayoutBox*, OwnPtr<ColumnInfo>> ColumnInfoMap; |
90 static ColumnInfoMap* gColumnInfoMap = 0; | 90 static ColumnInfoMap* gColumnInfoMap = 0; |
91 | 91 |
92 static TrackedDescendantsMap* gPositionedDescendantsMap = 0; | 92 static TrackedDescendantsMap* gPositionedDescendantsMap = 0; |
93 static TrackedDescendantsMap* gPercentHeightDescendantsMap = 0; | 93 static TrackedDescendantsMap* gPercentHeightDescendantsMap = 0; |
94 | 94 |
95 static TrackedContainerMap* gPositionedContainerMap = 0; | 95 static TrackedContainerMap* gPositionedContainerMap = 0; |
96 static TrackedContainerMap* gPercentHeightContainerMap = 0; | 96 static TrackedContainerMap* gPercentHeightContainerMap = 0; |
97 | 97 |
98 typedef WTF::HashSet<RenderBlock*> DelayedUpdateScrollInfoSet; | 98 typedef WTF::HashSet<RenderBlock*> DelayedUpdateScrollInfoSet; |
99 static int gDelayUpdateScrollInfo = 0; | 99 static int gDelayUpdateScrollInfo = 0; |
100 static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0; | 100 static DelayedUpdateScrollInfoSet* gDelayedUpdateScrollInfoSet = 0; |
101 | 101 |
102 static bool gColumnFlowSplitEnabled = true; | 102 static bool gColumnFlowSplitEnabled = true; |
103 | 103 |
104 // This class helps dispatching the 'overflow' event on layout change. overflow
can be set on RenderBoxes, yet the existing code | 104 // This class helps dispatching the 'overflow' event on layout change. overflow
can be set on LayoutBoxes, yet the existing code |
105 // only works on RenderBlocks. If this changes, this class should be shared with
other RenderBoxes. | 105 // only works on RenderBlocks. If this changes, this class should be shared with
other LayoutBoxes. |
106 class OverflowEventDispatcher { | 106 class OverflowEventDispatcher { |
107 WTF_MAKE_NONCOPYABLE(OverflowEventDispatcher); | 107 WTF_MAKE_NONCOPYABLE(OverflowEventDispatcher); |
108 public: | 108 public: |
109 OverflowEventDispatcher(const RenderBlock* block) | 109 OverflowEventDispatcher(const RenderBlock* block) |
110 : m_block(block) | 110 : m_block(block) |
111 , m_hadHorizontalLayoutOverflow(false) | 111 , m_hadHorizontalLayoutOverflow(false) |
112 , m_hadVerticalLayoutOverflow(false) | 112 , m_hadVerticalLayoutOverflow(false) |
113 { | 113 { |
114 m_shouldDispatchEvent = !m_block->isAnonymous() && m_block->hasOverflowC
lip() && m_block->document().hasListenerType(Document::OVERFLOWCHANGED_LISTENER)
; | 114 m_shouldDispatchEvent = !m_block->isAnonymous() && m_block->hasOverflowC
lip() && m_block->document().hasListenerType(Document::OVERFLOWCHANGED_LISTENER)
; |
115 if (m_shouldDispatchEvent) { | 115 if (m_shouldDispatchEvent) { |
(...skipping 22 matching lines...) Expand all Loading... |
138 } | 138 } |
139 | 139 |
140 private: | 140 private: |
141 const RenderBlock* m_block; | 141 const RenderBlock* m_block; |
142 bool m_shouldDispatchEvent; | 142 bool m_shouldDispatchEvent; |
143 bool m_hadHorizontalLayoutOverflow; | 143 bool m_hadHorizontalLayoutOverflow; |
144 bool m_hadVerticalLayoutOverflow; | 144 bool m_hadVerticalLayoutOverflow; |
145 }; | 145 }; |
146 | 146 |
147 RenderBlock::RenderBlock(ContainerNode* node) | 147 RenderBlock::RenderBlock(ContainerNode* node) |
148 : RenderBox(node) | 148 : LayoutBox(node) |
149 , m_hasMarginBeforeQuirk(false) | 149 , m_hasMarginBeforeQuirk(false) |
150 , m_hasMarginAfterQuirk(false) | 150 , m_hasMarginAfterQuirk(false) |
151 , m_beingDestroyed(false) | 151 , m_beingDestroyed(false) |
152 , m_hasMarkupTruncation(false) | 152 , m_hasMarkupTruncation(false) |
153 , m_widthAvailableToChildrenChanged(false) | 153 , m_widthAvailableToChildrenChanged(false) |
154 , m_hasOnlySelfCollapsingChildren(false) | 154 , m_hasOnlySelfCollapsingChildren(false) |
155 , m_descendantsWithFloatsMarkedForLayout(false) | 155 , m_descendantsWithFloatsMarkedForLayout(false) |
156 { | 156 { |
157 // RenderBlockFlow calls setChildrenInline(true). | 157 // RenderBlockFlow calls setChildrenInline(true). |
158 // By default, subclasses do not have inline children. | 158 // By default, subclasses do not have inline children. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // The reason we don't destroy it before anonymous children is that they may | 236 // The reason we don't destroy it before anonymous children is that they may |
237 // have continuations of their own that are anonymous children of our contin
uation. | 237 // have continuations of their own that are anonymous children of our contin
uation. |
238 LayoutBoxModelObject* continuation = this->continuation(); | 238 LayoutBoxModelObject* continuation = this->continuation(); |
239 if (continuation) { | 239 if (continuation) { |
240 continuation->destroy(); | 240 continuation->destroy(); |
241 setContinuation(0); | 241 setContinuation(0); |
242 } | 242 } |
243 | 243 |
244 if (!documentBeingDestroyed()) { | 244 if (!documentBeingDestroyed()) { |
245 if (firstLineBox()) { | 245 if (firstLineBox()) { |
246 // We can't wait for RenderBox::destroy to clear the selection, | 246 // We can't wait for LayoutBox::destroy to clear the selection, |
247 // because by then we will have nuked the line boxes. | 247 // because by then we will have nuked the line boxes. |
248 // FIXME: The FrameSelection should be responsible for this when it | 248 // FIXME: The FrameSelection should be responsible for this when it |
249 // is notified of DOM mutations. | 249 // is notified of DOM mutations. |
250 if (isSelectionBorder()) | 250 if (isSelectionBorder()) |
251 view()->clearSelection(); | 251 view()->clearSelection(); |
252 | 252 |
253 // If we are an anonymous block, then our line boxes might have chil
dren | 253 // If we are an anonymous block, then our line boxes might have chil
dren |
254 // that will outlast this block. In the non-anonymous block case tho
se | 254 // that will outlast this block. In the non-anonymous block case tho
se |
255 // children will be destroyed by the time we return from this functi
on. | 255 // children will be destroyed by the time we return from this functi
on. |
256 if (isAnonymousBlock()) { | 256 if (isAnonymousBlock()) { |
257 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLi
neBox()) { | 257 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLi
neBox()) { |
258 while (InlineBox* childBox = box->firstChild()) | 258 while (InlineBox* childBox = box->firstChild()) |
259 childBox->remove(); | 259 childBox->remove(); |
260 } | 260 } |
261 } | 261 } |
262 } else if (parent()) | 262 } else if (parent()) |
263 parent()->dirtyLinesFromChangedChild(this); | 263 parent()->dirtyLinesFromChangedChild(this); |
264 } | 264 } |
265 | 265 |
266 m_lineBoxes.deleteLineBoxes(); | 266 m_lineBoxes.deleteLineBoxes(); |
267 | 267 |
268 if (UNLIKELY(gDelayedUpdateScrollInfoSet != 0)) | 268 if (UNLIKELY(gDelayedUpdateScrollInfoSet != 0)) |
269 gDelayedUpdateScrollInfoSet->remove(this); | 269 gDelayedUpdateScrollInfoSet->remove(this); |
270 | 270 |
271 if (TextAutosizer* textAutosizer = document().textAutosizer()) | 271 if (TextAutosizer* textAutosizer = document().textAutosizer()) |
272 textAutosizer->destroy(this); | 272 textAutosizer->destroy(this); |
273 | 273 |
274 RenderBox::willBeDestroyed(); | 274 LayoutBox::willBeDestroyed(); |
275 } | 275 } |
276 | 276 |
277 void RenderBlock::styleWillChange(StyleDifference diff, const LayoutStyle& newSt
yle) | 277 void RenderBlock::styleWillChange(StyleDifference diff, const LayoutStyle& newSt
yle) |
278 { | 278 { |
279 LayoutStyle* oldStyle = style(); | 279 LayoutStyle* oldStyle = style(); |
280 | 280 |
281 setReplaced(newStyle.isDisplayInlineType()); | 281 setReplaced(newStyle.isDisplayInlineType()); |
282 | 282 |
283 if (oldStyle && parent()) { | 283 if (oldStyle && parent()) { |
284 bool oldStyleIsContainer = oldStyle->position() != StaticPosition || old
Style->hasTransformRelatedProperty(); | 284 bool oldStyleIsContainer = oldStyle->position() != StaticPosition || old
Style->hasTransformRelatedProperty(); |
(...skipping 13 matching lines...) Expand all Loading... |
298 break; | 298 break; |
299 } | 299 } |
300 cb = cb->parent(); | 300 cb = cb->parent(); |
301 } | 301 } |
302 | 302 |
303 if (cb->isRenderBlock()) | 303 if (cb->isRenderBlock()) |
304 toRenderBlock(cb)->removePositionedObjects(this, NewContainingBl
ock); | 304 toRenderBlock(cb)->removePositionedObjects(this, NewContainingBl
ock); |
305 } | 305 } |
306 } | 306 } |
307 | 307 |
308 RenderBox::styleWillChange(diff, newStyle); | 308 LayoutBox::styleWillChange(diff, newStyle); |
309 } | 309 } |
310 | 310 |
311 static bool borderOrPaddingLogicalWidthChanged(const LayoutStyle& oldStyle, cons
t LayoutStyle& newStyle) | 311 static bool borderOrPaddingLogicalWidthChanged(const LayoutStyle& oldStyle, cons
t LayoutStyle& newStyle) |
312 { | 312 { |
313 if (newStyle.isHorizontalWritingMode()) | 313 if (newStyle.isHorizontalWritingMode()) |
314 return oldStyle.borderLeftWidth() != newStyle.borderLeftWidth() | 314 return oldStyle.borderLeftWidth() != newStyle.borderLeftWidth() |
315 || oldStyle.borderRightWidth() != newStyle.borderRightWidth() | 315 || oldStyle.borderRightWidth() != newStyle.borderRightWidth() |
316 || oldStyle.paddingLeft() != newStyle.paddingLeft() | 316 || oldStyle.paddingLeft() != newStyle.paddingLeft() |
317 || oldStyle.paddingRight() != newStyle.paddingRight(); | 317 || oldStyle.paddingRight() != newStyle.paddingRight(); |
318 | 318 |
319 return oldStyle.borderTopWidth() != newStyle.borderTopWidth() | 319 return oldStyle.borderTopWidth() != newStyle.borderTopWidth() |
320 || oldStyle.borderBottomWidth() != newStyle.borderBottomWidth() | 320 || oldStyle.borderBottomWidth() != newStyle.borderBottomWidth() |
321 || oldStyle.paddingTop() != newStyle.paddingTop() | 321 || oldStyle.paddingTop() != newStyle.paddingTop() |
322 || oldStyle.paddingBottom() != newStyle.paddingBottom(); | 322 || oldStyle.paddingBottom() != newStyle.paddingBottom(); |
323 } | 323 } |
324 | 324 |
325 void RenderBlock::styleDidChange(StyleDifference diff, const LayoutStyle* oldSty
le) | 325 void RenderBlock::styleDidChange(StyleDifference diff, const LayoutStyle* oldSty
le) |
326 { | 326 { |
327 RenderBox::styleDidChange(diff, oldStyle); | 327 LayoutBox::styleDidChange(diff, oldStyle); |
328 | 328 |
329 if (isFloatingOrOutOfFlowPositioned() && oldStyle && !oldStyle->isFloating()
&& !oldStyle->hasOutOfFlowPosition() && parent() && parent()->isRenderBlockFlow
()) | 329 if (isFloatingOrOutOfFlowPositioned() && oldStyle && !oldStyle->isFloating()
&& !oldStyle->hasOutOfFlowPosition() && parent() && parent()->isRenderBlockFlow
()) |
330 toRenderBlock(parent())->removeAnonymousWrappersIfRequired(); | 330 toRenderBlock(parent())->removeAnonymousWrappersIfRequired(); |
331 | 331 |
332 const LayoutStyle& newStyle = styleRef(); | 332 const LayoutStyle& newStyle = styleRef(); |
333 | 333 |
334 if (!isAnonymousBlock()) { | 334 if (!isAnonymousBlock()) { |
335 // Ensure that all of our continuation blocks pick up the new style. | 335 // Ensure that all of our continuation blocks pick up the new style. |
336 for (RenderBlock* currCont = blockElementContinuation(); currCont; currC
ont = currCont->blockElementContinuation()) { | 336 for (RenderBlock* currCont = blockElementContinuation(); currCont; currC
ont = currCont->blockElementContinuation()) { |
337 LayoutBoxModelObject* nextCont = currCont->continuation(); | 337 LayoutBoxModelObject* nextCont = currCont->continuation(); |
(...skipping 17 matching lines...) Expand all Loading... |
355 Vector<ImageResource*> images; | 355 Vector<ImageResource*> images; |
356 appendImagesFromStyle(images, newStyle); | 356 appendImagesFromStyle(images, newStyle); |
357 if (images.isEmpty()) | 357 if (images.isEmpty()) |
358 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeLa
youtObject(this); | 358 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->removeLa
youtObject(this); |
359 else | 359 else |
360 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->addLayou
tObject(this); | 360 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->addLayou
tObject(this); |
361 } | 361 } |
362 | 362 |
363 void RenderBlock::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationState
& childPaintInvalidationState) | 363 void RenderBlock::invalidatePaintOfSubtreesIfNeeded(const PaintInvalidationState
& childPaintInvalidationState) |
364 { | 364 { |
365 RenderBox::invalidatePaintOfSubtreesIfNeeded(childPaintInvalidationState); | 365 LayoutBox::invalidatePaintOfSubtreesIfNeeded(childPaintInvalidationState); |
366 | 366 |
367 // Take care of positioned objects. This is required as PaintInvalidationSta
te keeps a single clip rect. | 367 // Take care of positioned objects. This is required as PaintInvalidationSta
te keeps a single clip rect. |
368 if (TrackedRendererListHashSet* positionedObjects = this->positionedObjects(
)) { | 368 if (TrackedRendererListHashSet* positionedObjects = this->positionedObjects(
)) { |
369 TrackedRendererListHashSet::iterator end = positionedObjects->end(); | 369 TrackedRendererListHashSet::iterator end = positionedObjects->end(); |
370 for (TrackedRendererListHashSet::iterator it = positionedObjects->begin(
); it != end; ++it) { | 370 for (TrackedRendererListHashSet::iterator it = positionedObjects->begin(
); it != end; ++it) { |
371 RenderBox* box = *it; | 371 LayoutBox* box = *it; |
372 | 372 |
373 // One of the renderers we're skipping over here may be the child's
paint invalidation container, | 373 // One of the renderers we're skipping over here may be the child's
paint invalidation container, |
374 // so we can't pass our own paint invalidation container along. | 374 // so we can't pass our own paint invalidation container along. |
375 const LayoutBoxModelObject& paintInvalidationContainerForChild = *bo
x->containerForPaintInvalidation(); | 375 const LayoutBoxModelObject& paintInvalidationContainerForChild = *bo
x->containerForPaintInvalidation(); |
376 | 376 |
377 // If it's a new paint invalidation container, we won't have properl
y accumulated the offset into the | 377 // If it's a new paint invalidation container, we won't have properl
y accumulated the offset into the |
378 // PaintInvalidationState. | 378 // PaintInvalidationState. |
379 // FIXME: Teach PaintInvalidationState to handle this case. crbug.co
m/371485 | 379 // FIXME: Teach PaintInvalidationState to handle this case. crbug.co
m/371485 |
380 if (paintInvalidationContainerForChild != childPaintInvalidationStat
e.paintInvalidationContainer()) { | 380 if (paintInvalidationContainerForChild != childPaintInvalidationStat
e.paintInvalidationContainer()) { |
381 ForceHorriblySlowRectMapping slowRectMapping(&childPaintInvalida
tionState); | 381 ForceHorriblySlowRectMapping slowRectMapping(&childPaintInvalida
tionState); |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 LayoutObject* afterChild = beforeChild ? beforeChild->previousSibling()
: lastChild(); | 897 LayoutObject* afterChild = beforeChild ? beforeChild->previousSibling()
: lastChild(); |
898 | 898 |
899 if (afterChild && afterChild->isAnonymousBlock()) { | 899 if (afterChild && afterChild->isAnonymousBlock()) { |
900 afterChild->addChild(newChild); | 900 afterChild->addChild(newChild); |
901 return; | 901 return; |
902 } | 902 } |
903 | 903 |
904 if (newChild->isInline()) { | 904 if (newChild->isInline()) { |
905 // No suitable existing anonymous box - create a new one. | 905 // No suitable existing anonymous box - create a new one. |
906 RenderBlock* newBox = createAnonymousBlock(); | 906 RenderBlock* newBox = createAnonymousBlock(); |
907 RenderBox::addChild(newBox, beforeChild); | 907 LayoutBox::addChild(newBox, beforeChild); |
908 newBox->addChild(newChild); | 908 newBox->addChild(newChild); |
909 return; | 909 return; |
910 } | 910 } |
911 } | 911 } |
912 | 912 |
913 RenderBox::addChild(newChild, beforeChild); | 913 LayoutBox::addChild(newChild, beforeChild); |
914 | 914 |
915 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isRend
erBlock()) | 915 if (madeBoxesNonInline && parent() && isAnonymousBlock() && parent()->isRend
erBlock()) |
916 toRenderBlock(parent())->removeLeftoverAnonymousBlock(this); | 916 toRenderBlock(parent())->removeLeftoverAnonymousBlock(this); |
917 // this object may be dead here | 917 // this object may be dead here |
918 } | 918 } |
919 | 919 |
920 void RenderBlock::addChild(LayoutObject* newChild, LayoutObject* beforeChild) | 920 void RenderBlock::addChild(LayoutObject* newChild, LayoutObject* beforeChild) |
921 { | 921 { |
922 if (continuation() && !isAnonymousBlock()) | 922 if (continuation() && !isAnonymousBlock()) |
923 addChildToContinuation(newChild, beforeChild); | 923 addChildToContinuation(newChild, beforeChild); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 return true; | 1094 return true; |
1095 | 1095 |
1096 // Make sure the types of the anonymous blocks match up. | 1096 // Make sure the types of the anonymous blocks match up. |
1097 return prev->isAnonymousColumnsBlock() == next->isAnonymousColumnsBlock() | 1097 return prev->isAnonymousColumnsBlock() == next->isAnonymousColumnsBlock() |
1098 && prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanB
lock(); | 1098 && prev->isAnonymousColumnSpanBlock() == next->isAnonymousColumnSpanB
lock(); |
1099 } | 1099 } |
1100 | 1100 |
1101 void RenderBlock::removeAnonymousWrappersIfRequired() | 1101 void RenderBlock::removeAnonymousWrappersIfRequired() |
1102 { | 1102 { |
1103 ASSERT(isRenderBlockFlow()); | 1103 ASSERT(isRenderBlockFlow()); |
1104 Vector<RenderBox*, 16> blocksToRemove; | 1104 Vector<LayoutBox*, 16> blocksToRemove; |
1105 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) { | 1105 for (LayoutBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) { |
1106 // There are still block children in the container, so any anonymous wra
ppers are still needed. | 1106 // There are still block children in the container, so any anonymous wra
ppers are still needed. |
1107 if (!child->isAnonymousBlock() && !child->isFloatingOrOutOfFlowPositione
d()) | 1107 if (!child->isAnonymousBlock() && !child->isFloatingOrOutOfFlowPositione
d()) |
1108 return; | 1108 return; |
1109 // We can't remove anonymous wrappers if they contain continuations as t
his means there are block children present. | 1109 // We can't remove anonymous wrappers if they contain continuations as t
his means there are block children present. |
1110 if (child->isRenderBlock() && toRenderBlock(child)->continuation()) | 1110 if (child->isRenderBlock() && toRenderBlock(child)->continuation()) |
1111 return; | 1111 return; |
1112 // We are only interested in removing anonymous wrappers if there are in
line siblings underneath them. | 1112 // We are only interested in removing anonymous wrappers if there are in
line siblings underneath them. |
1113 if (!child->childrenInline()) | 1113 if (!child->childrenInline()) |
1114 return; | 1114 return; |
1115 if (child->isAnonymousBlock()) | 1115 if (child->isAnonymousBlock()) |
(...skipping 30 matching lines...) Expand all Loading... |
1146 // block handling in willBeDestroyed will cause problems. | 1146 // block handling in willBeDestroyed will cause problems. |
1147 child->deleteLineBoxTree(); | 1147 child->deleteLineBoxTree(); |
1148 child->destroy(); | 1148 child->destroy(); |
1149 } | 1149 } |
1150 | 1150 |
1151 void RenderBlock::removeChild(LayoutObject* oldChild) | 1151 void RenderBlock::removeChild(LayoutObject* oldChild) |
1152 { | 1152 { |
1153 // No need to waste time in merging or removing empty anonymous blocks. | 1153 // No need to waste time in merging or removing empty anonymous blocks. |
1154 // We can just bail out if our document is getting destroyed. | 1154 // We can just bail out if our document is getting destroyed. |
1155 if (documentBeingDestroyed()) { | 1155 if (documentBeingDestroyed()) { |
1156 RenderBox::removeChild(oldChild); | 1156 LayoutBox::removeChild(oldChild); |
1157 return; | 1157 return; |
1158 } | 1158 } |
1159 | 1159 |
1160 // This protects against column split flows when anonymous blocks are gettin
g merged. | 1160 // This protects against column split flows when anonymous blocks are gettin
g merged. |
1161 TemporaryChange<bool> columnFlowSplitEnabled(gColumnFlowSplitEnabled, false)
; | 1161 TemporaryChange<bool> columnFlowSplitEnabled(gColumnFlowSplitEnabled, false)
; |
1162 | 1162 |
1163 // If this child is a block, and if our previous and next siblings are | 1163 // If this child is a block, and if our previous and next siblings are |
1164 // both anonymous blocks with inline content, then we can go ahead and | 1164 // both anonymous blocks with inline content, then we can go ahead and |
1165 // fold the inline content back together. | 1165 // fold the inline content back together. |
1166 LayoutObject* prev = oldChild->previousSibling(); | 1166 LayoutObject* prev = oldChild->previousSibling(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1202 // the |prev| block. | 1202 // the |prev| block. |
1203 nextBlock->moveAllChildrenIncludingFloatsTo(prevBlock, nextBlock->ha
sLayer() || prevBlock->hasLayer()); | 1203 nextBlock->moveAllChildrenIncludingFloatsTo(prevBlock, nextBlock->ha
sLayer() || prevBlock->hasLayer()); |
1204 | 1204 |
1205 // Delete the now-empty block's lines and nuke it. | 1205 // Delete the now-empty block's lines and nuke it. |
1206 nextBlock->deleteLineBoxTree(); | 1206 nextBlock->deleteLineBoxTree(); |
1207 nextBlock->destroy(); | 1207 nextBlock->destroy(); |
1208 next = 0; | 1208 next = 0; |
1209 } | 1209 } |
1210 } | 1210 } |
1211 | 1211 |
1212 RenderBox::removeChild(oldChild); | 1212 LayoutBox::removeChild(oldChild); |
1213 | 1213 |
1214 LayoutObject* child = prev ? prev : next; | 1214 LayoutObject* child = prev ? prev : next; |
1215 if (canMergeAnonymousBlocks && child && !child->previousSibling() && !child-
>nextSibling() && canCollapseAnonymousBlockChild()) { | 1215 if (canMergeAnonymousBlocks && child && !child->previousSibling() && !child-
>nextSibling() && canCollapseAnonymousBlockChild()) { |
1216 // The removal has knocked us down to containing only a single anonymous | 1216 // The removal has knocked us down to containing only a single anonymous |
1217 // box. We can go ahead and pull the content right back up into our | 1217 // box. We can go ahead and pull the content right back up into our |
1218 // box. | 1218 // box. |
1219 collapseAnonymousBlockChild(this, toRenderBlock(child)); | 1219 collapseAnonymousBlockChild(this, toRenderBlock(child)); |
1220 } else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymous
Block())) && canCollapseAnonymousBlockChild()) { | 1220 } else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymous
Block())) && canCollapseAnonymousBlockChild()) { |
1221 // It's possible that the removal has knocked us down to a single anonym
ous | 1221 // It's possible that the removal has knocked us down to a single anonym
ous |
1222 // block with pseudo-style element siblings (e.g. first-letter). If thes
e | 1222 // block with pseudo-style element siblings (e.g. first-letter). If thes
e |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 if (hasAutoHeight || ((logicalHeightLength.isFixed() || logicalHeightLength.
isPercent()) && logicalHeightLength.isZero())) { | 1305 if (hasAutoHeight || ((logicalHeightLength.isFixed() || logicalHeightLength.
isPercent()) && logicalHeightLength.isZero())) { |
1306 // If the block has inline children, see if we generated any line boxes.
If we have any | 1306 // If the block has inline children, see if we generated any line boxes.
If we have any |
1307 // line boxes, then we can't be self-collapsing, since we have content. | 1307 // line boxes, then we can't be self-collapsing, since we have content. |
1308 if (childrenInline()) | 1308 if (childrenInline()) |
1309 return !firstLineBox(); | 1309 return !firstLineBox(); |
1310 | 1310 |
1311 // Whether or not we collapse is dependent on whether all our normal flo
w children | 1311 // Whether or not we collapse is dependent on whether all our normal flo
w children |
1312 // are also self-collapsing. | 1312 // are also self-collapsing. |
1313 if (m_hasOnlySelfCollapsingChildren) | 1313 if (m_hasOnlySelfCollapsingChildren) |
1314 return true; | 1314 return true; |
1315 for (RenderBox* child = firstChildBox(); child; child = child->nextSibli
ngBox()) { | 1315 for (LayoutBox* child = firstChildBox(); child; child = child->nextSibli
ngBox()) { |
1316 if (child->isFloatingOrOutOfFlowPositioned()) | 1316 if (child->isFloatingOrOutOfFlowPositioned()) |
1317 continue; | 1317 continue; |
1318 if (!child->isSelfCollapsingBlock()) | 1318 if (!child->isSelfCollapsingBlock()) |
1319 return false; | 1319 return false; |
1320 } | 1320 } |
1321 return true; | 1321 return true; |
1322 } | 1322 } |
1323 return false; | 1323 return false; |
1324 } | 1324 } |
1325 | 1325 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 m_overflow->setLayoutClientAfterEdge(oldClientAfterEdge); | 1491 m_overflow->setLayoutClientAfterEdge(oldClientAfterEdge); |
1492 } | 1492 } |
1493 | 1493 |
1494 addVisualEffectOverflow(); | 1494 addVisualEffectOverflow(); |
1495 | 1495 |
1496 addVisualOverflowFromTheme(); | 1496 addVisualOverflowFromTheme(); |
1497 } | 1497 } |
1498 | 1498 |
1499 void RenderBlock::addOverflowFromBlockChildren() | 1499 void RenderBlock::addOverflowFromBlockChildren() |
1500 { | 1500 { |
1501 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) { | 1501 for (LayoutBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) { |
1502 if (!child->isFloatingOrOutOfFlowPositioned() && !child->isColumnSpanAll
()) | 1502 if (!child->isFloatingOrOutOfFlowPositioned() && !child->isColumnSpanAll
()) |
1503 addOverflowFromChild(child); | 1503 addOverflowFromChild(child); |
1504 } | 1504 } |
1505 } | 1505 } |
1506 | 1506 |
1507 void RenderBlock::addOverflowFromPositionedObjects() | 1507 void RenderBlock::addOverflowFromPositionedObjects() |
1508 { | 1508 { |
1509 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); | 1509 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); |
1510 if (!positionedDescendants) | 1510 if (!positionedDescendants) |
1511 return; | 1511 return; |
1512 | 1512 |
1513 RenderBox* positionedObject; | 1513 LayoutBox* positionedObject; |
1514 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); | 1514 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); |
1515 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(
); it != end; ++it) { | 1515 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(
); it != end; ++it) { |
1516 positionedObject = *it; | 1516 positionedObject = *it; |
1517 | 1517 |
1518 // Fixed positioned elements don't contribute to layout overflow, since
they don't scroll with the content. | 1518 // Fixed positioned elements don't contribute to layout overflow, since
they don't scroll with the content. |
1519 if (positionedObject->style()->position() != FixedPosition) | 1519 if (positionedObject->style()->position() != FixedPosition) |
1520 addOverflowFromChild(positionedObject, toLayoutSize(positionedObject
->location())); | 1520 addOverflowFromChild(positionedObject, toLayoutSize(positionedObject
->location())); |
1521 } | 1521 } |
1522 } | 1522 } |
1523 | 1523 |
1524 void RenderBlock::addVisualOverflowFromTheme() | 1524 void RenderBlock::addVisualOverflowFromTheme() |
1525 { | 1525 { |
1526 if (!style()->hasAppearance()) | 1526 if (!style()->hasAppearance()) |
1527 return; | 1527 return; |
1528 | 1528 |
1529 IntRect inflatedRect = pixelSnappedBorderBoxRect(); | 1529 IntRect inflatedRect = pixelSnappedBorderBoxRect(); |
1530 LayoutTheme::theme().adjustPaintInvalidationRect(this, inflatedRect); | 1530 LayoutTheme::theme().adjustPaintInvalidationRect(this, inflatedRect); |
1531 addVisualOverflow(inflatedRect); | 1531 addVisualOverflow(inflatedRect); |
1532 } | 1532 } |
1533 | 1533 |
1534 bool RenderBlock::createsNewFormattingContext() const | 1534 bool RenderBlock::createsNewFormattingContext() const |
1535 { | 1535 { |
1536 return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() ||
hasOverflowClip() || isFlexItemIncludingDeprecated() | 1536 return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() ||
hasOverflowClip() || isFlexItemIncludingDeprecated() |
1537 || style()->specifiesColumns() || isLayoutFlowThread() || isTableCell()
|| isTableCaption() || isFieldset() || isWritingModeRoot() | 1537 || style()->specifiesColumns() || isLayoutFlowThread() || isTableCell()
|| isTableCaption() || isFieldset() || isWritingModeRoot() |
1538 || isDocumentElement() || (document().regionBasedColumnsEnabled() ? isCo
lumnSpanAll() : style()->columnSpan()) || isGridItem(); | 1538 || isDocumentElement() || (document().regionBasedColumnsEnabled() ? isCo
lumnSpanAll() : style()->columnSpan()) || isGridItem(); |
1539 } | 1539 } |
1540 | 1540 |
1541 void RenderBlock::updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, R
enderBox& child) | 1541 void RenderBlock::updateBlockChildDirtyBitsBeforeLayout(bool relayoutChildren, L
ayoutBox& child) |
1542 { | 1542 { |
1543 // FIXME: Technically percentage height objects only need a relayout if thei
r percentage isn't going to be turned into | 1543 // FIXME: Technically percentage height objects only need a relayout if thei
r percentage isn't going to be turned into |
1544 // an auto value. Add a method to determine this, so that we can avoid the r
elayout. | 1544 // an auto value. Add a method to determine this, so that we can avoid the r
elayout. |
1545 bool hasRelativeLogicalHeight = child.hasRelativeLogicalHeight() || (child.i
sAnonymous() && this->hasRelativeLogicalHeight()); | 1545 bool hasRelativeLogicalHeight = child.hasRelativeLogicalHeight() || (child.i
sAnonymous() && this->hasRelativeLogicalHeight()); |
1546 if (relayoutChildren || (hasRelativeLogicalHeight && !isRenderView())) | 1546 if (relayoutChildren || (hasRelativeLogicalHeight && !isRenderView())) |
1547 child.setChildNeedsLayout(MarkOnlyThis); | 1547 child.setChildNeedsLayout(MarkOnlyThis); |
1548 | 1548 |
1549 // If relayoutChildren is set and the child has percentage padding or an emb
edded content box, we also need to invalidate the childs pref widths. | 1549 // If relayoutChildren is set and the child has percentage padding or an emb
edded content box, we also need to invalidate the childs pref widths. |
1550 if (relayoutChildren && child.needsPreferredWidthsRecalculation()) | 1550 if (relayoutChildren && child.needsPreferredWidthsRecalculation()) |
1551 child.setPreferredLogicalWidthsDirty(MarkOnlyThis); | 1551 child.setPreferredLogicalWidthsDirty(MarkOnlyThis); |
1552 } | 1552 } |
1553 | 1553 |
1554 void RenderBlock::simplifiedNormalFlowLayout() | 1554 void RenderBlock::simplifiedNormalFlowLayout() |
1555 { | 1555 { |
1556 if (childrenInline()) { | 1556 if (childrenInline()) { |
1557 ListHashSet<RootInlineBox*> lineBoxes; | 1557 ListHashSet<RootInlineBox*> lineBoxes; |
1558 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { | 1558 for (InlineWalker walker(this); !walker.atEnd(); walker.advance()) { |
1559 LayoutObject* o = walker.current(); | 1559 LayoutObject* o = walker.current(); |
1560 if (!o->isOutOfFlowPositioned() && (o->isReplaced() || o->isFloating
())) { | 1560 if (!o->isOutOfFlowPositioned() && (o->isReplaced() || o->isFloating
())) { |
1561 o->layoutIfNeeded(); | 1561 o->layoutIfNeeded(); |
1562 if (toRenderBox(o)->inlineBoxWrapper()) { | 1562 if (toLayoutBox(o)->inlineBoxWrapper()) { |
1563 RootInlineBox& box = toRenderBox(o)->inlineBoxWrapper()->roo
t(); | 1563 RootInlineBox& box = toLayoutBox(o)->inlineBoxWrapper()->roo
t(); |
1564 lineBoxes.add(&box); | 1564 lineBoxes.add(&box); |
1565 } | 1565 } |
1566 } else if (o->isText() || (o->isRenderInline() && !walker.atEndOfInl
ine())) { | 1566 } else if (o->isText() || (o->isRenderInline() && !walker.atEndOfInl
ine())) { |
1567 o->clearNeedsLayout(); | 1567 o->clearNeedsLayout(); |
1568 } | 1568 } |
1569 } | 1569 } |
1570 | 1570 |
1571 // FIXME: Glyph overflow will get lost in this case, but not really a bi
g deal. | 1571 // FIXME: Glyph overflow will get lost in this case, but not really a bi
g deal. |
1572 GlyphOverflowAndFallbackFontsMap textBoxDataMap; | 1572 GlyphOverflowAndFallbackFontsMap textBoxDataMap; |
1573 for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin();
it != lineBoxes.end(); ++it) { | 1573 for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin();
it != lineBoxes.end(); ++it) { |
1574 RootInlineBox* box = *it; | 1574 RootInlineBox* box = *it; |
1575 box->computeOverflow(box->lineTop(), box->lineBottom(), textBoxDataM
ap); | 1575 box->computeOverflow(box->lineTop(), box->lineBottom(), textBoxDataM
ap); |
1576 } | 1576 } |
1577 } else { | 1577 } else { |
1578 for (RenderBox* box = firstChildBox(); box; box = box->nextSiblingBox())
{ | 1578 for (LayoutBox* box = firstChildBox(); box; box = box->nextSiblingBox())
{ |
1579 if (!box->isOutOfFlowPositioned()) | 1579 if (!box->isOutOfFlowPositioned()) |
1580 box->layoutIfNeeded(); | 1580 box->layoutIfNeeded(); |
1581 } | 1581 } |
1582 } | 1582 } |
1583 } | 1583 } |
1584 | 1584 |
1585 bool RenderBlock::simplifiedLayout() | 1585 bool RenderBlock::simplifiedLayout() |
1586 { | 1586 { |
1587 // Check if we need to do a full layout. | 1587 // Check if we need to do a full layout. |
1588 if (normalChildNeedsLayout() || selfNeedsLayout()) | 1588 if (normalChildNeedsLayout() || selfNeedsLayout()) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 bool hasStaticInlinePosition = child->style()->hasStaticInlinePosition(isHor
izontalWritingMode()); | 1643 bool hasStaticInlinePosition = child->style()->hasStaticInlinePosition(isHor
izontalWritingMode()); |
1644 if (!hasStaticBlockPosition && !hasStaticInlinePosition) | 1644 if (!hasStaticBlockPosition && !hasStaticInlinePosition) |
1645 return; | 1645 return; |
1646 | 1646 |
1647 LayoutObject* o = child->parent(); | 1647 LayoutObject* o = child->parent(); |
1648 while (o && !o->isRenderView() && o->style()->position() != AbsolutePosition
) | 1648 while (o && !o->isRenderView() && o->style()->position() != AbsolutePosition
) |
1649 o = o->parent(); | 1649 o = o->parent(); |
1650 if (o->style()->position() != AbsolutePosition) | 1650 if (o->style()->position() != AbsolutePosition) |
1651 return; | 1651 return; |
1652 | 1652 |
1653 RenderBox* box = toRenderBox(child); | 1653 LayoutBox* box = toLayoutBox(child); |
1654 if (hasStaticInlinePosition) { | 1654 if (hasStaticInlinePosition) { |
1655 LogicalExtentComputedValues computedValues; | 1655 LogicalExtentComputedValues computedValues; |
1656 box->computeLogicalWidth(computedValues); | 1656 box->computeLogicalWidth(computedValues); |
1657 LayoutUnit newLeft = computedValues.m_position; | 1657 LayoutUnit newLeft = computedValues.m_position; |
1658 if (newLeft != box->logicalLeft()) | 1658 if (newLeft != box->logicalLeft()) |
1659 layoutScope.setChildNeedsLayout(child); | 1659 layoutScope.setChildNeedsLayout(child); |
1660 } else if (hasStaticBlockPosition) { | 1660 } else if (hasStaticBlockPosition) { |
1661 LayoutUnit oldTop = box->logicalTop(); | 1661 LayoutUnit oldTop = box->logicalTop(); |
1662 box->updateLogicalHeight(); | 1662 box->updateLogicalHeight(); |
1663 if (box->logicalTop() != oldTop) | 1663 if (box->logicalTop() != oldTop) |
1664 layoutScope.setChildNeedsLayout(child); | 1664 layoutScope.setChildNeedsLayout(child); |
1665 } | 1665 } |
1666 } | 1666 } |
1667 | 1667 |
1668 LayoutUnit RenderBlock::marginIntrinsicLogicalWidthForChild(RenderBox& child) co
nst | 1668 LayoutUnit RenderBlock::marginIntrinsicLogicalWidthForChild(LayoutBox& child) co
nst |
1669 { | 1669 { |
1670 // A margin has three types: fixed, percentage, and auto (variable). | 1670 // A margin has three types: fixed, percentage, and auto (variable). |
1671 // Auto and percentage margins become 0 when computing min/max width. | 1671 // Auto and percentage margins become 0 when computing min/max width. |
1672 // Fixed margins can be added in as is. | 1672 // Fixed margins can be added in as is. |
1673 Length marginLeft = child.style()->marginStartUsing(style()); | 1673 Length marginLeft = child.style()->marginStartUsing(style()); |
1674 Length marginRight = child.style()->marginEndUsing(style()); | 1674 Length marginRight = child.style()->marginEndUsing(style()); |
1675 LayoutUnit margin = 0; | 1675 LayoutUnit margin = 0; |
1676 if (marginLeft.isFixed()) | 1676 if (marginLeft.isFixed()) |
1677 margin += marginLeft.value(); | 1677 margin += marginLeft.value(); |
1678 if (marginRight.isFixed()) | 1678 if (marginRight.isFixed()) |
1679 margin += marginRight.value(); | 1679 margin += marginRight.value(); |
1680 return margin; | 1680 return margin; |
1681 } | 1681 } |
1682 | 1682 |
1683 void RenderBlock::layoutPositionedObjects(bool relayoutChildren, PositionedLayou
tBehavior info) | 1683 void RenderBlock::layoutPositionedObjects(bool relayoutChildren, PositionedLayou
tBehavior info) |
1684 { | 1684 { |
1685 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); | 1685 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); |
1686 if (!positionedDescendants) | 1686 if (!positionedDescendants) |
1687 return; | 1687 return; |
1688 | 1688 |
1689 if (hasColumns()) | 1689 if (hasColumns()) |
1690 view()->layoutState()->clearPaginationInformation(); // Positioned objec
ts are not part of the column flow, so they don't paginate with the columns. | 1690 view()->layoutState()->clearPaginationInformation(); // Positioned objec
ts are not part of the column flow, so they don't paginate with the columns. |
1691 | 1691 |
1692 RenderBox* r; | 1692 LayoutBox* r; |
1693 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); | 1693 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); |
1694 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(
); it != end; ++it) { | 1694 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(
); it != end; ++it) { |
1695 r = *it; | 1695 r = *it; |
1696 | 1696 |
1697 r->setMayNeedPaintInvalidation(); | 1697 r->setMayNeedPaintInvalidation(); |
1698 | 1698 |
1699 SubtreeLayoutScope layoutScope(*r); | 1699 SubtreeLayoutScope layoutScope(*r); |
1700 // A fixed position element with an absolute positioned ancestor has no
way of knowing if the latter has changed position. So | 1700 // A fixed position element with an absolute positioned ancestor has no
way of knowing if the latter has changed position. So |
1701 // if this is a fixed position element, mark it for layout if it has an
abspos ancestor and needs to move with that ancestor, i.e. | 1701 // if this is a fixed position element, mark it for layout if it has an
abspos ancestor and needs to move with that ancestor, i.e. |
1702 // it has static position. | 1702 // it has static position. |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 while (child && child->isRenderBlock()) { | 1912 while (child && child->isRenderBlock()) { |
1913 beforeBlock = toRenderBlock(child); | 1913 beforeBlock = toRenderBlock(child); |
1914 offset += LayoutSize(beforeBlock->logicalLeft(), beforeBlock->logicalTop
()); | 1914 offset += LayoutSize(beforeBlock->logicalLeft(), beforeBlock->logicalTop
()); |
1915 child = beforeBlock->lastChild(); | 1915 child = beforeBlock->lastChild(); |
1916 } | 1916 } |
1917 return beforeBlock; | 1917 return beforeBlock; |
1918 } | 1918 } |
1919 | 1919 |
1920 void RenderBlock::setSelectionState(SelectionState state) | 1920 void RenderBlock::setSelectionState(SelectionState state) |
1921 { | 1921 { |
1922 RenderBox::setSelectionState(state); | 1922 LayoutBox::setSelectionState(state); |
1923 | 1923 |
1924 if (inlineBoxWrapper() && canUpdateSelectionOnRootLineBoxes()) | 1924 if (inlineBoxWrapper() && canUpdateSelectionOnRootLineBoxes()) |
1925 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone
); | 1925 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone
); |
1926 } | 1926 } |
1927 | 1927 |
1928 void RenderBlock::insertIntoTrackedRendererMaps(RenderBox* descendant, TrackedDe
scendantsMap*& descendantsMap, TrackedContainerMap*& containerMap) | 1928 void RenderBlock::insertIntoTrackedRendererMaps(LayoutBox* descendant, TrackedDe
scendantsMap*& descendantsMap, TrackedContainerMap*& containerMap) |
1929 { | 1929 { |
1930 if (!descendantsMap) { | 1930 if (!descendantsMap) { |
1931 descendantsMap = new TrackedDescendantsMap; | 1931 descendantsMap = new TrackedDescendantsMap; |
1932 containerMap = new TrackedContainerMap; | 1932 containerMap = new TrackedContainerMap; |
1933 } | 1933 } |
1934 | 1934 |
1935 TrackedRendererListHashSet* descendantSet = descendantsMap->get(this); | 1935 TrackedRendererListHashSet* descendantSet = descendantsMap->get(this); |
1936 if (!descendantSet) { | 1936 if (!descendantSet) { |
1937 descendantSet = new TrackedRendererListHashSet; | 1937 descendantSet = new TrackedRendererListHashSet; |
1938 descendantsMap->set(this, adoptPtr(descendantSet)); | 1938 descendantsMap->set(this, adoptPtr(descendantSet)); |
1939 } | 1939 } |
1940 bool added = descendantSet->add(descendant).isNewEntry; | 1940 bool added = descendantSet->add(descendant).isNewEntry; |
1941 if (!added) { | 1941 if (!added) { |
1942 ASSERT(containerMap->get(descendant)); | 1942 ASSERT(containerMap->get(descendant)); |
1943 ASSERT(containerMap->get(descendant)->contains(this)); | 1943 ASSERT(containerMap->get(descendant)->contains(this)); |
1944 return; | 1944 return; |
1945 } | 1945 } |
1946 | 1946 |
1947 HashSet<RenderBlock*>* containerSet = containerMap->get(descendant); | 1947 HashSet<RenderBlock*>* containerSet = containerMap->get(descendant); |
1948 if (!containerSet) { | 1948 if (!containerSet) { |
1949 containerSet = new HashSet<RenderBlock*>; | 1949 containerSet = new HashSet<RenderBlock*>; |
1950 containerMap->set(descendant, adoptPtr(containerSet)); | 1950 containerMap->set(descendant, adoptPtr(containerSet)); |
1951 } | 1951 } |
1952 ASSERT(!containerSet->contains(this)); | 1952 ASSERT(!containerSet->contains(this)); |
1953 containerSet->add(this); | 1953 containerSet->add(this); |
1954 } | 1954 } |
1955 | 1955 |
1956 void RenderBlock::removeFromTrackedRendererMaps(RenderBox* descendant, TrackedDe
scendantsMap*& descendantsMap, TrackedContainerMap*& containerMap) | 1956 void RenderBlock::removeFromTrackedRendererMaps(LayoutBox* descendant, TrackedDe
scendantsMap*& descendantsMap, TrackedContainerMap*& containerMap) |
1957 { | 1957 { |
1958 if (!descendantsMap) | 1958 if (!descendantsMap) |
1959 return; | 1959 return; |
1960 | 1960 |
1961 OwnPtr<HashSet<RenderBlock*> > containerSet = containerMap->take(descendant)
; | 1961 OwnPtr<HashSet<RenderBlock*> > containerSet = containerMap->take(descendant)
; |
1962 if (!containerSet) | 1962 if (!containerSet) |
1963 return; | 1963 return; |
1964 | 1964 |
1965 HashSet<RenderBlock*>::iterator end = containerSet->end(); | 1965 HashSet<RenderBlock*>::iterator end = containerSet->end(); |
1966 for (HashSet<RenderBlock*>::iterator it = containerSet->begin(); it != end;
++it) { | 1966 for (HashSet<RenderBlock*>::iterator it = containerSet->begin(); it != end;
++it) { |
(...skipping 16 matching lines...) Expand all Loading... |
1983 } | 1983 } |
1984 } | 1984 } |
1985 | 1985 |
1986 TrackedRendererListHashSet* RenderBlock::positionedObjects() const | 1986 TrackedRendererListHashSet* RenderBlock::positionedObjects() const |
1987 { | 1987 { |
1988 if (gPositionedDescendantsMap) | 1988 if (gPositionedDescendantsMap) |
1989 return gPositionedDescendantsMap->get(this); | 1989 return gPositionedDescendantsMap->get(this); |
1990 return 0; | 1990 return 0; |
1991 } | 1991 } |
1992 | 1992 |
1993 void RenderBlock::insertPositionedObject(RenderBox* o) | 1993 void RenderBlock::insertPositionedObject(LayoutBox* o) |
1994 { | 1994 { |
1995 ASSERT(!isAnonymousBlock()); | 1995 ASSERT(!isAnonymousBlock()); |
1996 insertIntoTrackedRendererMaps(o, gPositionedDescendantsMap, gPositionedConta
inerMap); | 1996 insertIntoTrackedRendererMaps(o, gPositionedDescendantsMap, gPositionedConta
inerMap); |
1997 } | 1997 } |
1998 | 1998 |
1999 void RenderBlock::removePositionedObject(RenderBox* o) | 1999 void RenderBlock::removePositionedObject(LayoutBox* o) |
2000 { | 2000 { |
2001 removeFromTrackedRendererMaps(o, gPositionedDescendantsMap, gPositionedConta
inerMap); | 2001 removeFromTrackedRendererMaps(o, gPositionedDescendantsMap, gPositionedConta
inerMap); |
2002 } | 2002 } |
2003 | 2003 |
2004 void RenderBlock::removePositionedObjects(RenderBlock* o, ContainingBlockState c
ontainingBlockState) | 2004 void RenderBlock::removePositionedObjects(RenderBlock* o, ContainingBlockState c
ontainingBlockState) |
2005 { | 2005 { |
2006 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); | 2006 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); |
2007 if (!positionedDescendants) | 2007 if (!positionedDescendants) |
2008 return; | 2008 return; |
2009 | 2009 |
2010 RenderBox* r; | 2010 LayoutBox* r; |
2011 | 2011 |
2012 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); | 2012 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); |
2013 | 2013 |
2014 Vector<RenderBox*, 16> deadObjects; | 2014 Vector<LayoutBox*, 16> deadObjects; |
2015 | 2015 |
2016 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(
); it != end; ++it) { | 2016 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(
); it != end; ++it) { |
2017 r = *it; | 2017 r = *it; |
2018 if (!o || r->isDescendantOf(o)) { | 2018 if (!o || r->isDescendantOf(o)) { |
2019 if (containingBlockState == NewContainingBlock) { | 2019 if (containingBlockState == NewContainingBlock) { |
2020 r->setChildNeedsLayout(MarkOnlyThis); | 2020 r->setChildNeedsLayout(MarkOnlyThis); |
2021 if (r->needsPreferredWidthsRecalculation()) | 2021 if (r->needsPreferredWidthsRecalculation()) |
2022 r->setPreferredLogicalWidthsDirty(MarkOnlyThis); | 2022 r->setPreferredLogicalWidthsDirty(MarkOnlyThis); |
2023 } | 2023 } |
2024 | 2024 |
2025 // It is parent blocks job to add positioned child to positioned obj
ects list of its containing block | 2025 // It is parent blocks job to add positioned child to positioned obj
ects list of its containing block |
2026 // Parent layout needs to be invalidated to ensure this happens. | 2026 // Parent layout needs to be invalidated to ensure this happens. |
2027 LayoutObject* p = r->parent(); | 2027 LayoutObject* p = r->parent(); |
2028 while (p && !p->isRenderBlock()) | 2028 while (p && !p->isRenderBlock()) |
2029 p = p->parent(); | 2029 p = p->parent(); |
2030 if (p) | 2030 if (p) |
2031 p->setChildNeedsLayout(); | 2031 p->setChildNeedsLayout(); |
2032 | 2032 |
2033 deadObjects.append(r); | 2033 deadObjects.append(r); |
2034 } | 2034 } |
2035 } | 2035 } |
2036 | 2036 |
2037 for (unsigned i = 0; i < deadObjects.size(); i++) | 2037 for (unsigned i = 0; i < deadObjects.size(); i++) |
2038 removePositionedObject(deadObjects.at(i)); | 2038 removePositionedObject(deadObjects.at(i)); |
2039 } | 2039 } |
2040 | 2040 |
2041 void RenderBlock::addPercentHeightDescendant(RenderBox* descendant) | 2041 void RenderBlock::addPercentHeightDescendant(LayoutBox* descendant) |
2042 { | 2042 { |
2043 insertIntoTrackedRendererMaps(descendant, gPercentHeightDescendantsMap, gPer
centHeightContainerMap); | 2043 insertIntoTrackedRendererMaps(descendant, gPercentHeightDescendantsMap, gPer
centHeightContainerMap); |
2044 } | 2044 } |
2045 | 2045 |
2046 void RenderBlock::removePercentHeightDescendant(RenderBox* descendant) | 2046 void RenderBlock::removePercentHeightDescendant(LayoutBox* descendant) |
2047 { | 2047 { |
2048 removeFromTrackedRendererMaps(descendant, gPercentHeightDescendantsMap, gPer
centHeightContainerMap); | 2048 removeFromTrackedRendererMaps(descendant, gPercentHeightDescendantsMap, gPer
centHeightContainerMap); |
2049 } | 2049 } |
2050 | 2050 |
2051 TrackedRendererListHashSet* RenderBlock::percentHeightDescendants() const | 2051 TrackedRendererListHashSet* RenderBlock::percentHeightDescendants() const |
2052 { | 2052 { |
2053 return gPercentHeightDescendantsMap ? gPercentHeightDescendantsMap->get(this
) : 0; | 2053 return gPercentHeightDescendantsMap ? gPercentHeightDescendantsMap->get(this
) : 0; |
2054 } | 2054 } |
2055 | 2055 |
2056 bool RenderBlock::hasPercentHeightContainerMap() | 2056 bool RenderBlock::hasPercentHeightContainerMap() |
2057 { | 2057 { |
2058 return gPercentHeightContainerMap; | 2058 return gPercentHeightContainerMap; |
2059 } | 2059 } |
2060 | 2060 |
2061 bool RenderBlock::hasPercentHeightDescendant(RenderBox* descendant) | 2061 bool RenderBlock::hasPercentHeightDescendant(LayoutBox* descendant) |
2062 { | 2062 { |
2063 // We don't null check gPercentHeightContainerMap since the caller | 2063 // We don't null check gPercentHeightContainerMap since the caller |
2064 // already ensures this and we need to call this function on every | 2064 // already ensures this and we need to call this function on every |
2065 // descendant in clearPercentHeightDescendantsFrom(). | 2065 // descendant in clearPercentHeightDescendantsFrom(). |
2066 ASSERT(gPercentHeightContainerMap); | 2066 ASSERT(gPercentHeightContainerMap); |
2067 return gPercentHeightContainerMap->contains(descendant); | 2067 return gPercentHeightContainerMap->contains(descendant); |
2068 } | 2068 } |
2069 | 2069 |
2070 void RenderBlock::dirtyForLayoutFromPercentageHeightDescendants(SubtreeLayoutSco
pe& layoutScope) | 2070 void RenderBlock::dirtyForLayoutFromPercentageHeightDescendants(SubtreeLayoutSco
pe& layoutScope) |
2071 { | 2071 { |
2072 if (!gPercentHeightDescendantsMap) | 2072 if (!gPercentHeightDescendantsMap) |
2073 return; | 2073 return; |
2074 | 2074 |
2075 TrackedRendererListHashSet* descendants = gPercentHeightDescendantsMap->get(
this); | 2075 TrackedRendererListHashSet* descendants = gPercentHeightDescendantsMap->get(
this); |
2076 if (!descendants) | 2076 if (!descendants) |
2077 return; | 2077 return; |
2078 | 2078 |
2079 TrackedRendererListHashSet::iterator end = descendants->end(); | 2079 TrackedRendererListHashSet::iterator end = descendants->end(); |
2080 for (TrackedRendererListHashSet::iterator it = descendants->begin(); it != e
nd; ++it) { | 2080 for (TrackedRendererListHashSet::iterator it = descendants->begin(); it != e
nd; ++it) { |
2081 RenderBox* box = *it; | 2081 LayoutBox* box = *it; |
2082 while (box != this) { | 2082 while (box != this) { |
2083 if (box->normalChildNeedsLayout()) | 2083 if (box->normalChildNeedsLayout()) |
2084 break; | 2084 break; |
2085 layoutScope.setChildNeedsLayout(box); | 2085 layoutScope.setChildNeedsLayout(box); |
2086 box = box->containingBlock(); | 2086 box = box->containingBlock(); |
2087 ASSERT(box); | 2087 ASSERT(box); |
2088 if (!box) | 2088 if (!box) |
2089 break; | 2089 break; |
2090 } | 2090 } |
2091 } | 2091 } |
2092 } | 2092 } |
2093 | 2093 |
2094 void RenderBlock::removePercentHeightDescendantIfNeeded(RenderBox* descendant) | 2094 void RenderBlock::removePercentHeightDescendantIfNeeded(LayoutBox* descendant) |
2095 { | 2095 { |
2096 // We query the map directly, rather than looking at style's | 2096 // We query the map directly, rather than looking at style's |
2097 // logicalHeight()/logicalMinHeight()/logicalMaxHeight() since those | 2097 // logicalHeight()/logicalMinHeight()/logicalMaxHeight() since those |
2098 // can change with writing mode/directional changes. | 2098 // can change with writing mode/directional changes. |
2099 if (!hasPercentHeightContainerMap()) | 2099 if (!hasPercentHeightContainerMap()) |
2100 return; | 2100 return; |
2101 | 2101 |
2102 if (!hasPercentHeightDescendant(descendant)) | 2102 if (!hasPercentHeightDescendant(descendant)) |
2103 return; | 2103 return; |
2104 | 2104 |
2105 removePercentHeightDescendant(descendant); | 2105 removePercentHeightDescendant(descendant); |
2106 } | 2106 } |
2107 | 2107 |
2108 void RenderBlock::clearPercentHeightDescendantsFrom(RenderBox* parent) | 2108 void RenderBlock::clearPercentHeightDescendantsFrom(LayoutBox* parent) |
2109 { | 2109 { |
2110 ASSERT(gPercentHeightContainerMap); | 2110 ASSERT(gPercentHeightContainerMap); |
2111 for (LayoutObject* curr = parent->slowFirstChild(); curr; curr = curr->nextI
nPreOrder(parent)) { | 2111 for (LayoutObject* curr = parent->slowFirstChild(); curr; curr = curr->nextI
nPreOrder(parent)) { |
2112 if (!curr->isBox()) | 2112 if (!curr->isBox()) |
2113 continue; | 2113 continue; |
2114 | 2114 |
2115 RenderBox* box = toRenderBox(curr); | 2115 LayoutBox* box = toLayoutBox(curr); |
2116 if (!hasPercentHeightDescendant(box)) | 2116 if (!hasPercentHeightDescendant(box)) |
2117 continue; | 2117 continue; |
2118 | 2118 |
2119 removePercentHeightDescendant(box); | 2119 removePercentHeightDescendant(box); |
2120 } | 2120 } |
2121 } | 2121 } |
2122 | 2122 |
2123 LayoutUnit RenderBlock::textIndentOffset() const | 2123 LayoutUnit RenderBlock::textIndentOffset() const |
2124 { | 2124 { |
2125 LayoutUnit cw = 0; | 2125 LayoutUnit cw = 0; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2358 { | 2358 { |
2359 if (childrenInline() && !isTable()) { | 2359 if (childrenInline() && !isTable()) { |
2360 // We have to hit-test our line boxes. | 2360 // We have to hit-test our line boxes. |
2361 if (m_lineBoxes.hitTest(this, request, result, locationInContainer, accu
mulatedOffset, hitTestAction)) | 2361 if (m_lineBoxes.hitTest(this, request, result, locationInContainer, accu
mulatedOffset, hitTestAction)) |
2362 return true; | 2362 return true; |
2363 } else { | 2363 } else { |
2364 // Hit test our children. | 2364 // Hit test our children. |
2365 HitTestAction childHitTest = hitTestAction; | 2365 HitTestAction childHitTest = hitTestAction; |
2366 if (hitTestAction == HitTestChildBlockBackgrounds) | 2366 if (hitTestAction == HitTestChildBlockBackgrounds) |
2367 childHitTest = HitTestChildBlockBackground; | 2367 childHitTest = HitTestChildBlockBackground; |
2368 for (RenderBox* child = lastChildBox(); child; child = child->previousSi
blingBox()) { | 2368 for (LayoutBox* child = lastChildBox(); child; child = child->previousSi
blingBox()) { |
2369 LayoutPoint childPoint = flipForWritingModeForChild(child, accumulat
edOffset); | 2369 LayoutPoint childPoint = flipForWritingModeForChild(child, accumulat
edOffset); |
2370 if (!child->hasSelfPaintingLayer() && !child->isFloating() && !child
->isColumnSpanAll() && child->nodeAtPoint(request, result, locationInContainer,
childPoint, childHitTest)) | 2370 if (!child->hasSelfPaintingLayer() && !child->isFloating() && !child
->isColumnSpanAll() && child->nodeAtPoint(request, result, locationInContainer,
childPoint, childHitTest)) |
2371 return true; | 2371 return true; |
2372 } | 2372 } |
2373 } | 2373 } |
2374 | 2374 |
2375 return false; | 2375 return false; |
2376 } | 2376 } |
2377 | 2377 |
2378 Position RenderBlock::positionForBox(InlineBox *box, bool start) const | 2378 Position RenderBlock::positionForBox(InlineBox *box, bool start) const |
(...skipping 15 matching lines...) Expand all Loading... |
2394 { | 2394 { |
2395 ASSERT(!ancestor || ancestor->nonPseudoNode()); | 2395 ASSERT(!ancestor || ancestor->nonPseudoNode()); |
2396 ASSERT(child && child->nonPseudoNode()); | 2396 ASSERT(child && child->nonPseudoNode()); |
2397 return !ancestor || !ancestor->parent() || (ancestor->hasLayer() && ancestor
->parent()->isRenderView()) | 2397 return !ancestor || !ancestor->parent() || (ancestor->hasLayer() && ancestor
->parent()->isRenderView()) |
2398 || ancestor->nonPseudoNode()->hasEditableStyle() == child->nonPseudoNode
()->hasEditableStyle(); | 2398 || ancestor->nonPseudoNode()->hasEditableStyle() == child->nonPseudoNode
()->hasEditableStyle(); |
2399 } | 2399 } |
2400 | 2400 |
2401 // FIXME: This function should go on LayoutObject as an instance method. Then | 2401 // FIXME: This function should go on LayoutObject as an instance method. Then |
2402 // all cases in which positionForPoint recurs could call this instead to | 2402 // all cases in which positionForPoint recurs could call this instead to |
2403 // prevent crossing editable boundaries. This would require many tests. | 2403 // prevent crossing editable boundaries. This would require many tests. |
2404 static PositionWithAffinity positionForPointRespectingEditingBoundaries(RenderBl
ock* parent, RenderBox* child, const LayoutPoint& pointInParentCoordinates) | 2404 static PositionWithAffinity positionForPointRespectingEditingBoundaries(RenderBl
ock* parent, LayoutBox* child, const LayoutPoint& pointInParentCoordinates) |
2405 { | 2405 { |
2406 LayoutPoint childLocation = child->location(); | 2406 LayoutPoint childLocation = child->location(); |
2407 if (child->isRelPositioned()) | 2407 if (child->isRelPositioned()) |
2408 childLocation += child->offsetForInFlowPosition(); | 2408 childLocation += child->offsetForInFlowPosition(); |
2409 | 2409 |
2410 // FIXME: This is wrong if the child's writing-mode is different from the pa
rent's. | 2410 // FIXME: This is wrong if the child's writing-mode is different from the pa
rent's. |
2411 LayoutPoint pointInChildCoordinates(toLayoutPoint(pointInParentCoordinates -
childLocation)); | 2411 LayoutPoint pointInChildCoordinates(toLayoutPoint(pointInParentCoordinates -
childLocation)); |
2412 | 2412 |
2413 // If this is an anonymous renderer, we just recur normally | 2413 // If this is an anonymous renderer, we just recur normally |
2414 Node* childNode = child->nonPseudoNode(); | 2414 Node* childNode = child->nonPseudoNode(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2496 // y coordinate is above first root line box, so return the star
t of the first | 2496 // y coordinate is above first root line box, so return the star
t of the first |
2497 return PositionWithAffinity(positionForBox(box, true), DOWNSTREA
M); | 2497 return PositionWithAffinity(positionForBox(box, true), DOWNSTREA
M); |
2498 } | 2498 } |
2499 } | 2499 } |
2500 | 2500 |
2501 // pass the box a top position that is inside it | 2501 // pass the box a top position that is inside it |
2502 LayoutPoint point(pointInLogicalContents.x(), closestBox->root().blockDi
rectionPointInLine()); | 2502 LayoutPoint point(pointInLogicalContents.x(), closestBox->root().blockDi
rectionPointInLine()); |
2503 if (!isHorizontalWritingMode()) | 2503 if (!isHorizontalWritingMode()) |
2504 point = point.transposedPoint(); | 2504 point = point.transposedPoint(); |
2505 if (closestBox->renderer().isReplaced()) | 2505 if (closestBox->renderer().isReplaced()) |
2506 return positionForPointRespectingEditingBoundaries(this, &toRenderBo
x(closestBox->renderer()), point); | 2506 return positionForPointRespectingEditingBoundaries(this, &toLayoutBo
x(closestBox->renderer()), point); |
2507 return closestBox->renderer().positionForPoint(point); | 2507 return closestBox->renderer().positionForPoint(point); |
2508 } | 2508 } |
2509 | 2509 |
2510 if (lastRootBoxWithChildren) { | 2510 if (lastRootBoxWithChildren) { |
2511 // We hit this case for Mac behavior when the Y coordinate is below the
last box. | 2511 // We hit this case for Mac behavior when the Y coordinate is below the
last box. |
2512 ASSERT(moveCaretToBoundary); | 2512 ASSERT(moveCaretToBoundary); |
2513 InlineBox* logicallyLastBox; | 2513 InlineBox* logicallyLastBox; |
2514 if (lastRootBoxWithChildren->getLogicalEndBoxWithNode(logicallyLastBox)) | 2514 if (lastRootBoxWithChildren->getLogicalEndBoxWithNode(logicallyLastBox)) |
2515 return PositionWithAffinity(positionForBox(logicallyLastBox, false),
DOWNSTREAM); | 2515 return PositionWithAffinity(positionForBox(logicallyLastBox, false),
DOWNSTREAM); |
2516 } | 2516 } |
2517 | 2517 |
2518 // Can't reach this. We have a root line box, but it has no kids. | 2518 // Can't reach this. We have a root line box, but it has no kids. |
2519 // FIXME: This should ASSERT_NOT_REACHED(), but clicking on placeholder text | 2519 // FIXME: This should ASSERT_NOT_REACHED(), but clicking on placeholder text |
2520 // seems to hit this code path. | 2520 // seems to hit this code path. |
2521 return createPositionWithAffinity(0, DOWNSTREAM); | 2521 return createPositionWithAffinity(0, DOWNSTREAM); |
2522 } | 2522 } |
2523 | 2523 |
2524 static inline bool isChildHitTestCandidate(RenderBox* box) | 2524 static inline bool isChildHitTestCandidate(LayoutBox* box) |
2525 { | 2525 { |
2526 return box->size().height() && box->style()->visibility() == VISIBLE && !box
->isFloatingOrOutOfFlowPositioned(); | 2526 return box->size().height() && box->style()->visibility() == VISIBLE && !box
->isFloatingOrOutOfFlowPositioned(); |
2527 } | 2527 } |
2528 | 2528 |
2529 PositionWithAffinity RenderBlock::positionForPoint(const LayoutPoint& point) | 2529 PositionWithAffinity RenderBlock::positionForPoint(const LayoutPoint& point) |
2530 { | 2530 { |
2531 if (isTable()) | 2531 if (isTable()) |
2532 return RenderBox::positionForPoint(point); | 2532 return LayoutBox::positionForPoint(point); |
2533 | 2533 |
2534 if (isReplaced()) { | 2534 if (isReplaced()) { |
2535 // FIXME: This seems wrong when the object's writing-mode doesn't match
the line's writing-mode. | 2535 // FIXME: This seems wrong when the object's writing-mode doesn't match
the line's writing-mode. |
2536 LayoutUnit pointLogicalLeft = isHorizontalWritingMode() ? point.x() : po
int.y(); | 2536 LayoutUnit pointLogicalLeft = isHorizontalWritingMode() ? point.x() : po
int.y(); |
2537 LayoutUnit pointLogicalTop = isHorizontalWritingMode() ? point.y() : poi
nt.x(); | 2537 LayoutUnit pointLogicalTop = isHorizontalWritingMode() ? point.y() : poi
nt.x(); |
2538 | 2538 |
2539 if (pointLogicalLeft < 0) | 2539 if (pointLogicalLeft < 0) |
2540 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM); | 2540 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM); |
2541 if (pointLogicalLeft >= logicalWidth()) | 2541 if (pointLogicalLeft >= logicalWidth()) |
2542 return createPositionWithAffinity(caretMaxOffset(), DOWNSTREAM); | 2542 return createPositionWithAffinity(caretMaxOffset(), DOWNSTREAM); |
2543 if (pointLogicalTop < 0) | 2543 if (pointLogicalTop < 0) |
2544 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM); | 2544 return createPositionWithAffinity(caretMinOffset(), DOWNSTREAM); |
2545 if (pointLogicalTop >= logicalHeight()) | 2545 if (pointLogicalTop >= logicalHeight()) |
2546 return createPositionWithAffinity(caretMaxOffset(), DOWNSTREAM); | 2546 return createPositionWithAffinity(caretMaxOffset(), DOWNSTREAM); |
2547 } | 2547 } |
2548 | 2548 |
2549 LayoutPoint pointInContents = point; | 2549 LayoutPoint pointInContents = point; |
2550 offsetForContents(pointInContents); | 2550 offsetForContents(pointInContents); |
2551 LayoutPoint pointInLogicalContents(pointInContents); | 2551 LayoutPoint pointInLogicalContents(pointInContents); |
2552 if (!isHorizontalWritingMode()) | 2552 if (!isHorizontalWritingMode()) |
2553 pointInLogicalContents = pointInLogicalContents.transposedPoint(); | 2553 pointInLogicalContents = pointInLogicalContents.transposedPoint(); |
2554 | 2554 |
2555 if (childrenInline()) | 2555 if (childrenInline()) |
2556 return positionForPointWithInlineChildren(pointInLogicalContents); | 2556 return positionForPointWithInlineChildren(pointInLogicalContents); |
2557 | 2557 |
2558 RenderBox* lastCandidateBox = lastChildBox(); | 2558 LayoutBox* lastCandidateBox = lastChildBox(); |
2559 while (lastCandidateBox && !isChildHitTestCandidate(lastCandidateBox)) | 2559 while (lastCandidateBox && !isChildHitTestCandidate(lastCandidateBox)) |
2560 lastCandidateBox = lastCandidateBox->previousSiblingBox(); | 2560 lastCandidateBox = lastCandidateBox->previousSiblingBox(); |
2561 | 2561 |
2562 bool blocksAreFlipped = style()->isFlippedBlocksWritingMode(); | 2562 bool blocksAreFlipped = style()->isFlippedBlocksWritingMode(); |
2563 if (lastCandidateBox) { | 2563 if (lastCandidateBox) { |
2564 if (pointInLogicalContents.y() > logicalTopForChild(*lastCandidateBox) | 2564 if (pointInLogicalContents.y() > logicalTopForChild(*lastCandidateBox) |
2565 || (!blocksAreFlipped && pointInLogicalContents.y() == logicalTopFor
Child(*lastCandidateBox))) | 2565 || (!blocksAreFlipped && pointInLogicalContents.y() == logicalTopFor
Child(*lastCandidateBox))) |
2566 return positionForPointRespectingEditingBoundaries(this, lastCandida
teBox, pointInContents); | 2566 return positionForPointRespectingEditingBoundaries(this, lastCandida
teBox, pointInContents); |
2567 | 2567 |
2568 for (RenderBox* childBox = firstChildBox(); childBox; childBox = childBo
x->nextSiblingBox()) { | 2568 for (LayoutBox* childBox = firstChildBox(); childBox; childBox = childBo
x->nextSiblingBox()) { |
2569 if (!isChildHitTestCandidate(childBox)) | 2569 if (!isChildHitTestCandidate(childBox)) |
2570 continue; | 2570 continue; |
2571 LayoutUnit childLogicalBottom = logicalTopForChild(*childBox) + logi
calHeightForChild(*childBox); | 2571 LayoutUnit childLogicalBottom = logicalTopForChild(*childBox) + logi
calHeightForChild(*childBox); |
2572 // We hit child if our click is above the bottom of its padding box
(like IE6/7 and FF3). | 2572 // We hit child if our click is above the bottom of its padding box
(like IE6/7 and FF3). |
2573 if (isChildHitTestCandidate(childBox) && (pointInLogicalContents.y()
< childLogicalBottom | 2573 if (isChildHitTestCandidate(childBox) && (pointInLogicalContents.y()
< childLogicalBottom |
2574 || (blocksAreFlipped && pointInLogicalContents.y() == childLogic
alBottom))) | 2574 || (blocksAreFlipped && pointInLogicalContents.y() == childLogic
alBottom))) |
2575 return positionForPointRespectingEditingBoundaries(this, childBo
x, pointInContents); | 2575 return positionForPointRespectingEditingBoundaries(this, childBo
x, pointInContents); |
2576 } | 2576 } |
2577 } | 2577 } |
2578 | 2578 |
2579 // We only get here if there are no hit test candidate children below the cl
ick. | 2579 // We only get here if there are no hit test candidate children below the cl
ick. |
2580 return RenderBox::positionForPoint(point); | 2580 return LayoutBox::positionForPoint(point); |
2581 } | 2581 } |
2582 | 2582 |
2583 void RenderBlock::offsetForContents(LayoutPoint& offset) const | 2583 void RenderBlock::offsetForContents(LayoutPoint& offset) const |
2584 { | 2584 { |
2585 offset = flipForWritingMode(offset); | 2585 offset = flipForWritingMode(offset); |
2586 | 2586 |
2587 if (hasOverflowClip()) | 2587 if (hasOverflowClip()) |
2588 offset += LayoutSize(scrolledContentOffset()); | 2588 offset += LayoutSize(scrolledContentOffset()); |
2589 | 2589 |
2590 if (hasColumns()) | 2590 if (hasColumns()) |
2591 adjustPointToColumnContents(offset); | 2591 adjustPointToColumnContents(offset); |
2592 | 2592 |
2593 offset = flipForWritingMode(offset); | 2593 offset = flipForWritingMode(offset); |
2594 } | 2594 } |
2595 | 2595 |
2596 LayoutUnit RenderBlock::availableLogicalWidth() const | 2596 LayoutUnit RenderBlock::availableLogicalWidth() const |
2597 { | 2597 { |
2598 // If we have multiple columns, then the available logical width is reduced
to our column width. | 2598 // If we have multiple columns, then the available logical width is reduced
to our column width. |
2599 if (hasColumns()) | 2599 if (hasColumns()) |
2600 return desiredColumnWidth(); | 2600 return desiredColumnWidth(); |
2601 return RenderBox::availableLogicalWidth(); | 2601 return LayoutBox::availableLogicalWidth(); |
2602 } | 2602 } |
2603 | 2603 |
2604 int RenderBlock::columnGap() const | 2604 int RenderBlock::columnGap() const |
2605 { | 2605 { |
2606 if (style()->hasNormalColumnGap()) | 2606 if (style()->hasNormalColumnGap()) |
2607 return style()->fontDescription().computedPixelSize(); // "1em" is recom
mended as the normal gap setting. Matches <p> margins. | 2607 return style()->fontDescription().computedPixelSize(); // "1em" is recom
mended as the normal gap setting. Matches <p> margins. |
2608 return static_cast<int>(style()->columnGap()); | 2608 return static_cast<int>(style()->columnGap()); |
2609 } | 2609 } |
2610 | 2610 |
2611 void RenderBlock::calcColumnWidth() | 2611 void RenderBlock::calcColumnWidth() |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3045 LayoutUnit floatLeftWidth = 0, floatRightWidth = 0; | 3045 LayoutUnit floatLeftWidth = 0, floatRightWidth = 0; |
3046 while (child) { | 3046 while (child) { |
3047 // Positioned children don't affect the min/max width. Spanners only aff
ect the min/max | 3047 // Positioned children don't affect the min/max width. Spanners only aff
ect the min/max |
3048 // width of the multicol container, not the flow thread. | 3048 // width of the multicol container, not the flow thread. |
3049 if (child->isOutOfFlowPositioned() || child->isColumnSpanAll()) { | 3049 if (child->isOutOfFlowPositioned() || child->isColumnSpanAll()) { |
3050 child = child->nextSibling(); | 3050 child = child->nextSibling(); |
3051 continue; | 3051 continue; |
3052 } | 3052 } |
3053 | 3053 |
3054 RefPtr<LayoutStyle> childStyle = child->style(); | 3054 RefPtr<LayoutStyle> childStyle = child->style(); |
3055 if (child->isFloating() || (child->isBox() && toRenderBox(child)->avoids
Floats())) { | 3055 if (child->isFloating() || (child->isBox() && toLayoutBox(child)->avoids
Floats())) { |
3056 LayoutUnit floatTotalWidth = floatLeftWidth + floatRightWidth; | 3056 LayoutUnit floatTotalWidth = floatLeftWidth + floatRightWidth; |
3057 if (childStyle->clear() & CLEFT) { | 3057 if (childStyle->clear() & CLEFT) { |
3058 maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth); | 3058 maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth); |
3059 floatLeftWidth = 0; | 3059 floatLeftWidth = 0; |
3060 } | 3060 } |
3061 if (childStyle->clear() & CRIGHT) { | 3061 if (childStyle->clear() & CRIGHT) { |
3062 maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth); | 3062 maxLogicalWidth = std::max(floatTotalWidth, maxLogicalWidth); |
3063 floatRightWidth = 0; | 3063 floatRightWidth = 0; |
3064 } | 3064 } |
3065 } | 3065 } |
3066 | 3066 |
3067 // A margin basically has three types: fixed, percentage, and auto (vari
able). | 3067 // A margin basically has three types: fixed, percentage, and auto (vari
able). |
3068 // Auto and percentage margins simply become 0 when computing min/max wi
dth. | 3068 // Auto and percentage margins simply become 0 when computing min/max wi
dth. |
3069 // Fixed margins can be added in as is. | 3069 // Fixed margins can be added in as is. |
3070 Length startMarginLength = childStyle->marginStartUsing(&styleToUse); | 3070 Length startMarginLength = childStyle->marginStartUsing(&styleToUse); |
3071 Length endMarginLength = childStyle->marginEndUsing(&styleToUse); | 3071 Length endMarginLength = childStyle->marginEndUsing(&styleToUse); |
3072 LayoutUnit margin = 0; | 3072 LayoutUnit margin = 0; |
3073 LayoutUnit marginStart = 0; | 3073 LayoutUnit marginStart = 0; |
3074 LayoutUnit marginEnd = 0; | 3074 LayoutUnit marginEnd = 0; |
3075 if (startMarginLength.isFixed()) | 3075 if (startMarginLength.isFixed()) |
3076 marginStart += startMarginLength.value(); | 3076 marginStart += startMarginLength.value(); |
3077 if (endMarginLength.isFixed()) | 3077 if (endMarginLength.isFixed()) |
3078 marginEnd += endMarginLength.value(); | 3078 marginEnd += endMarginLength.value(); |
3079 margin = marginStart + marginEnd; | 3079 margin = marginStart + marginEnd; |
3080 | 3080 |
3081 LayoutUnit childMinPreferredLogicalWidth, childMaxPreferredLogicalWidth; | 3081 LayoutUnit childMinPreferredLogicalWidth, childMaxPreferredLogicalWidth; |
3082 if (child->isBox() && child->isHorizontalWritingMode() != isHorizontalWr
itingMode()) { | 3082 if (child->isBox() && child->isHorizontalWritingMode() != isHorizontalWr
itingMode()) { |
3083 RenderBox* childBox = toRenderBox(child); | 3083 LayoutBox* childBox = toLayoutBox(child); |
3084 LogicalExtentComputedValues computedValues; | 3084 LogicalExtentComputedValues computedValues; |
3085 childBox->computeLogicalHeight(childBox->borderAndPaddingLogicalHeig
ht(), 0, computedValues); | 3085 childBox->computeLogicalHeight(childBox->borderAndPaddingLogicalHeig
ht(), 0, computedValues); |
3086 childMinPreferredLogicalWidth = childMaxPreferredLogicalWidth = comp
utedValues.m_extent; | 3086 childMinPreferredLogicalWidth = childMaxPreferredLogicalWidth = comp
utedValues.m_extent; |
3087 } else { | 3087 } else { |
3088 childMinPreferredLogicalWidth = child->minPreferredLogicalWidth(); | 3088 childMinPreferredLogicalWidth = child->minPreferredLogicalWidth(); |
3089 childMaxPreferredLogicalWidth = child->maxPreferredLogicalWidth(); | 3089 childMaxPreferredLogicalWidth = child->maxPreferredLogicalWidth(); |
3090 } | 3090 } |
3091 | 3091 |
3092 LayoutUnit w = childMinPreferredLogicalWidth + margin; | 3092 LayoutUnit w = childMinPreferredLogicalWidth + margin; |
3093 minLogicalWidth = std::max(w, minLogicalWidth); | 3093 minLogicalWidth = std::max(w, minLogicalWidth); |
3094 | 3094 |
3095 // IE ignores tables for calculation of nowrap. Makes some sense. | 3095 // IE ignores tables for calculation of nowrap. Makes some sense. |
3096 if (nowrap && !child->isTable()) | 3096 if (nowrap && !child->isTable()) |
3097 maxLogicalWidth = std::max(w, maxLogicalWidth); | 3097 maxLogicalWidth = std::max(w, maxLogicalWidth); |
3098 | 3098 |
3099 w = childMaxPreferredLogicalWidth + margin; | 3099 w = childMaxPreferredLogicalWidth + margin; |
3100 | 3100 |
3101 if (!child->isFloating()) { | 3101 if (!child->isFloating()) { |
3102 if (child->isBox() && toRenderBox(child)->avoidsFloats()) { | 3102 if (child->isBox() && toLayoutBox(child)->avoidsFloats()) { |
3103 // Determine a left and right max value based off whether or not
the floats can fit in the | 3103 // Determine a left and right max value based off whether or not
the floats can fit in the |
3104 // margins of the object. For negative margins, we will attempt
to overlap the float if the negative margin | 3104 // margins of the object. For negative margins, we will attempt
to overlap the float if the negative margin |
3105 // is smaller than the float width. | 3105 // is smaller than the float width. |
3106 bool ltr = containingBlock ? containingBlock->style()->isLeftToR
ightDirection() : styleToUse.isLeftToRightDirection(); | 3106 bool ltr = containingBlock ? containingBlock->style()->isLeftToR
ightDirection() : styleToUse.isLeftToRightDirection(); |
3107 LayoutUnit marginLogicalLeft = ltr ? marginStart : marginEnd; | 3107 LayoutUnit marginLogicalLeft = ltr ? marginStart : marginEnd; |
3108 LayoutUnit marginLogicalRight = ltr ? marginEnd : marginStart; | 3108 LayoutUnit marginLogicalRight = ltr ? marginEnd : marginStart; |
3109 LayoutUnit maxLeft = marginLogicalLeft > 0 ? std::max(floatLeftW
idth, marginLogicalLeft) : floatLeftWidth + marginLogicalLeft; | 3109 LayoutUnit maxLeft = marginLogicalLeft > 0 ? std::max(floatLeftW
idth, marginLogicalLeft) : floatLeftWidth + marginLogicalLeft; |
3110 LayoutUnit maxRight = marginLogicalRight > 0 ? std::max(floatRig
htWidth, marginLogicalRight) : floatRightWidth + marginLogicalRight; | 3110 LayoutUnit maxRight = marginLogicalRight > 0 ? std::max(floatRig
htWidth, marginLogicalRight) : floatRightWidth + marginLogicalRight; |
3111 w = childMaxPreferredLogicalWidth + maxLeft + maxRight; | 3111 w = childMaxPreferredLogicalWidth + maxLeft + maxRight; |
3112 w = std::max(w, floatLeftWidth + floatRightWidth); | 3112 w = std::max(w, floatLeftWidth + floatRightWidth); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3149 return false; | 3149 return false; |
3150 } | 3150 } |
3151 | 3151 |
3152 LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction,
LinePositionMode linePositionMode) const | 3152 LayoutUnit RenderBlock::lineHeight(bool firstLine, LineDirectionMode direction,
LinePositionMode linePositionMode) const |
3153 { | 3153 { |
3154 // Inline blocks are replaced elements. Otherwise, just pass off to | 3154 // Inline blocks are replaced elements. Otherwise, just pass off to |
3155 // the base class. If we're being queried as though we're the root line | 3155 // the base class. If we're being queried as though we're the root line |
3156 // box, then the fact that we're an inline-block is irrelevant, and we behav
e | 3156 // box, then the fact that we're an inline-block is irrelevant, and we behav
e |
3157 // just like a block. | 3157 // just like a block. |
3158 if (isReplaced() && linePositionMode == PositionOnContainingLine) | 3158 if (isReplaced() && linePositionMode == PositionOnContainingLine) |
3159 return RenderBox::lineHeight(firstLine, direction, linePositionMode); | 3159 return LayoutBox::lineHeight(firstLine, direction, linePositionMode); |
3160 | 3160 |
3161 const LayoutStyle& style = styleRef(firstLine && document().styleEngine()->u
sesFirstLineRules()); | 3161 const LayoutStyle& style = styleRef(firstLine && document().styleEngine()->u
sesFirstLineRules()); |
3162 return style.computedLineHeight(); | 3162 return style.computedLineHeight(); |
3163 } | 3163 } |
3164 | 3164 |
3165 int RenderBlock::beforeMarginInLineDirection(LineDirectionMode direction) const | 3165 int RenderBlock::beforeMarginInLineDirection(LineDirectionMode direction) const |
3166 { | 3166 { |
3167 return direction == HorizontalLine ? marginTop() : marginRight(); | 3167 return direction == HorizontalLine ? marginTop() : marginRight(); |
3168 } | 3168 } |
3169 | 3169 |
(...skipping 29 matching lines...) Expand all Loading... |
3199 // breaks -webkit-line-clamp, which is used in the wild -- we would | 3199 // breaks -webkit-line-clamp, which is used in the wild -- we would |
3200 // calculate the baseline as if -webkit-line-clamp wasn't used. | 3200 // calculate the baseline as if -webkit-line-clamp wasn't used. |
3201 // For simplicity, we use this for all uses of deprecated flexbox. | 3201 // For simplicity, we use this for all uses of deprecated flexbox. |
3202 LayoutUnit bottomOfContent = direction == HorizontalLine ? size().he
ight() - borderBottom() - paddingBottom() - horizontalScrollbarHeight() : size()
.width() - borderLeft() - paddingLeft() - verticalScrollbarWidth(); | 3202 LayoutUnit bottomOfContent = direction == HorizontalLine ? size().he
ight() - borderBottom() - paddingBottom() - horizontalScrollbarHeight() : size()
.width() - borderLeft() - paddingLeft() - verticalScrollbarWidth(); |
3203 if (baselinePos > bottomOfContent) | 3203 if (baselinePos > bottomOfContent) |
3204 baselinePos = -1; | 3204 baselinePos = -1; |
3205 } | 3205 } |
3206 if (baselinePos != -1) | 3206 if (baselinePos != -1) |
3207 return beforeMarginInLineDirection(direction) + baselinePos; | 3207 return beforeMarginInLineDirection(direction) + baselinePos; |
3208 | 3208 |
3209 return RenderBox::baselinePosition(baselineType, firstLine, direction, l
inePositionMode); | 3209 return LayoutBox::baselinePosition(baselineType, firstLine, direction, l
inePositionMode); |
3210 } | 3210 } |
3211 | 3211 |
3212 // If we're not replaced, we'll only get called with PositionOfInteriorLineB
oxes. | 3212 // If we're not replaced, we'll only get called with PositionOfInteriorLineB
oxes. |
3213 // Note that inline-block counts as replaced here. | 3213 // Note that inline-block counts as replaced here. |
3214 ASSERT(linePositionMode == PositionOfInteriorLineBoxes); | 3214 ASSERT(linePositionMode == PositionOfInteriorLineBoxes); |
3215 | 3215 |
3216 const FontMetrics& fontMetrics = style(firstLine)->fontMetrics(); | 3216 const FontMetrics& fontMetrics = style(firstLine)->fontMetrics(); |
3217 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction,
linePositionMode) - fontMetrics.height()) / 2; | 3217 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction,
linePositionMode) - fontMetrics.height()) / 2; |
3218 } | 3218 } |
3219 | 3219 |
(...skipping 13 matching lines...) Expand all Loading... |
3233 if (isWritingModeRoot() && !isRubyRun()) | 3233 if (isWritingModeRoot() && !isRubyRun()) |
3234 return -1; | 3234 return -1; |
3235 | 3235 |
3236 if (childrenInline()) { | 3236 if (childrenInline()) { |
3237 if (firstLineBox()) | 3237 if (firstLineBox()) |
3238 return firstLineBox()->logicalTop() + style(true)->fontMetrics().asc
ent(firstRootBox()->baselineType()); | 3238 return firstLineBox()->logicalTop() + style(true)->fontMetrics().asc
ent(firstRootBox()->baselineType()); |
3239 else | 3239 else |
3240 return -1; | 3240 return -1; |
3241 } | 3241 } |
3242 else { | 3242 else { |
3243 for (RenderBox* curr = firstChildBox(); curr; curr = curr->nextSiblingBo
x()) { | 3243 for (LayoutBox* curr = firstChildBox(); curr; curr = curr->nextSiblingBo
x()) { |
3244 if (!curr->isFloatingOrOutOfFlowPositioned()) { | 3244 if (!curr->isFloatingOrOutOfFlowPositioned()) { |
3245 int result = curr->firstLineBoxBaseline(); | 3245 int result = curr->firstLineBoxBaseline(); |
3246 if (result != -1) | 3246 if (result != -1) |
3247 return curr->logicalTop() + result; // Translate to our coor
dinate space. | 3247 return curr->logicalTop() + result; // Translate to our coor
dinate space. |
3248 } | 3248 } |
3249 } | 3249 } |
3250 } | 3250 } |
3251 | 3251 |
3252 return -1; | 3252 return -1; |
3253 } | 3253 } |
3254 | 3254 |
3255 int RenderBlock::inlineBlockBaseline(LineDirectionMode direction) const | 3255 int RenderBlock::inlineBlockBaseline(LineDirectionMode direction) const |
3256 { | 3256 { |
3257 if (!style()->isOverflowVisible()) { | 3257 if (!style()->isOverflowVisible()) { |
3258 // We are not calling RenderBox::baselinePosition here because the calle
r should add the margin-top/margin-right, not us. | 3258 // We are not calling LayoutBox::baselinePosition here because the calle
r should add the margin-top/margin-right, not us. |
3259 return direction == HorizontalLine ? size().height() + marginBottom() :
size().width() + marginLeft(); | 3259 return direction == HorizontalLine ? size().height() + marginBottom() :
size().width() + marginLeft(); |
3260 } | 3260 } |
3261 | 3261 |
3262 return lastLineBoxBaseline(direction); | 3262 return lastLineBoxBaseline(direction); |
3263 } | 3263 } |
3264 | 3264 |
3265 int RenderBlock::lastLineBoxBaseline(LineDirectionMode lineDirection) const | 3265 int RenderBlock::lastLineBoxBaseline(LineDirectionMode lineDirection) const |
3266 { | 3266 { |
3267 if (isWritingModeRoot() && !isRubyRun()) | 3267 if (isWritingModeRoot() && !isRubyRun()) |
3268 return -1; | 3268 return -1; |
3269 | 3269 |
3270 if (childrenInline()) { | 3270 if (childrenInline()) { |
3271 if (!firstLineBox() && hasLineIfEmpty()) { | 3271 if (!firstLineBox() && hasLineIfEmpty()) { |
3272 const FontMetrics& fontMetrics = firstLineStyle()->fontMetrics(); | 3272 const FontMetrics& fontMetrics = firstLineStyle()->fontMetrics(); |
3273 return fontMetrics.ascent() | 3273 return fontMetrics.ascent() |
3274 + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes)
- fontMetrics.height()) / 2 | 3274 + (lineHeight(true, lineDirection, PositionOfInteriorLineBoxes)
- fontMetrics.height()) / 2 |
3275 + (lineDirection == HorizontalLine ? borderTop() + paddingTop()
: borderRight() + paddingRight()); | 3275 + (lineDirection == HorizontalLine ? borderTop() + paddingTop()
: borderRight() + paddingRight()); |
3276 } | 3276 } |
3277 if (lastLineBox()) | 3277 if (lastLineBox()) |
3278 return lastLineBox()->logicalTop() + style(lastLineBox() == firstLin
eBox())->fontMetrics().ascent(lastRootBox()->baselineType()); | 3278 return lastLineBox()->logicalTop() + style(lastLineBox() == firstLin
eBox())->fontMetrics().ascent(lastRootBox()->baselineType()); |
3279 return -1; | 3279 return -1; |
3280 } else { | 3280 } else { |
3281 bool haveNormalFlowChild = false; | 3281 bool haveNormalFlowChild = false; |
3282 for (RenderBox* curr = lastChildBox(); curr; curr = curr->previousSiblin
gBox()) { | 3282 for (LayoutBox* curr = lastChildBox(); curr; curr = curr->previousSiblin
gBox()) { |
3283 if (!curr->isFloatingOrOutOfFlowPositioned()) { | 3283 if (!curr->isFloatingOrOutOfFlowPositioned()) { |
3284 haveNormalFlowChild = true; | 3284 haveNormalFlowChild = true; |
3285 int result = curr->inlineBlockBaseline(lineDirection); | 3285 int result = curr->inlineBlockBaseline(lineDirection); |
3286 if (result != -1) | 3286 if (result != -1) |
3287 return curr->logicalTop() + result; // Translate to our coor
dinate space. | 3287 return curr->logicalTop() + result; // Translate to our coor
dinate space. |
3288 } | 3288 } |
3289 } | 3289 } |
3290 if (!haveNormalFlowChild && hasLineIfEmpty()) { | 3290 if (!haveNormalFlowChild && hasLineIfEmpty()) { |
3291 const FontMetrics& fontMetrics = firstLineStyle()->fontMetrics(); | 3291 const FontMetrics& fontMetrics = firstLineStyle()->fontMetrics(); |
3292 return fontMetrics.ascent() | 3292 return fontMetrics.ascent() |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3345 | 3345 |
3346 static int getHeightForLineCount(RenderBlock* block, int l, bool includeBottom,
int& count) | 3346 static int getHeightForLineCount(RenderBlock* block, int l, bool includeBottom,
int& count) |
3347 { | 3347 { |
3348 if (block->style()->visibility() == VISIBLE) { | 3348 if (block->style()->visibility() == VISIBLE) { |
3349 if (block->isRenderBlockFlow() && block->childrenInline()) { | 3349 if (block->isRenderBlockFlow() && block->childrenInline()) { |
3350 for (RootInlineBox* box = toRenderBlockFlow(block)->firstRootBox();
box; box = box->nextRootBox()) { | 3350 for (RootInlineBox* box = toRenderBlockFlow(block)->firstRootBox();
box; box = box->nextRootBox()) { |
3351 if (++count == l) | 3351 if (++count == l) |
3352 return box->lineBottom() + (includeBottom ? (block->borderBo
ttom() + block->paddingBottom()) : LayoutUnit()); | 3352 return box->lineBottom() + (includeBottom ? (block->borderBo
ttom() + block->paddingBottom()) : LayoutUnit()); |
3353 } | 3353 } |
3354 } else { | 3354 } else { |
3355 RenderBox* normalFlowChildWithoutLines = 0; | 3355 LayoutBox* normalFlowChildWithoutLines = 0; |
3356 for (RenderBox* obj = block->firstChildBox(); obj; obj = obj->nextSi
blingBox()) { | 3356 for (LayoutBox* obj = block->firstChildBox(); obj; obj = obj->nextSi
blingBox()) { |
3357 if (shouldCheckLines(obj)) { | 3357 if (shouldCheckLines(obj)) { |
3358 int result = getHeightForLineCount(toRenderBlock(obj), l, fa
lse, count); | 3358 int result = getHeightForLineCount(toRenderBlock(obj), l, fa
lse, count); |
3359 if (result != -1) | 3359 if (result != -1) |
3360 return result + obj->location().y() + (includeBottom ? (
block->borderBottom() + block->paddingBottom()) : LayoutUnit()); | 3360 return result + obj->location().y() + (includeBottom ? (
block->borderBottom() + block->paddingBottom()) : LayoutUnit()); |
3361 } else if (!obj->isFloatingOrOutOfFlowPositioned()) { | 3361 } else if (!obj->isFloatingOrOutOfFlowPositioned()) { |
3362 normalFlowChildWithoutLines = obj; | 3362 normalFlowChildWithoutLines = obj; |
3363 } | 3363 } |
3364 } | 3364 } |
3365 if (normalFlowChildWithoutLines && l == 0) | 3365 if (normalFlowChildWithoutLines && l == 0) |
3366 return normalFlowChildWithoutLines->location().y() + normalFlowC
hildWithoutLines->size().height(); | 3366 return normalFlowChildWithoutLines->location().y() + normalFlowC
hildWithoutLines->size().height(); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3467 // inline boxes above and below us (thus getting merged with them to form a
single irregular | 3467 // inline boxes above and below us (thus getting merged with them to form a
single irregular |
3468 // shape). | 3468 // shape). |
3469 if (isAnonymousBlockContinuation()) { | 3469 if (isAnonymousBlockContinuation()) { |
3470 // FIXME: This is wrong for vertical writing-modes. | 3470 // FIXME: This is wrong for vertical writing-modes. |
3471 // https://bugs.webkit.org/show_bug.cgi?id=46781 | 3471 // https://bugs.webkit.org/show_bug.cgi?id=46781 |
3472 LayoutRect localRect(LayoutPoint(), size()); | 3472 LayoutRect localRect(LayoutPoint(), size()); |
3473 localRect.expand(collapsedMarginBoxLogicalOutsets()); | 3473 localRect.expand(collapsedMarginBoxLogicalOutsets()); |
3474 quads.append(localToAbsoluteQuad(FloatRect(localRect), 0 /* mode */, was
Fixed)); | 3474 quads.append(localToAbsoluteQuad(FloatRect(localRect), 0 /* mode */, was
Fixed)); |
3475 continuation()->absoluteQuads(quads, wasFixed); | 3475 continuation()->absoluteQuads(quads, wasFixed); |
3476 } else { | 3476 } else { |
3477 quads.append(RenderBox::localToAbsoluteQuad(FloatRect(0, 0, size().width
().toFloat(), size().height().toFloat()), 0 /* mode */, wasFixed)); | 3477 quads.append(LayoutBox::localToAbsoluteQuad(FloatRect(0, 0, size().width
().toFloat(), size().height().toFloat()), 0 /* mode */, wasFixed)); |
3478 } | 3478 } |
3479 } | 3479 } |
3480 | 3480 |
3481 LayoutRect RenderBlock::rectWithOutlineForPaintInvalidation(const LayoutBoxModel
Object* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInvalida
tionState* paintInvalidationState) const | 3481 LayoutRect RenderBlock::rectWithOutlineForPaintInvalidation(const LayoutBoxModel
Object* paintInvalidationContainer, LayoutUnit outlineWidth, const PaintInvalida
tionState* paintInvalidationState) const |
3482 { | 3482 { |
3483 LayoutRect r(RenderBox::rectWithOutlineForPaintInvalidation(paintInvalidatio
nContainer, outlineWidth, paintInvalidationState)); | 3483 LayoutRect r(LayoutBox::rectWithOutlineForPaintInvalidation(paintInvalidatio
nContainer, outlineWidth, paintInvalidationState)); |
3484 if (isAnonymousBlockContinuation()) | 3484 if (isAnonymousBlockContinuation()) |
3485 r.inflateY(collapsedMarginBefore()); // FIXME: This is wrong for vertica
l writing-modes. | 3485 r.inflateY(collapsedMarginBefore()); // FIXME: This is wrong for vertica
l writing-modes. |
3486 return r; | 3486 return r; |
3487 } | 3487 } |
3488 | 3488 |
3489 LayoutObject* RenderBlock::hoverAncestor() const | 3489 LayoutObject* RenderBlock::hoverAncestor() const |
3490 { | 3490 { |
3491 return isAnonymousBlockContinuation() ? continuation() : RenderBox::hoverAnc
estor(); | 3491 return isAnonymousBlockContinuation() ? continuation() : LayoutBox::hoverAnc
estor(); |
3492 } | 3492 } |
3493 | 3493 |
3494 void RenderBlock::updateDragState(bool dragOn) | 3494 void RenderBlock::updateDragState(bool dragOn) |
3495 { | 3495 { |
3496 RenderBox::updateDragState(dragOn); | 3496 LayoutBox::updateDragState(dragOn); |
3497 if (continuation()) | 3497 if (continuation()) |
3498 continuation()->updateDragState(dragOn); | 3498 continuation()->updateDragState(dragOn); |
3499 } | 3499 } |
3500 | 3500 |
3501 void RenderBlock::childBecameNonInline(LayoutObject*) | 3501 void RenderBlock::childBecameNonInline(LayoutObject*) |
3502 { | 3502 { |
3503 makeChildrenNonInline(); | 3503 makeChildrenNonInline(); |
3504 if (isAnonymousBlock() && parent() && parent()->isRenderBlock()) | 3504 if (isAnonymousBlock() && parent() && parent()->isRenderBlock()) |
3505 toRenderBlock(parent())->removeLeftoverAnonymousBlock(this); | 3505 toRenderBlock(parent())->removeLeftoverAnonymousBlock(this); |
3506 // |this| may be dead here | 3506 // |this| may be dead here |
(...skipping 16 matching lines...) Expand all Loading... |
3523 // so the firstChild() is nullptr if the only child is an empty inline-block. | 3523 // so the firstChild() is nullptr if the only child is an empty inline-block. |
3524 inline bool RenderBlock::isInlineBoxWrapperActuallyChild() const | 3524 inline bool RenderBlock::isInlineBoxWrapperActuallyChild() const |
3525 { | 3525 { |
3526 return isInlineBlockOrInlineTable() && !size().isEmpty() && node() && editin
gIgnoresContent(node()); | 3526 return isInlineBlockOrInlineTable() && !size().isEmpty() && node() && editin
gIgnoresContent(node()); |
3527 } | 3527 } |
3528 | 3528 |
3529 LayoutRect RenderBlock::localCaretRect(InlineBox* inlineBox, int caretOffset, La
youtUnit* extraWidthToEndOfLine) | 3529 LayoutRect RenderBlock::localCaretRect(InlineBox* inlineBox, int caretOffset, La
youtUnit* extraWidthToEndOfLine) |
3530 { | 3530 { |
3531 // Do the normal calculation in most cases. | 3531 // Do the normal calculation in most cases. |
3532 if (firstChild() || isInlineBoxWrapperActuallyChild()) | 3532 if (firstChild() || isInlineBoxWrapperActuallyChild()) |
3533 return RenderBox::localCaretRect(inlineBox, caretOffset, extraWidthToEnd
OfLine); | 3533 return LayoutBox::localCaretRect(inlineBox, caretOffset, extraWidthToEnd
OfLine); |
3534 | 3534 |
3535 LayoutRect caretRect = localCaretRectForEmptyElement(size().width(), textInd
entOffset()); | 3535 LayoutRect caretRect = localCaretRectForEmptyElement(size().width(), textInd
entOffset()); |
3536 | 3536 |
3537 if (extraWidthToEndOfLine) | 3537 if (extraWidthToEndOfLine) |
3538 *extraWidthToEndOfLine = size().width() - caretRect.maxX(); | 3538 *extraWidthToEndOfLine = size().width() - caretRect.maxX(); |
3539 | 3539 |
3540 return caretRect; | 3540 return caretRect; |
3541 } | 3541 } |
3542 | 3542 |
3543 void RenderBlock::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint
& additionalOffset) const | 3543 void RenderBlock::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint
& additionalOffset) const |
(...skipping 30 matching lines...) Expand all Loading... |
3574 | 3574 |
3575 addChildFocusRingRects(rects, additionalOffset); | 3575 addChildFocusRingRects(rects, additionalOffset); |
3576 } | 3576 } |
3577 | 3577 |
3578 if (inlineElementContinuation()) | 3578 if (inlineElementContinuation()) |
3579 inlineElementContinuation()->addFocusRingRects(rects, additionalOffset +
(inlineElementContinuation()->containingBlock()->location() - location())); | 3579 inlineElementContinuation()->addFocusRingRects(rects, additionalOffset +
(inlineElementContinuation()->containingBlock()->location() - location())); |
3580 } | 3580 } |
3581 | 3581 |
3582 void RenderBlock::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layou
tPoint& layerOffset) const | 3582 void RenderBlock::computeSelfHitTestRects(Vector<LayoutRect>& rects, const Layou
tPoint& layerOffset) const |
3583 { | 3583 { |
3584 RenderBox::computeSelfHitTestRects(rects, layerOffset); | 3584 LayoutBox::computeSelfHitTestRects(rects, layerOffset); |
3585 | 3585 |
3586 if (hasHorizontalLayoutOverflow() || hasVerticalLayoutOverflow()) { | 3586 if (hasHorizontalLayoutOverflow() || hasVerticalLayoutOverflow()) { |
3587 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo
x()) { | 3587 for (RootInlineBox* curr = firstRootBox(); curr; curr = curr->nextRootBo
x()) { |
3588 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); | 3588 LayoutUnit top = std::max<LayoutUnit>(curr->lineTop(), curr->top()); |
3589 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); | 3589 LayoutUnit bottom = std::min<LayoutUnit>(curr->lineBottom(), curr->t
op() + curr->height()); |
3590 LayoutRect rect(layerOffset.x() + curr->x(), layerOffset.y() + top,
curr->width(), bottom - top); | 3590 LayoutRect rect(layerOffset.x() + curr->x(), layerOffset.y() + top,
curr->width(), bottom - top); |
3591 // It's common for this rect to be entirely contained in our box, so
exclude that simple case. | 3591 // It's common for this rect to be entirely contained in our box, so
exclude that simple case. |
3592 if (!rect.isEmpty() && (rects.isEmpty() || !rects[0].contains(rect))
) | 3592 if (!rect.isEmpty() && (rects.isEmpty() || !rects[0].contains(rect))
) |
3593 rects.append(rect); | 3593 rects.append(rect); |
3594 } | 3594 } |
3595 } | 3595 } |
3596 } | 3596 } |
3597 | 3597 |
3598 RenderBox* RenderBlock::createAnonymousBoxWithSameTypeAs(const LayoutObject* par
ent) const | 3598 LayoutBox* RenderBlock::createAnonymousBoxWithSameTypeAs(const LayoutObject* par
ent) const |
3599 { | 3599 { |
3600 if (isAnonymousColumnsBlock()) | 3600 if (isAnonymousColumnsBlock()) |
3601 return createAnonymousColumnsWithParentRenderer(parent); | 3601 return createAnonymousColumnsWithParentRenderer(parent); |
3602 if (isAnonymousColumnSpanBlock()) | 3602 if (isAnonymousColumnSpanBlock()) |
3603 return createAnonymousColumnSpanWithParentRenderer(parent); | 3603 return createAnonymousColumnSpanWithParentRenderer(parent); |
3604 return createAnonymousWithParentRendererAndDisplay(parent, style()->display(
)); | 3604 return createAnonymousWithParentRendererAndDisplay(parent, style()->display(
)); |
3605 } | 3605 } |
3606 | 3606 |
3607 LayoutUnit RenderBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar
yRule pageBoundaryRule) const | 3607 LayoutUnit RenderBlock::nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundar
yRule pageBoundaryRule) const |
3608 { | 3608 { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3666 RELEASE_ASSERT(layoutState); | 3666 RELEASE_ASSERT(layoutState); |
3667 if (!layoutState->isPaginated()) | 3667 if (!layoutState->isPaginated()) |
3668 return LayoutUnit(); | 3668 return LayoutUnit(); |
3669 // It would be possible to remove the requirement that this block be the one
currently being | 3669 // It would be possible to remove the requirement that this block be the one
currently being |
3670 // laid out, but nobody needs that at the moment. | 3670 // laid out, but nobody needs that at the moment. |
3671 ASSERT(layoutState->renderer() == this); | 3671 ASSERT(layoutState->renderer() == this); |
3672 LayoutSize offsetDelta = layoutState->layoutOffset() - layoutState->pageOffs
et(); | 3672 LayoutSize offsetDelta = layoutState->layoutOffset() - layoutState->pageOffs
et(); |
3673 return isHorizontalWritingMode() ? offsetDelta.height() : offsetDelta.width(
); | 3673 return isHorizontalWritingMode() ? offsetDelta.height() : offsetDelta.width(
); |
3674 } | 3674 } |
3675 | 3675 |
3676 LayoutUnit RenderBlock::collapsedMarginBeforeForChild(const RenderBox& child) co
nst | 3676 LayoutUnit RenderBlock::collapsedMarginBeforeForChild(const LayoutBox& child) co
nst |
3677 { | 3677 { |
3678 // If the child has the same directionality as we do, then we can just retur
n its | 3678 // If the child has the same directionality as we do, then we can just retur
n its |
3679 // collapsed margin. | 3679 // collapsed margin. |
3680 if (!child.isWritingModeRoot()) | 3680 if (!child.isWritingModeRoot()) |
3681 return child.collapsedMarginBefore(); | 3681 return child.collapsedMarginBefore(); |
3682 | 3682 |
3683 // The child has a different directionality. If the child is parallel, then
it's just | 3683 // The child has a different directionality. If the child is parallel, then
it's just |
3684 // flipped relative to us. We can use the collapsed margin for the opposite
edge. | 3684 // flipped relative to us. We can use the collapsed margin for the opposite
edge. |
3685 if (child.isHorizontalWritingMode() == isHorizontalWritingMode()) | 3685 if (child.isHorizontalWritingMode() == isHorizontalWritingMode()) |
3686 return child.collapsedMarginAfter(); | 3686 return child.collapsedMarginAfter(); |
3687 | 3687 |
3688 // The child is perpendicular to us, which means its margins don't collapse
but are on the | 3688 // The child is perpendicular to us, which means its margins don't collapse
but are on the |
3689 // "logical left/right" sides of the child box. We can just return the raw
margin in this case. | 3689 // "logical left/right" sides of the child box. We can just return the raw
margin in this case. |
3690 return marginBeforeForChild(child); | 3690 return marginBeforeForChild(child); |
3691 } | 3691 } |
3692 | 3692 |
3693 LayoutUnit RenderBlock::collapsedMarginAfterForChild(const RenderBox& child) con
st | 3693 LayoutUnit RenderBlock::collapsedMarginAfterForChild(const LayoutBox& child) con
st |
3694 { | 3694 { |
3695 // If the child has the same directionality as we do, then we can just retur
n its | 3695 // If the child has the same directionality as we do, then we can just retur
n its |
3696 // collapsed margin. | 3696 // collapsed margin. |
3697 if (!child.isWritingModeRoot()) | 3697 if (!child.isWritingModeRoot()) |
3698 return child.collapsedMarginAfter(); | 3698 return child.collapsedMarginAfter(); |
3699 | 3699 |
3700 // The child has a different directionality. If the child is parallel, then
it's just | 3700 // The child has a different directionality. If the child is parallel, then
it's just |
3701 // flipped relative to us. We can use the collapsed margin for the opposite
edge. | 3701 // flipped relative to us. We can use the collapsed margin for the opposite
edge. |
3702 if (child.isHorizontalWritingMode() == isHorizontalWritingMode()) | 3702 if (child.isHorizontalWritingMode() == isHorizontalWritingMode()) |
3703 return child.collapsedMarginBefore(); | 3703 return child.collapsedMarginBefore(); |
3704 | 3704 |
3705 // The child is perpendicular to us, which means its margins don't collapse
but are on the | 3705 // The child is perpendicular to us, which means its margins don't collapse
but are on the |
3706 // "logical left/right" side of the child box. We can just return the raw m
argin in this case. | 3706 // "logical left/right" side of the child box. We can just return the raw m
argin in this case. |
3707 return marginAfterForChild(child); | 3707 return marginAfterForChild(child); |
3708 } | 3708 } |
3709 | 3709 |
3710 bool RenderBlock::hasMarginBeforeQuirk(const RenderBox* child) const | 3710 bool RenderBlock::hasMarginBeforeQuirk(const LayoutBox* child) const |
3711 { | 3711 { |
3712 // If the child has the same directionality as we do, then we can just retur
n its | 3712 // If the child has the same directionality as we do, then we can just retur
n its |
3713 // margin quirk. | 3713 // margin quirk. |
3714 if (!child->isWritingModeRoot()) | 3714 if (!child->isWritingModeRoot()) |
3715 return child->isRenderBlock() ? toRenderBlock(child)->hasMarginBeforeQui
rk() : child->style()->hasMarginBeforeQuirk(); | 3715 return child->isRenderBlock() ? toRenderBlock(child)->hasMarginBeforeQui
rk() : child->style()->hasMarginBeforeQuirk(); |
3716 | 3716 |
3717 // The child has a different directionality. If the child is parallel, then
it's just | 3717 // The child has a different directionality. If the child is parallel, then
it's just |
3718 // flipped relative to us. We can use the opposite edge. | 3718 // flipped relative to us. We can use the opposite edge. |
3719 if (child->isHorizontalWritingMode() == isHorizontalWritingMode()) | 3719 if (child->isHorizontalWritingMode() == isHorizontalWritingMode()) |
3720 return child->isRenderBlock() ? toRenderBlock(child)->hasMarginAfterQuir
k() : child->style()->hasMarginAfterQuirk(); | 3720 return child->isRenderBlock() ? toRenderBlock(child)->hasMarginAfterQuir
k() : child->style()->hasMarginAfterQuirk(); |
3721 | 3721 |
3722 // The child is perpendicular to us and box sides are never quirky in html.c
ss, and we don't really care about | 3722 // The child is perpendicular to us and box sides are never quirky in html.c
ss, and we don't really care about |
3723 // whether or not authors specified quirky ems, since they're an implementat
ion detail. | 3723 // whether or not authors specified quirky ems, since they're an implementat
ion detail. |
3724 return false; | 3724 return false; |
3725 } | 3725 } |
3726 | 3726 |
3727 bool RenderBlock::hasMarginAfterQuirk(const RenderBox* child) const | 3727 bool RenderBlock::hasMarginAfterQuirk(const LayoutBox* child) const |
3728 { | 3728 { |
3729 // If the child has the same directionality as we do, then we can just retur
n its | 3729 // If the child has the same directionality as we do, then we can just retur
n its |
3730 // margin quirk. | 3730 // margin quirk. |
3731 if (!child->isWritingModeRoot()) | 3731 if (!child->isWritingModeRoot()) |
3732 return child->isRenderBlock() ? toRenderBlock(child)->hasMarginAfterQuir
k() : child->style()->hasMarginAfterQuirk(); | 3732 return child->isRenderBlock() ? toRenderBlock(child)->hasMarginAfterQuir
k() : child->style()->hasMarginAfterQuirk(); |
3733 | 3733 |
3734 // The child has a different directionality. If the child is parallel, then
it's just | 3734 // The child has a different directionality. If the child is parallel, then
it's just |
3735 // flipped relative to us. We can use the opposite edge. | 3735 // flipped relative to us. We can use the opposite edge. |
3736 if (child->isHorizontalWritingMode() == isHorizontalWritingMode()) | 3736 if (child->isHorizontalWritingMode() == isHorizontalWritingMode()) |
3737 return child->isRenderBlock() ? toRenderBlock(child)->hasMarginBeforeQui
rk() : child->style()->hasMarginBeforeQuirk(); | 3737 return child->isRenderBlock() ? toRenderBlock(child)->hasMarginBeforeQui
rk() : child->style()->hasMarginBeforeQuirk(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3832 } | 3832 } |
3833 } | 3833 } |
3834 | 3834 |
3835 // FIXME: Glyph overflow will get lost in this case, but not really a bi
g deal. | 3835 // FIXME: Glyph overflow will get lost in this case, but not really a bi
g deal. |
3836 GlyphOverflowAndFallbackFontsMap textBoxDataMap; | 3836 GlyphOverflowAndFallbackFontsMap textBoxDataMap; |
3837 for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin();
it != lineBoxes.end(); ++it) { | 3837 for (ListHashSet<RootInlineBox*>::const_iterator it = lineBoxes.begin();
it != lineBoxes.end(); ++it) { |
3838 RootInlineBox* box = *it; | 3838 RootInlineBox* box = *it; |
3839 box->computeOverflow(box->lineTop(), box->lineBottom(), textBoxDataM
ap); | 3839 box->computeOverflow(box->lineTop(), box->lineBottom(), textBoxDataM
ap); |
3840 } | 3840 } |
3841 } else { | 3841 } else { |
3842 for (RenderBox* box = firstChildBox(); box; box = box->nextSiblingBox())
{ | 3842 for (LayoutBox* box = firstChildBox(); box; box = box->nextSiblingBox())
{ |
3843 if (recalcNormalFlowChildOverflowIfNeeded(box)) | 3843 if (recalcNormalFlowChildOverflowIfNeeded(box)) |
3844 childrenOverflowChanged = true; | 3844 childrenOverflowChanged = true; |
3845 } | 3845 } |
3846 } | 3846 } |
3847 | 3847 |
3848 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); | 3848 TrackedRendererListHashSet* positionedDescendants = positionedObjects(); |
3849 if (!positionedDescendants) | 3849 if (!positionedDescendants) |
3850 return childrenOverflowChanged; | 3850 return childrenOverflowChanged; |
3851 | 3851 |
3852 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); | 3852 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); |
3853 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(
); it != end; ++it) { | 3853 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(
); it != end; ++it) { |
3854 RenderBox* box = *it; | 3854 LayoutBox* box = *it; |
3855 | 3855 |
3856 if (!box->needsOverflowRecalcAfterStyleChange()) | 3856 if (!box->needsOverflowRecalcAfterStyleChange()) |
3857 continue; | 3857 continue; |
3858 RenderBlock* block = toRenderBlock(box); | 3858 RenderBlock* block = toRenderBlock(box); |
3859 if (!block->recalcOverflowAfterStyleChange() || box->style()->position()
== FixedPosition) | 3859 if (!block->recalcOverflowAfterStyleChange() || box->style()->position()
== FixedPosition) |
3860 continue; | 3860 continue; |
3861 | 3861 |
3862 childrenOverflowChanged = true; | 3862 childrenOverflowChanged = true; |
3863 } | 3863 } |
3864 return childrenOverflowChanged; | 3864 return childrenOverflowChanged; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3912 | 3912 |
3913 #if ENABLE(ASSERT) | 3913 #if ENABLE(ASSERT) |
3914 void RenderBlock::checkPositionedObjectsNeedLayout() | 3914 void RenderBlock::checkPositionedObjectsNeedLayout() |
3915 { | 3915 { |
3916 if (!gPositionedDescendantsMap) | 3916 if (!gPositionedDescendantsMap) |
3917 return; | 3917 return; |
3918 | 3918 |
3919 if (TrackedRendererListHashSet* positionedDescendantSet = positionedObjects(
)) { | 3919 if (TrackedRendererListHashSet* positionedDescendantSet = positionedObjects(
)) { |
3920 TrackedRendererListHashSet::const_iterator end = positionedDescendantSet
->end(); | 3920 TrackedRendererListHashSet::const_iterator end = positionedDescendantSet
->end(); |
3921 for (TrackedRendererListHashSet::const_iterator it = positionedDescendan
tSet->begin(); it != end; ++it) { | 3921 for (TrackedRendererListHashSet::const_iterator it = positionedDescendan
tSet->begin(); it != end; ++it) { |
3922 RenderBox* currBox = *it; | 3922 LayoutBox* currBox = *it; |
3923 ASSERT(!currBox->needsLayout()); | 3923 ASSERT(!currBox->needsLayout()); |
3924 } | 3924 } |
3925 } | 3925 } |
3926 } | 3926 } |
3927 | 3927 |
3928 bool RenderBlock::paintsContinuationOutline(RenderInline* flow) | 3928 bool RenderBlock::paintsContinuationOutline(RenderInline* flow) |
3929 { | 3929 { |
3930 ContinuationOutlineTableMap* table = continuationOutlineTable(); | 3930 ContinuationOutlineTableMap* table = continuationOutlineTable(); |
3931 if (table->isEmpty()) | 3931 if (table->isEmpty()) |
3932 return false; | 3932 return false; |
(...skipping 12 matching lines...) Expand all Loading... |
3945 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const | 3945 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout
Object* obj) const |
3946 { | 3946 { |
3947 showLayoutObject(); | 3947 showLayoutObject(); |
3948 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 3948 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
3949 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 3949 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
3950 } | 3950 } |
3951 | 3951 |
3952 #endif | 3952 #endif |
3953 | 3953 |
3954 } // namespace blink | 3954 } // namespace blink |
OLD | NEW |