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

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

Issue 1974953002: Descend into node with overflow and floating content (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/ScrollAnchor.h" 5 #include "core/layout/ScrollAnchor.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/frame/UseCounter.h" 8 #include "core/frame/UseCounter.h"
9 #include "core/layout/LayoutView.h" 9 #include "core/layout/LayoutView.h"
10 #include "core/layout/line/InlineTextBox.h" 10 #include "core/layout/line/InlineTextBox.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 ASSERT_NOT_REACHED(); 66 ASSERT_NOT_REACHED();
67 return LayoutPoint(); 67 return LayoutPoint();
68 } 68 }
69 69
70 // Bounds of the LayoutObject relative to the scroller's visible content rect. 70 // Bounds of the LayoutObject relative to the scroller's visible content rect.
71 static LayoutRect relativeBounds(const LayoutObject* layoutObject, const Scrolla bleArea* scroller) 71 static LayoutRect relativeBounds(const LayoutObject* layoutObject, const Scrolla bleArea* scroller)
72 { 72 {
73 LayoutRect localBounds; 73 LayoutRect localBounds;
74 if (layoutObject->isBox()) { 74 if (layoutObject->isBox()) {
75 localBounds = toLayoutBox(layoutObject)->borderBoxRect(); 75 localBounds = toLayoutBox(layoutObject)->borderBoxRect();
76 // borderBoxRect doesn't include overflow content and floats.
77 LayoutUnit maxHeight = std::max(localBounds.height(), toLayoutBox(layout Object)->layoutOverflowRect().height());
78 if (layoutObject->isLayoutBlockFlow() && toLayoutBlockFlow(layoutObject) ->containsFloats()) {
79 // Note that lowestFloatLogicalBottom doesn't include floating
80 // grandchildren.
81 maxHeight = std::max(maxHeight, toLayoutBlockFlow(layoutObject)->low estFloatLogicalBottom());
82 }
83 localBounds.setHeight(maxHeight);
76 } else if (layoutObject->isText()) { 84 } else if (layoutObject->isText()) {
77 // TODO(skobes): Use first and last InlineTextBox only? 85 // TODO(skobes): Use first and last InlineTextBox only?
78 for (InlineTextBox* box = toLayoutText(layoutObject)->firstTextBox(); bo x; box = box->nextTextBox()) 86 for (InlineTextBox* box = toLayoutText(layoutObject)->firstTextBox(); bo x; box = box->nextTextBox())
79 localBounds.unite(box->calculateBoundaries()); 87 localBounds.unite(box->calculateBoundaries());
80 } else { 88 } else {
81 // Only LayoutBox and LayoutText are supported. 89 // Only LayoutBox and LayoutText are supported.
82 ASSERT_NOT_REACHED(); 90 ASSERT_NOT_REACHED();
83 } 91 }
84 LayoutRect relativeBounds = LayoutRect(layoutObject->localToAncestorQuad( 92 LayoutRect relativeBounds = LayoutRect(layoutObject->localToAncestorQuad(
85 FloatRect(localBounds), scrollerLayoutBox(scroller)).boundingBox()); 93 FloatRect(localBounds), scrollerLayoutBox(scroller)).boundingBox());
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 void ScrollAnchor::clear() 222 void ScrollAnchor::clear()
215 { 223 {
216 LayoutObject* anchorObject = m_anchorObject; 224 LayoutObject* anchorObject = m_anchorObject;
217 m_anchorObject = nullptr; 225 m_anchorObject = nullptr;
218 226
219 if (anchorObject) 227 if (anchorObject)
220 anchorObject->maybeClearIsScrollAnchorObject(); 228 anchorObject->maybeClearIsScrollAnchorObject();
221 } 229 }
222 230
223 } // namespace blink 231 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlow.h ('k') | third_party/WebKit/Source/core/layout/ScrollAnchorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698