Merge autoland to mozilla-central a=merge

This commit is contained in:
Razvan Maries 2019-10-13 12:35:16 +03:00
commit 6866d3a650
22 changed files with 477 additions and 247 deletions

View File

@ -577,7 +577,7 @@ support-files = file_bug871161-1.html file_bug871161-2.html
[test_bug1013316.html]
[test_window_open_close.html]
tags = openwindow
skip-if = (toolkit == "android" && debug && !is_fennec) || (webrender && os == "linux") || (os == "windows" && debug && bits == 64) # Bug 1533759
skip-if = (toolkit == "android" && debug && !is_fennec) || (webrender && os == "linux") || (os == "win" && debug && bits == 64) # Bug 1533759
[test_viewport_resize.html]
[test_image_clone_load.html]
[test_bug1203668.html]

View File

@ -42,3 +42,7 @@ CompositorAnimationWarningHasRenderingObserver=Animation cannot be run on the co
## LOCALIZATION NOTE: Do not translate zoom, calc(), "transform", "transform-origin: 0 0"
ZoomPropertyWarning=This page uses the non standard property “zoom”. Consider using calc() in the relevant property values, or using “transform” along with “transform-origin: 0 0”.
## LOCALIZATION NOTE(PrincipalWritingModePropagationWarning):
## Do not translate <html>, <body>, CSS, "writing-mode", "direction", "text-orientation", :root, and "The Principal Writing Mode" because they are technical terms.
PrincipalWritingModePropagationWarning=When rendering the <html> element, the used values of CSS properties “writing-mode”, “direction”, and “text-orientation” on the <html> element are taken from the computed values of the <body> element, not from the <html> elements own values. Consider setting these properties on the :root CSS pseudo-class. For more information see “The Principal Writing Mode” in https://www.w3.org/TR/css-writing-modes-3/#principal-flow

View File

@ -2333,8 +2333,17 @@ nsIFrame* nsCSSFrameConstructor::ConstructDocElementFrame(
Element* body = mDocument->GetBodyElement();
if (body) {
RefPtr<ComputedStyle> bodyStyle = ResolveComputedStyle(body);
WritingMode bodyWM(bodyStyle);
if (bodyWM != mDocElementContainingBlock->GetWritingMode()) {
nsContentUtils::ReportToConsole(
nsIScriptError::warningFlag, NS_LITERAL_CSTRING("Layout"),
mDocument, nsContentUtils::eLAYOUT_PROPERTIES,
"PrincipalWritingModePropagationWarning");
}
mDocElementContainingBlock->PropagateWritingModeToSelfAndAncestors(
WritingMode(bodyStyle));
bodyWM);
} else {
mDocElementContainingBlock->PropagateWritingModeToSelfAndAncestors(
mDocElementContainingBlock->GetWritingMode());

View File

@ -719,9 +719,16 @@ nscoord nsComboboxControlFrame::GetIntrinsicISize(
const bool isContainSize = StyleDisplay()->IsContainSize();
nscoord displayISize = 0;
if (MOZ_LIKELY(mDisplayFrame) && !isContainSize) {
displayISize = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
mDisplayFrame, aType);
if (MOZ_LIKELY(mDisplayFrame)) {
if (isContainSize) {
// Note: the "h" in "hPadding" here really means "inline-axis".
// Its struct uses "h" prefixes for historical reasons, but they're all
// for the inline-axis, not (necessarily) the horizontal axis.
displayISize = mDisplayFrame->IntrinsicISizeOffsets().hPadding;
} else {
displayISize = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
mDisplayFrame, aType);
}
}
if (mDropdownFrame) {
@ -988,9 +995,16 @@ void nsComboboxControlFrame::HandleRedisplayTextEvent() {
void nsComboboxControlFrame::ActuallyDisplayText(bool aNotify) {
RefPtr<nsTextNode> displayContent = mDisplayContent;
if (mDisplayedOptionTextOrPreview.IsEmpty()) {
// Have to use a non-breaking space for line-block-size calculations
// to be right
static const char16_t space = 0xA0;
// Have to use a space character of some sort for line-block-size
// calculations to be right. Also, the space character must be zero-width
// in order for the the inline-size calculations to be consistent between
// size-contained comboboxes vs. empty comboboxes.
//
// XXXdholbert Does this space need to be "non-breaking"? I'm not sure
// if it matters, but we previously had a comment here (added in 2002)
// saying "Have to use a non-breaking space for line-height calculations
// to be right". So I'll stick with a non-breaking space for now...
static const char16_t space = 0xFEFF;
displayContent->SetText(&space, 1, aNotify);
} else {
displayContent->SetText(mDisplayedOptionTextOrPreview, aNotify);

View File

@ -7521,7 +7521,8 @@ void nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
0, col, std::move(colTrackPositions), std::move(colTrackSizes),
std::move(colTrackStates), std::move(colRemovedRepeatTracks),
gridReflowInput.mColFunctions.mRepeatAutoStart,
colLineNameMap.GetResolvedLineNamesForComputedGridTrackInfo());
colLineNameMap.GetResolvedLineNamesForComputedGridTrackInfo(),
IsSubgrid(eLogicalAxisInline));
SetProperty(GridColTrackInfo(), colInfo);
const auto* subgridRowRange = subgrid && IsSubgrid(eLogicalAxisBlock)
@ -7561,7 +7562,8 @@ void nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
std::move(rowTrackSizes), std::move(rowTrackStates),
std::move(rowRemovedRepeatTracks),
gridReflowInput.mRowFunctions.mRepeatAutoStart,
rowLineNameMap.GetResolvedLineNamesForComputedGridTrackInfo());
rowLineNameMap.GetResolvedLineNamesForComputedGridTrackInfo(),
IsSubgrid(eLogicalAxisBlock));
SetProperty(GridRowTrackInfo(), rowInfo);
if (prevInFlow) {
@ -7590,7 +7592,8 @@ void nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
std::move(priorRowInfo->mSizes), std::move(priorRowInfo->mStates),
std::move(priorRowInfo->mRemovedRepeatTracks),
priorRowInfo->mRepeatFirstTrack,
std::move(priorRowInfo->mResolvedLineNames));
std::move(priorRowInfo->mResolvedLineNames),
priorRowInfo->mIsSubgrid);
prevInFlow->SetProperty(GridRowTrackInfo(), revisedPriorRowInfo);
}

