/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* * Helper function for ViewportMetaData::ProcessViewportInfo. * * Handles a single key=value pair. If it corresponds to a valid viewport * attribute, add it to the document header data. No validation is done on the * value itself (this is done at display time).
*/ staticvoid ProcessViewportToken(ViewportMetaData& aData, const nsAString& token) { /* Iterators. */
nsAString::const_iterator tip, tail, end;
token.BeginReading(tip);
tail = tip;
token.EndReading(end);
/* Move tip to the '='. */ while ((tip != end) && (*tip != '=')) {
++tip;
}
/* If we didn't find an '=', punt. */ if (tip == end) { return;
}
/* Extract the key and value. */ const nsAString& key = nsContentUtils::TrimWhitespace<nsCRT::IsAsciiSpace>(
Substring(tail, tip), true); const nsAString& value = nsContentUtils::TrimWhitespace<nsCRT::IsAsciiSpace>(
Substring(++tip, end), true);
/* Check for known keys. If we find a match, insert the appropriate
* information into the document header. */
RefPtr<nsAtom> key_atom = NS_Atomize(key); if (key_atom == nsGkAtoms::height) {
aData.mHeight.Assign(value);
} elseif (key_atom == nsGkAtoms::width) {
aData.mWidth.Assign(value);
} elseif (key_atom == nsGkAtoms::initial_scale) {
aData.mInitialScale.Assign(value);
} elseif (key_atom == nsGkAtoms::minimum_scale) {
aData.mMinimumScale.Assign(value);
} elseif (key_atom == nsGkAtoms::maximum_scale) {
aData.mMaximumScale.Assign(value);
} elseif (key_atom == nsGkAtoms::user_scalable) {
aData.mUserScalable.Assign(value);
} elseif (key_atom == nsGkAtoms::viewport_fit) {
aData.mViewportFit.Assign(value);
} elseif (key_atom == nsGkAtoms::interactive_widget) {
aData.mInteractiveWidgetMode.Assign(value);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.