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

Unified Diff: third_party/WebKit/Source/core/layout/ScrollAnchor.cpp

Issue 1945353002: [Layout API] Start converting ScrollAnchor to new layout API (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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
diff --git a/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp b/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
index 642b37ec1613f5c21cb729a55778a05187885cf5..2d805f19d6f25979023b1f490169cb57cc4a0e4d 100644
--- a/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
+++ b/third_party/WebKit/Source/core/layout/ScrollAnchor.cpp
@@ -28,6 +28,8 @@ ScrollAnchor::~ScrollAnchor()
{
}
+// TODO(pilgrim) replace all instances of scrollerLayoutBox with scrollerLayoutBoxItem
+// https://crbug.com/499321
static LayoutBox* scrollerLayoutBox(const ScrollableArea* scroller)
{
LayoutBox* box = scroller->isFrameView()
@@ -37,6 +39,15 @@ static LayoutBox* scrollerLayoutBox(const ScrollableArea* scroller)
return box;
}
+static LayoutBoxItem scrollerLayoutBoxItem(const ScrollableArea* scroller)
+{
+ LayoutBoxItem box = scroller->isFrameView()
+ ? toFrameView(scroller)->layoutViewItem()
+ : LayoutBoxItem(&toPaintLayerScrollableArea(scroller)->box());
+ ASSERT(!box.isNull());
+ return box;
+}
+
static Corner cornerFromCandidateRect(LayoutRect candidateRect, LayoutRect visibleRect)
{
if (visibleRect.contains(candidateRect.minXMinYCorner()))
@@ -110,7 +121,7 @@ ScrollAnchor::ExamineResult ScrollAnchor::examine(const LayoutObject* candidate)
return ExamineResult(Skip);
LayoutRect candidateRect = relativeBounds(candidate, m_scroller);
- LayoutRect visibleRect = scrollerLayoutBox(m_scroller)->overflowClipRect(LayoutPoint());
+ LayoutRect visibleRect = scrollerLayoutBoxItem(m_scroller).overflowClipRect(LayoutPoint());
bool occupiesSpace = candidateRect.width() > 0 && candidateRect.height() > 0;
if (occupiesSpace && visibleRect.intersects(candidateRect)) {
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/layout/api/LayoutBoxItem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698