| OLD | NEW |
| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 return; | 256 return; |
| 257 IntSize adjustment = computeAdjustment(); | 257 IntSize adjustment = computeAdjustment(); |
| 258 if (adjustment.isZero()) | 258 if (adjustment.isZero()) |
| 259 return; | 259 return; |
| 260 | 260 |
| 261 if (m_scrollAnchorDisablingStyleChanged) { | 261 if (m_scrollAnchorDisablingStyleChanged) { |
| 262 // Note that we only clear if the adjustment would have been non-zero. | 262 // Note that we only clear if the adjustment would have been non-zero. |
| 263 // This minimizes redundant calls to findAnchor. | 263 // This minimizes redundant calls to findAnchor. |
| 264 // TODO(skobes): add UMA metric for this. | 264 // TODO(skobes): add UMA metric for this. |
| 265 clear(); | 265 clear(); |
| 266 |
| 267 DEFINE_STATIC_LOCAL(EnumerationHistogram, suppressedBySanaclapHistogram, |
| 268 ("Layout.ScrollAnchor.SuppressedBySanaclap", 2)); |
| 269 suppressedBySanaclapHistogram.count(1); |
| 270 |
| 266 return; | 271 return; |
| 267 } | 272 } |
| 268 | 273 |
| 269 m_scroller->setScrollPosition(m_scroller->scrollPositionDouble() + adjustmen
t, AnchoringScroll); | 274 m_scroller->setScrollPosition(m_scroller->scrollPositionDouble() + adjustmen
t, AnchoringScroll); |
| 270 | 275 |
| 271 // Update UMA metric. | 276 // Update UMA metric. |
| 272 DEFINE_STATIC_LOCAL(EnumerationHistogram, adjustedOffsetHistogram, | 277 DEFINE_STATIC_LOCAL(EnumerationHistogram, adjustedOffsetHistogram, |
| 273 ("Layout.ScrollAnchor.AdjustedScrollOffset", 2)); | 278 ("Layout.ScrollAnchor.AdjustedScrollOffset", 2)); |
| 274 adjustedOffsetHistogram.count(1); | 279 adjustedOffsetHistogram.count(1); |
| 275 UseCounter::count(scrollerLayoutBox(m_scroller)->document(), UseCounter::Scr
ollAnchored); | 280 UseCounter::count(scrollerLayoutBox(m_scroller)->document(), UseCounter::Scr
ollAnchored); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 289 return m_anchorObject == layoutObject; | 294 return m_anchorObject == layoutObject; |
| 290 } | 295 } |
| 291 | 296 |
| 292 void ScrollAnchor::notifyRemoved(LayoutObject* layoutObject) | 297 void ScrollAnchor::notifyRemoved(LayoutObject* layoutObject) |
| 293 { | 298 { |
| 294 if (m_anchorObject == layoutObject) | 299 if (m_anchorObject == layoutObject) |
| 295 clear(); | 300 clear(); |
| 296 } | 301 } |
| 297 | 302 |
| 298 } // namespace blink | 303 } // namespace blink |
| OLD | NEW |