Chromium Code Reviews| 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 deleteLineBoxTree(); | 254 deleteLineBoxTree(); |
| 255 } | 255 } |
| 256 | 256 |
| 257 bool RenderBlock::widthAvailableToChildrenHasChanged() | 257 bool RenderBlock::widthAvailableToChildrenHasChanged() |
| 258 { | 258 { |
| 259 bool widthAvailableToChildrenHasChanged = m_hasBorderOrPaddingLogicalWidthCh anged; | 259 bool widthAvailableToChildrenHasChanged = m_hasBorderOrPaddingLogicalWidthCh anged; |
| 260 m_hasBorderOrPaddingLogicalWidthChanged = false; | 260 m_hasBorderOrPaddingLogicalWidthChanged = false; |
| 261 | 261 |
| 262 // If we use border-box sizing, have percentage padding, and our parent has changed width then the width available to our children has changed even | 262 // If we use border-box sizing, have percentage padding, and our parent has changed width then the width available to our children has changed even |
| 263 // though our own width has remained the same. | 263 // though our own width has remained the same. |
| 264 widthAvailableToChildrenHasChanged |= style()->boxSizing() == BORDER_BOX && needsPreferredWidthsRecalculation() && view()->layoutState()->containingBlockLog icalWidthChanged(); | 264 widthAvailableToChildrenHasChanged |= style()->boxSizing() == BORDER_BOX && needsPreferredWidthsRecalculation(); |
|
ojan
2015/02/20 20:14:32
This is the potential change in behavior that's in
| |
| 265 | 265 |
| 266 return widthAvailableToChildrenHasChanged; | 266 return widthAvailableToChildrenHasChanged; |
| 267 } | 267 } |
| 268 | 268 |
| 269 bool RenderBlock::updateLogicalWidthAndColumnWidth() | 269 bool RenderBlock::updateLogicalWidthAndColumnWidth() |
| 270 { | 270 { |
| 271 LayoutUnit oldWidth = logicalWidth(); | 271 LayoutUnit oldWidth = logicalWidth(); |
| 272 updateLogicalWidth(); | 272 updateLogicalWidth(); |
| 273 return oldWidth != logicalWidth() || widthAvailableToChildrenHasChanged(); | 273 return oldWidth != logicalWidth() || widthAvailableToChildrenHasChanged(); |
| 274 } | 274 } |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 343 bool RenderBlock::simplifiedLayout() | 343 bool RenderBlock::simplifiedLayout() |
| 344 { | 344 { |
| 345 // Check if we need to do a full layout. | 345 // Check if we need to do a full layout. |
| 346 if (normalChildNeedsLayout() || selfNeedsLayout()) | 346 if (normalChildNeedsLayout() || selfNeedsLayout()) |
| 347 return false; | 347 return false; |
| 348 | 348 |
| 349 // Check that we actually need to do a simplified layout. | 349 // Check that we actually need to do a simplified layout. |
| 350 if (!posChildNeedsLayout() && !(needsSimplifiedNormalFlowLayout() || needsPo sitionedMovementLayout())) | 350 if (!posChildNeedsLayout() && !(needsSimplifiedNormalFlowLayout() || needsPo sitionedMovementLayout())) |
| 351 return false; | 351 return false; |
| 352 | 352 |
| 353 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovementOnly ()) | |
| 354 return false; | |
| 353 | 355 |
| 354 { | 356 // Lay out positioned descendants or objects that just need to recompute ove rflow. |
| 355 // LayoutState needs this deliberate scope to pop before paint invalidat ion. | 357 if (needsSimplifiedNormalFlowLayout()) |
| 356 LayoutState state(*this, locationOffset()); | 358 simplifiedNormalFlowLayout(); |
| 357 | 359 |
| 358 if (needsPositionedMovementLayout() && !tryLayoutDoingPositionedMovement Only()) | 360 if (posChildNeedsLayout() || needsPositionedMovementLayout()) |
| 359 return false; | 361 layoutPositionedObjects(false, needsPositionedMovementLayout() ? ForcedL ayoutAfterContainingBlockMoved : DefaultLayout); |
| 360 | 362 |
| 361 // Lay out positioned descendants or objects that just need to recompute overflow. | 363 // Recompute our overflow information. |
| 362 if (needsSimplifiedNormalFlowLayout()) | 364 // FIXME: We could do better here by computing a temporary overflow object f rom layoutPositionedObjects and only |
| 363 simplifiedNormalFlowLayout(); | 365 // updating our overflow if we either used to have overflow or if the new te mporary object has overflow. |
| 364 | 366 // For now just always recompute overflow. This is no worse performance-wise than the old code that called rightmostPosition and |
| 365 if (posChildNeedsLayout() || needsPositionedMovementLayout()) | 367 // lowestPosition on every relayout so it's not a regression. |
| 366 layoutPositionedObjects(false, needsPositionedMovementLayout() ? For cedLayoutAfterContainingBlockMoved : DefaultLayout); | 368 // computeOverflow expects the bottom edge before we clamp our height. Since this information isn't available during |
| 367 | 369 // simplifiedLayout, we cache the value in m_overflow. |
| 368 // Recompute our overflow information. | 370 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layoutClie ntAfterEdge() : clientLogicalBottom(); |
| 369 // FIXME: We could do better here by computing a temporary overflow obje ct from layoutPositionedObjects and only | 371 computeOverflow(oldClientAfterEdge, true); |
| 370 // updating our overflow if we either used to have overflow or if the ne w temporary object has overflow. | |
| 371 // For now just always recompute overflow. This is no worse performance- wise than the old code that called rightmostPosition and | |
| 372 // lowestPosition on every relayout so it's not a regression. | |
| 373 // computeOverflow expects the bottom edge before we clamp our height. S ince this information isn't available during | |
| 374 // simplifiedLayout, we cache the value in m_overflow. | |
| 375 LayoutUnit oldClientAfterEdge = hasRenderOverflow() ? m_overflow->layout ClientAfterEdge() : clientLogicalBottom(); | |
| 376 computeOverflow(oldClientAfterEdge, true); | |
| 377 } | |
| 378 | 372 |
| 379 updateLayerTransformAfterLayout(); | 373 updateLayerTransformAfterLayout(); |
| 380 | 374 |
| 381 clearNeedsLayout(); | 375 clearNeedsLayout(); |
| 382 return true; | 376 return true; |
| 383 } | 377 } |
| 384 | 378 |
| 385 LayoutUnit RenderBlock::marginIntrinsicLogicalWidthForChild(RenderBox* child) co nst | 379 LayoutUnit RenderBlock::marginIntrinsicLogicalWidthForChild(RenderBox* child) co nst |
| 386 { | 380 { |
| 387 // A margin has three types: fixed, percentage, and auto (variable). | 381 // A margin has three types: fixed, percentage, and auto (variable). |
| (...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1738 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const | 1732 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const |
| 1739 { | 1733 { |
| 1740 showRenderObject(); | 1734 showRenderObject(); |
| 1741 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) | 1735 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) |
| 1742 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); | 1736 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); |
| 1743 } | 1737 } |
| 1744 | 1738 |
| 1745 #endif | 1739 #endif |
| 1746 | 1740 |
| 1747 } // namespace blink | 1741 } // namespace blink |
| OLD | NEW |