| 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 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1164 // LayoutState needs this deliberate scope to pop before paint invalidat
ion. | 1164 // LayoutState needs this deliberate scope to pop before paint invalidat
ion. |
| 1165 LayoutState state(*this, locationOffset()); | 1165 LayoutState state(*this, locationOffset()); |
| 1166 | 1166 |
| 1167 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovement
Only()) | 1167 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovement
Only()) |
| 1168 return false; | 1168 return false; |
| 1169 | 1169 |
| 1170 // Lay out positioned descendants or objects that just need to recompute
overflow. | 1170 // Lay out positioned descendants or objects that just need to recompute
overflow. |
| 1171 if (needsSimplifiedNormalFlowLayout()) | 1171 if (needsSimplifiedNormalFlowLayout()) |
| 1172 simplifiedNormalFlowLayout(); | 1172 simplifiedNormalFlowLayout(); |
| 1173 | 1173 |
| 1174 // Lay out our positioned objects if our positioned child bit is set. | 1174 if (posChildNeedsLayout() || needsPositionedMovementLayout()) |
| 1175 // Also, if an absolute position element inside a relative positioned co
ntainer moves, and the absolute element has a fixed position | 1175 layoutPositionedObjects(false, needsPositionedMovementLayout() ? For
cedLayoutAfterContainingBlockMoved : DefaultLayout); |
| 1176 // child, neither the fixed element nor its container learn of the movem
ent since posChildNeedsLayout() is only marked as far as the | |
| 1177 // relative positioned container. So if we can have fixed pos objects in
our positioned objects list check if any of them | |
| 1178 // are statically positioned and thus need to move with their absolute a
ncestors. | |
| 1179 bool canContainFixedPosObjects = canContainFixedPositionObjects(); | |
| 1180 if (posChildNeedsLayout() || needsPositionedMovementLayout() || canConta
inFixedPosObjects) | |
| 1181 layoutPositionedObjects(false, needsPositionedMovementLayout() ? For
cedLayoutAfterContainingBlockMoved : (!posChildNeedsLayout() && canContainFixedP
osObjects ? LayoutOnlyFixedPositionedObjects : DefaultLayout)); | |
| 1182 | 1176 |
| 1183 // Recompute our overflow information. | 1177 // Recompute our overflow information. |
| 1184 // FIXME: We could do better here by computing a temporary overflow obje
ct from layoutPositionedObjects and only | 1178 // FIXME: We could do better here by computing a temporary overflow obje
ct from layoutPositionedObjects and only |
| 1185 // updating our overflow if we either used to have overflow or if the ne
w temporary object has overflow. | 1179 // updating our overflow if we either used to have overflow or if the ne
w temporary object has overflow. |
| 1186 // For now just always recompute overflow. This is no worse performance-
wise than the old code that called rightmostPosition and | 1180 // For now just always recompute overflow. This is no worse performance-
wise than the old code that called rightmostPosition and |
| 1187 // lowestPosition on every relayout so it's not a regression. | 1181 // lowestPosition on every relayout so it's not a regression. |
| 1188 // computeOverflow expects the bottom edge before we clamp our height. S
ince this information isn't available during | 1182 // computeOverflow expects the bottom edge before we clamp our height. S
ince this information isn't available during |
| 1189 // simplifiedLayout, we cache the value in m_overflow. | 1183 // simplifiedLayout, we cache the value in m_overflow. |
| 1190 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layout
ClientAfterEdge() : clientLogicalBottom(); | 1184 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layout
ClientAfterEdge() : clientLogicalBottom(); |
| 1191 computeOverflow(oldClientAfterEdge, true); | 1185 computeOverflow(oldClientAfterEdge, true); |
| 1192 } | 1186 } |
| 1193 | 1187 |
| 1194 updateLayerTransformAfterLayout(); | 1188 updateLayerTransformAfterLayout(); |
| 1195 | 1189 |
| 1196 updateScrollInfoAfterLayout(); | 1190 updateScrollInfoAfterLayout(); |
| 1197 | 1191 |
| 1198 clearNeedsLayout(); | 1192 clearNeedsLayout(); |
| 1199 return true; | 1193 return true; |
| 1200 } | 1194 } |
| 1201 | 1195 |
| 1202 void RenderBlock::markFixedPositionObjectForLayoutIfNeeded(RenderObject* child,
SubtreeLayoutScope& layoutScope) | |
| 1203 { | |
| 1204 // FIXME(sky): Remove | |
| 1205 } | |
| 1206 | |
| 1207 LayoutUnit RenderBlock::marginIntrinsicLogicalWidthForChild(RenderBox* child) co
nst | 1196 LayoutUnit RenderBlock::marginIntrinsicLogicalWidthForChild(RenderBox* child) co
nst |
| 1208 { | 1197 { |
| 1209 // A margin has three types: fixed, percentage, and auto (variable). | 1198 // A margin has three types: fixed, percentage, and auto (variable). |
| 1210 // Auto and percentage margins become 0 when computing min/max width. | 1199 // Auto and percentage margins become 0 when computing min/max width. |
| 1211 // Fixed margins can be added in as is. | 1200 // Fixed margins can be added in as is. |
| 1212 Length marginLeft = child->style()->marginStartUsing(style()); | 1201 Length marginLeft = child->style()->marginStartUsing(style()); |
| 1213 Length marginRight = child->style()->marginEndUsing(style()); | 1202 Length marginRight = child->style()->marginEndUsing(style()); |
| 1214 LayoutUnit margin = 0; | 1203 LayoutUnit margin = 0; |
| 1215 if (marginLeft.isFixed()) | 1204 if (marginLeft.isFixed()) |
| 1216 margin += marginLeft.value(); | 1205 margin += marginLeft.value(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1227 | 1216 |
| 1228 RenderBox* r; | 1217 RenderBox* r; |
| 1229 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); | 1218 TrackedRendererListHashSet::iterator end = positionedDescendants->end(); |
| 1230 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(
); it != end; ++it) { | 1219 for (TrackedRendererListHashSet::iterator it = positionedDescendants->begin(
); it != end; ++it) { |
| 1231 r = *it; | 1220 r = *it; |
| 1232 | 1221 |
| 1233 // FIXME: this should only be set from clearNeedsLayout crbug.com/361250 | 1222 // FIXME: this should only be set from clearNeedsLayout crbug.com/361250 |
| 1234 r->setLayoutDidGetCalled(true); | 1223 r->setLayoutDidGetCalled(true); |
| 1235 | 1224 |
| 1236 SubtreeLayoutScope layoutScope(*r); | 1225 SubtreeLayoutScope layoutScope(*r); |
| 1237 // A fixed position element with an absolute positioned ancestor has no
way of knowing if the latter has changed position. So | |
| 1238 // 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. | |
| 1239 // it has static position. | |
| 1240 markFixedPositionObjectForLayoutIfNeeded(r, layoutScope); | |
| 1241 if (info == LayoutOnlyFixedPositionedObjects) { | |
| 1242 r->layoutIfNeeded(); | |
| 1243 continue; | |
| 1244 } | |
| 1245 | 1226 |
| 1246 // When a non-positioned block element moves, it may have positioned chi
ldren that are implicitly positioned relative to the | 1227 // When a non-positioned block element moves, it may have positioned chi
ldren that are implicitly positioned relative to the |
| 1247 // non-positioned block. Rather than trying to detect all of these move
ment cases, we just always lay out positioned | 1228 // non-positioned block. Rather than trying to detect all of these move
ment cases, we just always lay out positioned |
| 1248 // objects that are positioned implicitly like this. Such objects are r
are, and so in typical DHTML menu usage (where everything is | 1229 // objects that are positioned implicitly like this. Such objects are r
are, and so in typical DHTML menu usage (where everything is |
| 1249 // positioned explicitly) this should not incur a performance penalty. | 1230 // positioned explicitly) this should not incur a performance penalty. |
| 1250 if (relayoutChildren || (r->style()->hasStaticBlockPosition(isHorizontal
WritingMode()) && r->parent() != this)) | 1231 if (relayoutChildren || (r->style()->hasStaticBlockPosition(isHorizontal
WritingMode()) && r->parent() != this)) |
| 1251 layoutScope.setChildNeedsLayout(r); | 1232 layoutScope.setChildNeedsLayout(r); |
| 1252 | 1233 |
| 1253 // If relayoutChildren is set and the child has percentage padding or an
embedded content box, we also need to invalidate the childs pref widths. | 1234 // If relayoutChildren is set and the child has percentage padding or an
embedded content box, we also need to invalidate the childs pref widths. |
| 1254 if (relayoutChildren && r->needsPreferredWidthsRecalculation()) | 1235 if (relayoutChildren && r->needsPreferredWidthsRecalculation()) |
| (...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3222 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 3203 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
| 3223 { | 3204 { |
| 3224 showRenderObject(); | 3205 showRenderObject(); |
| 3225 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 3206 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 3226 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 3207 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 3227 } | 3208 } |
| 3228 | 3209 |
| 3229 #endif | 3210 #endif |
| 3230 | 3211 |
| 3231 } // namespace blink | 3212 } // namespace blink |
| OLD | NEW |