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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlock.cpp

Issue 2404393003: Tie scroll anchoring adjustments to frame lifecycle instead of layout. (Closed)
Patch Set: add DCHECK Created 4 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) 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. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 } 392 }
393 393
394 void LayoutBlock::layout() { 394 void LayoutBlock::layout() {
395 DCHECK(!getScrollableArea() || getScrollableArea()->scrollAnchor()); 395 DCHECK(!getScrollableArea() || getScrollableArea()->scrollAnchor());
396 396
397 LayoutAnalyzer::Scope analyzer(*this); 397 LayoutAnalyzer::Scope analyzer(*this);
398 398
399 bool needsScrollAnchoring = 399 bool needsScrollAnchoring =
400 hasOverflowClip() && getScrollableArea()->shouldPerformScrollAnchoring(); 400 hasOverflowClip() && getScrollableArea()->shouldPerformScrollAnchoring();
401 if (needsScrollAnchoring) 401 if (needsScrollAnchoring)
402 getScrollableArea()->scrollAnchor()->save(); 402 getScrollableArea()->scrollAnchor()->notifyBeforeLayout();
403 403
404 // Table cells call layoutBlock directly, so don't add any logic here. Put 404 // Table cells call layoutBlock directly, so don't add any logic here. Put
405 // code into layoutBlock(). 405 // code into layoutBlock().
406 layoutBlock(false); 406 layoutBlock(false);
407 407
408 // It's safe to check for control clip here, since controls can never be table 408 // It's safe to check for control clip here, since controls can never be table
409 // cells. If we have a lightweight clip, there can never be any overflow from 409 // cells. If we have a lightweight clip, there can never be any overflow from
410 // children. 410 // children.
411 if (hasControlClip() && m_overflow) 411 if (hasControlClip() && m_overflow)
412 clearLayoutOverflow(); 412 clearLayoutOverflow();
413 413
414 invalidateBackgroundObscurationStatus(); 414 invalidateBackgroundObscurationStatus();
415
416 // If clamping is delayed, we will restore in
417 // PaintLayerScrollableArea::clampScrollPositionsAfterLayout.
418 // Restoring during the intermediate layout may clamp the scroller to the
419 // wrong bounds.
420 bool clampingDelayed = PaintLayerScrollableArea::DelayScrollOffsetClampScope::
421 clampingIsDelayed();
422 if (needsScrollAnchoring && !clampingDelayed)
423 getScrollableArea()->scrollAnchor()->restore();
424
425 m_heightAvailableToChildrenChanged = false; 415 m_heightAvailableToChildrenChanged = false;
426 } 416 }
427 417
428 bool LayoutBlock::widthAvailableToChildrenHasChanged() { 418 bool LayoutBlock::widthAvailableToChildrenHasChanged() {
429 // TODO(robhogan): Does m_widthAvailableToChildrenChanged always get reset 419 // TODO(robhogan): Does m_widthAvailableToChildrenChanged always get reset
430 // when it needs to? 420 // when it needs to?
431 bool widthAvailableToChildrenHasChanged = m_widthAvailableToChildrenChanged; 421 bool widthAvailableToChildrenHasChanged = m_widthAvailableToChildrenChanged;
432 m_widthAvailableToChildrenChanged = false; 422 m_widthAvailableToChildrenChanged = false;
433 423
434 // If we use border-box sizing, have percentage padding, and our parent has 424 // If we use border-box sizing, have percentage padding, and our parent has
(...skipping 1777 matching lines...) Expand 10 before | Expand all | Expand 10 after
2212 } 2202 }
2213 2203
2214 return availableHeight; 2204 return availableHeight;
2215 } 2205 }
2216 2206
2217 bool LayoutBlock::hasDefiniteLogicalHeight() const { 2207 bool LayoutBlock::hasDefiniteLogicalHeight() const {
2218 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1); 2208 return availableLogicalHeightForPercentageComputation() != LayoutUnit(-1);
2219 } 2209 }
2220 2210
2221 } // namespace blink 2211 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.cpp ('k') | third_party/WebKit/Source/core/layout/ScrollAnchor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698