Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 #include "core/frame/Settings.h" | 36 #include "core/frame/Settings.h" |
| 37 #include "core/rendering/HitTestLocation.h" | 37 #include "core/rendering/HitTestLocation.h" |
| 38 #include "core/rendering/RenderLayer.h" | 38 #include "core/rendering/RenderLayer.h" |
| 39 #include "core/rendering/RenderText.h" | 39 #include "core/rendering/RenderText.h" |
| 40 #include "core/rendering/RenderView.h" | 40 #include "core/rendering/RenderView.h" |
| 41 #include "core/rendering/line/LineWidth.h" | 41 #include "core/rendering/line/LineWidth.h" |
| 42 #include "platform/text/BidiTextRun.h" | 42 #include "platform/text/BidiTextRun.h" |
| 43 | 43 |
| 44 namespace blink { | 44 namespace blink { |
| 45 | 45 |
| 46 bool RenderBlockFlow::s_canPropagateFloatIntoSibling = false; | |
| 47 | |
| 48 struct SameSizeAsMarginInfo { | 46 struct SameSizeAsMarginInfo { |
| 49 uint16_t bitfields; | 47 uint16_t bitfields; |
| 50 LayoutUnit margins[2]; | 48 LayoutUnit margins[2]; |
| 51 }; | 49 }; |
| 52 | 50 |
| 53 COMPILE_ASSERT(sizeof(RenderBlockFlow::MarginValues) == sizeof(LayoutUnit[4]), M arginValues_should_stay_small); | 51 COMPILE_ASSERT(sizeof(RenderBlockFlow::MarginValues) == sizeof(LayoutUnit[4]), M arginValues_should_stay_small); |
| 54 | 52 |
| 55 class MarginInfo { | 53 class MarginInfo { |
| 56 // Collapsing flags for whether we can collapse our margins with our childre n's margins. | 54 // Collapsing flags for whether we can collapse our margins with our childre n's margins. |
| 57 bool m_canCollapseWithChildren : 1; | 55 bool m_canCollapseWithChildren : 1; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 | 193 |
| 196 clearNeedsLayout(); | 194 clearNeedsLayout(); |
| 197 } | 195 } |
| 198 | 196 |
| 199 inline void RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, SubtreeLayou tScope& layoutScope) | 197 inline void RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, SubtreeLayou tScope& layoutScope) |
| 200 { | 198 { |
| 201 LayoutUnit oldLeft = logicalLeft(); | 199 LayoutUnit oldLeft = logicalLeft(); |
| 202 bool logicalWidthChanged = updateLogicalWidthAndColumnWidth(); | 200 bool logicalWidthChanged = updateLogicalWidthAndColumnWidth(); |
| 203 relayoutChildren |= logicalWidthChanged; | 201 relayoutChildren |= logicalWidthChanged; |
| 204 | 202 |
| 205 rebuildFloatsFromIntruding(); | |
| 206 | |
| 207 LayoutState state(*this, locationOffset(), logicalWidthChanged); | 203 LayoutState state(*this, locationOffset(), logicalWidthChanged); |
| 208 | 204 |
| 209 // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg, to track | 205 // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg, to track |
| 210 // our current maximal positive and negative margins. These values are used when we | 206 // our current maximal positive and negative margins. These values are used when we |
| 211 // are collapsed with adjacent blocks, so for example, if you have block A a nd B | 207 // are collapsed with adjacent blocks, so for example, if you have block A a nd B |
| 212 // collapsing together, then you'd take the maximal positive margin from bot h A and B | 208 // collapsing together, then you'd take the maximal positive margin from bot h A and B |
| 213 // and subtract it from the maximal negative margin from both A and B to get the | 209 // and subtract it from the maximal negative margin from both A and B to get the |
| 214 // true collapsed margin. This algorithm is recursive, so when we finish lay out() | 210 // true collapsed margin. This algorithm is recursive, so when we finish lay out() |
| 215 // our block knows its current maximal positive/negative values. | 211 // our block knows its current maximal positive/negative values. |
| 216 initMaxMarginValues(); | 212 initMaxMarginValues(); |
| 217 setHasMarginBeforeQuirk(style()->hasMarginBeforeQuirk()); | 213 setHasMarginBeforeQuirk(style()->hasMarginBeforeQuirk()); |
| 218 setHasMarginAfterQuirk(style()->hasMarginAfterQuirk()); | 214 setHasMarginAfterQuirk(style()->hasMarginAfterQuirk()); |
| 219 | 215 |
| 220 LayoutUnit beforeEdge = borderBefore() + paddingBefore(); | 216 LayoutUnit beforeEdge = borderBefore() + paddingBefore(); |
| 221 LayoutUnit afterEdge = borderAfter() + paddingAfter() + scrollbarLogicalHeig ht(); | 217 LayoutUnit afterEdge = borderAfter() + paddingAfter() + scrollbarLogicalHeig ht(); |
| 222 LayoutUnit previousHeight = logicalHeight(); | 218 LayoutUnit previousHeight = logicalHeight(); |
| 223 setLogicalHeight(beforeEdge); | 219 setLogicalHeight(beforeEdge); |
| 224 | 220 |
| 225 m_paintInvalidationLogicalTop = 0; | 221 m_paintInvalidationLogicalTop = 0; |
| 226 m_paintInvalidationLogicalBottom = 0; | 222 m_paintInvalidationLogicalBottom = 0; |
| 227 if (!firstChild() && !isAnonymousBlock()) | 223 if (!firstChild() && !isAnonymousBlock()) |
| 228 setChildrenInline(true); | 224 setChildrenInline(true); |
| 229 | 225 |
| 230 if (childrenInline()) | 226 if (childrenInline()) |
| 231 layoutInlineChildren(relayoutChildren, m_paintInvalidationLogicalTop, m_ paintInvalidationLogicalBottom, afterEdge); | 227 layoutInlineChildren(relayoutChildren, m_paintInvalidationLogicalTop, m_ paintInvalidationLogicalBottom, afterEdge); |
| 232 else | 228 else |
| 233 layoutBlockChildren(relayoutChildren, layoutScope, beforeEdge, afterEdge ); | 229 layoutBlockChildren(relayoutChildren, layoutScope, beforeEdge, afterEdge ); |
| 234 | 230 |
| 235 // Expand our intrinsic height to encompass floats. | |
| 236 if (lowestFloatLogicalBottom() > (logicalHeight() - afterEdge) && createsBlo ckFormattingContext()) | |
| 237 setLogicalHeight(lowestFloatLogicalBottom() + afterEdge); | |
| 238 | |
| 239 // Calculate our new height. | |
| 240 LayoutUnit oldHeight = logicalHeight(); | |
| 241 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); | 231 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); |
| 242 | 232 |
| 243 updateLogicalHeight(); | 233 updateLogicalHeight(); |
| 244 LayoutUnit newHeight = logicalHeight(); | |
| 245 if (oldHeight > newHeight && !childrenInline()) { | |
| 246 // One of our children's floats may have become an overhanging float for us. | |
| 247 for (RenderObject* child = lastChild(); child; child = child->previousSi bling()) { | |
| 248 if (child->isRenderBlockFlow() && !child->isFloatingOrOutOfFlowPosit ioned()) { | |
| 249 RenderBlockFlow* block = toRenderBlockFlow(child); | |
| 250 if (block->lowestFloatLogicalBottom() + block->logicalTop() <= n ewHeight) | |
| 251 break; | |
| 252 addOverhangingFloats(block, false); | |
| 253 } | |
| 254 } | |
| 255 } | |
| 256 | 234 |
| 257 bool heightChanged = (previousHeight != newHeight); | 235 if (previousHeight != logicalHeight()) |
| 258 if (heightChanged) | |
| 259 relayoutChildren = true; | 236 relayoutChildren = true; |
| 260 | 237 |
| 261 layoutPositionedObjects(relayoutChildren || isDocumentElement(), oldLeft != logicalLeft() ? ForcedLayoutAfterContainingBlockMoved : DefaultLayout); | 238 layoutPositionedObjects(relayoutChildren || isDocumentElement(), oldLeft != logicalLeft() ? ForcedLayoutAfterContainingBlockMoved : DefaultLayout); |
| 262 | 239 |
| 263 // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway). | 240 // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway). |
| 264 computeOverflow(oldClientAfterEdge); | 241 computeOverflow(oldClientAfterEdge); |
| 265 | 242 |
| 266 m_descendantsWithFloatsMarkedForLayout = false; | 243 m_descendantsWithFloatsMarkedForLayout = false; |
| 267 } | 244 } |
| 268 | 245 |
| 269 void RenderBlockFlow::determineLogicalLeftPositionForChild(RenderBox* child) | 246 void RenderBlockFlow::determineLogicalLeftPositionForChild(RenderBox* child) |
| 270 { | 247 { |
| 271 LayoutUnit startPosition = borderStart() + paddingStart(); | 248 LayoutUnit startPosition = borderStart() + paddingStart(); |
| 272 LayoutUnit initialStartPosition = startPosition; | |
| 273 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | 249 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) |
| 274 startPosition -= verticalScrollbarWidth(); | 250 startPosition -= verticalScrollbarWidth(); |
| 275 LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + ava ilableLogicalWidth(); | 251 LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + ava ilableLogicalWidth(); |
| 276 | 252 |
| 277 LayoutUnit childMarginStart = marginStartForChild(child); | 253 LayoutUnit childMarginStart = marginStartForChild(child); |
| 278 LayoutUnit newPosition = startPosition + childMarginStart; | 254 LayoutUnit newPosition = startPosition + childMarginStart; |
| 279 | 255 |
| 280 LayoutUnit positionToAvoidFloats; | |
| 281 if (child->avoidsFloats() && containsFloats()) | |
| 282 positionToAvoidFloats = startOffsetForLine(logicalTopForChild(child), fa lse, logicalHeightForChild(child)); | |
| 283 | |
| 284 // If the child has an offset from the content edge to avoid floats then use that, otherwise let any negative | 256 // If the child has an offset from the content edge to avoid floats then use that, otherwise let any negative |
| 285 // margin pull it back over the content edge or any positive margin push it out. | 257 // margin pull it back over the content edge or any positive margin push it out. |
| 286 // If the child is being centred then the margin calculated to do that has f actored in any offset required to | 258 // If the child is being centred then the margin calculated to do that has f actored in any offset required to |
| 287 // avoid floats, so use it if necessary. | 259 // avoid floats, so use it if necessary. |
| 288 if (style()->textAlign() == WEBKIT_CENTER || child->style()->marginStartUsin g(style()).isAuto()) | 260 if (style()->textAlign() == WEBKIT_CENTER || child->style()->marginStartUsin g(style()).isAuto()) |
| 289 newPosition = std::max(newPosition, positionToAvoidFloats + childMarginS tart); | 261 newPosition = std::max(newPosition, childMarginStart); |
|
esprehn
2014/11/03 20:25:45
I think you merged the wrong side of the branch he
ojan
2014/11/03 20:27:06
?
ojan
2014/11/03 20:28:10
positionToAvoidFloats is always 0 since there are
ojan
2014/11/03 20:28:52
Ah, this is much more clear if you see this in the
esprehn
2014/11/03 20:30:44
Oh I see what happened here.
| |
| 290 else if (positionToAvoidFloats > initialStartPosition) | |
| 291 newPosition = std::max(newPosition, positionToAvoidFloats); | |
| 292 | 262 |
| 293 setLogicalLeftForChild(child, style()->isLeftToRightDirection() ? newPositio n : totalAvailableLogicalWidth - newPosition - logicalWidthForChild(child)); | 263 setLogicalLeftForChild(child, style()->isLeftToRightDirection() ? newPositio n : totalAvailableLogicalWidth - newPosition - logicalWidthForChild(child)); |
| 294 } | 264 } |
| 295 | 265 |
| 296 void RenderBlockFlow::setLogicalLeftForChild(RenderBox* child, LayoutUnit logica lLeft) | 266 void RenderBlockFlow::setLogicalLeftForChild(RenderBox* child, LayoutUnit logica lLeft) |
| 297 { | 267 { |
| 298 child->setX(logicalLeft); | 268 child->setX(logicalLeft); |
| 299 } | 269 } |
| 300 | 270 |
| 301 void RenderBlockFlow::setLogicalTopForChild(RenderBox* child, LayoutUnit logical Top) | 271 void RenderBlockFlow::setLogicalTopForChild(RenderBox* child, LayoutUnit logical Top) |
| 302 { | 272 { |
| 303 child->setY(logicalTop); | 273 child->setY(logicalTop); |
| 304 } | 274 } |
| 305 | 275 |
| 306 void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, LayoutUnit& previousFloatLogicalBottom) | 276 void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo) |
| 307 { | 277 { |
| 308 LayoutUnit oldPosMarginBefore = maxPositiveMarginBefore(); | |
| 309 LayoutUnit oldNegMarginBefore = maxNegativeMarginBefore(); | |
| 310 | |
| 311 // The child is a normal flow object. Compute the margins we will use for co llapsing now. | 278 // The child is a normal flow object. Compute the margins we will use for co llapsing now. |
| 312 child->computeAndSetBlockDirectionMargins(this); | 279 child->computeAndSetBlockDirectionMargins(this); |
| 313 | 280 |
| 314 // Try to guess our correct logical top position. In most cases this guess w ill | 281 // Try to guess our correct logical top position. In most cases this guess w ill |
| 315 // be correct. Only if we're wrong (when we compute the real logical top pos ition) | 282 // be correct. Only if we're wrong (when we compute the real logical top pos ition) |
| 316 // will we have to potentially relayout. | 283 // will we have to potentially relayout. |
| 317 LayoutUnit logicalTopEstimate = estimateLogicalTopPosition(child, marginInfo ); | 284 // Go ahead and position the child as though it didn't collapse with the top . |
| 285 setLogicalTopForChild(child, estimateLogicalTopPosition(child, marginInfo)); | |
| 318 | 286 |
| 319 // Cache our old rect so that we can dirty the proper paint invalidation rec ts if the child moves. | 287 child->layoutIfNeeded(); |
| 320 LayoutRect oldRect = child->frameRect(); | |
| 321 LayoutUnit oldLogicalTop = logicalTopForChild(child); | |
| 322 | |
| 323 // Go ahead and position the child as though it didn't collapse with the top . | |
| 324 setLogicalTopForChild(child, logicalTopEstimate); | |
| 325 | |
| 326 RenderBlockFlow* childRenderBlockFlow = child->isRenderBlockFlow() ? toRende rBlockFlow(child) : 0; | |
| 327 bool markDescendantsWithFloats = false; | |
| 328 if (logicalTopEstimate != oldLogicalTop && childRenderBlockFlow && !childRen derBlockFlow->avoidsFloats() && childRenderBlockFlow->containsFloats()) { | |
| 329 markDescendantsWithFloats = true; | |
| 330 } else if (UNLIKELY(logicalTopEstimate.mightBeSaturated())) { | |
| 331 // logicalTopEstimate, returned by estimateLogicalTopPosition, might be saturated for | |
| 332 // very large elements. If it does the comparison with oldLogicalTop mig ht yield a | |
| 333 // false negative as adding and removing margins, borders etc from a sat urated number | |
| 334 // might yield incorrect results. If this is the case always mark for la yout. | |
| 335 markDescendantsWithFloats = true; | |
| 336 } else if (!child->avoidsFloats() || child->shrinkToAvoidFloats()) { | |
| 337 // If an element might be affected by the presence of floats, then alway s mark it for | |
| 338 // layout. | |
| 339 LayoutUnit fb = std::max(previousFloatLogicalBottom, lowestFloatLogicalB ottom()); | |
| 340 if (fb > logicalTopEstimate) | |
| 341 markDescendantsWithFloats = true; | |
| 342 } | |
| 343 | |
| 344 if (childRenderBlockFlow) { | |
| 345 if (markDescendantsWithFloats) | |
| 346 childRenderBlockFlow->markAllDescendantsWithFloatsForLayout(); | |
| 347 previousFloatLogicalBottom = std::max(previousFloatLogicalBottom, oldLog icalTop + childRenderBlockFlow->lowestFloatLogicalBottom()); | |
| 348 } | |
| 349 | |
| 350 SubtreeLayoutScope layoutScope(*child); | |
| 351 | |
| 352 bool childHadLayout = child->everHadLayout(); | |
| 353 bool childNeededLayout = child->needsLayout(); | |
| 354 if (childNeededLayout) | |
| 355 child->layout(); | |
| 356 | 288 |
| 357 // Cache if we are at the top of the block right now. | 289 // Cache if we are at the top of the block right now. |
| 358 bool childIsSelfCollapsing = child->isSelfCollapsingBlock(); | 290 bool childIsSelfCollapsing = child->isSelfCollapsingBlock(); |
| 359 | 291 |
| 360 // Now determine the correct ypos based off examination of collapsing margin | 292 // Now determine the correct ypos based off examination of collapsing margin |
| 361 // values. | 293 // values. |
| 362 LayoutUnit logicalTopBeforeClear = collapseMargins(child, marginInfo, childI sSelfCollapsing); | 294 setLogicalTopForChild(child, collapseMargins(child, marginInfo, childIsSelfC ollapsing)); |
| 363 | 295 |
| 364 // Now check for clear. | 296 // FIXME(sky): Is it still actually possible for the child to need layout he re? |
| 365 LayoutUnit logicalTopAfterClear = clearFloatsIfNeeded(child, marginInfo, old PosMarginBefore, oldNegMarginBefore, logicalTopBeforeClear, childIsSelfCollapsin g); | 297 // This used to be needed for floats and/or margin collapsing. |
| 366 | 298 child->layoutIfNeeded(); |
| 367 setLogicalTopForChild(child, logicalTopAfterClear); | |
| 368 | |
| 369 // Now we have a final top position. See if it really does end up being diff erent from our estimate. | |
| 370 // clearFloatsIfNeeded can also mark the child as needing a layout even thou gh we didn't move. This happens | |
| 371 // when collapseMargins dynamically adds overhanging floats because of a chi ld with negative margins. | |
| 372 if (logicalTopAfterClear != logicalTopEstimate || child->needsLayout()) { | |
| 373 SubtreeLayoutScope layoutScope(*child); | |
| 374 if (child->shrinkToAvoidFloats()) { | |
| 375 // The child's width depends on the line width. | |
| 376 // When the child shifts to clear an item, its width can | |
| 377 // change (because it has more available line width). | |
| 378 // So go ahead and mark the item as dirty. | |
| 379 layoutScope.setChildNeedsLayout(child); | |
| 380 } | |
| 381 | |
| 382 if (childRenderBlockFlow && !childRenderBlockFlow->avoidsFloats() && chi ldRenderBlockFlow->containsFloats()) | |
| 383 childRenderBlockFlow->markAllDescendantsWithFloatsForLayout(); | |
| 384 | |
| 385 // Our guess was wrong. Make the child lay itself out again. | |
| 386 child->layoutIfNeeded(); | |
| 387 } | |
| 388 | 299 |
| 389 // If we previously encountered a self-collapsing sibling of this child that had clearance then | 300 // If we previously encountered a self-collapsing sibling of this child that had clearance then |
| 390 // we set this bit to ensure we would not collapse the child's margins, and those of any subsequent | 301 // we set this bit to ensure we would not collapse the child's margins, and those of any subsequent |
| 391 // self-collapsing siblings, with our parent. If this child is not self-coll apsing then it can | 302 // self-collapsing siblings, with our parent. If this child is not self-coll apsing then it can |
| 392 // collapse its margins with the parent so reset the bit. | 303 // collapse its margins with the parent so reset the bit. |
| 393 if (!marginInfo.canCollapseMarginAfterWithLastChild() && !childIsSelfCollaps ing) | 304 if (!marginInfo.canCollapseMarginAfterWithLastChild() && !childIsSelfCollaps ing) |
| 394 marginInfo.setCanCollapseMarginAfterWithLastChild(true); | 305 marginInfo.setCanCollapseMarginAfterWithLastChild(true); |
| 395 | 306 |
| 396 // We are no longer at the top of the block if we encounter a non-empty chil d. | 307 // We are no longer at the top of the block if we encounter a non-empty chil d. |
| 397 // This has to be done after checking for clear, so that margins can be rese t if a clear occurred. | 308 // This has to be done after checking for clear, so that margins can be rese t if a clear occurred. |
| 398 if (marginInfo.atBeforeSideOfBlock() && !childIsSelfCollapsing) | 309 if (marginInfo.atBeforeSideOfBlock() && !childIsSelfCollapsing) |
| 399 marginInfo.setAtBeforeSideOfBlock(false); | 310 marginInfo.setAtBeforeSideOfBlock(false); |
| 400 | 311 |
| 401 // Now place the child in the correct left position | 312 // Now place the child in the correct left position |
| 402 determineLogicalLeftPositionForChild(child); | 313 determineLogicalLeftPositionForChild(child); |
| 403 | 314 |
| 404 LayoutSize childOffset = child->location() - oldRect.location(); | |
| 405 | |
| 406 // Update our height now that the child has been placed in the correct posit ion. | 315 // Update our height now that the child has been placed in the correct posit ion. |
| 407 setLogicalHeight(logicalHeight() + logicalHeightForChild(child)); | 316 setLogicalHeight(logicalHeight() + logicalHeightForChild(child)); |
| 408 if (mustSeparateMarginAfterForChild(child)) { | 317 if (mustSeparateMarginAfterForChild(child)) { |
| 409 setLogicalHeight(logicalHeight() + marginAfterForChild(child)); | 318 setLogicalHeight(logicalHeight() + marginAfterForChild(child)); |
| 410 marginInfo.clearMargin(); | 319 marginInfo.clearMargin(); |
| 411 } | 320 } |
| 412 // If the child has overhanging floats that intrude into following siblings (or possibly out | |
| 413 // of this block), then the parent gets notified of the floats now. | |
| 414 if (childRenderBlockFlow) | |
| 415 addOverhangingFloats(childRenderBlockFlow, !childNeededLayout); | |
| 416 | |
| 417 // If the child moved, we have to invalidate it's paint as well as any floa ting/positioned | |
| 418 // descendants. An exception is if we need a layout. In this case, we know w e're going to | |
| 419 // invalidate our paint (and the child) anyway. | |
| 420 bool didNotDoFullLayoutAndMoved = childHadLayout && !selfNeedsLayout() && (c hildOffset.width() || childOffset.height()); | |
| 421 bool didNotLayoutAndNeedsPaintInvalidation = !childHadLayout && child->check ForPaintInvalidation(); | |
| 422 | |
| 423 if (didNotDoFullLayoutAndMoved || didNotLayoutAndNeedsPaintInvalidation) | |
| 424 child->invalidatePaintForOverhangingFloats(true); | |
| 425 } | |
| 426 | |
| 427 void RenderBlockFlow::rebuildFloatsFromIntruding() | |
| 428 { | |
| 429 // FIXME(sky): Remove this. | |
| 430 } | 321 } |
| 431 | 322 |
| 432 void RenderBlockFlow::layoutBlockChildren(bool relayoutChildren, SubtreeLayoutSc ope& layoutScope, LayoutUnit beforeEdge, LayoutUnit afterEdge) | 323 void RenderBlockFlow::layoutBlockChildren(bool relayoutChildren, SubtreeLayoutSc ope& layoutScope, LayoutUnit beforeEdge, LayoutUnit afterEdge) |
| 433 { | 324 { |
| 434 dirtyForLayoutFromPercentageHeightDescendants(layoutScope); | 325 dirtyForLayoutFromPercentageHeightDescendants(layoutScope); |
| 435 | 326 |
| 436 // The margin struct caches all our current margin collapsing state. The com pact struct caches state when we encounter compacts, | 327 // The margin struct caches all our current margin collapsing state. The com pact struct caches state when we encounter compacts, |
| 437 MarginInfo marginInfo(this, beforeEdge, afterEdge); | 328 MarginInfo marginInfo(this, beforeEdge, afterEdge); |
| 438 | 329 |
| 439 LayoutUnit previousFloatLogicalBottom = 0; | |
| 440 | |
| 441 RenderBox* next = firstChildBox(); | 330 RenderBox* next = firstChildBox(); |
| 442 RenderBox* lastNormalFlowChild = 0; | 331 RenderBox* lastNormalFlowChild = 0; |
| 443 | 332 |
| 444 while (next) { | 333 while (next) { |
| 445 RenderBox* child = next; | 334 RenderBox* child = next; |
| 446 next = child->nextSiblingBox(); | 335 next = child->nextSiblingBox(); |
| 447 | 336 |
| 448 // FIXME: this should only be set from clearNeedsLayout crbug.com/361250 | 337 // FIXME: this should only be set from clearNeedsLayout crbug.com/361250 |
| 449 child->setLayoutDidGetCalled(true); | 338 child->setLayoutDidGetCalled(true); |
| 450 | 339 |
| 451 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, child); | 340 updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, child); |
| 452 | 341 |
| 453 if (child->isOutOfFlowPositioned()) { | 342 if (child->isOutOfFlowPositioned()) { |
| 454 child->containingBlock()->insertPositionedObject(child); | 343 child->containingBlock()->insertPositionedObject(child); |
| 455 adjustPositionedBlock(child, marginInfo); | 344 adjustPositionedBlock(child, marginInfo); |
| 456 continue; | 345 continue; |
| 457 } | 346 } |
| 458 | 347 |
| 459 // Lay out the child. | 348 // Lay out the child. |
| 460 layoutBlockChild(child, marginInfo, previousFloatLogicalBottom); | 349 layoutBlockChild(child, marginInfo); |
| 461 lastNormalFlowChild = child; | 350 lastNormalFlowChild = child; |
| 462 } | 351 } |
| 463 | 352 |
| 464 // Now do the handling of the bottom of the block, adding in our bottom bord er/padding and | 353 // Now do the handling of the bottom of the block, adding in our bottom bord er/padding and |
| 465 // determining the correct collapsed bottom margin information. | 354 // determining the correct collapsed bottom margin information. |
| 466 handleAfterSideOfBlock(lastNormalFlowChild, beforeEdge, afterEdge, marginInf o); | 355 handleAfterSideOfBlock(lastNormalFlowChild, beforeEdge, afterEdge, marginInf o); |
| 467 } | 356 } |
| 468 | 357 |
| 469 // Our MarginInfo state used when laying out block children. | 358 // Our MarginInfo state used when laying out block children. |
| 470 MarginInfo::MarginInfo(RenderBlockFlow* blockFlow, LayoutUnit beforeBorderPaddin g, LayoutUnit afterBorderPadding) | 359 MarginInfo::MarginInfo(RenderBlockFlow* blockFlow, LayoutUnit beforeBorderPaddin g, LayoutUnit afterBorderPadding) |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 657 marginInfo.setPositiveMargin(childMargins.positiveMarginAfter()); | 546 marginInfo.setPositiveMargin(childMargins.positiveMarginAfter()); |
| 658 marginInfo.setNegativeMargin(childMargins.negativeMarginAfter()); | 547 marginInfo.setNegativeMargin(childMargins.negativeMarginAfter()); |
| 659 } else { | 548 } else { |
| 660 marginInfo.clearMargin(); | 549 marginInfo.clearMargin(); |
| 661 } | 550 } |
| 662 | 551 |
| 663 if (marginInfo.margin()) | 552 if (marginInfo.margin()) |
| 664 marginInfo.setHasMarginAfterQuirk(hasMarginAfterQuirk(child)); | 553 marginInfo.setHasMarginAfterQuirk(hasMarginAfterQuirk(child)); |
| 665 } | 554 } |
| 666 | 555 |
| 667 if (previousBlockFlow) { | |
| 668 // If |child| is a self-collapsing block it may have collapsed into a pr evious sibling and although it hasn't reduced the height of the parent yet | |
| 669 // any floats from the parent will now overhang. | |
| 670 LayoutUnit oldLogicalHeight = logicalHeight(); | |
| 671 setLogicalHeight(logicalTop); | |
| 672 if (!previousBlockFlow->avoidsFloats() && (previousBlockFlow->logicalTop () + previousBlockFlow->lowestFloatLogicalBottom()) > logicalTop) | |
| 673 addOverhangingFloats(previousBlockFlow, false); | |
| 674 setLogicalHeight(oldLogicalHeight); | |
| 675 | |
| 676 // If |child|'s previous sibling is a self-collapsing block that cleared a float and margin collapsing resulted in |child| moving up | |
| 677 // into the margin area of the self-collapsing block then the float it c lears is now intruding into |child|. Layout again so that we can look for | |
| 678 // floats in the parent that overhang |child|'s new logical top. | |
| 679 bool logicalTopIntrudesIntoFloat = clearanceForSelfCollapsingBlock > 0 & & logicalTop < beforeCollapseLogicalTop; | |
| 680 if (logicalTopIntrudesIntoFloat && containsFloats() && !child->avoidsFlo ats() && lowestFloatLogicalBottom() > logicalTop) | |
| 681 child->setNeedsLayoutAndFullPaintInvalidation(); | |
| 682 } | |
| 683 | |
| 684 return logicalTop; | 556 return logicalTop; |
| 685 } | 557 } |
| 686 | 558 |
| 687 void RenderBlockFlow::adjustPositionedBlock(RenderBox* child, const MarginInfo& marginInfo) | 559 void RenderBlockFlow::adjustPositionedBlock(RenderBox* child, const MarginInfo& marginInfo) |
| 688 { | 560 { |
| 689 bool hasStaticBlockPosition = child->style()->hasStaticBlockPosition(); | 561 bool hasStaticBlockPosition = child->style()->hasStaticBlockPosition(); |
| 690 | 562 |
| 691 LayoutUnit logicalTop = logicalHeight(); | 563 LayoutUnit logicalTop = logicalHeight(); |
| 692 updateStaticInlinePositionForChild(child, logicalTop); | 564 updateStaticInlinePositionForChild(child, logicalTop); |
| 693 | 565 |
| 694 if (!marginInfo.canCollapseWithMarginBefore()) { | 566 if (!marginInfo.canCollapseWithMarginBefore()) { |
| 695 // Positioned blocks don't collapse margins, so add the margin provided by | 567 // Positioned blocks don't collapse margins, so add the margin provided by |
| 696 // the container now. The child's own margin is added later when calcula ting its logical top. | 568 // the container now. The child's own margin is added later when calcula ting its logical top. |
| 697 LayoutUnit collapsedBeforePos = marginInfo.positiveMargin(); | 569 LayoutUnit collapsedBeforePos = marginInfo.positiveMargin(); |
| 698 LayoutUnit collapsedBeforeNeg = marginInfo.negativeMargin(); | 570 LayoutUnit collapsedBeforeNeg = marginInfo.negativeMargin(); |
| 699 logicalTop += collapsedBeforePos - collapsedBeforeNeg; | 571 logicalTop += collapsedBeforePos - collapsedBeforeNeg; |
| 700 } | 572 } |
| 701 | 573 |
| 702 RenderLayer* childLayer = child->layer(); | 574 RenderLayer* childLayer = child->layer(); |
| 703 if (childLayer->staticBlockPosition() != logicalTop) { | 575 if (childLayer->staticBlockPosition() != logicalTop) { |
| 704 childLayer->setStaticBlockPosition(logicalTop); | 576 childLayer->setStaticBlockPosition(logicalTop); |
| 705 if (hasStaticBlockPosition) | 577 if (hasStaticBlockPosition) |
| 706 child->setChildNeedsLayout(MarkOnlyThis); | 578 child->setChildNeedsLayout(MarkOnlyThis); |
| 707 } | 579 } |
| 708 } | 580 } |
| 709 | 581 |
| 710 LayoutUnit RenderBlockFlow::clearFloatsIfNeeded(RenderBox* child, MarginInfo& ma rginInfo, LayoutUnit oldTopPosMargin, LayoutUnit oldTopNegMargin, LayoutUnit yPo s, bool childIsSelfCollapsing) | |
| 711 { | |
| 712 LayoutUnit heightIncrease = getClearDelta(child, yPos); | |
| 713 if (!heightIncrease) | |
| 714 return yPos; | |
| 715 | |
| 716 if (childIsSelfCollapsing) { | |
| 717 bool childDiscardMargin = mustDiscardMarginBeforeForChild(child) || must DiscardMarginAfterForChild(child); | |
| 718 | |
| 719 // For self-collapsing blocks that clear, they can still collapse their | |
| 720 // margins with following siblings. Reset the current margins to represe nt | |
| 721 // the self-collapsing block's margins only. | |
| 722 // If DISCARD is specified for -webkit-margin-collapse, reset the margin values. | |
| 723 RenderBlockFlow::MarginValues childMargins = marginValuesForChild(child) ; | |
| 724 if (!childDiscardMargin) { | |
| 725 marginInfo.setPositiveMargin(std::max(childMargins.positiveMarginBef ore(), childMargins.positiveMarginAfter())); | |
| 726 marginInfo.setNegativeMargin(std::max(childMargins.negativeMarginBef ore(), childMargins.negativeMarginAfter())); | |
| 727 } else { | |
| 728 marginInfo.clearMargin(); | |
| 729 } | |
| 730 marginInfo.setDiscardMargin(childDiscardMargin); | |
| 731 | |
| 732 // CSS2.1 states: | |
| 733 // "If the top and bottom margins of an element with clearance are adjoi ning, its margins collapse with | |
| 734 // the adjoining margins of following siblings but that resulting margin does not collapse with the bottom margin of the parent block." | |
| 735 // So the parent's bottom margin cannot collapse through this block or a ny subsequent self-collapsing blocks. Set a bit to ensure | |
| 736 // this happens; it will get reset if we encounter an in-flow sibling th at is not self-collapsing. | |
| 737 marginInfo.setCanCollapseMarginAfterWithLastChild(false); | |
| 738 | |
| 739 // For now set the border-top of |child| flush with the bottom border-ed ge of the float so it can layout any floating or positioned children of | |
| 740 // its own at the correct vertical position. If subsequent siblings atte mpt to collapse with |child|'s margins in |collapseMargins| we will | |
| 741 // adjust the height of the parent to |child|'s margin top (which if it is positive sits up 'inside' the float it's clearing) so that all three | |
| 742 // margins can collapse at the correct vertical position. | |
| 743 // Per CSS2.1 we need to ensure that any negative margin-top clears |chi ld| beyond the bottom border-edge of the float so that the top border edge of th e child | |
| 744 // (i.e. its clearance) is at a position that satisfies the equation: " the amount of clearance is set so that clearance + margin-top = [height of float ], | |
| 745 // i.e., clearance = [height of float] - margin-top". | |
| 746 setLogicalHeight(child->logicalTop() + childMargins.negativeMarginBefore ()); | |
| 747 } else { | |
| 748 // Increase our height by the amount we had to clear. | |
| 749 setLogicalHeight(logicalHeight() + heightIncrease); | |
| 750 } | |
| 751 | |
| 752 if (marginInfo.canCollapseWithMarginBefore()) { | |
| 753 // We can no longer collapse with the top of the block since a clear | |
| 754 // occurred. The empty blocks collapse into the cleared block. | |
| 755 setMaxMarginBeforeValues(oldTopPosMargin, oldTopNegMargin); | |
| 756 marginInfo.setAtBeforeSideOfBlock(false); | |
| 757 | |
| 758 // In case the child discarded the before margin of the block we need to reset the mustDiscardMarginBefore flag to the initial value. | |
| 759 setMustDiscardMarginBefore(style()->marginBeforeCollapse() == MDISCARD); | |
| 760 } | |
| 761 | |
| 762 return yPos + heightIncrease; | |
| 763 } | |
| 764 | |
| 765 void RenderBlockFlow::setCollapsedBottomMargin(const MarginInfo& marginInfo) | 582 void RenderBlockFlow::setCollapsedBottomMargin(const MarginInfo& marginInfo) |
| 766 { | 583 { |
| 767 if (marginInfo.canCollapseWithMarginAfter() && !marginInfo.canCollapseWithMa rginBefore()) { | 584 if (marginInfo.canCollapseWithMarginAfter() && !marginInfo.canCollapseWithMa rginBefore()) { |
| 768 // Update the after side margin of the container to discard if the after margin of the last child also discards and we collapse with it. | 585 // Update the after side margin of the container to discard if the after margin of the last child also discards and we collapse with it. |
| 769 // Don't update the max margin values because we won't need them anyway. | 586 // Don't update the max margin values because we won't need them anyway. |
| 770 if (marginInfo.discardMargin()) { | 587 if (marginInfo.discardMargin()) { |
| 771 setMustDiscardMarginAfter(); | 588 setMustDiscardMarginAfter(); |
| 772 return; | 589 return; |
| 773 } | 590 } |
| 774 | 591 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 863 positiveMarginBefore = std::max(positiveMarginBefore, marginValues.p ositiveMarginBefore()); | 680 positiveMarginBefore = std::max(positiveMarginBefore, marginValues.p ositiveMarginBefore()); |
| 864 negativeMarginBefore = std::max(negativeMarginBefore, marginValues.n egativeMarginBefore()); | 681 negativeMarginBefore = std::max(negativeMarginBefore, marginValues.n egativeMarginBefore()); |
| 865 discardMarginBefore = mustDiscardMarginBeforeForChild(child); | 682 discardMarginBefore = mustDiscardMarginBeforeForChild(child); |
| 866 } | 683 } |
| 867 | 684 |
| 868 // Collapse the result with our current margins. | 685 // Collapse the result with our current margins. |
| 869 if (!discardMarginBefore) | 686 if (!discardMarginBefore) |
| 870 logicalTopEstimate += std::max(marginInfo.positiveMargin(), positive MarginBefore) - std::max(marginInfo.negativeMargin(), negativeMarginBefore); | 687 logicalTopEstimate += std::max(marginInfo.positiveMargin(), positive MarginBefore) - std::max(marginInfo.negativeMargin(), negativeMarginBefore); |
| 871 } | 688 } |
| 872 | 689 |
| 873 logicalTopEstimate += getClearDelta(child, logicalTopEstimate); | |
| 874 return logicalTopEstimate; | 690 return logicalTopEstimate; |
| 875 } | 691 } |
| 876 | 692 |
| 877 LayoutUnit RenderBlockFlow::marginOffsetForSelfCollapsingBlock() | 693 LayoutUnit RenderBlockFlow::marginOffsetForSelfCollapsingBlock() |
| 878 { | 694 { |
| 695 // FIXME(sky): Remove | |
| 879 ASSERT(isSelfCollapsingBlock()); | 696 ASSERT(isSelfCollapsingBlock()); |
| 880 RenderBlockFlow* parentBlock = toRenderBlockFlow(parent()); | |
| 881 if (parentBlock && style()->clear() && parentBlock->getClearDelta(this, logi calHeight())) | |
| 882 return marginValuesForChild(this).positiveMarginBefore(); | |
| 883 return LayoutUnit(); | 697 return LayoutUnit(); |
| 884 } | 698 } |
| 885 | 699 |
| 886 void RenderBlockFlow::adjustFloatingBlock(const MarginInfo& marginInfo) | |
| 887 { | |
| 888 // The float should be positioned taking into account the bottom margin | |
| 889 // of the previous flow. We add that margin into the height, get the | |
| 890 // float positioned properly, and then subtract the margin out of the | |
| 891 // height again. In the case of self-collapsing blocks, we always just | |
| 892 // use the top margins, since the self-collapsing block collapsed its | |
| 893 // own bottom margin into its top margin. | |
| 894 // | |
| 895 // Note also that the previous flow may collapse its margin into the top of | |
| 896 // our block. If this is the case, then we do not add the margin in to our | |
| 897 // height when computing the position of the float. This condition can be te sted | |
| 898 // for by simply calling canCollapseWithMarginBefore. See | |
| 899 // http://www.hixie.ch/tests/adhoc/css/box/block/margin-collapse/046.html fo r | |
| 900 // an example of this scenario. | |
| 901 LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? LayoutU nit() : marginInfo.margin(); | |
| 902 setLogicalHeight(logicalHeight() + marginOffset); | |
| 903 positionNewFloats(); | |
| 904 setLogicalHeight(logicalHeight() - marginOffset); | |
| 905 } | |
| 906 | |
| 907 void RenderBlockFlow::handleAfterSideOfBlock(RenderBox* lastChild, LayoutUnit be foreSide, LayoutUnit afterSide, MarginInfo& marginInfo) | 700 void RenderBlockFlow::handleAfterSideOfBlock(RenderBox* lastChild, LayoutUnit be foreSide, LayoutUnit afterSide, MarginInfo& marginInfo) |
| 908 { | 701 { |
| 909 marginInfo.setAtAfterSideOfBlock(true); | 702 marginInfo.setAtAfterSideOfBlock(true); |
| 910 | 703 |
| 911 // If our last child was a self-collapsing block with clearance then our log ical height is flush with the | 704 // If our last child was a self-collapsing block with clearance then our log ical height is flush with the |
| 912 // bottom edge of the float that the child clears. The correct vertical posi tion for the margin-collapsing we want | 705 // bottom edge of the float that the child clears. The correct vertical posi tion for the margin-collapsing we want |
| 913 // to perform now is at the child's margin-top - so adjust our height to tha t position. | 706 // to perform now is at the child's margin-top - so adjust our height to tha t position. |
| 914 if (lastChild && lastChild->isRenderBlockFlow() && lastChild->isSelfCollapsi ngBlock()) | 707 if (lastChild && lastChild->isRenderBlockFlow() && lastChild->isSelfCollapsi ngBlock()) |
| 915 setLogicalHeight(logicalHeight() - toRenderBlockFlow(lastChild)->marginO ffsetForSelfCollapsingBlock()); | 708 setLogicalHeight(logicalHeight() - toRenderBlockFlow(lastChild)->marginO ffsetForSelfCollapsingBlock()); |
| 916 | 709 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1015 return childStyle->marginBeforeCollapse() == MSEPARATE; | 808 return childStyle->marginBeforeCollapse() == MSEPARATE; |
| 1016 } | 809 } |
| 1017 | 810 |
| 1018 bool RenderBlockFlow::mustSeparateMarginAfterForChild(const RenderBox* child) co nst | 811 bool RenderBlockFlow::mustSeparateMarginAfterForChild(const RenderBox* child) co nst |
| 1019 { | 812 { |
| 1020 ASSERT(!child->selfNeedsLayout()); | 813 ASSERT(!child->selfNeedsLayout()); |
| 1021 const RenderStyle* childStyle = child->style(); | 814 const RenderStyle* childStyle = child->style(); |
| 1022 return childStyle->marginAfterCollapse() == MSEPARATE; | 815 return childStyle->marginAfterCollapse() == MSEPARATE; |
| 1023 } | 816 } |
| 1024 | 817 |
| 1025 void RenderBlockFlow::addOverflowFromFloats() | |
| 1026 { | |
| 1027 // FIXME(sky): Remove this. | |
| 1028 } | |
| 1029 | |
| 1030 void RenderBlockFlow::computeOverflow(LayoutUnit oldClientAfterEdge, bool recomp uteFloats) | |
| 1031 { | |
| 1032 RenderBlock::computeOverflow(oldClientAfterEdge, recomputeFloats); | |
| 1033 if (recomputeFloats || createsBlockFormattingContext() || hasSelfPaintingLay er()) | |
| 1034 addOverflowFromFloats(); | |
| 1035 } | |
| 1036 | |
| 1037 RootInlineBox* RenderBlockFlow::createAndAppendRootInlineBox() | 818 RootInlineBox* RenderBlockFlow::createAndAppendRootInlineBox() |
| 1038 { | 819 { |
| 1039 RootInlineBox* rootBox = createRootInlineBox(); | 820 RootInlineBox* rootBox = createRootInlineBox(); |
| 1040 m_lineBoxes.appendLineBox(rootBox); | 821 m_lineBoxes.appendLineBox(rootBox); |
| 1041 | 822 |
| 1042 return rootBox; | 823 return rootBox; |
| 1043 } | 824 } |
| 1044 | 825 |
| 1045 void RenderBlockFlow::deleteLineBoxTree() | 826 void RenderBlockFlow::deleteLineBoxTree() |
| 1046 { | 827 { |
| 1047 m_lineBoxes.deleteLineBoxTree(); | 828 m_lineBoxes.deleteLineBoxTree(); |
| 1048 } | 829 } |
| 1049 | 830 |
| 1050 void RenderBlockFlow::markAllDescendantsWithFloatsForLayout(RenderBox* floatToRe move, bool inLayout) | |
| 1051 { | |
| 1052 // FIXME(sky): Remove this. | |
| 1053 } | |
| 1054 | |
| 1055 void RenderBlockFlow::markSiblingsWithFloatsForLayout(RenderBox* floatToRemove) | |
| 1056 { | |
| 1057 // FIXME(sky): Remove this. | |
| 1058 } | |
| 1059 | |
| 1060 LayoutUnit RenderBlockFlow::getClearDelta(RenderBox* child, LayoutUnit logicalTo p) | |
| 1061 { | |
| 1062 // FIXME(sky): Remove this. | |
| 1063 return 0; | |
| 1064 } | |
| 1065 | |
| 1066 void RenderBlockFlow::styleWillChange(StyleDifference diff, const RenderStyle& n ewStyle) | |
| 1067 { | |
| 1068 RenderStyle* oldStyle = style(); | |
| 1069 s_canPropagateFloatIntoSibling = oldStyle ? !isFloatingOrOutOfFlowPositioned () && !avoidsFloats() : false; | |
| 1070 if (oldStyle && parent() && diff.needsFullLayout() && oldStyle->position() ! = newStyle.position() | |
| 1071 && containsFloats() && !isFloating() && !isOutOfFlowPositioned() && newS tyle.hasOutOfFlowPosition()) | |
| 1072 markAllDescendantsWithFloatsForLayout(); | |
| 1073 | |
| 1074 RenderBlock::styleWillChange(diff, newStyle); | |
| 1075 } | |
| 1076 | |
| 1077 void RenderBlockFlow::styleDidChange(StyleDifference diff, const RenderStyle* ol dStyle) | |
| 1078 { | |
| 1079 // FIXME(sky): Remove this. | |
| 1080 RenderBlock::styleDidChange(diff, oldStyle); | |
| 1081 } | |
| 1082 | |
| 1083 void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox* child, Layou tUnit logicalTop) | 831 void RenderBlockFlow::updateStaticInlinePositionForChild(RenderBox* child, Layou tUnit logicalTop) |
| 1084 { | 832 { |
| 1085 if (child->style()->isOriginalDisplayInlineType()) | 833 if (child->style()->isOriginalDisplayInlineType()) |
| 1086 setStaticInlinePositionForChild(child, startAlignedOffsetForLine(logical Top, false)); | 834 setStaticInlinePositionForChild(child, startAlignedOffsetForLine(logical Top, false)); |
| 1087 else | 835 else |
| 1088 setStaticInlinePositionForChild(child, startOffsetForContent()); | 836 setStaticInlinePositionForChild(child, startOffsetForContent()); |
| 1089 } | 837 } |
| 1090 | 838 |
| 1091 void RenderBlockFlow::setStaticInlinePositionForChild(RenderBox* child, LayoutUn it inlinePosition) | 839 void RenderBlockFlow::setStaticInlinePositionForChild(RenderBox* child, LayoutUn it inlinePosition) |
| 1092 { | 840 { |
| 1093 child->layer()->setStaticInlinePosition(inlinePosition); | 841 child->layer()->setStaticInlinePosition(inlinePosition); |
| 1094 } | 842 } |
| 1095 | 843 |
| 1096 void RenderBlockFlow::addChild(RenderObject* newChild, RenderObject* beforeChild ) | 844 void RenderBlockFlow::addChild(RenderObject* newChild, RenderObject* beforeChild ) |
| 1097 { | 845 { |
| 1098 RenderBlock::addChild(newChild, beforeChild); | 846 RenderBlock::addChild(newChild, beforeChild); |
| 1099 } | 847 } |
| 1100 | 848 |
| 1101 void RenderBlockFlow::moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, boo l fullRemoveInsert) | 849 void RenderBlockFlow::moveAllChildrenIncludingFloatsTo(RenderBlock* toBlock, boo l fullRemoveInsert) |
| 1102 { | 850 { |
| 1103 // FIXME(sky): Merge this into callers. | 851 // FIXME(sky): Merge this into callers. |
| 1104 RenderBlockFlow* toBlockFlow = toRenderBlockFlow(toBlock); | 852 RenderBlockFlow* toBlockFlow = toRenderBlockFlow(toBlock); |
| 1105 moveAllChildrenTo(toBlockFlow, fullRemoveInsert); | 853 moveAllChildrenTo(toBlockFlow, fullRemoveInsert); |
| 1106 } | 854 } |
| 1107 | 855 |
| 1108 void RenderBlockFlow::invalidatePaintForOverhangingFloats(bool paintAllDescendan ts) | |
| 1109 { | |
| 1110 // FIXME(sky): Remove this. | |
| 1111 } | |
| 1112 | |
| 1113 void RenderBlockFlow::invalidatePaintForOverflow() | 856 void RenderBlockFlow::invalidatePaintForOverflow() |
| 1114 { | 857 { |
| 1115 // FIXME: We could tighten up the left and right invalidation points if we l et layoutInlineChildren fill them in based off the particular lines | 858 // FIXME: We could tighten up the left and right invalidation points if we l et layoutInlineChildren fill them in based off the particular lines |
| 1116 // it had to lay out. We wouldn't need the hasOverflowClip() hack in that ca se either. | 859 // it had to lay out. We wouldn't need the hasOverflowClip() hack in that ca se either. |
| 1117 LayoutUnit paintInvalidationLogicalLeft = logicalLeftVisualOverflow(); | 860 LayoutUnit paintInvalidationLogicalLeft = logicalLeftVisualOverflow(); |
| 1118 LayoutUnit paintInvalidationLogicalRight = logicalRightVisualOverflow(); | 861 LayoutUnit paintInvalidationLogicalRight = logicalRightVisualOverflow(); |
| 1119 if (hasOverflowClip()) { | 862 if (hasOverflowClip()) { |
| 1120 // If we have clipped overflow, we should use layout overflow as well, s ince visual overflow from lines didn't propagate to our block's overflow. | 863 // If we have clipped overflow, we should use layout overflow as well, s ince visual overflow from lines didn't propagate to our block's overflow. |
| 1121 // Note the old code did this as well but even for overflow:visible. The addition of hasOverflowClip() at least tightens up the hack a bit. | 864 // Note the old code did this as well but even for overflow:visible. The addition of hasOverflowClip() at least tightens up the hack a bit. |
| 1122 // layoutInlineChildren should be patched to compute the entire paint in validation rect. | 865 // layoutInlineChildren should be patched to compute the entire paint in validation rect. |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 1144 | 887 |
| 1145 m_paintInvalidationLogicalTop = 0; | 888 m_paintInvalidationLogicalTop = 0; |
| 1146 m_paintInvalidationLogicalBottom = 0; | 889 m_paintInvalidationLogicalBottom = 0; |
| 1147 } | 890 } |
| 1148 | 891 |
| 1149 void RenderBlockFlow::paintFloats(PaintInfo& paintInfo, const LayoutPoint& paint Offset, bool preservePhase) | 892 void RenderBlockFlow::paintFloats(PaintInfo& paintInfo, const LayoutPoint& paint Offset, bool preservePhase) |
| 1150 { | 893 { |
| 1151 // FIXME(sky): Remove this. | 894 // FIXME(sky): Remove this. |
| 1152 } | 895 } |
| 1153 | 896 |
| 1154 void RenderBlockFlow::clearFloats(EClear clear) | |
| 1155 { | |
| 1156 // FIXME(sky): Remove this. | |
| 1157 } | |
| 1158 | |
| 1159 LayoutUnit RenderBlockFlow::logicalLeftOffsetForPositioningFloat(LayoutUnit logi calTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemainin g) const | 897 LayoutUnit RenderBlockFlow::logicalLeftOffsetForPositioningFloat(LayoutUnit logi calTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemainin g) const |
| 1160 { | 898 { |
| 1161 // FIXME(sky): Remove this. | 899 // FIXME(sky): Remove this. |
| 1162 LayoutUnit offset = fixedOffset; | 900 LayoutUnit offset = fixedOffset; |
| 1163 return adjustLogicalLeftOffsetForLine(offset, applyTextIndent); | 901 return adjustLogicalLeftOffsetForLine(offset, applyTextIndent); |
| 1164 } | 902 } |
| 1165 | 903 |
| 1166 LayoutUnit RenderBlockFlow::logicalRightOffsetForPositioningFloat(LayoutUnit log icalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaini ng) const | 904 LayoutUnit RenderBlockFlow::logicalRightOffsetForPositioningFloat(LayoutUnit log icalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaini ng) const |
| 1167 { | 905 { |
| 1168 // FIXME(sky): Remove this. | 906 // FIXME(sky): Remove this. |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 1183 LayoutUnit RenderBlockFlow::adjustLogicalRightOffsetForLine(LayoutUnit offsetFro mFloats, bool applyTextIndent) const | 921 LayoutUnit RenderBlockFlow::adjustLogicalRightOffsetForLine(LayoutUnit offsetFro mFloats, bool applyTextIndent) const |
| 1184 { | 922 { |
| 1185 LayoutUnit right = offsetFromFloats; | 923 LayoutUnit right = offsetFromFloats; |
| 1186 | 924 |
| 1187 if (applyTextIndent && !style()->isLeftToRightDirection()) | 925 if (applyTextIndent && !style()->isLeftToRightDirection()) |
| 1188 right -= textIndentOffset(); | 926 right -= textIndentOffset(); |
| 1189 | 927 |
| 1190 return right; | 928 return right; |
| 1191 } | 929 } |
| 1192 | 930 |
| 1193 LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject * floatingObject, LayoutUnit logicalTopOffset) const | |
| 1194 { | |
| 1195 // FIXME(sky): Remove this. | |
| 1196 return LayoutPoint(); | |
| 1197 } | |
| 1198 | |
| 1199 bool RenderBlockFlow::positionNewFloats() | |
| 1200 { | |
| 1201 // FIXME(sky): Remove this. | |
| 1202 return false; | |
| 1203 } | |
| 1204 | |
| 1205 bool RenderBlockFlow::hasOverhangingFloat(RenderBox* renderer) | |
| 1206 { | |
| 1207 // FIXME(sky): Remove this. | |
| 1208 return false; | |
| 1209 } | |
| 1210 | |
| 1211 void RenderBlockFlow::addIntrudingFloats(RenderBlockFlow* prev, LayoutUnit logic alLeftOffset, LayoutUnit logicalTopOffset) | |
| 1212 { | |
| 1213 // FIXME(sky): Remove this. | |
| 1214 } | |
| 1215 | |
| 1216 void RenderBlockFlow::addOverhangingFloats(RenderBlockFlow* child, bool makeChil dPaintOtherFloats) | |
| 1217 { | |
| 1218 // FIXME(sky): Remove this. | |
| 1219 } | |
| 1220 | |
| 1221 bool RenderBlockFlow::hitTestFloats(const HitTestRequest& request, HitTestResult & result, const HitTestLocation& locationInContainer, const LayoutPoint& accumul atedOffset) | 931 bool RenderBlockFlow::hitTestFloats(const HitTestRequest& request, HitTestResult & result, const HitTestLocation& locationInContainer, const LayoutPoint& accumul atedOffset) |
| 1222 { | 932 { |
| 1223 // FIXME(sky): Remove this. | 933 // FIXME(sky): Remove this. |
| 1224 return false; | 934 return false; |
| 1225 } | 935 } |
| 1226 | 936 |
| 1227 LayoutUnit RenderBlockFlow::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const | 937 LayoutUnit RenderBlockFlow::logicalLeftFloatOffsetForLine(LayoutUnit logicalTop, LayoutUnit fixedOffset, LayoutUnit logicalHeight) const |
| 1228 { | 938 { |
| 1229 // FIXME(sky): remove this. | 939 // FIXME(sky): remove this. |
| 1230 return fixedOffset; | 940 return fixedOffset; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1332 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() | 1042 RenderBlockFlow::RenderBlockFlowRareData& RenderBlockFlow::ensureRareData() |
| 1333 { | 1043 { |
| 1334 if (m_rareData) | 1044 if (m_rareData) |
| 1335 return *m_rareData; | 1045 return *m_rareData; |
| 1336 | 1046 |
| 1337 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); | 1047 m_rareData = adoptPtr(new RenderBlockFlowRareData(this)); |
| 1338 return *m_rareData; | 1048 return *m_rareData; |
| 1339 } | 1049 } |
| 1340 | 1050 |
| 1341 } // namespace blink | 1051 } // namespace blink |
| OLD | NEW |