/* -*- 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/. */
/** * Utility function to convert a nscoord size to CSS pixel values, with * graceful treatment of NS_UNCONSTRAINEDSIZE (which this function converts to * the double "positive infinity" value). * * This function is suitable for converting quantities that are expected to * sometimes legitimately (rather than arbitrarily/accidentally) contain the * sentinel value NS_UNCONSTRAINEDSIZE -- e.g. to handle "max-width: none".
*/ staticdouble ToPossiblyUnconstrainedPixels(nscoord aSize) { if (aSize == NS_UNCONSTRAINEDSIZE) { return std::numeric_limits<double>::infinity();
} return nsPresContext::AppUnitsToDoubleCSSPixels(aSize);
}
FlexItemValues::FlexItemValues(FlexLineValues* aParent, const ComputedFlexItemInfo* aItem)
: mParent(aParent) {
MOZ_ASSERT(aItem, "Should never be instantiated with a null ComputedFlexLineInfo.");
// Eagerly copy values from aItem, because we're not // going to keep it around.
mNode = aItem->mNode;
// Since mNode might be null, we associate the mFrameRect with // our parent.
mFrameRect = new DOMRectReadOnly(
mParent, nsPresContext::AppUnitsToDoubleCSSPixels(aItem->mFrameRect.X()),
nsPresContext::AppUnitsToDoubleCSSPixels(aItem->mFrameRect.Y()),
nsPresContext::AppUnitsToDoubleCSSPixels(aItem->mFrameRect.Width()),
nsPresContext::AppUnitsToDoubleCSSPixels(aItem->mFrameRect.Height()));
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.