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(); |
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; | 296 LayoutUnit pageLogicalHeight; |
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 2518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2835 FrameView* frameView = document().view(); | 2839 FrameView* frameView = document().view(); |
2836 LayoutUnit top = LayoutUnit((style()->position() == FixedPosition) ? 0 : fra
meView->scrollOffset().height()); | 2840 LayoutUnit top = LayoutUnit((style()->position() == FixedPosition) ? 0 : fra
meView->scrollOffset().height()); |
2837 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); | 2841 int visibleHeight = frameView->visibleContentRect(IncludeScrollbars).height(
); |
2838 if (size().height() < visibleHeight) | 2842 if (size().height() < visibleHeight) |
2839 top += (visibleHeight - size().height()) / 2; | 2843 top += (visibleHeight - size().height()) / 2; |
2840 setY(top); | 2844 setY(top); |
2841 dialog->setCentered(top); | 2845 dialog->setCentered(top); |
2842 } | 2846 } |
2843 | 2847 |
2844 } // namespace blink | 2848 } // namespace blink |
OLD | NEW |