Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1472)

Unified Diff: Source/web/PageScaleConstraintsSet.cpp

Issue 26251010: Reset to initial page scale in additional scenarios. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add test coverage and extra setNeedsLayout() call Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/web/PageScaleConstraintsSet.cpp
diff --git a/Source/web/PageScaleConstraintsSet.cpp b/Source/web/PageScaleConstraintsSet.cpp
index 582c27fce1427446acfd83a516d60c0ab7d01569..15f6e824d27c58167a67bcd1e952c71d0b2dc37d 100644
--- a/Source/web/PageScaleConstraintsSet.cpp
+++ b/Source/web/PageScaleConstraintsSet.cpp
@@ -66,11 +66,17 @@ void PageScaleConstraintsSet::setUserAgentConstraints(const PageScaleConstraints
m_constraintsDirty = true;
}
+PageScaleConstraints PageScaleConstraintsSet::computeConstraintsStack() const
+{
+ PageScaleConstraints constraints = defaultConstraints();
+ constraints.overrideWith(m_pageDefinedConstraints);
+ constraints.overrideWith(m_userAgentConstraints);
+ return constraints;
+}
+
void PageScaleConstraintsSet::computeFinalConstraints()
{
- m_finalConstraints = defaultConstraints();
- m_finalConstraints.overrideWith(m_pageDefinedConstraints);
- m_finalConstraints.overrideWith(m_userAgentConstraints);
+ m_finalConstraints = computeConstraintsStack();
m_constraintsDirty = false;
}
@@ -89,12 +95,12 @@ void PageScaleConstraintsSet::setNeedsReset(bool needsReset)
void PageScaleConstraintsSet::didChangeContentsSize(IntSize contentsSize, float pageScaleFactor)
{
- // If a large fixed-width element expanded the size of the document
- // late in loading and our initial scale is not constrained, reset the
- // page scale factor to the new minimum scale.
+ // If a large fixed-width element expanded the size of the document late in
+ // loading and our initial scale is not set (or set to be less than the last
+ // minimum scale), reset the page scale factor to the new initial scale.
if (contentsSize.width() > m_lastContentsWidth
&& pageScaleFactor == finalConstraints().minimumScale
- && userAgentConstraints().initialScale == -1 && pageDefinedConstraints().initialScale == -1)
+ && computeConstraintsStack().initialScale < finalConstraints().minimumScale)
setNeedsReset(true);
m_constraintsDirty = true;
@@ -168,9 +174,6 @@ void PageScaleConstraintsSet::adjustForAndroidWebViewQuirks(const ViewportDescri
}
}
- if (oldInitialScale != m_pageDefinedConstraints.initialScale && m_pageDefinedConstraints.initialScale != -1)
- setNeedsReset(true);
-
if (adjustedLayoutSizeWidth != m_pageDefinedConstraints.layoutSize.width()) {
ASSERT(m_pageDefinedConstraints.layoutSize.width() > 0);
float adjustedLayoutSizeHeight = (adjustedLayoutSizeWidth * m_pageDefinedConstraints.layoutSize.height()) / m_pageDefinedConstraints.layoutSize.width();

Powered by Google App Engine
This is Rietveld 408576698