mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
cbf860dd80
- Bug 1207790 - Fix sandbox build for older Linux distributions. r=gdestuynder (33726f14d6)
- Bug 1157864 - chromium sandbox: Fix compilation for systems without <sys/cdefs.h>. r=jld (19789c8f28)
- Bug 1181704 - Import chromium SafeSPrintf. r=bobowen (c8f2f34098)
- Bug 1196403 - Apply crbug/522201 to support Windows 10 build 10525. r=bobowen (ee9862b408)
- Bug 1200336: Apply fix for Chromium issue 482784 for sandbox bug when built with VS2015. r=tabraldes (7f4cf9640b)
- Bug 1150765 - Add sandbox rules to allow hardware rendering of OpenGL on Mac. r=smichaud (e23a3d3e89)
- Bug 1153809 - Loosen Mac content process sandbox rules for NVidia and Intel HD 3000 graphics hardware. r=areinald (9a3a1fa6ea)
- Bug 1229804: Use the correct string length in Windows sandbox logging. r=tabraldes (6a8cb035ed)
- Bug 1181704 - Use chromium SafeSPrintf for sandbox logging. r=gdestuynder r=glandium (cff9ae432b)
- crash reporter (009341774b)
- Bug 1168555 - Work around Nuwa not always being single-threaded when a normal content process is. r=kang (b858b1fd62)
- Bug 1199413 - Fix MOZ_DISABLE_GMP_SANDBOX so it disables all the sandboxing. r=kang (49125e07be)
- Bug 1176085 - Fix second/nanosecond confusion in Linux sandbox start error case. r=kang (701181c7d2)
- Bug 1199481 - Complain more when entering sandboxing code as root. r=kang (baf7b24675)
- Bug 1215303 - Part 1 - add permissive mode r=jld (e8237859ac)
- Bug 1215303 - Part 2 - automatically enable broker when in permissive mode r=jld (9636c8a956)
- Bug 1222500 - Handle unexpected thread creation better on desktop Linux. r=gdestuynder (58e2f81f96)
- Bug 1131227 - Make the about:certerror Unknown Issuer string mention missing intermediates and unimported roots. r=keeler (29ae92e655)
- Bug 443811 - Use long date format for cert date output. r=keeler (50a31e099c)
- namespace (10ccb72736)
- Bug 1225682 - Don't use nsAuto{,C}String as class member variables in security/manager/. r=keeler (24d10b66f6)
- Bug 1110935 - Part 1 - Assert we're on the main thread on public methods. r=keeler (b9b2b52bf2)
- Bug 1110935 - Part 2 - Remove ReentrantMonitor and ReentrantMonitorAutoEnter uses. r=keeler (3fee4d4653)
- Bug 1110935 - Part 3 - Remove now unnecessary temp variables. r=keeler (f81461993a)
- Bug 1168635 - Add an XPCOM interface to allow RC4. r=keeler (dac5f75e75)
- Bug 1136301 - Null check for mCert->slot added in destructorSafeDestroyNSSReference & MarkForPermDeletion. Formatting update in MarkForPermDeletion. r=keeler (daaaf2db22)
- Bug 1168048 - Avoid potential null-pointer dereferencing in nsNSSCertificateDB r=keeler (c511046073)
- Bug 1224121 - change getRelativeRuleLine to return 0 for line-less rules; r=heycam (7cef25806d)
- Bug 1216234 - add inIDOMUtils.getCSSPseudoElementNames; r=heycam,pbrosset (1c94ca86b4)
- Bug 1146114 - Make assertion checking additional leading in ruby frame non-crash. r=dholbert (326d82db79)
- Bug 1052924 followup - Move the XXX comment to the right field. DONTBUILD (481cb50d0d)
- Bug 1136521 - Don't try to use the ascent when placing a frame whose block-direction doesn't match the line's. r=smontagu (eb01f6aa1a)
- Bug 1138353 - Correct the directionality of vertical-align dimensions in cases where line- and flow-relative coordinate directions differ. r=smontagu (6e51f4be05)
- Bug 1133945 - Fix behavior of vertical-align with a specified length, relative to dominant centered baseline in vertical mode. r=smontagu (a2e611f978)
- Bug 1146117 - Downgrade the assertion in FindNearestRubyBaseAncestor to warning. r=dbaron (db29a321f4)
- Bug 1191185 - Simplify nsHypotheticalBox, eliminating obsolete/redundant fields, and rename to nsHypotheticalPosition. r=dholbert (3741b6aa49)
- Bug 1227099 - [css-grid] Grid container block-size should include a grid-row-gap between each row. r=dholbert (35eed9d00b)
- Bug 1225368 - [css-grid] Make CollectGrowable() deal with frozen tracks; i.e. subtract their base size but don't collect them since they aren't growable. r=dholbert (073964a857)
- Bug 1224634 - [css-grid] Make grid items shrink-wrap when reflowing them, unless they have justify-self:stretch. r=dholbert (070c2cf6a9)
- Bug 1176793 part 1 - [css-grid] Implement margin:auto for grid items. r=dholbert (ff89b80fc2)
- Bug 1176793 part 2 - [css-grid] Reftests for margin:auto on grid items. (fe9367e7ca)
- Bug 1229999 - [css-grid] Clamp auto-placed lines to where kMaxLine is in the translated grid. r=dholbert (576d9a8384)
- Bug 1151243 part 1 - Replace three bool params for nsAbsoluteContainingBlock::Reflow with a flag param (idempotent patch). r=dholbert (7303bb9468)
- Bug 978212 - [css-grid] Resolved value of grid-template-{columns,rows} in px units. r=mat (fe4b886917)
- Bug 1151243 part 2 - [css-grid] Add a eIsGridContainerCB flag for nsAbsoluteContainingBlock::Reflow to trigger Grid specific code (rather than checking GetType()). r=dholbert (2f5f857b16)
- Bug 1215099 part 1 - [css-grid] Backout bug 1206703. r=dholbert (b6af6389ce)
- Bug 1123299 - Allow <input type=number> to be displayed in vertical writing mode; but keep the spinner arrows arranged as for horizontal writing mode. r=dholbert (2a2e17ce76)
- (no bug) Fix typo in grid style-struct comment: s/grid-columns-rows/grid-template-rows/. No review, DONTBUILD (f362946aed)
- fix namespace (70ec283c08)
- Bug 1224251 patch 1 - Add reftests. r=mattwoodrow (4f5eed4d0c)
- Bug 1224251 patch 2 - Add nsChangeHint_UpdateUsesOpacity to say when opacity changes between 1 and non-1. r=xidorn (0cec051688)
- Bug 1224251 patch 3 - Return nsChangeHint_UpdateUsesOpacity when opacity changes between 1 and non-1. r=xidorn (acf5f3514c)
- Bug 1224251 patch 4 - Convert UpdateOpacityLayer to RepaintFrame when changing opacity between 1 and non-1 on table parts. r=mattwoodrow (3101e06481)
- Tweak a couple of comments; no bug. (DONTBUILD) (6b7d8486ad)
- Bug 1219534 - Remove unused nsStyleContext::SetStyle##name_ methods. r=dholbert (4c032b5914)
- (no bug) Fix typo in nsStyleContext.h (s/currenlty/currently/). Comment-only, DONTBUILD (3864f8194b)
- Bug 1208901 - Fix a typo in nsStyleClipPath::nsStyleClipPath; r=heycam (df5c3b59a6)
- Bug 1227766 patch 3 - Make will-change cause creation of a containing block for fixed and absolutely positioned elements when needed. r=dholbert (09c59e07f1)
- Bug 1229278 - Fix dynamic changes to text-emphasis-style. r=dbaron (ab0c450f14)
- Bug 1159729 - Reftest to check that text decoration is properly offset when needed. r=smontagu (b93bb0ca41)
- Bug 196292 - Make table inside align=left reset alignment just like for align=center and align=right. r=bz (3b45a62477)
- Bug 1227917 - Update |disp| after we've (potentially) cloned the Display struct so that subsequent tests of 'display' use the new value. r=jfkthame (d3216e7aad)
- Bug 1155766 - Fix a bad assertion r=dbaron (d6744220f4)
- Bug 1167589 - Mark the members of CSSParsingEnvironment as MOZ_UNSAFE_REF. r=dbaron (ebb9729549)
- Bug 1228542 - Resetting AuthorStyleSheets. r=bz (31b27e491d)
- Use nsContentUtils::GenerateUUIDInPlace() in nsIDocument::GenerateDocumentId(), no bug (642138ebac)
- Bug 1226443 P2 Make service worker fetch and functional events used scheduled timer updates. r=ehsan (a4fc5a9275)
- Bug 1227015 P1 Create ServiceWorkerScriptJobBase as parent class to register and install jobs. r=ehsan (214dda4e7d)
- Bug 1226443 P1 Add a timer based mechanism for firing service worker updates. r=ehsan (f2a9eae9d2)
- Bug 1229052 - Add a telemetry histogram to gather data on the number of top-level pages with scroll-linked positioning effects. r=vladan (6844bfaa2b)
- Bug 1229052 - Log a warning when we detect a scroll-linked effect based on the scroll event. r=roc (da8dd5cff2)
- bug 1215657 - make AccessibleWrap::get_accFocus work with proxied accessibles (02bfa582d6)
- Bug 1227285 part 1 - Add a nsHTMLReflowState ctor flag to request shrink-wrap behavior. r=dholbert (da92253664)
- Bug 1227285 part 2 - [css-grid] Request shrink-wrap behavior when doing a measuring reflow to figure out a grid item's block-size. r=dholbert (6bfcf381fe)
- Bug 1227285 part 3 - [css-grid] Reftests for testing minmax(min-content,max-content) track sizing with grid item with %-sized descendants. (61b769d0d2)
- No bug - [css-grid] Add a small fuzz factor to make this reftest pass on Windows. r=me (3c51c91220)
- Bug 1173689: allow column sets in an orthogonal writing mode to their container to expand in the container's block direction, r=roc (88aa32efd9)
- Bug 1209994. Take block-wrapper path only for blocks that are wrappers. r=bz (ecb4ae8d7e)
- Bug 1191109 - Clean up use of writing-modes in GetHypotheticalBoxContainer, eliminating a redundant ConvertTo call. r=dholbert (f58d0d63c4)
- Bug 1183439 - Update the wording of a few assertions to reflect logical-coordinate conversion. r=dholbert (8aacb0f89d)
- Bug 1233276 - Make css::Declaration::List more useful again, given that it degraded a bit in bug 978833 (/ bug 1221436). r=heycam (1efda568e7)
- Bug 1167665 - Mark css::Loader::mDocument as MOZ_NON_OWNING_REF. r=dbaron (f4d4f4ed1d)
- Bug 621596 - Don't assert when a percentage base value overflows to become negative, when getting the computed style of a property that rejects negative values. r=bzbarsky (6076ce7cb6)
- Bug 622314 - Add crashtest. (f1d64b943c)
- Bug 1230613 - Long-press to trigger text selection should vibrate, r=snorp (f35f37336e)
- Bug 1230582 - Always show caret even if input is empty on Fennec. f=capella, r=roc (6cf1258232)
- Bug 1183085 - Correct argument name for BuildContainerLayerFor; r=roc (0fd119efd1)
- Bug 1183085 - Correct a typo in FrameLayerBuilder.h; r=roc (1fb9a583ed)
- Comment typo fix; no bug. (DONTBUILD) (27d7270052)
- Bug 1211858 - Add a hint for the Restyle label when the id is unavailable. r=roc,benwa (8eb99a4b45)
- bug 1218596 - remove nsPSMInitPanic and other unnecessary things from nsNSSComponent r=Cykesiopka r=jcj (a986e73f0b)
- bug 1220223 - don't load PKCS11 modules in safe mode r=mgoodwin r=bsmedberg (5e071955b0)
- Bug 921907 - Enable OCSP must-staple. r=keeler (448661431f)
- Bug 1215795 - Fix documentation in nsIWeakCryptoOverride.idl. r=keeler IGNORE IDL (3cf051737c)
- bug 1222179 - remove unnecessary observation topics in nsNSSComponent r=Cykesiopka (2eaa16d860)
- bug 986956 - only ever initialize NSS once per process r=Cykesiopka r=mgoodwin (efdec10cbb)
- Bug 1224875 - Enable TLS extended master secret. r=keeler (8f56d54ec1)
- Bug 1145893 - Shutdown nsNSSComponent background threads during xpcom-shutdown. r=keeler, a=me (5d513b930d)
- namespace (bf40a8f575)
- Bug 1224951 - Part 1: Fix nsPresContext::SizeOfExcludingThis() size calculation. r=dholbert (530a54e15d)
- Bug 1227666 - Insure that cached plugin geometry configuration cached in ShadowLayerForwarder gets cleared when we reflow and new content has no plugins. r=roc (a44fbce70e)
- Bug 1140625 - Part 1: Add recursive call in GetFrameForNodeOffset. r=roc (0b7535cf7b)
- Bug 1140625 - Recursive call GetFrameForNodeOffset if text node has no frame. r=roc (9198ab6a20)
- Bug 1140625 - Part 3: Fix a bug in bug414526 so we can reopen the test. r=roc (cbe0d3577d)
- Bug 1140625 - Part 4: Fix scroll_selection_into_view test to make its function remain. r=roc (97ca749e63)
619 lines
23 KiB
C++
619 lines
23 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
/* This Source Code is subject to the terms of the Mozilla Public License
|
|
* version 2.0 (the "License"). You can obtain a copy of the License at
|
|
* http://mozilla.org/MPL/2.0/. */
|
|
|
|
/* rendering object for CSS "display: grid | inline-grid" */
|
|
|
|
#ifndef nsGridContainerFrame_h___
|
|
#define nsGridContainerFrame_h___
|
|
|
|
#include "mozilla/TypeTraits.h"
|
|
#include "nsContainerFrame.h"
|
|
#include "nsHashKeys.h"
|
|
#include "nsTHashtable.h"
|
|
|
|
/**
|
|
* Factory function.
|
|
* @return a newly allocated nsGridContainerFrame (infallible)
|
|
*/
|
|
nsContainerFrame* NS_NewGridContainerFrame(nsIPresShell* aPresShell,
|
|
nsStyleContext* aContext);
|
|
|
|
class nsGridContainerFrame final : public nsContainerFrame
|
|
{
|
|
public:
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
NS_DECL_QUERYFRAME_TARGET(nsGridContainerFrame)
|
|
NS_DECL_QUERYFRAME
|
|
|
|
// nsIFrame overrides
|
|
void Reflow(nsPresContext* aPresContext,
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
const nsHTMLReflowState& aReflowState,
|
|
nsReflowStatus& aStatus) override;
|
|
nscoord GetMinISize(nsRenderingContext* aRenderingContext) override;
|
|
nscoord GetPrefISize(nsRenderingContext* aRenderingContext) override;
|
|
void MarkIntrinsicISizesDirty() override;
|
|
virtual nsIAtom* GetType() const override;
|
|
|
|
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
const nsRect& aDirtyRect,
|
|
const nsDisplayListSet& aLists) override;
|
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
|
#endif
|
|
|
|
/**
|
|
* Return the containing block for aChild which MUST be an abs.pos. child
|
|
* of a grid container. This is just a helper method for
|
|
* nsAbsoluteContainingBlock::Reflow - it's not meant to be used elsewhere.
|
|
*/
|
|
static const nsRect& GridItemCB(nsIFrame* aChild);
|
|
|
|
struct TrackSize {
|
|
void Initialize(nscoord aPercentageBasis,
|
|
const nsStyleCoord& aMinCoord,
|
|
const nsStyleCoord& aMaxCoord);
|
|
bool IsFrozen() const { return mState & eFrozen; }
|
|
#ifdef DEBUG
|
|
void Dump() const;
|
|
#endif
|
|
enum StateBits : uint16_t {
|
|
eAutoMinSizing = 0x1,
|
|
eMinContentMinSizing = 0x2,
|
|
eMaxContentMinSizing = 0x4,
|
|
eMinOrMaxContentMinSizing = eMinContentMinSizing | eMaxContentMinSizing,
|
|
eIntrinsicMinSizing = eMinOrMaxContentMinSizing | eAutoMinSizing,
|
|
eFlexMinSizing = 0x8,
|
|
eAutoMaxSizing = 0x10,
|
|
eMinContentMaxSizing = 0x20,
|
|
eMaxContentMaxSizing = 0x40,
|
|
eAutoOrMaxContentMaxSizing = eAutoMaxSizing | eMaxContentMaxSizing,
|
|
eIntrinsicMaxSizing = eAutoOrMaxContentMaxSizing | eMinContentMaxSizing,
|
|
eFlexMaxSizing = 0x80,
|
|
eFrozen = 0x100,
|
|
eSkipGrowUnlimited1 = 0x200,
|
|
eSkipGrowUnlimited2 = 0x400,
|
|
eSkipGrowUnlimited = eSkipGrowUnlimited1 | eSkipGrowUnlimited2,
|
|
};
|
|
|
|
nscoord mBase;
|
|
nscoord mLimit;
|
|
nscoord mPosition; // zero until we apply 'align/justify-content'
|
|
StateBits mState;
|
|
};
|
|
|
|
NS_DECLARE_FRAME_PROPERTY(GridItemContainingBlockRect, DeleteValue<nsRect>)
|
|
|
|
NS_DECLARE_FRAME_PROPERTY(GridColTrackSizes, DeleteValue<nsTArray<nscoord>>)
|
|
|
|
const nsTArray<nscoord>* GetComputedTemplateColumns()
|
|
{
|
|
return static_cast<nsTArray<nscoord>*>(Properties().Get(GridColTrackSizes()));
|
|
}
|
|
|
|
NS_DECLARE_FRAME_PROPERTY(GridRowTrackSizes, DeleteValue<nsTArray<nscoord>>)
|
|
|
|
const nsTArray<nscoord>* GetComputedTemplateRows()
|
|
{
|
|
return static_cast<nsTArray<nscoord>*>(Properties().Get(GridRowTrackSizes()));
|
|
}
|
|
|
|
protected:
|
|
static const uint32_t kAutoLine;
|
|
// The maximum line number, in the zero-based translated grid.
|
|
static const uint32_t kTranslatedMaxLine;
|
|
typedef mozilla::LogicalPoint LogicalPoint;
|
|
typedef mozilla::LogicalRect LogicalRect;
|
|
typedef mozilla::WritingMode WritingMode;
|
|
typedef mozilla::css::GridNamedArea GridNamedArea;
|
|
typedef nsLayoutUtils::IntrinsicISizeType IntrinsicISizeType;
|
|
class GridItemCSSOrderIterator;
|
|
struct TrackSizingFunctions;
|
|
struct Tracks;
|
|
struct GridReflowState;
|
|
friend nsContainerFrame* NS_NewGridContainerFrame(nsIPresShell* aPresShell,
|
|
nsStyleContext* aContext);
|
|
explicit nsGridContainerFrame(nsStyleContext* aContext)
|
|
: nsContainerFrame(aContext)
|
|
, mCachedMinISize(NS_INTRINSIC_WIDTH_UNKNOWN)
|
|
, mCachedPrefISize(NS_INTRINSIC_WIDTH_UNKNOWN)
|
|
{}
|
|
|
|
/**
|
|
* A LineRange can be definite or auto - when it's definite it represents
|
|
* a consecutive set of tracks between a starting line and an ending line.
|
|
* Before it's definite it can also represent an auto position with a span,
|
|
* where mStart == kAutoLine and mEnd is the (non-zero positive) span.
|
|
* For normal-flow items, the invariant mStart < mEnd holds when both
|
|
* lines are definite.
|
|
*
|
|
* For abs.pos. grid items, mStart and mEnd may both be kAutoLine, meaning
|
|
* "attach this side to the grid container containing block edge".
|
|
* Additionally, mStart <= mEnd holds when both are definite (non-kAutoLine),
|
|
* i.e. the invariant is slightly relaxed compared to normal flow items.
|
|
*/
|
|
struct LineRange {
|
|
LineRange(int32_t aStart, int32_t aEnd)
|
|
: mUntranslatedStart(aStart), mUntranslatedEnd(aEnd)
|
|
{
|
|
#ifdef DEBUG
|
|
if (!IsAutoAuto()) {
|
|
if (IsAuto()) {
|
|
MOZ_ASSERT(aEnd >= nsStyleGridLine::kMinLine &&
|
|
aEnd <= nsStyleGridLine::kMaxLine, "invalid span");
|
|
} else {
|
|
MOZ_ASSERT(aStart >= nsStyleGridLine::kMinLine &&
|
|
aStart <= nsStyleGridLine::kMaxLine, "invalid start line");
|
|
MOZ_ASSERT(aEnd == int32_t(kAutoLine) ||
|
|
(aEnd >= nsStyleGridLine::kMinLine &&
|
|
aEnd <= nsStyleGridLine::kMaxLine), "invalid end line");
|
|
}
|
|
}
|
|
#endif
|
|
}
|
|
bool IsAutoAuto() const { return mStart == kAutoLine && mEnd == kAutoLine; }
|
|
bool IsAuto() const { return mStart == kAutoLine; }
|
|
bool IsDefinite() const { return mStart != kAutoLine; }
|
|
uint32_t Extent() const
|
|
{
|
|
MOZ_ASSERT(mEnd != kAutoLine, "Extent is undefined for abs.pos. 'auto'");
|
|
if (IsAuto()) {
|
|
MOZ_ASSERT(mEnd >= 1 && mEnd < uint32_t(nsStyleGridLine::kMaxLine),
|
|
"invalid span");
|
|
return mEnd;
|
|
}
|
|
return mEnd - mStart;
|
|
}
|
|
/**
|
|
* Resolve this auto range to start at aStart, making it definite.
|
|
* Precondition: this range IsAuto()
|
|
*/
|
|
void ResolveAutoPosition(uint32_t aStart, uint32_t aExplicitGridOffset)
|
|
{
|
|
MOZ_ASSERT(IsAuto(), "Why call me?");
|
|
mStart = aStart;
|
|
mEnd += aStart;
|
|
// Clamping to where kMaxLine is in the explicit grid, per
|
|
// http://dev.w3.org/csswg/css-grid/#overlarge-grids :
|
|
uint32_t translatedMax = aExplicitGridOffset + nsStyleGridLine::kMaxLine;
|
|
if (MOZ_UNLIKELY(mStart >= translatedMax)) {
|
|
mEnd = translatedMax;
|
|
mStart = mEnd - 1;
|
|
} else if (MOZ_UNLIKELY(mEnd > translatedMax)) {
|
|
mEnd = translatedMax;
|
|
}
|
|
}
|
|
/**
|
|
* Return the contribution of this line range for step 2 in
|
|
* http://dev.w3.org/csswg/css-grid/#auto-placement-algo
|
|
*/
|
|
uint32_t HypotheticalEnd() const { return mEnd; }
|
|
/**
|
|
* Given an array of track sizes, return the starting position and length
|
|
* of the tracks in this line range.
|
|
*/
|
|
void ToPositionAndLength(const nsTArray<TrackSize>& aTrackSizes,
|
|
nscoord* aPos, nscoord* aLength) const;
|
|
/**
|
|
* Given an array of track sizes, return the length of the tracks in this
|
|
* line range.
|
|
*/
|
|
nscoord ToLength(const nsTArray<TrackSize>& aTrackSizes) const;
|
|
/**
|
|
* Given an array of track sizes and a grid origin coordinate, adjust the
|
|
* abs.pos. containing block along an axis given by aPos and aLength.
|
|
* aPos and aLength should already be initialized to the grid container
|
|
* containing block for this axis before calling this method.
|
|
*/
|
|
void ToPositionAndLengthForAbsPos(const nsTArray<TrackSize>& aTrackSizes,
|
|
nscoord aGridOrigin,
|
|
nscoord* aPos, nscoord* aLength) const;
|
|
|
|
/**
|
|
* @note We'll use the signed member while resolving definite positions
|
|
* to line numbers (1-based), which may become negative for implicit lines
|
|
* to the top/left of the explicit grid. PlaceGridItems() then translates
|
|
* the whole grid to a 0,0 origin and we'll use the unsigned member from
|
|
* there on.
|
|
*/
|
|
union {
|
|
uint32_t mStart;
|
|
int32_t mUntranslatedStart;
|
|
};
|
|
union {
|
|
uint32_t mEnd;
|
|
int32_t mUntranslatedEnd;
|
|
};
|
|
protected:
|
|
LineRange() {}
|
|
};
|
|
|
|
/**
|
|
* Helper class to construct a LineRange from translated lines.
|
|
* The ctor only accepts translated definite line numbers.
|
|
*/
|
|
struct TranslatedLineRange : public LineRange {
|
|
TranslatedLineRange(uint32_t aStart, uint32_t aEnd)
|
|
{
|
|
MOZ_ASSERT(aStart < aEnd && aEnd <= kTranslatedMaxLine);
|
|
mStart = aStart;
|
|
mEnd = aEnd;
|
|
}
|
|
};
|
|
|
|
/**
|
|
* Return aLine if it's inside the aMin..aMax range (inclusive),
|
|
* otherwise return kAutoLine.
|
|
*/
|
|
static int32_t
|
|
AutoIfOutside(int32_t aLine, int32_t aMin, int32_t aMax)
|
|
{
|
|
MOZ_ASSERT(aMin <= aMax);
|
|
if (aLine < aMin || aLine > aMax) {
|
|
return kAutoLine;
|
|
}
|
|
return aLine;
|
|
}
|
|
|
|
/**
|
|
* A GridArea is the area in the grid for a grid item.
|
|
* The area is represented by two LineRanges, both of which can be auto
|
|
* (@see LineRange) in intermediate steps while the item is being placed.
|
|
* @see PlaceGridItems
|
|
*/
|
|
struct GridArea {
|
|
GridArea(const LineRange& aCols, const LineRange& aRows)
|
|
: mCols(aCols), mRows(aRows) {}
|
|
bool IsDefinite() const { return mCols.IsDefinite() && mRows.IsDefinite(); }
|
|
LineRange mCols;
|
|
LineRange mRows;
|
|
};
|
|
|
|
/**
|
|
* A CellMap holds state for each cell in the grid.
|
|
* It's row major. It's sparse in the sense that it only has enough rows to
|
|
* cover the last row that has a grid item. Each row only has enough entries
|
|
* to cover columns that are occupied *on that row*, i.e. it's not a full
|
|
* matrix covering the entire implicit grid. An absent Cell means that it's
|
|
* unoccupied by any grid item.
|
|
*/
|
|
struct CellMap {
|
|
struct Cell {
|
|
Cell() : mIsOccupied(false) {}
|
|
bool mIsOccupied : 1;
|
|
};
|
|
void Fill(const GridArea& aGridArea);
|
|
void ClearOccupied();
|
|
#if DEBUG
|
|
void Dump() const;
|
|
#endif
|
|
nsTArray<nsTArray<Cell>> mCells;
|
|
};
|
|
|
|
struct GridItemInfo {
|
|
explicit GridItemInfo(const GridArea& aArea)
|
|
: mArea(aArea)
|
|
{
|
|
mIsFlexing[0] = false;
|
|
mIsFlexing[1] = false;
|
|
}
|
|
|
|
GridArea mArea;
|
|
bool mIsFlexing[2]; // does the item span a flex track? (LogicalAxis index)
|
|
static_assert(mozilla::eLogicalAxisBlock == 0, "unexpected index value");
|
|
static_assert(mozilla::eLogicalAxisInline == 1, "unexpected index value");
|
|
#ifdef DEBUG
|
|
nsIFrame* mFrame;
|
|
#endif
|
|
};
|
|
|
|
enum LineRangeSide {
|
|
eLineRangeSideStart, eLineRangeSideEnd
|
|
};
|
|
/**
|
|
* Return a line number for (non-auto) aLine, per:
|
|
* http://dev.w3.org/csswg/css-grid/#line-placement
|
|
* @param aLine style data for the line (must be non-auto)
|
|
* @param aNth a number of lines to find from aFromIndex, negative if the
|
|
* search should be in reverse order. In the case aLine has
|
|
* a specified line name, it's permitted to pass in zero which
|
|
* will be treated as one.
|
|
* @param aFromIndex the zero-based index to start counting from
|
|
* @param aLineNameList the explicit named lines
|
|
* @param aAreaStart a pointer to GridNamedArea::mColumnStart/mRowStart
|
|
* @param aAreaEnd a pointer to GridNamedArea::mColumnEnd/mRowEnd
|
|
* @param aExplicitGridEnd the last line in the explicit grid
|
|
* @param aEdge indicates whether we are resolving a start or end line
|
|
* @param aStyle the StylePosition() for the grid container
|
|
* @return a definite line (1-based), clamped to the kMinLine..kMaxLine range
|
|
*/
|
|
int32_t ResolveLine(const nsStyleGridLine& aLine,
|
|
int32_t aNth,
|
|
uint32_t aFromIndex,
|
|
const nsTArray<nsTArray<nsString>>& aLineNameList,
|
|
uint32_t GridNamedArea::* aAreaStart,
|
|
uint32_t GridNamedArea::* aAreaEnd,
|
|
uint32_t aExplicitGridEnd,
|
|
LineRangeSide aEdge,
|
|
const nsStylePosition* aStyle);
|
|
/**
|
|
* Return a LineRange based on the given style data. Non-auto lines
|
|
* are resolved to a definite line number (1-based) per:
|
|
* http://dev.w3.org/csswg/css-grid/#line-placement
|
|
* with placement errors corrected per:
|
|
* http://dev.w3.org/csswg/css-grid/#grid-placement-errors
|
|
* @param aStyle the StylePosition() for the grid container
|
|
* @param aStart style data for the start line
|
|
* @param aEnd style data for the end line
|
|
* @param aLineNameList the explicit named lines
|
|
* @param aAreaStart a pointer to GridNamedArea::mColumnStart/mRowStart
|
|
* @param aAreaEnd a pointer to GridNamedArea::mColumnEnd/mRowEnd
|
|
* @param aExplicitGridEnd the last line in the explicit grid
|
|
* @param aStyle the StylePosition() for the grid container
|
|
*/
|
|
LineRange ResolveLineRange(const nsStyleGridLine& aStart,
|
|
const nsStyleGridLine& aEnd,
|
|
const nsTArray<nsTArray<nsString>>& aLineNameList,
|
|
uint32_t GridNamedArea::* aAreaStart,
|
|
uint32_t GridNamedArea::* aAreaEnd,
|
|
uint32_t aExplicitGridEnd,
|
|
const nsStylePosition* aStyle);
|
|
|
|
/**
|
|
* As above but for an abs.pos. child. Any 'auto' lines will be represented
|
|
* by kAutoLine in the LineRange result.
|
|
* @param aGridStart the first line in the final, but untranslated grid
|
|
* @param aGridEnd the last line in the final, but untranslated grid
|
|
*/
|
|
LineRange
|
|
ResolveAbsPosLineRange(const nsStyleGridLine& aStart,
|
|
const nsStyleGridLine& aEnd,
|
|
const nsTArray<nsTArray<nsString>>& aLineNameList,
|
|
uint32_t GridNamedArea::* aAreaStart,
|
|
uint32_t GridNamedArea::* aAreaEnd,
|
|
uint32_t aExplicitGridEnd,
|
|
int32_t aGridStart,
|
|
int32_t aGridEnd,
|
|
const nsStylePosition* aStyle);
|
|
|
|
/**
|
|
* Return a GridArea with non-auto lines placed at a definite line (1-based)
|
|
* with placement errors resolved. One or both positions may still
|
|
* be 'auto'.
|
|
* @param aChild the grid item
|
|
* @param aStyle the StylePosition() for the grid container
|
|
*/
|
|
GridArea PlaceDefinite(nsIFrame* aChild, const nsStylePosition* aStyle);
|
|
|
|
/**
|
|
* Place aArea in the first column (in row aArea->mRows.mStart) starting at
|
|
* aStartCol without overlapping other items. The resulting aArea may
|
|
* overflow the current implicit grid bounds.
|
|
* Pre-condition: aArea->mRows.IsDefinite() is true.
|
|
* Post-condition: aArea->IsDefinite() is true.
|
|
*/
|
|
void PlaceAutoCol(uint32_t aStartCol, GridArea* aArea) const;
|
|
|
|
/**
|
|
* Find the first column in row aLockedRow starting at aStartCol where aArea
|
|
* could be placed without overlapping other items. The returned column may
|
|
* cause aArea to overflow the current implicit grid bounds if placed there.
|
|
*/
|
|
uint32_t FindAutoCol(uint32_t aStartCol, uint32_t aLockedRow,
|
|
const GridArea* aArea) const;
|
|
|
|
/**
|
|
* Place aArea in the first row (in column aArea->mCols.mStart) starting at
|
|
* aStartRow without overlapping other items. The resulting aArea may
|
|
* overflow the current implicit grid bounds.
|
|
* Pre-condition: aArea->mCols.IsDefinite() is true.
|
|
* Post-condition: aArea->IsDefinite() is true.
|
|
*/
|
|
void PlaceAutoRow(uint32_t aStartRow, GridArea* aArea) const;
|
|
|
|
/**
|
|
* Find the first row in column aLockedCol starting at aStartRow where aArea
|
|
* could be placed without overlapping other items. The returned row may
|
|
* cause aArea to overflow the current implicit grid bounds if placed there.
|
|
*/
|
|
uint32_t FindAutoRow(uint32_t aLockedCol, uint32_t aStartRow,
|
|
const GridArea* aArea) const;
|
|
|
|
/**
|
|
* Place aArea in the first column starting at aStartCol,aStartRow without
|
|
* causing it to overlap other items or overflow mGridColEnd.
|
|
* If there's no such column in aStartRow, continue in position 1,aStartRow+1.
|
|
* Pre-condition: aArea->mCols.IsAuto() && aArea->mRows.IsAuto() is true.
|
|
* Post-condition: aArea->IsDefinite() is true.
|
|
*/
|
|
void PlaceAutoAutoInRowOrder(uint32_t aStartCol, uint32_t aStartRow,
|
|
GridArea* aArea) const;
|
|
|
|
/**
|
|
* Place aArea in the first row starting at aStartCol,aStartRow without
|
|
* causing it to overlap other items or overflow mGridRowEnd.
|
|
* If there's no such row in aStartCol, continue in position aStartCol+1,1.
|
|
* Pre-condition: aArea->mCols.IsAuto() && aArea->mRows.IsAuto() is true.
|
|
* Post-condition: aArea->IsDefinite() is true.
|
|
*/
|
|
void PlaceAutoAutoInColOrder(uint32_t aStartCol, uint32_t aStartRow,
|
|
GridArea* aArea) const;
|
|
|
|
/**
|
|
* Return a GridArea for abs.pos. item with non-auto lines placed at
|
|
* a definite line (1-based) with placement errors resolved. One or both
|
|
* positions may still be 'auto'.
|
|
* @param aChild the abs.pos. grid item to place
|
|
* @param aStyle the StylePosition() for the grid container
|
|
*/
|
|
GridArea PlaceAbsPos(nsIFrame* aChild, const nsStylePosition* aStyle);
|
|
|
|
/**
|
|
* Place all child frames into the grid and expand the (implicit) grid as
|
|
* needed. The allocated GridAreas are stored in the GridAreaProperty
|
|
* frame property on the child frame.
|
|
*/
|
|
void PlaceGridItems(GridReflowState& aState);
|
|
|
|
/**
|
|
* Initialize the end lines of the Explicit Grid (mExplicitGridCol[Row]End).
|
|
* This is determined by the larger of the number of rows/columns defined
|
|
* by 'grid-template-areas' and the 'grid-template-rows'/'-columns', plus one.
|
|
* Also initialize the Implicit Grid (mGridCol[Row]End) to the same values.
|
|
* @param aStyle the StylePosition() for the grid container
|
|
*/
|
|
void InitializeGridBounds(const nsStylePosition* aStyle);
|
|
|
|
/**
|
|
* Inflate the implicit grid to include aArea.
|
|
* @param aArea may be definite or auto
|
|
*/
|
|
void InflateGridFor(const GridArea& aArea)
|
|
{
|
|
mGridColEnd = std::max(mGridColEnd, aArea.mCols.HypotheticalEnd());
|
|
mGridRowEnd = std::max(mGridRowEnd, aArea.mRows.HypotheticalEnd());
|
|
MOZ_ASSERT(mGridColEnd <= kTranslatedMaxLine &&
|
|
mGridRowEnd <= kTranslatedMaxLine);
|
|
}
|
|
|
|
/**
|
|
* Calculate track sizes.
|
|
*/
|
|
void CalculateTrackSizes(GridReflowState& aState,
|
|
const mozilla::LogicalSize& aContentBox,
|
|
IntrinsicISizeType aConstraint);
|
|
|
|
/**
|
|
* Helper method for ResolveLineRange.
|
|
* @see ResolveLineRange
|
|
* @return a pair (start,end) of lines
|
|
*/
|
|
typedef std::pair<int32_t, int32_t> LinePair;
|
|
LinePair ResolveLineRangeHelper(const nsStyleGridLine& aStart,
|
|
const nsStyleGridLine& aEnd,
|
|
const nsTArray<nsTArray<nsString>>& aLineNameList,
|
|
uint32_t GridNamedArea::* aAreaStart,
|
|
uint32_t GridNamedArea::* aAreaEnd,
|
|
uint32_t aExplicitGridEnd,
|
|
const nsStylePosition* aStyle);
|
|
|
|
/**
|
|
* XXX temporary - move the ImplicitNamedAreas stuff to the style system.
|
|
* The implicit area names that come from x-start .. x-end lines in
|
|
* grid-template-columns / grid-template-rows are stored in this frame
|
|
* property when needed, as a ImplicitNamedAreas* value.
|
|
*/
|
|
NS_DECLARE_FRAME_PROPERTY(ImplicitNamedAreasProperty,
|
|
DeleteValue<ImplicitNamedAreas>)
|
|
void InitImplicitNamedAreas(const nsStylePosition* aStyle);
|
|
void AddImplicitNamedAreas(const nsTArray<nsTArray<nsString>>& aLineNameLists);
|
|
typedef nsTHashtable<nsStringHashKey> ImplicitNamedAreas;
|
|
ImplicitNamedAreas* GetImplicitNamedAreas() const {
|
|
return static_cast<ImplicitNamedAreas*>(Properties().Get(ImplicitNamedAreasProperty()));
|
|
}
|
|
bool HasImplicitNamedArea(const nsString& aName) const {
|
|
ImplicitNamedAreas* areas = GetImplicitNamedAreas();
|
|
return areas && areas->Contains(aName);
|
|
}
|
|
|
|
/**
|
|
* Return the containing block for a grid item occupying aArea.
|
|
*/
|
|
LogicalRect ContainingBlockFor(const GridReflowState& aState,
|
|
const GridArea& aArea) const;
|
|
|
|
/**
|
|
* Return the containing block for an abs.pos. grid item occupying aArea.
|
|
* Any 'auto' lines in the grid area will be aligned with grid container
|
|
* containing block on that side.
|
|
* @param aGridOrigin the origin of the grid
|
|
* @param aGridCB the grid container containing block (its padding area)
|
|
*/
|
|
LogicalRect ContainingBlockForAbsPos(const GridReflowState& aState,
|
|
const GridArea& aArea,
|
|
const LogicalPoint& aGridOrigin,
|
|
const LogicalRect& aGridCB) const;
|
|
|
|
/**
|
|
* Reflow and place our children.
|
|
*/
|
|
void ReflowChildren(GridReflowState& aState,
|
|
const LogicalRect& aContentArea,
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
nsReflowStatus& aStatus);
|
|
|
|
/**
|
|
* Helper for GetMinISize / GetPrefISize.
|
|
*/
|
|
nscoord IntrinsicISize(nsRenderingContext* aRenderingContext,
|
|
IntrinsicISizeType aConstraint);
|
|
|
|
#ifdef DEBUG
|
|
void SanityCheckAnonymousGridItems() const;
|
|
#endif // DEBUG
|
|
|
|
private:
|
|
/**
|
|
* Info about each (normal flow) grid item.
|
|
*/
|
|
nsTArray<GridItemInfo> mGridItems;
|
|
|
|
/**
|
|
* Info about each grid-aligned abs.pos. child.
|
|
*/
|
|
nsTArray<GridItemInfo> mAbsPosItems;
|
|
|
|
/**
|
|
* State for each cell in the grid.
|
|
*/
|
|
CellMap mCellMap;
|
|
|
|
/**
|
|
* The last column grid line (1-based) in the explicit grid.
|
|
* (i.e. the number of explicit columns + 1)
|
|
*/
|
|
uint32_t mExplicitGridColEnd;
|
|
/**
|
|
* The last row grid line (1-based) in the explicit grid.
|
|
* (i.e. the number of explicit rows + 1)
|
|
*/
|
|
uint32_t mExplicitGridRowEnd;
|
|
// Same for the implicit grid, except these become zero-based after
|
|
// resolving definite lines.
|
|
uint32_t mGridColEnd;
|
|
uint32_t mGridRowEnd;
|
|
|
|
/**
|
|
* Offsets from the start of the implicit grid to the start of the translated
|
|
* explicit grid. They are zero if there are no implicit lines before 1,1.
|
|
* e.g. "grid-column: span 3 / 1" makes mExplicitGridOffsetCol = 3 and the
|
|
* corresponding GridArea::mCols will be 0 / 3 in the zero-based translated
|
|
* grid.
|
|
*/
|
|
uint32_t mExplicitGridOffsetCol;
|
|
uint32_t mExplicitGridOffsetRow;
|
|
|
|
/**
|
|
* Cached values to optimize GetMinISize/GetPrefISize.
|
|
*/
|
|
nscoord mCachedMinISize;
|
|
nscoord mCachedPrefISize;
|
|
|
|
/**
|
|
* True iff the normal flow children are already in CSS 'order' in the
|
|
* order they occur in the child frame list.
|
|
*/
|
|
bool mIsNormalFlowInCSSOrder : 1;
|
|
};
|
|
|
|
namespace mozilla {
|
|
template <>
|
|
struct IsPod<nsGridContainerFrame::TrackSize> : TrueType {};
|
|
}
|
|
|
|
#endif /* nsGridContainerFrame_h___ */
|