Backed out 2 changesets (bug 1495055) for frequently asserting on FrameLayerBuilder.cpp in crashtest on OSX. a=backout

Backed out changeset fd895bb95b99 (bug 1495055)
Backed out changeset ed9b268816b4 (bug 1495055)
This commit is contained in:
Cosmin Sabou 2018-10-05 12:36:11 +03:00
Родитель 518c1edc03
Коммит 5a7a044de4
3 изменённых файлов: 35 добавлений и 57 удалений

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

@ -19,23 +19,16 @@ FrameMetrics::RecalculateViewportOffset()
if (!mIsRootContent) {
return;
}
KeepLayoutViewportEnclosingVisualViewport(GetVisualViewport(), mViewport);
}
/* static */ void
FrameMetrics::KeepLayoutViewportEnclosingVisualViewport(
const CSSRect& aVisualViewport,
CSSRect& aLayoutViewport)
{
CSSRect visualViewport = GetVisualViewport();
// If the visual viewport is contained within the layout viewport, we don't
// need to make any adjustments, so we can exit early.
//
// Additionally, if the composition bounds changes (due to an orientation
// change, window resize, etc.), it may take a few frames for aLayoutViewport to
// change, window resize, etc.), it may take a few frames for mViewport to
// update and during that time, the visual viewport may be larger than the
// layout viewport. In such situations, we take an early exit if the visual
// viewport contains the layout viewport.
if (aLayoutViewport.Contains(aVisualViewport) || aVisualViewport.Contains(aLayoutViewport)) {
if (mViewport.Contains(visualViewport) || visualViewport.Contains(mViewport)) {
return;
}
@ -43,41 +36,40 @@ FrameMetrics::KeepLayoutViewportEnclosingVisualViewport(
// viewport such that it remains inside the visual viewport. Otherwise,
// move the layout viewport such that the visual viewport is contained
// inside the layout viewport.
if ((aLayoutViewport.Width() < aVisualViewport.Width() &&
!FuzzyEqualsMultiplicative(aLayoutViewport.Width(), aVisualViewport.Width())) ||
(aLayoutViewport.Height() < aVisualViewport.Height() &&
!FuzzyEqualsMultiplicative(aLayoutViewport.Height(), aVisualViewport.Height()))) {
if ((mViewport.Width() < visualViewport.Width() &&
!FuzzyEqualsMultiplicative(mViewport.Width(), visualViewport.Width())) ||
(mViewport.Height() < visualViewport.Height() &&
!FuzzyEqualsMultiplicative(mViewport.Height(), visualViewport.Height()))) {
if (aLayoutViewport.X() < aVisualViewport.X()) {
if (mViewport.X() < visualViewport.X()) {
// layout viewport moves right
aLayoutViewport.MoveToX(aVisualViewport.X());
} else if (aVisualViewport.XMost() < aLayoutViewport.XMost()) {
mViewport.MoveToX(visualViewport.X());
} else if (visualViewport.XMost() < mViewport.XMost()) {
// layout viewport moves left
aLayoutViewport.MoveByX(aVisualViewport.XMost() - aLayoutViewport.XMost());
mViewport.MoveByX(visualViewport.XMost() - mViewport.XMost());
}
if (aLayoutViewport.Y() < aVisualViewport.Y()) {
if (mViewport.Y() < visualViewport.Y()) {
// layout viewport moves down
aLayoutViewport.MoveToY(aVisualViewport.Y());
} else if (aVisualViewport.YMost() < aLayoutViewport.YMost()) {
mViewport.MoveToY(visualViewport.Y());
} else if (visualViewport.YMost() < mViewport.YMost()) {
// layout viewport moves up
aLayoutViewport.MoveByY(aVisualViewport.YMost() - aLayoutViewport.YMost());
mViewport.MoveByY(visualViewport.YMost() - mViewport.YMost());
}
} else {
if (aVisualViewport.X() < aLayoutViewport.X()) {
aLayoutViewport.MoveToX(aVisualViewport.X());
} else if (aLayoutViewport.XMost() < aVisualViewport.XMost()) {
aLayoutViewport.MoveByX(aVisualViewport.XMost() - aLayoutViewport.XMost());
if (visualViewport.X() < mViewport.X()) {
mViewport.MoveToX(visualViewport.X());
} else if (mViewport.XMost() < visualViewport.XMost()) {
mViewport.MoveByX(visualViewport.XMost() - mViewport.XMost());
}
if (aVisualViewport.Y() < aLayoutViewport.Y()) {
aLayoutViewport.MoveToY(aVisualViewport.Y());
} else if (aLayoutViewport.YMost() < aVisualViewport.YMost()) {
aLayoutViewport.MoveByY(aVisualViewport.YMost() - aLayoutViewport.YMost());
if (visualViewport.Y() < mViewport.Y()) {
mViewport.MoveToY(visualViewport.Y());
} else if (mViewport.YMost() < visualViewport.YMost()) {
mViewport.MoveByY(visualViewport.YMost() - mViewport.YMost());
}
}
}
void
ScrollMetadata::SetUsesContainerScrolling(bool aValue) {
mUsesContainerScrolling = aValue;

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

@ -538,16 +538,6 @@ public:
// This is a no-op if mIsRootContent is false.
void RecalculateViewportOffset();
// Helper function for RecalculateViewportOffset(). Exposed so that
// APZC can perform the operation on other copies of the layout
// and visual viewport rects (e.g. the "effective" ones used to implement
// the frame delay).
// Modifies |aLayoutViewport| to continue enclosing |aVisualViewport|
// if possible.
static void KeepLayoutViewportEnclosingVisualViewport(
const CSSRect& aVisualViewport,
CSSRect& aLayoutViewport);
private:
// A unique ID assigned to each scrollable frame.
ViewID mScrollId;

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

@ -3331,14 +3331,6 @@ void AsyncPanZoomController::AdjustScrollForSurfaceShift(const ScreenPoint& aShi
// the shift to take effect right away, without the usual frame delay.
mCompositedScrollOffset = scrollRange.ClampPoint(
mCompositedScrollOffset + adjustment);
// For a similar reason, apply the shift to mCompositedLayoutViewport.
// mCompositedLayoutViewport also needs to immediately pick up any new
// size from Metrics().GetViewport() to make sure it reflects any height
// change due to dynamic toolbar movement.
mCompositedLayoutViewport.SizeTo(Metrics().GetViewport().Size());
FrameMetrics::KeepLayoutViewportEnclosingVisualViewport(
CSSRect(mCompositedScrollOffset, Metrics().CalculateCompositedSizeInCssPixels()),
mCompositedLayoutViewport);
RequestContentRepaint();
UpdateSharedCompositorFrameMetrics();
}
@ -4226,14 +4218,18 @@ void AsyncPanZoomController::NotifyLayersUpdated(const ScrollMetadata& aScrollMe
bool needContentRepaint = false;
bool viewportUpdated = false;
if (Metrics().GetViewport().Width() != aLayerMetrics.GetViewport().Width() ||
Metrics().GetViewport().Height() != aLayerMetrics.GetViewport().Height()) {
needContentRepaint = true;
viewportUpdated = true;
}
if (viewportUpdated || scrollOffsetUpdated) {
Metrics().SetViewport(aLayerMetrics.GetViewport());
if (FuzzyEqualsAdditive(aLayerMetrics.GetCompositionBounds().Width(), Metrics().GetCompositionBounds().Width()) &&
FuzzyEqualsAdditive(aLayerMetrics.GetCompositionBounds().Height(), Metrics().GetCompositionBounds().Height())) {
// Remote content has sync'd up to the composition geometry
// change, so we can accept the viewport it's calculated.
if (Metrics().GetViewport().Width() != aLayerMetrics.GetViewport().Width() ||
Metrics().GetViewport().Height() != aLayerMetrics.GetViewport().Height()) {
needContentRepaint = true;
viewportUpdated = true;
}
if (viewportUpdated || scrollOffsetUpdated) {
Metrics().SetViewport(aLayerMetrics.GetViewport());
}
}
#if defined(MOZ_WIDGET_ANDROID)