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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
280 // If we are self-collapsing with self-collapsing descendants this will get set to save us burrowing through our | 280 // If we are self-collapsing with self-collapsing descendants this will get set to save us burrowing through our |
281 // descendants every time in |isSelfCollapsingBlock|. We reset it here so th at |isSelfCollapsingBlock| attempts to burrow | 281 // descendants every time in |isSelfCollapsingBlock|. We reset it here so th at |isSelfCollapsingBlock| attempts to burrow |
282 // at least once and so that it always gives a reliable result reflecting th e latest layout. | 282 // at least once and so that it always gives a reliable result reflecting th e latest layout. |
283 m_hasOnlySelfCollapsingChildren = false; | 283 m_hasOnlySelfCollapsingChildren = false; |
284 | 284 |
285 if (!relayoutChildren && simplifiedLayout()) | 285 if (!relayoutChildren && simplifiedLayout()) |
286 return; | 286 return; |
287 | 287 |
288 LayoutAnalyzer::BlockScope analyzer(*this); | 288 LayoutAnalyzer::BlockScope analyzer(*this); |
289 SubtreeLayoutScope layoutScope(*this); | 289 SubtreeLayoutScope layoutScope(*this); |
290 if (scrollAnchoringEnabled() && hasOverflowClip()) | |
291 scrollableArea()->scrollAnchor().save(); | |
ojan
2016/02/02 06:51:01
Can you instead do this in LayoutBlock::layout()?
skobes
2016/02/02 22:39:10
I thought about this but was scared off by the com
ojan
2016/02/03 06:17:52
Yes, that way the code will work for flex/grid/etc
| |
290 | 292 |
291 // Multiple passes might be required for column based layout. | 293 // Multiple passes might be required for column based layout. |
292 // The number of passes could be as high as the number of columns. | 294 // The number of passes could be as high as the number of columns. |
293 bool done = false; | 295 bool done = false; |
294 LayoutUnit pageLogicalHeight = 0; | 296 LayoutUnit pageLogicalHeight = 0; |
295 while (!done) | 297 while (!done) |
296 done = layoutBlockFlow(relayoutChildren, pageLogicalHeight, layoutScope) ; | 298 done = layoutBlockFlow(relayoutChildren, pageLogicalHeight, layoutScope) ; |
297 | 299 |
298 LayoutView* layoutView = view(); | 300 LayoutView* layoutView = view(); |
299 if (layoutView->layoutState()->pageLogicalHeight()) | 301 if (layoutView->layoutState()->pageLogicalHeight()) |
300 setPageLogicalOffset(layoutView->layoutState()->pageLogicalOffset(*this, logicalTop())); | 302 setPageLogicalOffset(layoutView->layoutState()->pageLogicalOffset(*this, logicalTop())); |
301 | 303 |
302 updateLayerTransformAfterLayout(); | 304 updateLayerTransformAfterLayout(); |
303 | 305 |
304 // Update our scroll information if we're overflow:auto/scroll/hidden now th at we know if | 306 // Update our scroll information if we're overflow:auto/scroll/hidden now th at we know if |
305 // we overflow or not. | 307 // we overflow or not. |
306 updateScrollInfoAfterLayout(); | 308 updateScrollInfoAfterLayout(); |
309 if (scrollAnchoringEnabled() && hasOverflowClip()) | |
310 scrollableArea()->scrollAnchor().restore(); | |
307 | 311 |
308 if (m_paintInvalidationLogicalTop != m_paintInvalidationLogicalBottom) { | 312 if (m_paintInvalidationLogicalTop != m_paintInvalidationLogicalBottom) { |
309 bool hasVisibleContent = style()->visibility() == VISIBLE; | 313 bool hasVisibleContent = style()->visibility() == VISIBLE; |
310 if (!hasVisibleContent) { | 314 if (!hasVisibleContent) { |
311 PaintLayer* layer = enclosingLayer(); | 315 PaintLayer* layer = enclosingLayer(); |
312 layer->updateDescendantDependentFlags(); | 316 layer->updateDescendantDependentFlags(); |
313 hasVisibleContent = layer->hasVisibleContent(); | 317 hasVisibleContent = layer->hasVisibleContent(); |
314 } | 318 } |
315 if (hasVisibleContent) | 319 if (hasVisibleContent) |
316 setShouldInvalidateOverflowForPaint(); | 320 setShouldInvalidateOverflowForPaint(); |
(...skipping 2807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3124 FrameView* frameView = document().view(); | 3128 FrameView* frameView = document().view(); |
3125 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); | 3129 LayoutUnit top = (style()->position() == FixedPosition) ? 0 : frameView->scr ollOffset().height(); |
3126 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); | 3130 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height( ); |
3127 if (size().height() < visibleHeight) | 3131 if (size().height() < visibleHeight) |
3128 top += (visibleHeight - size().height()) / 2; | 3132 top += (visibleHeight - size().height()) / 2; |
3129 setY(top); | 3133 setY(top); |
3130 dialog->setCentered(top); | 3134 dialog->setCentered(top); |
3131 } | 3135 } |
3132 | 3136 |
3133 } // namespace blink | 3137 } // namespace blink |
OLD | NEW |