Bug 1519553 - Don't round scroll anchor adjustments to device pixels. r=dholbert, a=jcristau
authorRyan Hunt <rhunt@eqrion.net>
Thu, 07 Feb 2019 20:39:49 -0600
changeset 516015 92af0592bc43c8c11e57fd227ce6568bb0b1d0ea
parent 516014 310de8854f9bf3c51139db12a7e01d8a378b7fd6
child 516016 1d2492f5e16c30063ffe410223d604776caa0ad1
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert, jcristau
bugs1519553
milestone66.0
Bug 1519553 - Don't round scroll anchor adjustments to device pixels. r=dholbert, a=jcristau Differential Revision: https://phabricator.services.mozilla.com/D19107
layout/generic/ScrollAnchorContainer.cpp
--- a/layout/generic/ScrollAnchorContainer.cpp
+++ b/layout/generic/ScrollAnchorContainer.cpp
@@ -340,25 +340,23 @@ void ScrollAnchorContainer::ApplyAdjustm
       physicalAdjustment.x = logicalAdjustment;
       break;
     }
     case WritingMode::eBlockRL: {
       physicalAdjustment.x = -logicalAdjustment;
       break;
     }
   }
-  nsIntPoint physicalDevicePixels = physicalAdjustment.ToNearestPixels(
-      Frame()->PresContext()->AppUnitsPerDevPixel());
 
   MOZ_ASSERT(!mApplyingAnchorAdjustment);
   // We should use AutoRestore here, but that doesn't work with bitfields
   mApplyingAnchorAdjustment = true;
-  mScrollFrame->ScrollBy(
-      physicalDevicePixels, nsIScrollableFrame::DEVICE_PIXELS,
-      nsIScrollableFrame::INSTANT, nullptr, nsGkAtoms::relative);
+  mScrollFrame->ScrollTo(
+      mScrollFrame->GetScrollPosition() + physicalAdjustment,
+      nsIScrollableFrame::INSTANT, nsGkAtoms::relative);
   mApplyingAnchorAdjustment = false;
 
   nsPresContext* pc = Frame()->PresContext();
   Document* doc = pc->Document();
   doc->UpdateForScrollAnchorAdjustment(logicalAdjustment);
 
   // The anchor position may not be in the same relative position after
   // adjustment. Update ourselves so we have consistent state.