View File

@ -45,7 +45,8 @@ struct ComputedGridTrackInfo {
nsTArray<nscoord>&& aPositions, nsTArray<nscoord>&& aSizes,
nsTArray<uint32_t>&& aStates, nsTArray<bool>&& aRemovedRepeatTracks,
uint32_t aRepeatFirstTrack,
nsTArray<nsTArray<StyleCustomIdent>>&& aResolvedLineNames)
nsTArray<nsTArray<StyleCustomIdent>>&& aResolvedLineNames,
bool aIsSubgrid)
: mNumLeadingImplicitTracks(aNumLeadingImplicitTracks),
mNumExplicitTracks(aNumExplicitTracks),
mStartFragmentTrack(aStartFragmentTrack),
@ -54,8 +55,9 @@ struct ComputedGridTrackInfo {
mSizes(aSizes),
mStates(aStates),
mRemovedRepeatTracks(aRemovedRepeatTracks),
mResolvedLineNames(std::move(aResolvedLineNames)),
mRepeatFirstTrack(aRepeatFirstTrack),
mResolvedLineNames(std::move(aResolvedLineNames)) {}
mIsSubgrid(aIsSubgrid) {}
uint32_t mNumLeadingImplicitTracks;
uint32_t mNumExplicitTracks;
uint32_t mStartFragmentTrack;
@ -64,8 +66,9 @@ struct ComputedGridTrackInfo {
nsTArray<nscoord> mSizes;
nsTArray<uint32_t> mStates;
nsTArray<bool> mRemovedRepeatTracks;
uint32_t mRepeatFirstTrack;
nsTArray<nsTArray<StyleCustomIdent>> mResolvedLineNames;
uint32_t mRepeatFirstTrack;
bool mIsSubgrid;
};
struct ComputedGridLineInfo {

View File

@ -36,7 +36,7 @@ fuzzy-if(webrender&&winWidget,0-24,0-2) == contain-size-inline-flex-001.html con
== contain-size-multicol-002.html contain-size-multicol-002-ref.html
== contain-size-multicol-003.html contain-size-multicol-003-ref.html
fuzzy-if(Android,0-4,0-4) == contain-size-select-elem-001.html contain-size-select-elem-001-ref.html # bug 1480862
fails-if(!gtkWidget) == contain-size-select-elem-002.html contain-size-select-elem-002-ref.html # bug 1562057
fails-if(Android) == contain-size-select-elem-002.html contain-size-select-elem-002-ref.html # bug 1588212
== contain-size-select-elem-003.html contain-size-select-elem-003-ref.html
== contain-size-select-elem-004.html contain-size-select-elem-004-ref.html
== contain-size-select-elem-005.html contain-size-select-elem-005-ref.html

View File

@ -1547,263 +1547,194 @@ already_AddRefed<nsROCSSPrimitiveValue> nsComputedDOMStyle::GetGridTrackSize(
already_AddRefed<CSSValue> nsComputedDOMStyle::GetGridTemplateColumnsRows(
const StyleGridTemplateComponent& aTrackList,
const ComputedGridTrackInfo* aTrackInfo) {
if (aTrackList.IsSubgrid()) {
// XXX TODO: add support for repeat(auto-fill) for 'subgrid' (bug 1234311)
const ComputedGridTrackInfo& aTrackInfo) {
if (aTrackInfo.mIsSubgrid) {
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(false);
auto& subgrid = *aTrackList.AsSubgrid();
RefPtr<nsROCSSPrimitiveValue> subgridKeyword = new nsROCSSPrimitiveValue;
subgridKeyword->SetIdent(eCSSKeyword_subgrid);
valueList->AppendCSSValue(subgridKeyword.forget());
auto names = subgrid.names.AsSpan();
for (auto i : IntegerRange(names.Length())) {
if (MOZ_UNLIKELY(i == subgrid.fill_idx)) {
RefPtr<nsROCSSPrimitiveValue> start = new nsROCSSPrimitiveValue;
start->SetString(NS_LITERAL_STRING("repeat(auto-fill,"));
valueList->AppendCSSValue(start.forget());
}
AppendGridLineNames(valueList, names[i].AsSpan(),
/*aSuppressEmptyList*/ false);
if (MOZ_UNLIKELY(i == subgrid.fill_idx)) {
RefPtr<nsROCSSPrimitiveValue> end = new nsROCSSPrimitiveValue;
end->SetString(NS_LITERAL_STRING(")"));
valueList->AppendCSSValue(end.forget());
}
for (const auto& lineNames : aTrackInfo.mResolvedLineNames) {
AppendGridLineNames(valueList, lineNames, /*aSuppressEmptyList*/ false);
}
uint32_t line = aTrackInfo.mResolvedLineNames.Length();
uint32_t lastLine = aTrackInfo.mNumExplicitTracks + 1;
const Span<const StyleCustomIdent> empty;
for (; line < lastLine; ++line) {
AppendGridLineNames(valueList, empty, /*aSuppressEmptyList*/ false);
}
return valueList.forget();
}
uint32_t numSizes = aTrackInfo.mSizes.Length();
if (!numSizes && !aTrackList.HasRepeatAuto()) {
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetIdent(eCSSKeyword_none);
return val.forget();
}
// We've done layout on the grid and have resolved the sizes of its tracks,
// so we'll return those sizes here. The grid spec says we MAY use
// repeat(<positive-integer>, Npx) here for consecutive tracks with the same
// size, but that doesn't seem worth doing since even for repeat(auto-*)
// the resolved size might differ for the repeated tracks.
RefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(false);
if (aTrackInfo) {
uint32_t numSizes = aTrackInfo->mSizes.Length();
if (!numSizes && !aTrackList.HasRepeatAuto()) {
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetIdent(eCSSKeyword_none);
return val.forget();
const nsTArray<nscoord>& trackSizes = aTrackInfo.mSizes;
const uint32_t numExplicitTracks = aTrackInfo.mNumExplicitTracks;
const uint32_t numLeadingImplicitTracks =
aTrackInfo.mNumLeadingImplicitTracks;
MOZ_ASSERT(numSizes >= numLeadingImplicitTracks + numExplicitTracks);
// Add any leading implicit tracks.
for (uint32_t i = 0; i < numLeadingImplicitTracks; ++i) {
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetAppUnits(trackSizes[i]);
valueList->AppendCSSValue(val.forget());
}
// Then add any explicit tracks and removed auto-fit tracks.
if (numExplicitTracks || aTrackList.HasRepeatAuto()) {
uint32_t endOfRepeat = 0; // first index after any repeat() tracks
int32_t offsetToLastRepeat = 0;
if (aTrackList.HasRepeatAuto()) {
// offsetToLastRepeat is -1 if all repeat(auto-fit) tracks are empty
offsetToLastRepeat =
numExplicitTracks + 1 - aTrackInfo.mResolvedLineNames.Length();
endOfRepeat = aTrackInfo.mRepeatFirstTrack + offsetToLastRepeat + 1;
}
// We've done layout on the grid and have resolved the sizes of its tracks,
// so we'll return those sizes here. The grid spec says we MAY use
// repeat(<positive-integer>, Npx) here for consecutive tracks with the same
// size, but that doesn't seem worth doing since even for repeat(auto-*)
// the resolved size might differ for the repeated tracks.
const nsTArray<nscoord>& trackSizes = aTrackInfo->mSizes;
const uint32_t numExplicitTracks = aTrackInfo->mNumExplicitTracks;
const uint32_t numLeadingImplicitTracks =
aTrackInfo->mNumLeadingImplicitTracks;
MOZ_ASSERT(numSizes >= numLeadingImplicitTracks + numExplicitTracks);
auto* autoRepeatValue = aTrackList.GetRepeatAutoValue();
auto beforeAutoRepeat =
autoRepeatValue ? autoRepeatValue->line_names.AsSpan()[0].AsSpan()
: Span<StyleCustomIdent>();
auto afterAutoRepeat =
autoRepeatValue ? autoRepeatValue->line_names.AsSpan()[1].AsSpan()
: Span<StyleCustomIdent>();
uint32_t repeatIndex = 0;
uint32_t numRepeatTracks = aTrackInfo.mRemovedRepeatTracks.Length();
enum LinePlacement { LinesPrecede, LinesFollow, LinesBetween };
auto AppendRemovedAutoFits =
[&aTrackInfo, &valueList, aTrackList, beforeAutoRepeat, afterAutoRepeat,
&repeatIndex, numRepeatTracks](LinePlacement aPlacement) {
// Add in removed auto-fit tracks and lines here, if necessary
bool atLeastOneTrackReported = false;
while (repeatIndex < numRepeatTracks &&
aTrackInfo.mRemovedRepeatTracks[repeatIndex]) {
if ((aPlacement == LinesPrecede) ||
((aPlacement == LinesBetween) && atLeastOneTrackReported)) {
// Precede it with the lines between repeats.
AppendGridLineNames(valueList, afterAutoRepeat, beforeAutoRepeat);
}
// Add any leading implicit tracks.
for (uint32_t i = 0; i < numLeadingImplicitTracks; ++i) {
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetAppUnits(trackSizes[i]);
valueList->AppendCSSValue(val.forget());
}
// Removed 'auto-fit' tracks are reported as 0px.
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetAppUnits(0);
valueList->AppendCSSValue(val.forget());
atLeastOneTrackReported = true;
// Then add any explicit tracks and removed auto-fit tracks.
if (numExplicitTracks || aTrackList.HasRepeatAuto()) {
uint32_t endOfRepeat = 0; // first index after any repeat() tracks
int32_t offsetToLastRepeat = 0;
if (aTrackList.HasRepeatAuto()) {
// offsetToLastRepeat is -1 if all repeat(auto-fit) tracks are empty
offsetToLastRepeat =
numExplicitTracks + 1 - aTrackInfo->mResolvedLineNames.Length();
endOfRepeat = aTrackInfo->mRepeatFirstTrack + offsetToLastRepeat + 1;
}
auto* autoRepeatValue = aTrackList.GetRepeatAutoValue();
auto beforeAutoRepeat =
autoRepeatValue ? autoRepeatValue->line_names.AsSpan()[0].AsSpan()
: Span<StyleCustomIdent>();
auto afterAutoRepeat =
autoRepeatValue ? autoRepeatValue->line_names.AsSpan()[1].AsSpan()
: Span<StyleCustomIdent>();
uint32_t repeatIndex = 0;
uint32_t numRepeatTracks = aTrackInfo->mRemovedRepeatTracks.Length();
enum LinePlacement { LinesPrecede, LinesFollow, LinesBetween };
auto AppendRemovedAutoFits = [aTrackInfo, &valueList, aTrackList,
beforeAutoRepeat, afterAutoRepeat,
&repeatIndex,
numRepeatTracks](LinePlacement aPlacement) {
// Add in removed auto-fit tracks and lines here, if necessary
bool atLeastOneTrackReported = false;
while (repeatIndex < numRepeatTracks &&
aTrackInfo->mRemovedRepeatTracks[repeatIndex]) {
if ((aPlacement == LinesPrecede) ||
((aPlacement == LinesBetween) && atLeastOneTrackReported)) {
// Precede it with the lines between repeats.
AppendGridLineNames(valueList, afterAutoRepeat, beforeAutoRepeat);
}
// Removed 'auto-fit' tracks are reported as 0px.
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetAppUnits(0);
valueList->AppendCSSValue(val.forget());
atLeastOneTrackReported = true;
if (aPlacement == LinesFollow) {
// Follow it with the lines between repeats.
AppendGridLineNames(valueList, afterAutoRepeat, beforeAutoRepeat);
if (aPlacement == LinesFollow) {
// Follow it with the lines between repeats.
AppendGridLineNames(valueList, afterAutoRepeat, beforeAutoRepeat);
}
repeatIndex++;
}
repeatIndex++;
}
repeatIndex++;
};
};
for (uint32_t i = 0;; i++) {
if (aTrackList.HasRepeatAuto()) {
if (i == aTrackInfo->mRepeatFirstTrack) {
const nsTArray<StyleCustomIdent>& lineNames =
aTrackInfo->mResolvedLineNames[i];
if (i == endOfRepeat) {
// All auto-fit tracks are empty, but we report them anyway.
AppendGridLineNames(valueList, lineNames);
AppendRemovedAutoFits(LinesBetween);
AppendGridLineNames(valueList,
aTrackInfo->mResolvedLineNames[i + 1]);
} else {
AppendGridLineNames(valueList, lineNames);
AppendRemovedAutoFits(LinesFollow);
}
} else if (i == endOfRepeat) {
// Before appending the last line, finish off any removed auto-fits.
AppendRemovedAutoFits(LinesPrecede);
const nsTArray<StyleCustomIdent>& lineNames =
aTrackInfo
->mResolvedLineNames[aTrackInfo->mRepeatFirstTrack + 1];
AppendGridLineNames(valueList, lineNames);
} else if (i > aTrackInfo->mRepeatFirstTrack && i < endOfRepeat) {
AppendGridLineNames(valueList, afterAutoRepeat, beforeAutoRepeat);
AppendRemovedAutoFits(LinesFollow);
} else {
uint32_t j = i > endOfRepeat ? i - offsetToLastRepeat : i;
const nsTArray<StyleCustomIdent>& lineNames =
aTrackInfo->mResolvedLineNames[j];
AppendGridLineNames(valueList, lineNames);
}
} else {
for (uint32_t i = 0;; i++) {
if (aTrackList.HasRepeatAuto()) {
if (i == aTrackInfo.mRepeatFirstTrack) {
const nsTArray<StyleCustomIdent>& lineNames =
aTrackInfo->mResolvedLineNames[i];
aTrackInfo.mResolvedLineNames[i];
if (i == endOfRepeat) {
// All auto-fit tracks are empty, but we report them anyway.
AppendGridLineNames(valueList, lineNames);
AppendRemovedAutoFits(LinesBetween);
AppendGridLineNames(valueList,
aTrackInfo.mResolvedLineNames[i + 1]);
} else {
AppendGridLineNames(valueList, lineNames);
AppendRemovedAutoFits(LinesFollow);
}
} else if (i == endOfRepeat) {
// Before appending the last line, finish off any removed auto-fits.
AppendRemovedAutoFits(LinesPrecede);
const nsTArray<StyleCustomIdent>& lineNames =
aTrackInfo.mResolvedLineNames[aTrackInfo.mRepeatFirstTrack + 1];
AppendGridLineNames(valueList, lineNames);
} else if (i > aTrackInfo.mRepeatFirstTrack && i < endOfRepeat) {
AppendGridLineNames(valueList, afterAutoRepeat, beforeAutoRepeat);
AppendRemovedAutoFits(LinesFollow);
} else {
uint32_t j = i > endOfRepeat ? i - offsetToLastRepeat : i;
const nsTArray<StyleCustomIdent>& lineNames =
aTrackInfo.mResolvedLineNames[j];
AppendGridLineNames(valueList, lineNames);
}
if (i == numExplicitTracks) {
break;
}
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetAppUnits(trackSizes[i + numLeadingImplicitTracks]);
valueList->AppendCSSValue(val.forget());
} else {
const nsTArray<StyleCustomIdent>& lineNames =
aTrackInfo.mResolvedLineNames[i];
AppendGridLineNames(valueList, lineNames);
}
}
// Add any trailing implicit tracks.
for (uint32_t i = numLeadingImplicitTracks + numExplicitTracks;
i < numSizes; ++i) {
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetAppUnits(trackSizes[i]);
valueList->AppendCSSValue(val.forget());
}
} else {
if (aTrackList.IsNone()) {
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetIdent(eCSSKeyword_none);
return val.forget();
}
// We don't have a frame. So, we'll just return a serialization of
// the tracks from the style (without resolved sizes).
auto& trackList = *aTrackList.AsTrackList();
auto nameLists = trackList.line_names.AsSpan();
auto values = trackList.values.AsSpan();
uint32_t numSizes = values.Length();
for (uint32_t i = 0;; i++) {
auto names = nameLists[i].AsSpan();
if (!names.IsEmpty()) {
AppendGridLineNames(valueList, names);
}
if (i == numSizes) {
if (i == numExplicitTracks) {
break;
}
auto& value = values[i];
if (value.IsTrackRepeat()) {
auto& repeat = value.AsTrackRepeat();
nsAutoString string;
string.AppendLiteral("repeat(");
if (repeat.count.IsNumber()) {
nsStyleUtil::AppendCSSNumber(repeat.count.AsNumber(), string);
} else if (repeat.count.IsAutoFit()) {
string.AppendLiteral("auto-fit");
} else {
MOZ_ASSERT(repeat.count.IsAutoFill());
string.AppendLiteral("auto-fill");
}
string.AppendLiteral(",");
auto repeat_names = repeat.line_names.AsSpan();
auto repeat_sizes = repeat.track_sizes.AsSpan();
MOZ_ASSERT(repeat_names.Length() == repeat_sizes.Length() ||
repeat_names.Length() == repeat_sizes.Length() + 1);
for (auto i : IntegerRange(repeat_sizes.Length())) {
auto names = repeat_names[i];
if (!names.IsEmpty()) {
string.Append(' ');
AppendGridLineNames(string, names.AsSpan(), Brackets::Yes);
}
string.Append(' ');
RefPtr<nsROCSSPrimitiveValue> size =
GetGridTrackSize(repeat_sizes[i]);
nsAutoString tmp;
size->GetCssText(tmp);
string.Append(tmp);
}
if (repeat_names.Length() == repeat_sizes.Length() + 1) {
auto lastList = repeat_names[repeat_sizes.Length()].AsSpan();
if (!lastList.IsEmpty()) {
string.Append(' ');
AppendGridLineNames(string, lastList, Brackets::Yes);
}
}
string.Append(')');
RefPtr<nsROCSSPrimitiveValue> value = new nsROCSSPrimitiveValue;
value->SetString(string);
valueList->AppendCSSValue(value.forget());
} else {
valueList->AppendCSSValue(GetGridTrackSize(value.AsTrackSize()));
}
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetAppUnits(trackSizes[i + numLeadingImplicitTracks]);
valueList->AppendCSSValue(val.forget());
}
}
// Add any trailing implicit tracks.
for (uint32_t i = numLeadingImplicitTracks + numExplicitTracks; i < numSizes;
++i) {
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetAppUnits(trackSizes[i]);
valueList->AppendCSSValue(val.forget());
}
return valueList.forget();
}
already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetGridTemplateColumns() {
const ComputedGridTrackInfo* info = nullptr;
nsGridContainerFrame* gridFrame =
nsGridContainerFrame::GetGridFrameWithComputedInfo(mInnerFrame);
if (gridFrame) {
info = gridFrame->GetComputedTemplateColumns();
if (!gridFrame) {
// The element doesn't have a box - return the computed value.
// https://drafts.csswg.org/css-grid/#resolved-track-list
nsAutoString string;
Servo_GetPropertyValue(mComputedStyle, eCSSProperty_grid_template_columns,
&string);
RefPtr<nsROCSSPrimitiveValue> value = new nsROCSSPrimitiveValue;
value->SetString(string);
return value.forget();
}
// GetGridFrameWithComputedInfo() above ensures that this returns non-null:
const ComputedGridTrackInfo* info = gridFrame->GetComputedTemplateColumns();
return GetGridTemplateColumnsRows(StylePosition()->mGridTemplateColumns,
info);
*info);
}
already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetGridTemplateRows() {
const ComputedGridTrackInfo* info = nullptr;
nsGridContainerFrame* gridFrame =
nsGridContainerFrame::GetGridFrameWithComputedInfo(mInnerFrame);
if (gridFrame) {
info = gridFrame->GetComputedTemplateRows();
if (!gridFrame) {
// The element doesn't have a box - return the computed value.
// https://drafts.csswg.org/css-grid/#resolved-track-list
nsAutoString string;
Servo_GetPropertyValue(mComputedStyle, eCSSProperty_grid_template_rows,
&string);
RefPtr<nsROCSSPrimitiveValue> value = new nsROCSSPrimitiveValue;
value->SetString(string);
return value.forget();
}
return GetGridTemplateColumnsRows(StylePosition()->mGridTemplateRows, info);
// GetGridFrameWithComputedInfo() above ensures that this returns non-null:
const ComputedGridTrackInfo* info = gridFrame->GetComputedTemplateRows();
return GetGridTemplateColumnsRows(StylePosition()->mGridTemplateRows, *info);
}
already_AddRefed<CSSValue> nsComputedDOMStyle::DoGetPaddingTop() {

View File

@ -197,7 +197,7 @@ class nsComputedDOMStyle final : public nsDOMCSSDeclaration,
const mozilla::StyleTrackBreadth&);
already_AddRefed<CSSValue> GetGridTemplateColumnsRows(
const mozilla::StyleGridTemplateComponent& aTrackList,
const mozilla::ComputedGridTrackInfo* aTrackInfo);
const mozilla::ComputedGridTrackInfo& aTrackInfo);
bool GetLineHeightCoord(nscoord& aCoord);

View File

@ -1,3 +1,4 @@
[contain-size-select-001.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1562057
expected:
if os == "android": FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1588212

View File

@ -1,3 +1,4 @@
[contain-size-select-002.html]
expected: FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1562057
expected:
if os == "android": FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1588212

View File

@ -1,4 +1,4 @@
[contain-size-select-elem-002.html]
expected:
if os == "linux": PASS
FAIL
if os == "android": FAIL
bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1588212

View File

@ -1,3 +0,0 @@
[text-transform.html]
expected:
if os == "android": FAIL

View File

@ -38,5 +38,20 @@ x { background: grey; }
</div>
</div>
<script>
const expectedResults = [
"subgrid [] [] [] []",
];
[...document.querySelectorAll('.subgrid')].forEach(function(subgrid, i) {
let actual = window.getComputedStyle(subgrid)['grid-template-columns'];
let expected = expectedResults[i];
if (actual != expected) {
let err = "Unexpected getComputedStyle value for subgrid " + i + " with className '" + subgrid.className + "':" +
" Actual: \"" + actual + "\", Expected: \"" + expected + "\"";
document.body.appendChild(document.createTextNode(err));
}
});
</script>
</body>
</html>

View File

@ -50,5 +50,20 @@ x { background: grey; }
</div>
</div>
<script>
const expectedResults = [
"subgrid [x] [b] [] [] [b]",
];
[...document.querySelectorAll('.subgrid')].forEach(function(subgrid, i) {
let actual = window.getComputedStyle(subgrid)['grid-template-columns'];
let expected = expectedResults[i];
if (actual != expected) {
let err = "Unexpected getComputedStyle value for subgrid " + i + " with className '" + subgrid.className + "':" +
" Actual: \"" + actual + "\", Expected: \"" + expected + "\"";
document.body.appendChild(document.createTextNode(err));
}
});
</script>
</body>
</html>

View File

@ -151,5 +151,32 @@ x {
</div>
</div>
<script>
const expectedResults = [
"subgrid [] [] [] [] [] [] [] [] []",
"subgrid [] [] [] [] [] [] [] [] []",
"subgrid [] [] [] [] [] [] [] [] []",
"subgrid [] [] [] [b] [] [] [] [] [] [] []",
"subgrid [] [] [] [b] [] [] [] [] [] [] []",
"subgrid [] [] [] [b] [] [] [] [] [] [] []",
"subgrid [] [] [] [b] [] [] [] [] [] [] []",
"subgrid [] [] [] [b] [] [] [] [] [] [] []",
"subgrid [] [] [] [b] [] [] [] [] [] [] []",
"subgrid [] [] [] [] [] [] [] [] [] [] []",
"subgrid [] [] [] [] [] []",
"subgrid [] [] [] [] [] [] [] [] [] [] []",
"subgrid [] [] [] [] [] []",
];
[...document.querySelectorAll('div > div')].forEach(function(subgrid, i) {
let actual = window.getComputedStyle(subgrid)['grid-template-columns'];
let expected = expectedResults[i];
if (actual != expected) {
let err = "Unexpected getComputedStyle value for subgrid " + i + " with className '" + subgrid.className + "':" +
" Actual: \"" + actual + "\", Expected: \"" + expected + "\"";
document.body.appendChild(document.createTextNode(err));
}
});
</script>
</body>
</html>

View File

@ -390,5 +390,44 @@ html,body {
<div style="grid-column:y -5"></div>
</div></div>
<script>
const expectedResults = [
"subgrid [z] [z] [z] [z] [z]",
"subgrid [x] [z] [z] [z] [z]",
"subgrid [x] [x] [z] [z] [z]",
"subgrid [x] [x] [x] [z] [z]",
"subgrid [x] [x] [x] [x] [z]",
"subgrid [x] [x] [x] [x] [x]",
"subgrid [x] [x] [x] [x] [x]",
"subgrid [x] [x] [x] [x] [x]",
"subgrid [x] [x] [x] [x] [x]",
"subgrid [x] [x] [x] [x] [x]",
"subgrid [y] [z] [z] [z] [z]",
"subgrid [x] [y] [z] [z] [z]",
"subgrid [x] [x] [y] [z] [z]",
"subgrid [x] [x] [x] [y] [z]",
"subgrid [x] [x] [x] [x] [y]",
"subgrid [y] [y] [z] [z] [z]",
"subgrid [x] [y] [y] [z] [z]",
"subgrid [x] [x] [y] [y] [z]",
"subgrid [x] [x] [x] [y] [y]",
"subgrid [y] [y] [y] [z] [z]",
"subgrid [x] [y] [y] [y] [z]",
"subgrid [x] [x] [y] [y] [y]",
"subgrid [y] [y] [y] [y] [z]",
"subgrid [x] [y] [y] [y] [y]",
"subgrid [y] [y] [y] [y] [y]",
];
[...document.querySelectorAll('.subgrid')].forEach(function(subgrid, i) {
let actual = window.getComputedStyle(subgrid)['grid-template-columns'];
let expected = expectedResults[i];
if (actual != expected) {
let err = "Unexpected getComputedStyle value for subgrid " + i + " with className '" + subgrid.className + "':" +
" Actual: \"" + actual + "\", Expected: \"" + expected + "\"";
document.body.appendChild(document.createTextNode(err));
}
});
</script>
</body>
</html>

View File

@ -165,5 +165,40 @@ item {
</div>
</div>
<script>
const expectedResults = [
"subgrid [] [] [] [] [x]",
"subgrid [] [] [] [] [x]",
"subgrid [] [] [] [] []",
"subgrid [x] [x] [] [] [x]",
"subgrid [x] [x] [] [x] []",
"subgrid [x] [x] [x] [x] []",
"subgrid [] [] [] [] []",
"subgrid [] [] [] [x] []",
"subgrid [] [] [] [] [x]",
"subgrid [] [] [] [] []",
"subgrid [] [] [] [] []",
"subgrid [] [] [] [] [x]",
"subgrid [x] [x] [] [] [x]",
"subgrid [x] [x] [x] [] []",
"subgrid [] [] [] [] [x]",
"subgrid [] [] [] [] [x]",
"subgrid [] [] [] [] [x]",
"subgrid [] [] [] [] [x]",
"subgrid [] [] [] [] [x]",
"subgrid [] [] [] [] [x]",
"subgrid [] [] [] [] []",
];
[...document.querySelectorAll('.subgrid')].forEach(function(subgrid, i) {
let actual = window.getComputedStyle(subgrid)['grid-template-rows'];
let expected = expectedResults[i];
if (actual != expected) {
let err = "Unexpected getComputedStyle value for subgrid " + i + " with className '" + subgrid.className + "':" +
" Actual: \"" + actual + "\", Expected: \"" + expected + "\"";
document.body.appendChild(document.createTextNode(err));
}
});
</script>
</body>
</html>

View File

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Reference for sizing of select elements, with wide vs. empty option selected</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<style>
select {
color: transparent;
margin: 1px;
}
div.customBorder > select {
/* This class is to let us test select elements *without* native theming
(for browsers that have both native and non-native controls): */
border: 3px solid black;
}
</style>
</head>
<body>
<div>
<select>
<option>some wide option</option>
</select>
<br>
<select>
<option>some wide option</option>
</select>
<br>
<select>
<option>some wide option</option>
</select>
<br>
<select>
<option>some wide option</option>
</select>
</div>
<!-- This is the same as above, but now with a custom border on the
select elements: -->
<div class="customBorder">
<select>
<option>some wide option</option>
</select>
<br>
<select>
<option>some wide option</option>
</select>
<br>
<select>
<option>some wide option</option>
</select>
<br>
<select>
<option>some wide option</option>
</select>
</div>
</body>
</html>

View File

@ -0,0 +1,77 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test for sizing of select elements, with wide vs. empty option selected</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<link rel="help" href="https://html.spec.whatwg.org/multipage/rendering.html#list-box">
<link rel="match" href="select-sizing-001-ref.html">
<style>
select {
color: transparent;
margin: 1px;
}
div.customBorder > select {
/* This class is to let us test select elements *without* native theming
(for browsers that have both native and non-native controls): */
border: 3px solid black;
}
</style>
</head>
<body>
<div>
<!-- Wide thing is 2nd, and not selected: -->
<select>
<option></option>
<option>some wide option</option>
</select>
<br>
<!-- Wide thing is 2nd, and selected: -->
<select>
<option></option>
<option selected>some wide option</option>
</select>
<br>
<!-- Wide thing is 1st, and selected (implicitly): -->
<select>
<option>some wide option</option>
<option></option>
</select>
<br>
<!-- Wide thing is 1st, and not selected: -->
<select>
<option>some wide option</option>
<option selected></option>
</select>
</div>
<!-- This is the same as above, but now with a custom border on the
select elements: -->
<div class="customBorder">
<!-- Wide thing is 2nd, and not selected: -->
<select>
<option></option>
<option>some wide option</option>
</select>
<br>
<!-- Wide thing is 2nd, and selected: -->
<select>
<option></option>
<option selected>some wide option</option>
</select>
<br>
<!-- Wide thing is 1st, and selected (implicitly): -->
<select>
<option>some wide option</option>
<option></option>
</select>
<br>
<!-- Wide thing is 1st, and not selected: -->
<select>
<option>some wide option</option>
<option selected></option>
</select>
</div>
</body>
</html>

View File

@ -73,7 +73,6 @@ skip-if = headless # Bug 1405872
skip-if = os == 'android' # bug 1369440
[test_ext_contentscript_cache.html]
skip-if = (os == 'linux' && debug) || (toolkit == 'android' && debug) # bug 1348241
fail-if = fission
[test_ext_contentscript_canvas.html]
skip-if =
(verify && debug && (os == 'linux')) ||

View File

@ -15,11 +15,13 @@
// This file defines content scripts.
/* eslint-env mozilla/frame-script */
const BASE = "http://mochi.test:8888/tests/toolkit/components/extensions/test/mochitest";
add_task(async function test_contentscript_cache() {
let extension = ExtensionTestUtils.loadExtension({
manifest: {
content_scripts: [{
"matches": ["http://example.com/"],
"matches": ["http://mochi.test/*/file_sample.html"],
"js": ["content_script.js"],
"run_at": "document_start",
}],
@ -52,7 +54,7 @@ add_task(async function test_contentscript_cache() {
ext.staticScripts.expiryTimeout = 3000;
is(ext.staticScripts.size, 0, "Should have no cached scripts");
let win = window.open("http://example.com/");
let win = window.open(`${BASE}/file_sample.html`);
await extension.awaitMessage("content-script-loaded");
if (AppConstants.platform !== "android") {
@ -91,8 +93,7 @@ add_task(async function test_contentscript_cache() {
win.close();
win = window.open("http://example.com/");
win = window.open(`${BASE}/file_sample.html`);
await extension.awaitMessage("content-script-loaded");
is(ext.staticScripts.size, 1, "Should have one cached script");