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

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

Issue 2518363003: Refactor InlineBox::calculateBoundaries() (Closed)
Patch Set: Rebase Created 4 years 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/LayoutBlockFlow.h" 9 #include "core/layout/LayoutBlockFlow.h"
10 #include "core/layout/api/LayoutBoxItem.h" 10 #include "core/layout/api/LayoutBoxItem.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 maxHeight = std::max( 86 maxHeight = std::max(
87 maxHeight, 87 maxHeight,
88 toLayoutBlockFlow(layoutObject)->lowestFloatLogicalBottom()); 88 toLayoutBlockFlow(layoutObject)->lowestFloatLogicalBottom());
89 } 89 }
90 localBounds.setHeight(maxHeight); 90 localBounds.setHeight(maxHeight);
91 } 91 }
92 } else if (layoutObject->isText()) { 92 } else if (layoutObject->isText()) {
93 // TODO(skobes): Use first and last InlineTextBox only? 93 // TODO(skobes): Use first and last InlineTextBox only?
94 for (InlineTextBox* box = toLayoutText(layoutObject)->firstTextBox(); box; 94 for (InlineTextBox* box = toLayoutText(layoutObject)->firstTextBox(); box;
95 box = box->nextTextBox()) 95 box = box->nextTextBox())
96 localBounds.unite(box->calculateBoundaries()); 96 localBounds.unite(box->frameRect());
97 } else { 97 } else {
98 // Only LayoutBox and LayoutText are supported. 98 // Only LayoutBox and LayoutText are supported.
99 ASSERT_NOT_REACHED(); 99 ASSERT_NOT_REACHED();
100 } 100 }
101 101
102 LayoutRect relativeBounds = LayoutRect( 102 LayoutRect relativeBounds = LayoutRect(
103 scroller->localToVisibleContentQuad(FloatRect(localBounds), layoutObject) 103 scroller->localToVisibleContentQuad(FloatRect(localBounds), layoutObject)
104 .boundingBox()); 104 .boundingBox());
105 105
106 return relativeBounds; 106 return relativeBounds;
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 bool ScrollAnchor::refersTo(const LayoutObject* layoutObject) const { 330 bool ScrollAnchor::refersTo(const LayoutObject* layoutObject) const {
331 return m_anchorObject == layoutObject; 331 return m_anchorObject == layoutObject;
332 } 332 }
333 333
334 void ScrollAnchor::notifyRemoved(LayoutObject* layoutObject) { 334 void ScrollAnchor::notifyRemoved(LayoutObject* layoutObject) {
335 if (m_anchorObject == layoutObject) 335 if (m_anchorObject == layoutObject)
336 clearSelf(); 336 clearSelf();
337 } 337 }
338 338
339 } // namespace blink 339 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698