зеркало из https://github.com/mozilla/gecko-dev.git
Bug 888321 - Pass CSSIntPoint to ScrollToCSSPixels; f=kats r=roc
This commit is contained in:
Родитель
85fe8f6af4
Коммит
8e0a6b5a85
|
@ -39,6 +39,7 @@
|
|||
#include "nsAttrValue.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "nsIHTMLCollection.h"
|
||||
#include "Units.h"
|
||||
|
||||
class nsIDOMEventListener;
|
||||
class nsIFrame;
|
||||
|
@ -674,8 +675,8 @@ public:
|
|||
{
|
||||
nsIScrollableFrame* sf = GetScrollFrame();
|
||||
if (sf) {
|
||||
sf->ScrollToCSSPixels(nsIntPoint(sf->GetScrollPositionCSSPixels().x,
|
||||
aScrollTop));
|
||||
sf->ScrollToCSSPixels(CSSIntPoint(sf->GetScrollPositionCSSPixels().x,
|
||||
aScrollTop));
|
||||
}
|
||||
}
|
||||
int32_t ScrollLeft()
|
||||
|
@ -687,8 +688,8 @@ public:
|
|||
{
|
||||
nsIScrollableFrame* sf = GetScrollFrame();
|
||||
if (sf) {
|
||||
sf->ScrollToCSSPixels(nsIntPoint(aScrollLeft,
|
||||
sf->GetScrollPositionCSSPixels().y));
|
||||
sf->ScrollToCSSPixels(CSSIntPoint(aScrollLeft,
|
||||
sf->GetScrollPositionCSSPixels().y));
|
||||
}
|
||||
}
|
||||
int32_t ScrollWidth();
|
||||
|
|
|
@ -6067,7 +6067,7 @@ nsGlobalWindow::ScrollTo(const CSSIntPoint& aScroll)
|
|||
if (scroll.y > maxpx) {
|
||||
scroll.y = maxpx;
|
||||
}
|
||||
sf->ScrollToCSSPixels(nsIntPoint(scroll.x, scroll.y));
|
||||
sf->ScrollToCSSPixels(scroll);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1577,12 +1577,11 @@ nsGfxScrollFrameInner::AsyncScrollCallback(void* anInstance, mozilla::TimeStamp
|
|||
}
|
||||
|
||||
void
|
||||
nsGfxScrollFrameInner::ScrollToCSSPixels(nsIntPoint aScrollPosition)
|
||||
nsGfxScrollFrameInner::ScrollToCSSPixels(const CSSIntPoint& aScrollPosition)
|
||||
{
|
||||
nsPoint current = GetScrollPosition();
|
||||
nsIntPoint currentCSSPixels = GetScrollPositionCSSPixels();
|
||||
nsPoint pt(nsPresContext::CSSPixelsToAppUnits(aScrollPosition.x),
|
||||
nsPresContext::CSSPixelsToAppUnits(aScrollPosition.y));
|
||||
nsPoint pt = CSSPoint::ToAppUnits(aScrollPosition);
|
||||
nscoord halfPixel = nsPresContext::CSSPixelsToAppUnits(0.5f);
|
||||
nsRect range(pt.x - halfPixel, pt.y - halfPixel, 2*halfPixel - 1, 2*halfPixel - 1);
|
||||
// XXX I don't think the following blocks are needed anymore, now that
|
||||
|
|
|
@ -170,7 +170,7 @@ public:
|
|||
const nsRect* aRange = nullptr) {
|
||||
ScrollToWithOrigin(aScrollPosition, aMode, nsGkAtoms::other, aRange);
|
||||
}
|
||||
void ScrollToCSSPixels(nsIntPoint aScrollPosition);
|
||||
void ScrollToCSSPixels(const mozilla::CSSIntPoint& aScrollPosition);
|
||||
void ScrollToCSSPixelsApproximate(const mozilla::CSSPoint& aScrollPosition);
|
||||
nsIntPoint GetScrollPositionCSSPixels();
|
||||
void ScrollToImpl(nsPoint aScrollPosition, const nsRect& aRange);
|
||||
|
@ -519,7 +519,7 @@ public:
|
|||
const nsRect* aRange = nullptr) MOZ_OVERRIDE {
|
||||
mInner.ScrollTo(aScrollPosition, aMode, aRange);
|
||||
}
|
||||
virtual void ScrollToCSSPixels(nsIntPoint aScrollPosition) MOZ_OVERRIDE {
|
||||
virtual void ScrollToCSSPixels(const mozilla::CSSIntPoint& aScrollPosition) MOZ_OVERRIDE {
|
||||
mInner.ScrollToCSSPixels(aScrollPosition);
|
||||
}
|
||||
virtual void ScrollToCSSPixelsApproximate(const mozilla::CSSPoint& aScrollPosition) MOZ_OVERRIDE {
|
||||
|
@ -783,7 +783,7 @@ public:
|
|||
const nsRect* aRange = nullptr) MOZ_OVERRIDE {
|
||||
mInner.ScrollTo(aScrollPosition, aMode, aRange);
|
||||
}
|
||||
virtual void ScrollToCSSPixels(nsIntPoint aScrollPosition) MOZ_OVERRIDE {
|
||||
virtual void ScrollToCSSPixels(const mozilla::CSSIntPoint& aScrollPosition) MOZ_OVERRIDE {
|
||||
mInner.ScrollToCSSPixels(aScrollPosition);
|
||||
}
|
||||
virtual void ScrollToCSSPixelsApproximate(const mozilla::CSSPoint& aScrollPosition) MOZ_OVERRIDE {
|
||||
|
|
|
@ -156,7 +156,7 @@ public:
|
|||
* rounding to CSS pixels) will be exactly aScrollPosition.
|
||||
* The scroll mode is INSTANT.
|
||||
*/
|
||||
virtual void ScrollToCSSPixels(nsIntPoint aScrollPosition) = 0;
|
||||
virtual void ScrollToCSSPixels(const mozilla::CSSIntPoint& aScrollPosition) = 0;
|
||||
/**
|
||||
* Scrolls to a particular position in float CSS pixels.
|
||||
* This does not guarantee that GetScrollPositionCSSPixels equals
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include "nsIFrame.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
class nsScrollBoxObject : public nsIScrollBoxObject, public nsBoxObject
|
||||
{
|
||||
public:
|
||||
|
@ -54,7 +56,7 @@ NS_IMETHODIMP nsScrollBoxObject::ScrollTo(int32_t x, int32_t y)
|
|||
nsIScrollableFrame* sf = GetScrollFrame();
|
||||
if (!sf)
|
||||
return NS_ERROR_FAILURE;
|
||||
sf->ScrollToCSSPixels(nsIntPoint(x, y));
|
||||
sf->ScrollToCSSPixels(CSSIntPoint(x, y));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче