Commit 24337033 authored by Robert O'Callahan's avatar Robert O'Callahan
Browse files

Bug 681192. Part 12: more fixes to remove unnecessary rounding to pixels. r=matspal

--HG--
extra : rebase_source : 39f2c0ef3220b3f0d4f6bc2564a86daa2112dc3b
parent e30cdb3c
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -2386,12 +2386,6 @@ nsGfxScrollFrameInner::GetScrollbarStylesFromFrame() const
  return result;
}

static nscoord
AlignToDevPixelRoundingToZero(nscoord aVal, PRInt32 aAppUnitsPerDevPixel)
{
  return (aVal/aAppUnitsPerDevPixel)*aAppUnitsPerDevPixel;
}

nsRect
nsGfxScrollFrameInner::GetScrollRange() const
{
@@ -2927,11 +2921,14 @@ void nsGfxScrollFrameInner::CurPosAttributeChanged(nsIContent* aContent)
                             &allowedRange.x, &allowedRange.width);
  dest.y = GetCoordAttribute(mVScrollbarBox, nsGkAtoms::curpos, current.y,
                             &allowedRange.y, &allowedRange.height);
  current += scrolledRect.TopLeft();
  dest += scrolledRect.TopLeft();
  allowedRange += scrolledRect.TopLeft();

  // If we have an async scroll pending don't stomp on that by calling ScrollTo.
  if (mAsyncScroll && allowedRange.Contains(GetScrollPosition())) {
  // Don't try to scroll if we're already at an acceptable place.
  // Don't call Contains here since Contains returns false when the point is
  // on the bottom or right edge of the rectangle.
  if (allowedRange.ClampPoint(current) == current) {
    return;
  }

@@ -3494,6 +3491,12 @@ nsGfxScrollFrameInner::ReflowFinished()
  // do anything.
  nsPoint currentScrollPos = GetScrollPosition();
  ScrollToImpl(currentScrollPos, nsRect(currentScrollPos, nsSize(0, 0)));
  if (!mAsyncScroll) {
    // We need to have mDestination track the current scroll position,
    // in case it falls outside the new reflow area. mDestination is used
    // by ScrollBy as its starting position.
    mDestination = GetScrollPosition();
  }

  if (NS_SUBTREE_DIRTY(mOuter) || !mUpdateScrollbarAttributes)
    return false;
+1 −4
Original line number Diff line number Diff line
@@ -819,12 +819,9 @@ protected:
    /* 
     * For RTL frames, restore the original scrolled position of the right
     * edge, then subtract the current width to find the physical position.
     * This can break the invariant that the scroll position is a multiple of
     * device pixels, so round off the result to the nearest device pixel.
     */
    if (!mInner.IsLTR()) {
      aRect.x = PresContext()->RoundAppUnitsToNearestDevPixels(
         mInner.mScrollPort.XMost() - aScrollPosition.x - aRect.width);
      aRect.x = mInner.mScrollPort.XMost() - aScrollPosition.x - aRect.width;
    }
    mInner.mScrolledFrame->SetBounds(aState, aRect, aRemoveOverflowAreas);
  }