michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsViewportInfo.h" michael@0: #include "mozilla/Assertions.h" michael@0: #include michael@0: michael@0: using namespace mozilla; michael@0: michael@0: void michael@0: nsViewportInfo::SetDefaultZoom(const CSSToScreenScale& aDefaultZoom) michael@0: { michael@0: MOZ_ASSERT(aDefaultZoom.scale >= 0.0f); michael@0: mDefaultZoom = aDefaultZoom; michael@0: } michael@0: michael@0: void michael@0: nsViewportInfo::ConstrainViewportValues() michael@0: { michael@0: // Constrain the min/max zoom as specified at: michael@0: // dev.w3.org/csswg/css-device-adapt section 6.2 michael@0: mMaxZoom = std::max(mMinZoom, mMaxZoom); michael@0: michael@0: mDefaultZoom = mDefaultZoom < mMaxZoom ? mDefaultZoom : mMaxZoom; michael@0: mDefaultZoom = mDefaultZoom > mMinZoom ? mDefaultZoom : mMinZoom; michael@0: }