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->isDescendant()) | |
3997 oldIntrudingFloatSet.add(floatingObject->m_renderer); | |
3998 } | |
3999 } | |
4000 | |
4001 // Inline blocks are covered by the isReplaced() check in the avoidFloats me
thod. | 3990 // Inline blocks are covered by the isReplaced() check in the avoidFloats me
thod. |
4002 if (avoidsFloats() || isRoot() || isRenderView() || isFloatingOrPositioned()
|| isTableCell()) { | 3991 if (avoidsFloats() || isRoot() || isRenderView() || isFloatingOrPositioned()
|| isTableCell()) { |
4003 if (m_floatingObjects) { | 3992 if (m_floatingObjects) { |
4004 deleteAllValues(m_floatingObjects->set()); | 3993 deleteAllValues(m_floatingObjects->set()); |
4005 m_floatingObjects->clear(); | 3994 m_floatingObjects->clear(); |
4006 } | 3995 } |
4007 if (layoutPass == PositionedFloatLayoutPass) | 3996 if (layoutPass == PositionedFloatLayoutPass) |
4008 addPositionedFloats(); | 3997 addPositionedFloats(); |
4009 if (!oldIntrudingFloatSet.isEmpty()) | |
4010 markAllDescendantsWithFloatsForLayout(); | |
4011 return; | 3998 return; |
4012 } | 3999 } |
4013 | 4000 |
4014 typedef HashMap<RenderObject*, FloatingObject*> RendererToFloatInfoMap; | 4001 typedef HashMap<RenderObject*, FloatingObject*> RendererToFloatInfoMap; |
4015 RendererToFloatInfoMap floatMap; | 4002 RendererToFloatInfoMap floatMap; |
4016 | 4003 |
4017 if (m_floatingObjects) { | 4004 if (m_floatingObjects) { |
4018 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); | 4005 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
4019 if (childrenInline()) { | 4006 if (childrenInline()) { |
4020 FloatingObjectSetIterator end = floatingObjectSet.end(); | 4007 FloatingObjectSetIterator end = floatingObjectSet.end(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4103 for (RendererToFloatInfoMap::iterator it = floatMap.begin(); it != end;
++it) { | 4090 for (RendererToFloatInfoMap::iterator it = floatMap.begin(); it != end;
++it) { |
4104 FloatingObject* floatingObject = (*it).second; | 4091 FloatingObject* floatingObject = (*it).second; |
4105 if (!floatingObject->m_isDescendant) { | 4092 if (!floatingObject->m_isDescendant) { |
4106 changeLogicalTop = 0; | 4093 changeLogicalTop = 0; |
4107 changeLogicalBottom = max(changeLogicalBottom, logicalBottomForF
loat(floatingObject)); | 4094 changeLogicalBottom = max(changeLogicalBottom, logicalBottomForF
loat(floatingObject)); |
4108 } | 4095 } |
4109 } | 4096 } |
4110 deleteAllValues(floatMap); | 4097 deleteAllValues(floatMap); |
4111 | 4098 |
4112 markLinesDirtyInBlockRange(changeLogicalTop, changeLogicalBottom); | 4099 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(); | |
4122 } | 4100 } |
4123 } | 4101 } |
4124 | 4102 |
4125 LayoutUnit RenderBlock::addOverhangingFloats(RenderBlock* child, bool makeChildP
aintOtherFloats) | 4103 LayoutUnit RenderBlock::addOverhangingFloats(RenderBlock* child, bool makeChildP
aintOtherFloats) |
4126 { | 4104 { |
4127 // Prevent floats from being added to the canvas by the root element, e.g.,
<html>. | 4105 // Prevent floats from being added to the canvas by the root element, e.g.,
<html>. |
4128 if (child->hasOverflowClip() || !child->containsFloats() || child->isRoot()
|| child->hasColumns() || child->isWritingModeRoot()) | 4106 if (child->hasOverflowClip() || !child->containsFloats() || child->isRoot()
|| child->hasColumns() || child->isWritingModeRoot()) |
4129 return 0; | 4107 return 0; |
4130 | 4108 |
4131 LayoutUnit childLogicalTop = child->logicalTop(); | 4109 LayoutUnit childLogicalTop = child->logicalTop(); |
(...skipping 3133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7265 } | 7243 } |
7266 | 7244 |
7267 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) | 7245 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl
oatingObject* floatingObject) |
7268 { | 7246 { |
7269 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); | 7247 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->x(
), floatingObject->y(), floatingObject->maxX(), floatingObject->maxY()); |
7270 } | 7248 } |
7271 | 7249 |
7272 #endif | 7250 #endif |
7273 | 7251 |
7274 } // namespace WebCore | 7252 } // namespace WebCore |
OLD | NEW |