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 3969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3980 } | 3980 } |
3981 | 3981 |
3982 void RenderBlock::clearFloats(BlockLayoutPass layoutPass) | 3982 void RenderBlock::clearFloats(BlockLayoutPass layoutPass) |
3983 { | 3983 { |
3984 if (m_floatingObjects) | 3984 if (m_floatingObjects) |
3985 m_floatingObjects->setHorizontalWritingMode(isHorizontalWritingMode()); | 3985 m_floatingObjects->setHorizontalWritingMode(isHorizontalWritingMode()); |
3986 | 3986 |
3987 // Clear our positioned floats boolean. | 3987 // Clear our positioned floats boolean. |
3988 m_hasPositionedFloats = false; | 3988 m_hasPositionedFloats = false; |
3989 | 3989 |
| 3990 HashSet<RenderBox*> oldIntrudingFloatSet; |
| 3991 if (!childrenInline() && m_floatingObjects) { |
| 3992 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 3993 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 3994 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end
; ++it) { |
| 3995 FloatingObject* floatingObject = *it; |
| 3996 if (!floatingObject->m_isDescendant) |
| 3997 oldIntrudingFloatSet.add(floatingObject->m_renderer); |
| 3998 } |
| 3999 } |
| 4000 |
3990 // Inline blocks are covered by the isReplaced() check in the avoidFloats me
thod. | 4001 // Inline blocks are covered by the isReplaced() check in the avoidFloats me
thod. |
3991 if (avoidsFloats() || isRoot() || isRenderView() || isFloatingOrPositioned()
|| isTableCell()) { | 4002 if (avoidsFloats() || isRoot() || isRenderView() || isFloatingOrPositioned()
|| isTableCell()) { |
3992 if (m_floatingObjects) { | 4003 if (m_floatingObjects) { |
3993 deleteAllValues(m_floatingObjects->set()); | 4004 deleteAllValues(m_floatingObjects->set()); |
3994 m_floatingObjects->clear(); | 4005 m_floatingObjects->clear(); |
3995 } | 4006 } |
3996 if (layoutPass == PositionedFloatLayoutPass) | 4007 if (layoutPass == PositionedFloatLayoutPass) |
3997 addPositionedFloats(); | 4008 addPositionedFloats(); |
| 4009 if (!oldIntrudingFloatSet.isEmpty()) |
| 4010 markAllDescendantsWithFloatsForLayout(); |
3998 return; | 4011 return; |
3999 } | 4012 } |
4000 | 4013 |
4001 typedef HashMap<RenderObject*, FloatingObject*> RendererToFloatInfoMap; | 4014 typedef HashMap<RenderObject*, FloatingObject*> RendererToFloatInfoMap; |
4002 RendererToFloatInfoMap floatMap; | 4015 RendererToFloatInfoMap floatMap; |
4003 | 4016 |
4004 if (m_floatingObjects) { | 4017 if (m_floatingObjects) { |
4005 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 4018 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
4006 if (childrenInline()) { | 4019 if (childrenInline()) { |
4007 FloatingObjectSetIterator end = floatingObjectSet.end(); | 4020 FloatingObjectSetIterator end = floatingObjectSet.end(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4090 for (RendererToFloatInfoMap::iterator it = floatMap.begin(); it != end;
++it) { | 4103 for (RendererToFloatInfoMap::iterator it = floatMap.begin(); it != end;
++it) { |
4091 FloatingObject* floatingObject = (*it).second; | 4104 FloatingObject* floatingObject = (*it).second; |
4092 if (!floatingObject->m_isDescendant) { | 4105 if (!floatingObject->m_isDescendant) { |
4093 changeLogicalTop = 0; | 4106 changeLogicalTop = 0; |
4094 changeLogicalBottom = max(changeLogicalBottom, logicalBottomForF
loat(floatingObject)); | 4107 changeLogicalBottom = max(changeLogicalBottom, logicalBottomForF
loat(floatingObject)); |
4095 } | 4108 } |
4096 } | 4109 } |
4097 deleteAllValues(floatMap); | 4110 deleteAllValues(floatMap); |
4098 | 4111 |
4099 markLinesDirtyInBlockRange(changeLogicalTop, changeLogicalBottom); | 4112 markLinesDirtyInBlockRange(changeLogicalTop, changeLogicalBottom); |
| 4113 } else if (!oldIntrudingFloatSet.isEmpty()) { |
| 4114 // If there are previously intruding floats that no longer intrude, then
children with floats |
| 4115 // should also get layout because they might need their floating object
lists cleared. |
| 4116 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| 4117 FloatingObjectSetIterator end = floatingObjectSet.end(); |
| 4118 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end
; ++it) |
| 4119 oldIntrudingFloatSet.remove((*it)->m_renderer); |
| 4120 if (!oldIntrudingFloatSet.isEmpty()) |
| 4121 markAllDescendantsWithFloatsForLayout(); |
4100 } | 4122 } |
4101 } | 4123 } |
4102 | 4124 |
4103 LayoutUnit RenderBlock::addOverhangingFloats(RenderBlock* child, bool makeChildP
aintOtherFloats) | 4125 LayoutUnit RenderBlock::addOverhangingFloats(RenderBlock* child, bool makeChildP
aintOtherFloats) |
4104 { | 4126 { |
4105 // Prevent floats from being added to the canvas by the root element, e.g.,
<html>. | 4127 // Prevent floats from being added to the canvas by the root element, e.g.,
<html>. |
4106 if (child->hasOverflowClip() || !child->containsFloats() || child->isRoot()
|| child->hasColumns() || child->isWritingModeRoot()) | 4128 if (child->hasOverflowClip() || !child->containsFloats() || child->isRoot()
|| child->hasColumns() || child->isWritingModeRoot()) |
4107 return 0; | 4129 return 0; |
4108 | 4130 |
4109 LayoutUnit childLogicalTop = child->logicalTop(); | 4131 LayoutUnit childLogicalTop = child->logicalTop(); |
(...skipping 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7243 } | 7265 } |
7244 | 7266 |
7245 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 7267 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
7246 { | 7268 { |
7247 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); | 7269 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); |
7248 } | 7270 } |
7249 | 7271 |
7250 #endif | 7272 #endif |
7251 | 7273 |
7252 } // namespace WebCore | 7274 } // namespace WebCore |
OLD | NEW |