Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Side by Side Diff: sky/engine/core/rendering/RenderBlockFlow.cpp

Issue 707233006: Remove scrollbar width/height computations from layout. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 inline void RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, SubtreeLayou tScope& layoutScope) 92 inline void RenderBlockFlow::layoutBlockFlow(bool relayoutChildren, SubtreeLayou tScope& layoutScope)
93 { 93 {
94 LayoutUnit oldLeft = logicalLeft(); 94 LayoutUnit oldLeft = logicalLeft();
95 bool logicalWidthChanged = updateLogicalWidthAndColumnWidth(); 95 bool logicalWidthChanged = updateLogicalWidthAndColumnWidth();
96 relayoutChildren |= logicalWidthChanged; 96 relayoutChildren |= logicalWidthChanged;
97 97
98 LayoutState state(*this, locationOffset(), logicalWidthChanged); 98 LayoutState state(*this, locationOffset(), logicalWidthChanged);
99 99
100 LayoutUnit beforeEdge = borderBefore() + paddingBefore(); 100 LayoutUnit beforeEdge = borderBefore() + paddingBefore();
101 LayoutUnit afterEdge = borderAfter() + paddingAfter() + scrollbarLogicalHeig ht(); 101 LayoutUnit afterEdge = borderAfter() + paddingAfter();
102 LayoutUnit previousHeight = logicalHeight(); 102 LayoutUnit previousHeight = logicalHeight();
103 setLogicalHeight(beforeEdge); 103 setLogicalHeight(beforeEdge);
104 104
105 m_paintInvalidationLogicalTop = 0; 105 m_paintInvalidationLogicalTop = 0;
106 m_paintInvalidationLogicalBottom = 0; 106 m_paintInvalidationLogicalBottom = 0;
107 if (!firstChild() && !isAnonymousBlock()) 107 if (!firstChild() && !isAnonymousBlock())
108 setChildrenInline(true); 108 setChildrenInline(true);
109 109
110 if (childrenInline()) 110 if (childrenInline())
111 layoutInlineChildren(relayoutChildren, m_paintInvalidationLogicalTop, m_ paintInvalidationLogicalBottom, afterEdge); 111 layoutInlineChildren(relayoutChildren, m_paintInvalidationLogicalTop, m_ paintInvalidationLogicalBottom, afterEdge);
112 else 112 else
113 layoutBlockChildren(relayoutChildren, layoutScope, beforeEdge, afterEdge ); 113 layoutBlockChildren(relayoutChildren, layoutScope, beforeEdge, afterEdge );
114 114
115 LayoutUnit oldClientAfterEdge = clientLogicalBottom(); 115 LayoutUnit oldClientAfterEdge = clientLogicalBottom();
116 116
117 updateLogicalHeight(); 117 updateLogicalHeight();
118 118
119 if (previousHeight != logicalHeight()) 119 if (previousHeight != logicalHeight())
120 relayoutChildren = true; 120 relayoutChildren = true;
121 121
122 layoutPositionedObjects(relayoutChildren || isDocumentElement(), oldLeft != logicalLeft() ? ForcedLayoutAfterContainingBlockMoved : DefaultLayout); 122 layoutPositionedObjects(relayoutChildren || isDocumentElement(), oldLeft != logicalLeft() ? ForcedLayoutAfterContainingBlockMoved : DefaultLayout);
123 123
124 // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway). 124 // Add overflow from children (unless we're multi-column, since in that case all our child overflow is clipped anyway).
125 computeOverflow(oldClientAfterEdge); 125 computeOverflow(oldClientAfterEdge);
126 } 126 }
127 127
128 void RenderBlockFlow::determineLogicalLeftPositionForChild(RenderBox* child) 128 void RenderBlockFlow::determineLogicalLeftPositionForChild(RenderBox* child)
129 { 129 {
130 LayoutUnit startPosition = borderStart() + paddingStart(); 130 LayoutUnit startPosition = borderStart() + paddingStart();
131 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
132 startPosition -= verticalScrollbarWidth();
133 LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + ava ilableLogicalWidth(); 131 LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + ava ilableLogicalWidth();
134 132
135 LayoutUnit childMarginStart = marginStartForChild(child); 133 LayoutUnit childMarginStart = marginStartForChild(child);
136 LayoutUnit newPosition = startPosition + childMarginStart; 134 LayoutUnit newPosition = startPosition + childMarginStart;
137 135
138 // If the child has an offset from the content edge to avoid floats then use that, otherwise let any negative 136 // If the child has an offset from the content edge to avoid floats then use that, otherwise let any negative
139 // margin pull it back over the content edge or any positive margin push it out. 137 // margin pull it back over the content edge or any positive margin push it out.
140 if (child->style()->marginStartUsing(style()).isAuto()) 138 if (child->style()->marginStartUsing(style()).isAuto())
141 newPosition = std::max(newPosition, childMarginStart); 139 newPosition = std::max(newPosition, childMarginStart);
142 140
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 } 347 }
350 return logicalRight; 348 return logicalRight;
351 } 349 }
352 350
353 RootInlineBox* RenderBlockFlow::createRootInlineBox() 351 RootInlineBox* RenderBlockFlow::createRootInlineBox()
354 { 352 {
355 return new RootInlineBox(*this); 353 return new RootInlineBox(*this);
356 } 354 }
357 355
358 } // namespace blink 356 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderBlock.cpp ('k') | sky/engine/core/rendering/RenderBlockLineLayout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698