import changes from `dev' branch of rmottola/Arctic-Fox:

- 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)
This commit is contained in:
2023-07-11 15:00:13 +08:00
parent 585686d345
commit cbf860dd80
185 changed files with 7656 additions and 1185 deletions
+121 -123
View File
@@ -79,6 +79,9 @@ nsHTMLReflowState::nsHTMLReflowState(nsPresContext* aPresContext,
if (aFlags & DUMMY_PARENT_REFLOW_STATE) {
mFlags.mDummyParentReflowState = true;
}
if (aFlags & COMPUTE_SIZE_SHRINK_WRAP) {
mFlags.mShrinkWrap = true;
}
if (!(aFlags & CALLER_WILL_INIT)) {
Init(aPresContext);
@@ -219,6 +222,7 @@ nsHTMLReflowState::nsHTMLReflowState(
mFlags.mIsColumnBalancing = false;
mFlags.mIsFlexContainerMeasuringHeight = false;
mFlags.mDummyParentReflowState = false;
mFlags.mShrinkWrap = !!(aFlags & COMPUTE_SIZE_SHRINK_WRAP);
mDiscoveredClearance = nullptr;
mPercentBSizeObserver = (aParentReflowState.mPercentBSizeObserver &&
@@ -444,11 +448,19 @@ nsHTMLReflowState::Init(nsPresContext* aPresContext,
}
}
if (AvailableBSize() != NS_UNCONSTRAINEDSIZE && parentReflowState &&
if (parentReflowState &&
parentReflowState->GetWritingMode().IsOrthogonalTo(mWritingMode)) {
// Orthogonal frames are always reflowed with unconstrained block-size,
// to avoid incomplete reflow across an orthogonal boundary.
AvailableBSize() = NS_UNCONSTRAINEDSIZE;
// Orthogonal frames are always reflowed with an unconstrained
// dimension to avoid incomplete reflow across an orthogonal
// boundary. Normally this is the block-size, but for column sets
// with auto-height it's the inline-size, so that they can add
// columns in the container's block direction
if (type == nsGkAtoms::columnSetFrame &&
eStyleUnit_Auto == mStylePosition->ISize(mWritingMode).GetUnit()) {
ComputedISize() = NS_UNCONSTRAINEDSIZE;
} else {
AvailableBSize() = NS_UNCONSTRAINEDSIZE;
}
}
LAYOUT_WARN_IF_FALSE((mFrameType == NS_CSS_FRAME_TYPE_INLINE &&
@@ -621,7 +633,7 @@ nsHTMLReflowState::InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameT
// mCBReflowState->IsBResize() is set correctly below when
// reflowing descendant.
SetBResize(true);
} else if (mCBReflowState && !nsLayoutUtils::IsNonWrapperBlock(frame)) {
} else if (mCBReflowState && frame->IsBlockWrapper()) {
// XXX Is this problematic for relatively positioned inlines acting
// as containing block for absolutely positioned elements?
// Possibly; in that case we should at least be checking
@@ -1017,11 +1029,10 @@ nsHTMLReflowState::GetHypotheticalBoxContainer(nsIFrame* aFrame,
state = nullptr;
}
WritingMode wm = aFrame->GetWritingMode();
if (state) {
WritingMode stateWM = state->GetWritingMode();
aCBIStartEdge =
state->ComputedLogicalBorderPadding().ConvertTo(wm, stateWM).IStart(wm);
WritingMode wm = state->GetWritingMode();
NS_ASSERTION(wm == aFrame->GetWritingMode(), "unexpected writing mode");
aCBIStartEdge = state->ComputedLogicalBorderPadding().IStart(wm);
aCBSize = state->ComputedSize(wm);
} else {
/* Didn't find a reflow state for aFrame. Just compute the information we
@@ -1029,6 +1040,7 @@ nsHTMLReflowState::GetHypotheticalBoxContainer(nsIFrame* aFrame,
ought to be true by now. */
NS_ASSERTION(!(aFrame->GetStateBits() & NS_FRAME_IN_REFLOW),
"aFrame shouldn't be in reflow; we'll lie if it is");
WritingMode wm = aFrame->GetWritingMode();
LogicalMargin borderPadding = aFrame->GetLogicalUsedBorderAndPadding(wm);
aCBIStartEdge = borderPadding.IStart(wm);
aCBSize = aFrame->GetLogicalSize(wm) - borderPadding.Size(wm);
@@ -1037,27 +1049,12 @@ nsHTMLReflowState::GetHypotheticalBoxContainer(nsIFrame* aFrame,
return aFrame;
}
// When determining the hypothetical box that would have been if the element
// had been in the flow we may not be able to exactly determine both the IStart
// and IEnd edges. For example, if the element is a non-replaced inline-level
// element we would have to reflow it in order to determine its desired ISize.
// In that case depending on the progression direction either the IStart or
// IEnd edge would be marked as not being exact.
struct nsHypotheticalBox {
// offsets from inline-start edge of containing block (which is a padding edge)
nscoord mIStart, mIEnd;
struct nsHypotheticalPosition {
// offset from inline-start edge of containing block (which is a padding edge)
nscoord mIStart;
// offset from block-start edge of containing block (which is a padding edge)
nscoord mBStart;
WritingMode mWritingMode;
#ifdef DEBUG
bool mIStartIsExact, mIEndIsExact;
#endif
nsHypotheticalBox() {
#ifdef DEBUG
mIStartIsExact = mIEndIsExact = false;
#endif
}
};
static bool
@@ -1191,20 +1188,22 @@ static bool AreAllEarlierInFlowFramesEmpty(nsIFrame* aFrame,
return true;
}
// Calculate the hypothetical box that the element would have if it were in
// the flow. The values returned are relative to the padding edge of the
// absolute containing block. The writing-mode of the hypothetical box will
// Calculate the position of the hypothetical box that the element would have
// if it were in the flow.
// The values returned are relative to the padding edge of the absolute
// containing block. The writing-mode of the hypothetical box position will
// have the same block direction as the absolute containing block, but may
// differ in inline-bidi direction.
// In the code below, |cbrs->frame| is the absolute containing block, while
// |containingBlock| is the nearest block container of the placeholder frame,
// which may be different from the absolute containing block.
void
nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext,
nsIFrame* aPlaceholderFrame,
const nsHTMLReflowState* cbrs,
nsHypotheticalBox& aHypotheticalBox,
nsIAtom* aFrameType)
nsHTMLReflowState::CalculateHypotheticalPosition
(nsPresContext* aPresContext,
nsIFrame* aPlaceholderFrame,
const nsHTMLReflowState* cbrs,
nsHypotheticalPosition& aHypotheticalPos,
nsIAtom* aFrameType)
{
NS_ASSERTION(mStyleDisplay->mOriginalDisplay != NS_STYLE_DISPLAY_NONE,
"mOriginalDisplay has not been properly initialized");
@@ -1311,7 +1310,7 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext,
if (!isValid) {
// Give up. We're probably dealing with somebody using
// position:absolute inside native-anonymous content anyway.
aHypotheticalBox.mBStart = placeholderOffset.B(wm);
aHypotheticalPos.mBStart = placeholderOffset.B(wm);
} else {
NS_ASSERTION(iter.GetContainer() == blockFrame,
"Found placeholder in wrong block!");
@@ -1325,7 +1324,7 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext,
if (mStyleDisplay->IsOriginalDisplayInlineOutsideStyle()) {
// Use the block-start of the inline box which the placeholder lives in
// as the hypothetical box's block-start.
aHypotheticalBox.mBStart = lineBounds.BStart(wm) + blockOffset.B(wm);
aHypotheticalPos.mBStart = lineBounds.BStart(wm) + blockOffset.B(wm);
} else {
// The element would have been block-level which means it would
// be below the line containing the placeholder frame, unless
@@ -1350,15 +1349,17 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext,
// The top of the hypothetical box is the top of the line
// containing the placeholder, since there is nothing in the
// line before our placeholder except empty frames.
aHypotheticalBox.mBStart = lineBounds.BStart(wm) + blockOffset.B(wm);
aHypotheticalPos.mBStart =
lineBounds.BStart(wm) + blockOffset.B(wm);
} else {
// The top of the hypothetical box is just below the line
// containing the placeholder.
aHypotheticalBox.mBStart = lineBounds.BEnd(wm) + blockOffset.B(wm);
aHypotheticalPos.mBStart =
lineBounds.BEnd(wm) + blockOffset.B(wm);
}
} else {
// Just use the placeholder's block-offset wrt the containing block
aHypotheticalBox.mBStart = placeholderOffset.B(wm);
aHypotheticalPos.mBStart = placeholderOffset.B(wm);
}
}
}
@@ -1366,36 +1367,17 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext,
// The containing block is not a block, so it's probably something
// like a XUL box, etc.
// Just use the placeholder's block-offset
aHypotheticalBox.mBStart = placeholderOffset.B(wm);
aHypotheticalPos.mBStart = placeholderOffset.B(wm);
}
// Second, determine the hypothetical box's mIStart & mIEnd.
// Second, determine the hypothetical box's mIStart.
// How we determine the hypothetical box depends on whether the element
// would have been inline-level or block-level
if (mStyleDisplay->IsOriginalDisplayInlineOutsideStyle()) {
// The placeholder represents the left edge of the hypothetical box
aHypotheticalBox.mIStart = placeholderOffset.I(wm);
aHypotheticalPos.mIStart = placeholderOffset.I(wm);
} else {
aHypotheticalBox.mIStart = blockIStartContentEdge;
}
#ifdef DEBUG
aHypotheticalBox.mIStartIsExact = true;
#endif
if (knowBoxISize) {
aHypotheticalBox.mIEnd = aHypotheticalBox.mIStart + boxISize;
#ifdef DEBUG
aHypotheticalBox.mIEndIsExact = true;
#endif
} else {
// We can't compute the inline-end edge because we don't know the desired
// inline-size. So instead use the end content edge of the block parent,
// but remember it's not exact
aHypotheticalBox.mIEnd =
blockIStartContentEdge + blockContentSize.ISize(wm);
#ifdef DEBUG
aHypotheticalBox.mIEndIsExact = false;
#endif
aHypotheticalPos.mIStart = blockIStartContentEdge;
}
// The current coordinate space is that of the nearest block to the placeholder.
@@ -1437,9 +1419,8 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext,
}
nsSize cbrsSize = cbrs->ComputedSizeAsContainerIfConstrained();
LogicalPoint logCBOffs(wm, cbOffset, cbrsSize - containerSize);
aHypotheticalBox.mIStart += logCBOffs.I(wm);
aHypotheticalBox.mIEnd += logCBOffs.I(wm);
aHypotheticalBox.mBStart += logCBOffs.B(wm);
aHypotheticalPos.mIStart += logCBOffs.I(wm);
aHypotheticalPos.mBStart += logCBOffs.B(wm);
// The specified offsets are relative to the absolute containing block's
// padding edge and our current values are relative to the border edge, so
@@ -1447,20 +1428,19 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext,
LogicalMargin border =
cbrs->ComputedLogicalBorderPadding() - cbrs->ComputedLogicalPadding();
border = border.ConvertTo(wm, cbrs->GetWritingMode());
aHypotheticalBox.mIStart -= border.IStart(wm);
aHypotheticalBox.mIEnd -= border.IStart(wm);
aHypotheticalBox.mBStart -= border.BStart(wm);
aHypotheticalPos.mIStart -= border.IStart(wm);
aHypotheticalPos.mBStart -= border.BStart(wm);
// At this point, we have computed aHypotheticalBox using the writing mode
// At this point, we have computed aHypotheticalPos using the writing mode
// of the placeholder's containing block.
if (cbwm.GetBlockDir() != wm.GetBlockDir()) {
// If the block direction we used in calculating aHypotheticalBox does not
// If the block direction we used in calculating aHypotheticalPos does not
// match the absolute containing block's, we need to convert here so that
// aHypotheticalBox is usable in relation to the absolute containing block.
// aHypotheticalPos is usable in relation to the absolute containing block.
// This requires computing or measuring the abspos frame's block-size,
// which is not otherwise required/used here (as aHypotheticalBox records
// only the block-start coordinate).
// which is not otherwise required/used here (as aHypotheticalPos
// records only the block-start coordinate).
// This is similar to the inline-size calculation for a replaced
// inline-level element or a block-level element (above), except that
@@ -1502,21 +1482,16 @@ nsHTMLReflowState::CalculateHypotheticalBox(nsPresContext* aPresContext,
LogicalSize boxSize(wm, knowBoxISize ? boxISize : 0, boxBSize);
LogicalPoint origin(wm, aHypotheticalBox.mIStart,
aHypotheticalBox.mBStart);
LogicalPoint origin(wm, aHypotheticalPos.mIStart,
aHypotheticalPos.mBStart);
origin = origin.ConvertTo(cbwm, wm, cbrsSize -
boxSize.GetPhysicalSize(wm));
aHypotheticalBox.mIStart = origin.I(cbwm);
aHypotheticalBox.mIEnd = aHypotheticalBox.mIStart +
boxSize.ConvertTo(cbwm, wm).ISize(cbwm);
#ifdef DEBUG
aHypotheticalBox.mIEndIsExact = false; // it may be fake
#endif
aHypotheticalBox.mBStart = origin.B(cbwm);
aHypotheticalBox.mWritingMode = cbwm;
aHypotheticalPos.mIStart = origin.I(cbwm);
aHypotheticalPos.mBStart = origin.B(cbwm);
aHypotheticalPos.mWritingMode = cbwm;
} else {
aHypotheticalBox.mWritingMode = wm;
aHypotheticalPos.mWritingMode = wm;
}
}
@@ -1543,15 +1518,15 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext,
NS_ASSERTION(nullptr != placeholderFrame, "no placeholder frame");
// If both 'left' and 'right' are 'auto' or both 'top' and 'bottom' are
// 'auto', then compute the hypothetical box of where the element would
// 'auto', then compute the hypothetical box position where the element would
// have been if it had been in the flow
nsHypotheticalBox hypotheticalBox;
nsHypotheticalPosition hypotheticalPos;
if (((eStyleUnit_Auto == mStylePosition->mOffset.GetLeftUnit()) &&
(eStyleUnit_Auto == mStylePosition->mOffset.GetRightUnit())) ||
((eStyleUnit_Auto == mStylePosition->mOffset.GetTopUnit()) &&
(eStyleUnit_Auto == mStylePosition->mOffset.GetBottomUnit()))) {
CalculateHypotheticalBox(aPresContext, placeholderFrame, cbrs,
hypotheticalBox, aFrameType);
CalculateHypotheticalPosition(aPresContext, placeholderFrame, cbrs,
hypotheticalPos, aFrameType);
}
// Initialize the 'left' and 'right' computed offsets
@@ -1583,13 +1558,11 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext,
}
if (iStartIsAuto && iEndIsAuto) {
NS_ASSERTION(hypotheticalBox.mIStartIsExact, "should always have "
"exact value on containing block's start side");
if (cbwm.IsBidiLTR() != hypotheticalBox.mWritingMode.IsBidiLTR()) {
offsets.IEnd(cbwm) = hypotheticalBox.mIStart;
if (cbwm.IsBidiLTR() != hypotheticalPos.mWritingMode.IsBidiLTR()) {
offsets.IEnd(cbwm) = hypotheticalPos.mIStart;
iEndIsAuto = false;
} else {
offsets.IStart(cbwm) = hypotheticalBox.mIStart;
offsets.IStart(cbwm) = hypotheticalPos.mIStart;
iStartIsAuto = false;
}
}
@@ -1613,7 +1586,7 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext,
if (bStartIsAuto && bEndIsAuto) {
// Treat 'top' like 'static-position'
offsets.BStart(cbwm) = hypotheticalBox.mBStart;
offsets.BStart(cbwm) = hypotheticalPos.mBStart;
bStartIsAuto = false;
}
@@ -1624,6 +1597,10 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext,
typedef nsIFrame::ComputeSizeFlags ComputeSizeFlags;
ComputeSizeFlags computeSizeFlags = ComputeSizeFlags::eDefault;
if (mFlags.mShrinkWrap) {
computeSizeFlags =
ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eShrinkWrap);
}
if (wm.IsOrthogonalTo(cbwm)) {
if (bStartIsAuto || bEndIsAuto) {
computeSizeFlags =
@@ -2026,11 +2003,11 @@ nsHTMLReflowState::ComputeContainingBlockRectangle(
cbSize.ISize(wm) = aContainingBlockRS->frame->ISize(wm) -
computedBorder.IStartEnd(wm);
NS_ASSERTION(cbSize.ISize(wm) >= 0,
"Negative containing block width!");
"Negative containing block isize!");
cbSize.BSize(wm) = aContainingBlockRS->frame->BSize(wm) -
computedBorder.BStartEnd(wm);
NS_ASSERTION(cbSize.BSize(wm) >= 0,
"Negative containing block height!");
"Negative containing block bsize!");
} else {
// If the ancestor is block-level, the containing block is formed by the
// padding edge of the ancestor
@@ -2254,11 +2231,12 @@ nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
// this MUST come after we've computed our border and padding.
ComputeMinMaxValues(cbSize);
// Calculate the computed width and blockSize. This varies by frame type
// Calculate the computed inlineSize and blockSize.
// This varies by frame type.
if (NS_CSS_FRAME_TYPE_INTERNAL_TABLE == mFrameType) {
// Internal table elements. The rules vary depending on the type.
// Calculate the computed width
// Calculate the computed isize
bool rowOrRowGroup = false;
const nsStyleCoord &inlineSize = mStylePosition->ISize(wm);
nsStyleUnit inlineSizeUnit = inlineSize.GetUnit();
@@ -2281,11 +2259,11 @@ nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
if (ComputedISize() < 0)
ComputedISize() = 0;
}
NS_ASSERTION(ComputedISize() >= 0, "Bogus computed width");
NS_ASSERTION(ComputedISize() >= 0, "Bogus computed isize");
} else {
NS_ASSERTION(inlineSizeUnit == inlineSize.GetUnit(),
"unexpected width unit change");
"unexpected inline size unit change");
ComputedISize() = ComputeISizeValue(cbSize.ISize(wm),
mStylePosition->mBoxSizing,
inlineSize);
@@ -2323,37 +2301,57 @@ nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
typedef nsIFrame::ComputeSizeFlags ComputeSizeFlags;
ComputeSizeFlags computeSizeFlags =
isBlock ? ComputeSizeFlags::eDefault : ComputeSizeFlags::eShrinkWrap;
// Make sure legend frames with display:block and width:auto still
// shrink-wrap.
// Also shrink-wrap blocks that are orthogonal to their container.
if (isBlock &&
((aFrameType == nsGkAtoms::legendFrame &&
frame->StyleContext()->GetPseudo() != nsCSSAnonBoxes::scrolledContent) ||
(aFrameType == nsGkAtoms::scrollFrame &&
frame->GetContentInsertionFrame()->GetType() == nsGkAtoms::legendFrame) ||
(mCBReflowState &&
mCBReflowState->GetWritingMode().IsOrthogonalTo(mWritingMode)))) {
if (mFlags.mShrinkWrap) {
computeSizeFlags =
ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eShrinkWrap);
}
nsIFrame* parent = frame->GetParent();
nsIAtom* parentFrameType = parent ? parent->GetType() : nullptr;
if (parentFrameType == nsGkAtoms::flexContainerFrame) {
computeSizeFlags =
ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eShrinkWrap);
// If we're inside of a flex container that needs to measure our
// auto height, pass that information along to ComputeSize().
if (mFlags.mIsFlexContainerMeasuringHeight) {
if (parentFrameType == nsGkAtoms::gridContainerFrame) {
// Shrink-wrap grid items that will be aligned (rather than stretched)
// in its inline axis.
auto inlineAxisAlignment = wm.IsOrthogonalTo(cbwm) ?
mStylePosition->ComputedAlignSelf(mStyleDisplay,
frame->StyleContext()->GetParent()) :
mStylePosition->ComputedJustifySelf(mStyleDisplay,
frame->StyleContext()->GetParent());
if (inlineAxisAlignment != NS_STYLE_ALIGN_STRETCH ||
mStyleMargin->mMargin.GetIStartUnit(wm) == eStyleUnit_Auto ||
mStyleMargin->mMargin.GetIEndUnit(wm) == eStyleUnit_Auto) {
computeSizeFlags =
ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eUseAutoHeight);
ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eShrinkWrap);
}
} else {
MOZ_ASSERT(!mFlags.mIsFlexContainerMeasuringHeight,
"We're not in a flex container, so the flag "
"'mIsFlexContainerMeasuringHeight' shouldn't be set");
// Make sure legend frames with display:block and width:auto still
// shrink-wrap.
// Also shrink-wrap blocks that are orthogonal to their container.
if (isBlock &&
((aFrameType == nsGkAtoms::legendFrame &&
frame->StyleContext()->GetPseudo() != nsCSSAnonBoxes::scrolledContent) ||
(aFrameType == nsGkAtoms::scrollFrame &&
frame->GetContentInsertionFrame()->GetType() == nsGkAtoms::legendFrame) ||
(mCBReflowState &&
mCBReflowState->GetWritingMode().IsOrthogonalTo(mWritingMode)))) {
computeSizeFlags =
ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eShrinkWrap);
}
if (parentFrameType == nsGkAtoms::flexContainerFrame) {
computeSizeFlags =
ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eShrinkWrap);
// If we're inside of a flex container that needs to measure our
// auto height, pass that information along to ComputeSize().
if (mFlags.mIsFlexContainerMeasuringHeight) {
computeSizeFlags =
ComputeSizeFlags(computeSizeFlags | ComputeSizeFlags::eUseAutoHeight);
}
} else {
MOZ_ASSERT(!mFlags.mIsFlexContainerMeasuringHeight,
"We're not in a flex container, so the flag "
"'mIsFlexContainerMeasuringHeight' shouldn't be set");
}
}
if (cbSize.ISize(wm) == NS_UNCONSTRAINEDSIZE) {