зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 1e6c032825f1 (bug 1798810) for wpt failures at baseline-source-last-001.html CLOSED TREE
This commit is contained in:
Родитель
d771cbde8d
Коммит
5e8833a881
|
@ -5838,7 +5838,8 @@ bool nsLayoutUtils::GetFirstLinePosition(WritingMode aWM,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fType == LayoutFrameType::FieldSet) {
|
if (fType == LayoutFrameType::FieldSet ||
|
||||||
|
fType == LayoutFrameType::ColumnSet) {
|
||||||
LinePosition kidPosition;
|
LinePosition kidPosition;
|
||||||
nsIFrame* kid = aFrame->PrincipalChildList().FirstChild();
|
nsIFrame* kid = aFrame->PrincipalChildList().FirstChild();
|
||||||
// If aFrame is fieldset, kid might be a legend frame here, but that's ok.
|
// If aFrame is fieldset, kid might be a legend frame here, but that's ok.
|
||||||
|
@ -5850,29 +5851,6 @@ bool nsLayoutUtils::GetFirstLinePosition(WritingMode aWM,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fType == LayoutFrameType::ColumnSet) {
|
|
||||||
// Note(dshin): This is basically the same as
|
|
||||||
// `nsColumnSetFrame::GetNaturalBaselineBOffset`, but with line start and
|
|
||||||
// end, all stored in `LinePosition`. Field value apart from baseline is
|
|
||||||
// used in one other place
|
|
||||||
// (`nsBlockFrame`) - if that goes away, this becomes a duplication that
|
|
||||||
// should be removed.
|
|
||||||
LinePosition kidPosition;
|
|
||||||
for (const auto* kid : aFrame->PrincipalChildList()) {
|
|
||||||
LinePosition position;
|
|
||||||
if (!GetFirstLinePosition(aWM, kid, &position)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (position.mBaseline < kidPosition.mBaseline) {
|
|
||||||
kidPosition = position;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (kidPosition.mBaseline != nscoord_MAX) {
|
|
||||||
*aResult = kidPosition;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// No baseline.
|
// No baseline.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -5928,21 +5906,6 @@ bool nsLayoutUtils::GetLastLineBaseline(WritingMode aWM, const nsIFrame* aFrame,
|
||||||
*aResult = std::clamp(*aResult, 0, maxBaseline);
|
*aResult = std::clamp(*aResult, 0, maxBaseline);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No need to duplicate the baseline logic (Unlike `GetFirstLinePosition`,
|
|
||||||
// we don't need to return any other value apart from baseline), just defer
|
|
||||||
// to `GetNaturalBaselineBOffset`. Technically, we could do this at
|
|
||||||
// `ColumnSetWrapperFrame` level, but this keeps it symmetric to
|
|
||||||
// `GetFirstLinePosition`.
|
|
||||||
if (aFrame->IsColumnSetFrame()) {
|
|
||||||
const auto baseline =
|
|
||||||
aFrame->GetNaturalBaselineBOffset(aWM, BaselineSharingGroup::Last);
|
|
||||||
if (!baseline) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
*aResult = aFrame->BSize(aWM) - *baseline;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// No baseline.
|
// No baseline.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1754,9 +1754,7 @@ class nsLayoutUtils {
|
||||||
* Otherwise returns false.
|
* Otherwise returns false.
|
||||||
*/
|
*/
|
||||||
struct LinePosition {
|
struct LinePosition {
|
||||||
nscoord mBStart{nscoord_MAX};
|
nscoord mBStart, mBaseline, mBEnd;
|
||||||
nscoord mBaseline{nscoord_MAX};
|
|
||||||
nscoord mBEnd{nscoord_MAX};
|
|
||||||
|
|
||||||
LinePosition operator+(nscoord aOffset) const {
|
LinePosition operator+(nscoord aOffset) const {
|
||||||
LinePosition result;
|
LinePosition result;
|
||||||
|
|
|
@ -232,53 +232,6 @@ nscoord ColumnSetWrapperFrame::GetPrefISize(gfxContext* aRenderingContext) {
|
||||||
return iSize;
|
return iSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Iterator>
|
|
||||||
Maybe<nscoord> ColumnSetWrapperFrame::GetBaselineBOffset(
|
|
||||||
Iterator aStart, Iterator aEnd, WritingMode aWM,
|
|
||||||
BaselineSharingGroup aBaselineGroup) const {
|
|
||||||
// Either forward iterator + first baseline, or reverse iterator + last
|
|
||||||
// baseline
|
|
||||||
MOZ_ASSERT((*aStart == PrincipalChildList().FirstChild() &&
|
|
||||||
aBaselineGroup == BaselineSharingGroup::First) ||
|
|
||||||
(*aStart == PrincipalChildList().LastChild() &&
|
|
||||||
aBaselineGroup == BaselineSharingGroup::Last),
|
|
||||||
"Iterator direction must match baseline sharing group.");
|
|
||||||
if (StyleDisplay()->IsContainLayout()) {
|
|
||||||
return Nothing{};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start from start/end of principal child list, and use the first valid
|
|
||||||
// baseline.
|
|
||||||
for (auto itr = aStart; itr != aEnd; ++itr) {
|
|
||||||
const nsIFrame* kid = *itr;
|
|
||||||
auto kidBaseline = kid->GetNaturalBaselineBOffset(aWM, aBaselineGroup);
|
|
||||||
if (!kidBaseline) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// Baseline is offset from the kid's rectangle, so find the offset to the
|
|
||||||
// kid's rectangle.
|
|
||||||
LogicalRect kidRect{aWM, kid->GetLogicalNormalPosition(aWM, GetSize()),
|
|
||||||
kid->GetLogicalSize(aWM)};
|
|
||||||
if (aBaselineGroup == BaselineSharingGroup::First) {
|
|
||||||
*kidBaseline += kidRect.BStart(aWM);
|
|
||||||
} else {
|
|
||||||
*kidBaseline += (GetLogicalSize().BSize(aWM) - kidRect.BEnd(aWM));
|
|
||||||
}
|
|
||||||
return kidBaseline;
|
|
||||||
}
|
|
||||||
return Nothing{};
|
|
||||||
}
|
|
||||||
|
|
||||||
Maybe<nscoord> ColumnSetWrapperFrame::GetNaturalBaselineBOffset(
|
|
||||||
WritingMode aWM, BaselineSharingGroup aBaselineGroup) const {
|
|
||||||
if (aBaselineGroup == BaselineSharingGroup::First) {
|
|
||||||
return GetBaselineBOffset(PrincipalChildList().cbegin(),
|
|
||||||
PrincipalChildList().cend(), aWM, aBaselineGroup);
|
|
||||||
}
|
|
||||||
return GetBaselineBOffset(PrincipalChildList().crbegin(),
|
|
||||||
PrincipalChildList().crend(), aWM, aBaselineGroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
|
|
@ -59,9 +59,6 @@ class ColumnSetWrapperFrame final : public nsBlockFrame {
|
||||||
|
|
||||||
nscoord GetPrefISize(gfxContext* aRenderingContext) override;
|
nscoord GetPrefISize(gfxContext* aRenderingContext) override;
|
||||||
|
|
||||||
Maybe<nscoord> GetNaturalBaselineBOffset(
|
|
||||||
WritingMode aWM, BaselineSharingGroup aBaselineGroup) const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit ColumnSetWrapperFrame(ComputedStyle* aStyle,
|
explicit ColumnSetWrapperFrame(ComputedStyle* aStyle,
|
||||||
nsPresContext* aPresContext);
|
nsPresContext* aPresContext);
|
||||||
|
@ -74,11 +71,6 @@ class ColumnSetWrapperFrame final : public nsBlockFrame {
|
||||||
// its descendants.
|
// its descendants.
|
||||||
bool mFinishedBuildingColumns = false;
|
bool mFinishedBuildingColumns = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <typename Iterator>
|
|
||||||
Maybe<nscoord> GetBaselineBOffset(Iterator aStart, Iterator aEnd,
|
|
||||||
WritingMode aWM,
|
|
||||||
BaselineSharingGroup aBaselineGroup) const;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
#include "mozilla/ToString.h"
|
#include "mozilla/ToString.h"
|
||||||
#include "nsCSSRendering.h"
|
#include "nsCSSRendering.h"
|
||||||
#include "nsDisplayList.h"
|
#include "nsDisplayList.h"
|
||||||
#include "nsIFrameInlines.h"
|
|
||||||
#include "nsLayoutUtils.h"
|
#include "nsLayoutUtils.h"
|
||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
|
@ -1296,32 +1295,6 @@ void nsColumnSetFrame::AppendDirectlyOwnedAnonBoxes(
|
||||||
aResult.AppendElement(OwnedAnonBox(column));
|
aResult.AppendElement(OwnedAnonBox(column));
|
||||||
}
|
}
|
||||||
|
|
||||||
Maybe<nscoord> nsColumnSetFrame::GetNaturalBaselineBOffset(
|
|
||||||
WritingMode aWM, BaselineSharingGroup aBaselineGroup) const {
|
|
||||||
Maybe<nscoord> result;
|
|
||||||
for (const auto* kid : mFrames) {
|
|
||||||
auto kidBaseline = kid->GetNaturalBaselineBOffset(aWM, aBaselineGroup);
|
|
||||||
if (!kidBaseline) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// The kid frame may not necessarily be aligned with the columnset frame.
|
|
||||||
LogicalRect kidRect{aWM, kid->GetLogicalNormalPosition(aWM, GetSize()),
|
|
||||||
kid->GetLogicalSize(aWM)};
|
|
||||||
if (aBaselineGroup == BaselineSharingGroup::First) {
|
|
||||||
*kidBaseline += kidRect.BStart(aWM);
|
|
||||||
} else {
|
|
||||||
*kidBaseline += (GetLogicalSize().BSize(aWM) - kidRect.BEnd(aWM));
|
|
||||||
}
|
|
||||||
// Take the smallest of the baselines (i.e. Closest to border-block-start
|
|
||||||
// for `BaselineSharingGroup::First`, border-block-end for
|
|
||||||
// `BaselineSharingGroup::Last`)
|
|
||||||
if (!result || *kidBaseline < *result) {
|
|
||||||
result = kidBaseline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
void nsColumnSetFrame::SetInitialChildList(ChildListID aListID,
|
void nsColumnSetFrame::SetInitialChildList(ChildListID aListID,
|
||||||
nsFrameList&& aChildList) {
|
nsFrameList&& aChildList) {
|
||||||
|
|
|
@ -74,10 +74,6 @@ class nsColumnSetFrame final : public nsContainerFrame {
|
||||||
gfxContext* aCtx, const nsRect& aDirtyRect,
|
gfxContext* aCtx, const nsRect& aDirtyRect,
|
||||||
const nsPoint& aPt);
|
const nsPoint& aPt);
|
||||||
|
|
||||||
Maybe<nscoord> GetNaturalBaselineBOffset(
|
|
||||||
mozilla::WritingMode aWM,
|
|
||||||
BaselineSharingGroup aBaselineGroup) const override;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nscoord mLastBalanceBSize;
|
nscoord mLastBalanceBSize;
|
||||||
nsReflowStatus mLastFrameStatus;
|
nsReflowStatus mLastFrameStatus;
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
[baseline-001.html]
|
||||||
|
expected: FAIL
|
|
@ -0,0 +1,2 @@
|
||||||
|
[baseline-002.html]
|
||||||
|
expected: FAIL
|
|
@ -0,0 +1,2 @@
|
||||||
|
[baseline-008.html]
|
||||||
|
expected: FAIL
|
Загрузка…
Ссылка в новой задаче