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 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All r
ights 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 m_lineHeight = -1; | 256 m_lineHeight = -1; |
257 | 257 |
258 // Update pseudos for :before and :after now. | 258 // Update pseudos for :before and :after now. |
259 if (!isAnonymous() && document()->usesBeforeAfterRules() && canHaveChildren(
)) { | 259 if (!isAnonymous() && document()->usesBeforeAfterRules() && canHaveChildren(
)) { |
260 updateBeforeAfterContent(BEFORE); | 260 updateBeforeAfterContent(BEFORE); |
261 updateBeforeAfterContent(AFTER); | 261 updateBeforeAfterContent(AFTER); |
262 } | 262 } |
263 | 263 |
264 // After our style changed, if we lose our ability to propagate floats into
next sibling | 264 // After our style changed, if we lose our ability to propagate floats into
next sibling |
265 // blocks, then we need to mark our descendants with floats for layout and c
lear all floats | 265 // blocks, then we need to find the top most parent containing that overhang
ing float and |
266 // from next sibling blocks that exist in our floating objects list. See bug
56299. | 266 // then mark its descendants with floats for layout and clear all floats fro
m its next |
| 267 // sibling blocks that exist in our floating objects list. See bug 56299 and
62875. |
267 bool canPropagateFloatIntoSibling = !isFloatingOrPositioned() && !avoidsFloa
ts(); | 268 bool canPropagateFloatIntoSibling = !isFloatingOrPositioned() && !avoidsFloa
ts(); |
268 if (diff == StyleDifferenceLayout && s_canPropagateFloatIntoSibling && !canP
ropagateFloatIntoSibling && hasOverhangingFloats()) { | 269 if (diff == StyleDifferenceLayout && s_canPropagateFloatIntoSibling && !canP
ropagateFloatIntoSibling && hasOverhangingFloats()) { |
269 markAllDescendantsWithFloatsForLayout(); | 270 RenderBlock* parentBlock = this; |
270 markSiblingsWithFloatsForLayout(); | 271 FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 272 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 273 |
| 274 for (RenderObject* curr = parent(); curr && !curr->isRenderView(); curr
= curr->parent()) { |
| 275 if (curr->isRenderBlock()) { |
| 276 RenderBlock* currBlock = toRenderBlock(curr); |
| 277 |
| 278 if (currBlock->hasOverhangingFloats()) { |
| 279 for (FloatingObjectSetIterator it = floatingObjectSet.begin(
); it != end; ++it) { |
| 280 RenderBox* renderer = (*it)->renderer(); |
| 281 if (currBlock->hasOverhangingFloat(renderer)) { |
| 282 parentBlock = currBlock; |
| 283 break; |
| 284 } |
| 285 } |
| 286 } |
| 287 } |
| 288 } |
| 289 |
| 290 parentBlock->markAllDescendantsWithFloatsForLayout(); |
| 291 parentBlock->markSiblingsWithFloatsForLayout(); |
271 } | 292 } |
272 } | 293 } |
273 | 294 |
274 void RenderBlock::updateBeforeAfterContent(PseudoId pseudoId) | 295 void RenderBlock::updateBeforeAfterContent(PseudoId pseudoId) |
275 { | 296 { |
276 // If this is an anonymous wrapper, then the parent applies its own pseudo-e
lement style to it. | 297 // If this is an anonymous wrapper, then the parent applies its own pseudo-e
lement style to it. |
277 if (parent() && parent()->createsAnonymousWrapper()) | 298 if (parent() && parent()->createsAnonymousWrapper()) |
278 return; | 299 return; |
279 return children()->updateBeforeAfterContent(this, pseudoId); | 300 return children()->updateBeforeAfterContent(this, pseudoId); |
280 } | 301 } |
(...skipping 3453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3734 | 3755 |
3735 // Since the float doesn't overhang, it didn't get put into our list
. We need to go ahead and add its overflow in to the | 3756 // Since the float doesn't overhang, it didn't get put into our list
. We need to go ahead and add its overflow in to the |
3736 // child now. | 3757 // child now. |
3737 if (r->m_isDescendant) | 3758 if (r->m_isDescendant) |
3738 child->addOverflowFromChild(r->m_renderer, IntSize(xPositionForF
loatIncludingMargin(r), yPositionForFloatIncludingMargin(r))); | 3759 child->addOverflowFromChild(r->m_renderer, IntSize(xPositionForF
loatIncludingMargin(r), yPositionForFloatIncludingMargin(r))); |
3739 } | 3760 } |
3740 } | 3761 } |
3741 return lowestFloatLogicalBottom; | 3762 return lowestFloatLogicalBottom; |
3742 } | 3763 } |
3743 | 3764 |
| 3765 bool RenderBlock::hasOverhangingFloat(RenderBox* renderer) |
| 3766 { |
| 3767 if (!m_floatingObjects || hasColumns() || !parent()) |
| 3768 return false; |
| 3769 |
| 3770 FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 3771 FloatingObjectSetIterator it = floatingObjectSet.find<RenderBox*, FloatingOb
jectHashTranslator>(renderer); |
| 3772 if (it == floatingObjectSet.end()) |
| 3773 return false; |
| 3774 |
| 3775 return logicalBottomForFloat(*it) > logicalHeight(); |
| 3776 } |
| 3777 |
3744 void RenderBlock::addIntrudingFloats(RenderBlock* prev, int logicalLeftOffset, i
nt logicalTopOffset) | 3778 void RenderBlock::addIntrudingFloats(RenderBlock* prev, int logicalLeftOffset, i
nt logicalTopOffset) |
3745 { | 3779 { |
3746 // If the parent or previous sibling doesn't have any floats to add, don't b
other. | 3780 // If the parent or previous sibling doesn't have any floats to add, don't b
other. |
3747 if (!prev->m_floatingObjects) | 3781 if (!prev->m_floatingObjects) |
3748 return; | 3782 return; |
3749 | 3783 |
3750 logicalLeftOffset += (isHorizontalWritingMode() ? marginLeft() : marginTop()
); | 3784 logicalLeftOffset += (isHorizontalWritingMode() ? marginLeft() : marginTop()
); |
3751 | 3785 |
3752 FloatingObjectSet& prevSet = prev->m_floatingObjects->set(); | 3786 FloatingObjectSet& prevSet = prev->m_floatingObjects->set(); |
3753 FloatingObjectSetIterator prevEnd = prevSet.end(); | 3787 FloatingObjectSetIterator prevEnd = prevSet.end(); |
(...skipping 2594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6348 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 6382 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
6349 { | 6383 { |
6350 showRenderObject(); | 6384 showRenderObject(); |
6351 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 6385 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
6352 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 6386 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
6353 } | 6387 } |
6354 | 6388 |
6355 #endif | 6389 #endif |
6356 | 6390 |
6357 } // namespace WebCore | 6391 } // namespace WebCore |
OLD | NEW |