Bug 1158933 - Prevent scrollbars from jumping while zoomed in the B2G browser. r=botond

This commit is contained in:
Kartikaya Gupta 2015-04-29 07:22:27 -04:00
Родитель ca4c4fda69
Коммит 0d34f1455a
3 изменённых файлов: 16 добавлений и 7 удалений

Просмотреть файл

@ -1711,8 +1711,10 @@ protected:
nsAutoPtr<StickyPositionData> mStickyPositionData;
FrameMetrics::ViewID mScrollbarTargetId;
ScrollDirection mScrollbarDirection;
float mScrollbarThumbRatio; // Ratio of the thumb position to the scroll
// position, in app units.
// The scrollbar thumb ratio is the ratio of the thumb position (in the CSS
// pixels of the scrollframe's parent's space) to the scroll position (in the
// CSS pixels of the scrollframe's space).
float mScrollbarThumbRatio;
bool mIsScrollbarContainer;
DebugOnly<uint32_t> mDebugColorIndex;
// If this layer is used for OMTA, then this counter is used to ensure we

Просмотреть файл

@ -726,8 +726,12 @@ ApplyAsyncTransformToScrollbarForContent(Layer* aScrollbar,
const CSSCoord compositedHeight = (metrics.mCompositionBounds / effectiveZoom).height;
const CSSCoord scrollableHeight = metrics.GetScrollableRect().height;
// The scrollbar thumb ratio is in AppUnits.
const float ratio = aScrollbar->GetScrollbarThumbRatio();
const LayoutDeviceToParentLayerScale nonLayoutScale = effectiveZoom /
metrics.GetDevPixelsPerCSSPixel();
// Here we convert the scrollbar thumb ratio into a true unitless ratio by
// dividing out the conversion factor from the scrollframe's parent's space
// to the scrollframe's space.
const float ratio = aScrollbar->GetScrollbarThumbRatio() / nonLayoutScale.scale;
ParentLayerCoord yTranslation = -asyncScrollY * ratio;
// The scroll thumb additionally needs to be translated to compensate for
@ -773,8 +777,9 @@ ApplyAsyncTransformToScrollbarForContent(Layer* aScrollbar,
const CSSCoord compositedWidth = (metrics.mCompositionBounds / effectiveZoom).width;
const CSSCoord scrollableWidth = metrics.GetScrollableRect().width;
// The scrollbar thumb ratio is in AppUnits.
const float ratio = aScrollbar->GetScrollbarThumbRatio();
const LayoutDeviceToParentLayerScale nonLayoutScale = effectiveZoom /
metrics.GetDevPixelsPerCSSPixel();
const float ratio = aScrollbar->GetScrollbarThumbRatio() / nonLayoutScale.scale;
ParentLayerCoord xTranslation = -asyncScrollX * ratio;
const CSSCoord thumbOrigin = (metrics.GetScrollOffset().x / scrollableWidth) * compositedWidth;

Просмотреть файл

@ -1317,7 +1317,9 @@ float
nsSliderFrame::GetThumbRatio() const
{
// mRatio is in thumb app units per scrolled css pixels. Convert it to a
// a true unitless ratio.
// ratio of the thumb's CSS pixels per scrolled CSS pixels. (Note the thumb
// is in the scrollframe's parent's space whereas the scrolled CSS pixels
// are in the scrollframe's space).
return mRatio / mozilla::AppUnitsPerCSSPixel();
}