From 515e5875fef05668265eb8241d9f78b81b05a1ef Mon Sep 17 00:00:00 2001 From: Stanca Serban Date: Tue, 12 Sep 2023 06:54:17 +0300 Subject: [PATCH] Backed out 2 changesets (bug 1287054) for causing Android wpt failures in SVGLength-ch.html. CLOSED TREE Backed out changeset fc8eaef017f9 (bug 1287054) Backed out changeset 8a94c155e35c (bug 1287054) --- dom/canvas/CanvasRenderingContext2D.cpp | 80 +++------- dom/svg/SVGAnimatedLength.cpp | 165 ++------------------- dom/svg/SVGAnimatedLength.h | 36 +---- dom/svg/SVGGeometryProperty.h | 5 +- dom/svg/SVGLength.cpp | 113 ++------------ layout/style/nsCSSValue.h | 20 +-- servo/ports/geckolib/glue.rs | 26 +--- .../meta/svg/types/scripted/SVGLength-ic.html.ini | 5 + .../tests/svg/types/scripted/SVGLength-cap.html | 23 --- .../tests/svg/types/scripted/SVGLength-ch.html | 43 ------ .../tests/svg/types/scripted/SVGLength-rem.html | 30 ---- .../svg/types/scripted/SVGLength-viewport.html | 35 ----- 12 files changed, 60 insertions(+), 521 deletions(-) delete mode 100644 testing/web-platform/tests/svg/types/scripted/SVGLength-cap.html delete mode 100644 testing/web-platform/tests/svg/types/scripted/SVGLength-ch.html delete mode 100644 testing/web-platform/tests/svg/types/scripted/SVGLength-rem.html delete mode 100644 testing/web-platform/tests/svg/types/scripted/SVGLength-viewport.html diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp index e41a648c0ed1..c26cd969ba78 100644 --- a/dom/canvas/CanvasRenderingContext2D.cpp +++ b/dom/canvas/CanvasRenderingContext2D.cpp @@ -13,7 +13,6 @@ #include "nsContentUtils.h" #include "mozilla/intl/BidiEmbeddingLevel.h" -#include "mozilla/GeckoBindings.h" #include "mozilla/PresShell.h" #include "mozilla/PresShellInlines.h" #include "mozilla/SVGImageContext.h" @@ -2799,67 +2798,37 @@ void CanvasRenderingContext2D::ParseSpacing(const nsACString& aSpacing, class CanvasUserSpaceMetrics : public UserSpaceMetricsWithSize { public: CanvasUserSpaceMetrics(const gfx::IntSize& aSize, const nsFont& aFont, - const ComputedStyle* aCanvasStyle, + nsAtom* aFontLanguage, bool aExplicitLanguage, nsPresContext* aPresContext) : mSize(aSize), mFont(aFont), - mCanvasStyle(aCanvasStyle), + mFontLanguage(aFontLanguage), + mExplicitLanguage(aExplicitLanguage), mPresContext(aPresContext) {} - float GetEmLength(Type aType) const override { - switch (aType) { - case Type::This: - return mFont.size.ToCSSPixels(); - case Type::Root: - return SVGContentUtils::GetFontSize( - mPresContext->Document()->GetRootElement()); - default: - MOZ_ASSERT_UNREACHABLE("Was a new value added to the enumeration?"); - return 1.0f; - } - } - gfx::Size GetSize() const override { return Size(mSize); } - - CSSSize GetCSSViewportSize() const override { - return GetCSSViewportSizeFromContext(mPresContext); + virtual float GetEmLength() const override { + return mFont.size.ToCSSPixels(); } - private: - GeckoFontMetrics GetFontMetricsForType(Type aType) const override { - switch (aType) { - case Type::This: { - if (!mCanvasStyle) { - return DefaultFontMetrics(); - } - return Gecko_GetFontMetrics( - mPresContext, WritingMode(mCanvasStyle).IsVertical(), - mCanvasStyle->StyleFont(), mCanvasStyle->StyleFont()->mFont.size, - /* aUseUserFontSet = */ true, - /* aRetrieveMathScales */ false); - } - case Type::Root: - return GetFontMetrics(mPresContext->Document()->GetRootElement()); - default: - MOZ_ASSERT_UNREACHABLE("Was a new value added to the enumeration?"); - return DefaultFontMetrics(); - } + virtual float GetExLength() const override { + nsFontMetrics::Params params; + params.language = mFontLanguage; + params.explicitLanguage = mExplicitLanguage; + params.textPerf = mPresContext->GetTextPerfMetrics(); + params.featureValueLookup = mPresContext->GetFontFeatureValuesLookup(); + RefPtr fontMetrics = + mPresContext->GetMetricsFor(mFont, params); + return NSAppUnitsToFloatPixels(fontMetrics->XHeight(), + AppUnitsPerCSSPixel()); } - WritingMode GetWritingModeForType(Type aType) const override { - switch (aType) { - case Type::This: - return WritingMode(mCanvasStyle); - case Type::Root: - return GetWritingMode(mPresContext->Document()->GetRootElement()); - default: - MOZ_ASSERT_UNREACHABLE("Was a new value added to the enumeration?"); - return WritingMode(); - } - } + virtual gfx::Size GetSize() const override { return Size(mSize); } + private: gfx::IntSize mSize; const nsFont& mFont; - RefPtr mCanvasStyle; + nsAtom* mFontLanguage; + bool mExplicitLanguage; nsPresContext* mPresContext; }; @@ -2889,18 +2858,12 @@ void CanvasRenderingContext2D::UpdateFilter() { return; } - RefPtr canvasStyle; - // The PresContext is only used with URL filters and we don't allow those to // be used on worker threads. nsPresContext* presContext = nullptr; if (presShell) { if (FiltersNeedFrameFlush(CurrentState().filterChain.AsSpan())) { presShell->FlushPendingNotifications(FlushType::Frames); - if (mCanvasElement) { - canvasStyle = - nsComputedDOMStyle::GetComputedStyleNoFlush(mCanvasElement); - } } if (MOZ_UNLIKELY(presShell->IsDestroying())) { @@ -2914,8 +2877,9 @@ void CanvasRenderingContext2D::UpdateFilter() { CurrentState().filter = FilterInstance::GetFilterDescription( mCanvasElement, CurrentState().filterChain.AsSpan(), writeOnly, - CanvasUserSpaceMetrics(GetSize(), CurrentState().fontFont, canvasStyle, - presContext), + CanvasUserSpaceMetrics(GetSize(), CurrentState().fontFont, + CurrentState().fontLanguage, + CurrentState().fontExplicitLanguage, presContext), gfxRect(0, 0, mWidth, mHeight), CurrentState().filterAdditionalImages); CurrentState().filterSourceGraphicTainted = writeOnly; } diff --git a/dom/svg/SVGAnimatedLength.cpp b/dom/svg/SVGAnimatedLength.cpp index 1bcc1fab2137..8254cfe8800a 100644 --- a/dom/svg/SVGAnimatedLength.cpp +++ b/dom/svg/SVGAnimatedLength.cpp @@ -8,24 +8,18 @@ #include "mozAutoDocUpdate.h" #include "mozilla/ArrayUtils.h" -#include "mozilla/GeckoBindings.h" #include "mozilla/Maybe.h" -#include "mozilla/PresShell.h" #include "mozilla/SMILValue.h" -#include "mozilla/StaticPresData.h" #include "mozilla/SVGIntegrationUtils.h" #include "mozilla/dom/SVGViewportElement.h" #include "DOMSVGAnimatedLength.h" #include "DOMSVGLength.h" -#include "gfxTextRun.h" #include "LayoutLogging.h" #include "nsContentUtils.h" #include "nsIFrame.h" -#include "nsLayoutUtils.h" #include "nsTextFormatter.h" #include "SMILFloatType.h" #include "SVGAttrTearoffTable.h" -#include "SVGGeometryProperty.h" using namespace mozilla::dom; @@ -110,122 +104,26 @@ static float FixAxisLength(float aLength) { return aLength; } -GeckoFontMetrics UserSpaceMetrics::DefaultFontMetrics() { - return {StyleLength::FromPixels(16.0f), - StyleLength::FromPixels(-1), - StyleLength::FromPixels(-1), - StyleLength::FromPixels(-1), - StyleLength::FromPixels(-1), - StyleLength::FromPixels(16.0f), - 0.0f, - 0.0f}; -} - -GeckoFontMetrics UserSpaceMetrics::GetFontMetrics(const Element* aElement) { - GeckoFontMetrics metrics = DefaultFontMetrics(); - auto* presContext = - aElement ? nsContentUtils::GetContextForContent(aElement) : nullptr; - if (presContext) { - SVGGeometryProperty::DoForComputedStyle( - aElement, [&](const ComputedStyle* style) { - metrics = Gecko_GetFontMetrics( - presContext, WritingMode(style).IsVertical(), style->StyleFont(), - style->StyleFont()->mFont.size, - /* aUseUserFontSet = */ true, - /* aRetrieveMathScales */ false); - }); - } - return metrics; -} - -WritingMode UserSpaceMetrics::GetWritingMode(const Element* aElement) { - WritingMode writingMode; - SVGGeometryProperty::DoForComputedStyle( - aElement, - [&](const ComputedStyle* style) { writingMode = WritingMode(style); }); - return writingMode; -} - -float UserSpaceMetrics::GetExLength(Type aType) const { - return GetFontMetricsForType(aType).mXSize.ToCSSPixels(); -} - -float UserSpaceMetrics::GetChSize(Type aType) const { - auto metrics = GetFontMetricsForType(aType); - if (metrics.mChSize.ToCSSPixels() > 0.0) { - return metrics.mChSize.ToCSSPixels(); - } - auto emLength = GetEmLength(aType); - WritingMode writingMode = GetWritingModeForType(aType); - return writingMode.IsVertical() && !writingMode.IsSideways() - ? emLength - : emLength * 0.5f; -} - -float UserSpaceMetrics::GetIcWidth(Type aType) const { - auto metrics = GetFontMetricsForType(aType); - if (metrics.mIcWidth.ToCSSPixels() > 0.0) { - return metrics.mIcWidth.ToCSSPixels(); - } - return GetEmLength(aType); -} - -float UserSpaceMetrics::GetCapHeight(Type aType) const { - auto metrics = GetFontMetricsForType(aType); - if (metrics.mCapHeight.ToCSSPixels() > 0.0) { - return metrics.mCapHeight.ToCSSPixels(); - } - return GetEmLength(aType); -} - -CSSSize UserSpaceMetrics::GetCSSViewportSizeFromContext( - const nsPresContext* aContext) { - return CSSPixel::FromAppUnits(aContext->GetSizeForViewportUnits()); -} - SVGElementMetrics::SVGElementMetrics(const SVGElement* aSVGElement, const SVGViewportElement* aCtx) : mSVGElement(aSVGElement), mCtx(aCtx) {} -const Element* SVGElementMetrics::GetElementForType(Type aType) const { - switch (aType) { - case Type::This: - return mSVGElement; - case Type::Root: - return mSVGElement ? mSVGElement->OwnerDoc()->GetRootElement() : nullptr; - default: - MOZ_ASSERT_UNREACHABLE("Was a new value added to the enumeration?"); - return nullptr; - } -} - -GeckoFontMetrics SVGElementMetrics::GetFontMetricsForType(Type aType) const { - return GetFontMetrics(GetElementForType(aType)); +float SVGElementMetrics::GetEmLength() const { + return SVGContentUtils::GetFontSize(mSVGElement); } -WritingMode SVGElementMetrics::GetWritingModeForType(Type aType) const { - return GetWritingMode(GetElementForType(aType)); +float SVGElementMetrics::GetExLength() const { + return SVGContentUtils::GetFontXHeight(mSVGElement); } float SVGElementMetrics::GetAxisLength(uint8_t aCtxType) const { if (!EnsureCtx()) { - return 1.0f; + return 1; } return FixAxisLength(mCtx->GetLength(aCtxType)); } -CSSSize SVGElementMetrics::GetCSSViewportSize() const { - if (!mSVGElement) { - return {0.0f, 0.0f}; - } - nsPresContext* context = nsContentUtils::GetContextForContent(mSVGElement); - if (!context) { - return {0.0f, 0.0f}; - } - return GetCSSViewportSizeFromContext(context); -} - bool SVGElementMetrics::EnsureCtx() const { if (!mCtx && mSVGElement) { mCtx = mSVGElement->GetCtx(); @@ -242,63 +140,20 @@ bool SVGElementMetrics::EnsureCtx() const { } NonSVGFrameUserSpaceMetrics::NonSVGFrameUserSpaceMetrics(nsIFrame* aFrame) - : mFrame(aFrame) { - MOZ_ASSERT(mFrame, "Need a frame"); -} - -float NonSVGFrameUserSpaceMetrics::GetEmLength(Type aType) const { - switch (aType) { - case Type::This: - return SVGContentUtils::GetFontSize(mFrame); - case Type::Root: - return SVGContentUtils::GetFontSize( - mFrame->PresContext()->Document()->GetRootElement()); - default: - MOZ_ASSERT_UNREACHABLE("Was a new value added to the enumeration?"); - return 1.0f; - } -} + : mFrame(aFrame) {} -GeckoFontMetrics NonSVGFrameUserSpaceMetrics::GetFontMetricsForType( - Type aType) const { - switch (aType) { - case Type::This: - return Gecko_GetFontMetrics( - mFrame->PresContext(), mFrame->GetWritingMode().IsVertical(), - mFrame->StyleFont(), mFrame->StyleFont()->mFont.size, - /* aUseUserFontSet = */ true, - /* aRetrieveMathScales */ false); - case Type::Root: - return GetFontMetrics( - mFrame->PresContext()->Document()->GetRootElement()); - default: - MOZ_ASSERT_UNREACHABLE("Was a new value added to the enumeration?"); - return DefaultFontMetrics(); - } +float NonSVGFrameUserSpaceMetrics::GetEmLength() const { + return SVGContentUtils::GetFontSize(mFrame); } -WritingMode NonSVGFrameUserSpaceMetrics::GetWritingModeForType( - Type aType) const { - switch (aType) { - case Type::This: - return mFrame->GetWritingMode(); - case Type::Root: - return GetWritingMode( - mFrame->PresContext()->Document()->GetRootElement()); - default: - MOZ_ASSERT_UNREACHABLE("Was a new value added to the enumeration?"); - return WritingMode(); - } +float NonSVGFrameUserSpaceMetrics::GetExLength() const { + return SVGContentUtils::GetFontXHeight(mFrame); } gfx::Size NonSVGFrameUserSpaceMetrics::GetSize() const { return SVGIntegrationUtils::GetSVGCoordContextForNonSVGFrame(mFrame); } -CSSSize NonSVGFrameUserSpaceMetrics::GetCSSViewportSize() const { - return GetCSSViewportSizeFromContext(mFrame->PresContext()); -} - float UserSpaceMetricsWithSize::GetAxisLength(uint8_t aCtxType) const { gfx::Size size = GetSize(); float length; diff --git a/dom/svg/SVGAnimatedLength.h b/dom/svg/SVGAnimatedLength.h index e36badd73eac..1ae22f71ccb6 100644 --- a/dom/svg/SVGAnimatedLength.h +++ b/dom/svg/SVGAnimatedLength.h @@ -19,9 +19,6 @@ #include "nsError.h" #include "nsMathUtils.h" -struct GeckoFontMetrics; -class nsPresContext; -class nsFontMetrics; class mozAutoDocUpdate; class nsIFrame; @@ -38,25 +35,11 @@ class SVGViewportElement; class UserSpaceMetrics { public: - enum class Type : uint32_t { This, Root }; - static GeckoFontMetrics DefaultFontMetrics(); - static GeckoFontMetrics GetFontMetrics(const Element* aElement); - static WritingMode GetWritingMode(const Element* aElement); - static CSSSize GetCSSViewportSizeFromContext(const nsPresContext* aContext); - virtual ~UserSpaceMetrics() = default; - virtual float GetEmLength(Type aType) const = 0; - float GetExLength(Type aType) const; - float GetChSize(Type aType) const; - float GetIcWidth(Type aType) const; - float GetCapHeight(Type aType) const; + virtual float GetEmLength() const = 0; + virtual float GetExLength() const = 0; virtual float GetAxisLength(uint8_t aCtxType) const = 0; - virtual CSSSize GetCSSViewportSize() const = 0; - - protected: - virtual GeckoFontMetrics GetFontMetricsForType(Type aType) const = 0; - virtual WritingMode GetWritingModeForType(Type aType) const = 0; }; class UserSpaceMetricsWithSize : public UserSpaceMetrics { @@ -70,17 +53,12 @@ class SVGElementMetrics : public UserSpaceMetrics { explicit SVGElementMetrics(const SVGElement* aSVGElement, const SVGViewportElement* aCtx = nullptr); - float GetEmLength(Type aType) const override { - return SVGContentUtils::GetFontSize(GetElementForType(aType)); - } + float GetEmLength() const override; + float GetExLength() const override; float GetAxisLength(uint8_t aCtxType) const override; - CSSSize GetCSSViewportSize() const override; private: bool EnsureCtx() const; - const Element* GetElementForType(Type aType) const; - GeckoFontMetrics GetFontMetricsForType(Type aType) const override; - WritingMode GetWritingModeForType(Type aType) const override; const SVGElement* mSVGElement; mutable const SVGViewportElement* mCtx; @@ -90,13 +68,11 @@ class NonSVGFrameUserSpaceMetrics : public UserSpaceMetricsWithSize { public: explicit NonSVGFrameUserSpaceMetrics(nsIFrame* aFrame); - float GetEmLength(Type aType) const override; + float GetEmLength() const override; + float GetExLength() const override; gfx::Size GetSize() const override; - CSSSize GetCSSViewportSize() const override; private: - GeckoFontMetrics GetFontMetricsForType(Type aType) const override; - WritingMode GetWritingModeForType(Type aType) const override; nsIFrame* mFrame; }; diff --git a/dom/svg/SVGGeometryProperty.h b/dom/svg/SVGGeometryProperty.h index 9349942acb2b..349668916222 100644 --- a/dom/svg/SVGGeometryProperty.h +++ b/dom/svg/SVGGeometryProperty.h @@ -227,10 +227,7 @@ float ResolveWith(const ComputedStyle& aStyle, const SVGElement* aElement) { } template -bool DoForComputedStyle(const Element* aElement, Func aFunc) { - if (!aElement) { - return false; - } +bool DoForComputedStyle(const SVGElement* aElement, Func aFunc) { if (const nsIFrame* f = aElement->GetPrimaryFrame()) { aFunc(f->Style()); return true; diff --git a/dom/svg/SVGLength.cpp b/dom/svg/SVGLength.cpp index f7c383a16fa5..44cd05f44dd2 100644 --- a/dom/svg/SVGLength.cpp +++ b/dom/svg/SVGLength.cpp @@ -21,14 +21,6 @@ using namespace mozilla::dom::SVGLength_Binding; namespace mozilla { const unsigned short SVG_LENGTHTYPE_Q = 11; -const unsigned short SVG_LENGTHTYPE_CH = 12; -const unsigned short SVG_LENGTHTYPE_REM = 13; -const unsigned short SVG_LENGTHTYPE_IC = 14; -const unsigned short SVG_LENGTHTYPE_CAP = 15; -const unsigned short SVG_LENGTHTYPE_VW = 16; -const unsigned short SVG_LENGTHTYPE_VH = 17; -const unsigned short SVG_LENGTHTYPE_VMIN = 18; -const unsigned short SVG_LENGTHTYPE_VMAX = 19; void SVGLength::GetValueAsString(nsAString& aValue) const { nsTextFormatter::ssprintf(aValue, u"%g", (double)mValue); @@ -73,8 +65,7 @@ bool SVGLength::IsAbsoluteUnit(uint8_t aUnit) { /*static*/ bool SVGLength::IsFontRelativeUnit(uint8_t aUnit) { - return aUnit == SVG_LENGTHTYPE_EMS || aUnit == SVG_LENGTHTYPE_EXS || - (aUnit >= SVG_LENGTHTYPE_CH && aUnit <= SVG_LENGTHTYPE_CAP); + return aUnit == SVG_LENGTHTYPE_EMS || aUnit == SVG_LENGTHTYPE_EXS; } /** @@ -147,6 +138,12 @@ float SVGLength::GetValueInSpecifiedUnit(uint8_t aUnit, float userUnitsPerNewUnit = SVGLength(0.0f, aUnit).GetPixelsPerUnit(userSpaceMetrics, aAxis); + NS_ASSERTION( + userUnitsPerCurrentUnit >= 0 || !std::isfinite(userUnitsPerCurrentUnit), + "bad userUnitsPerCurrentUnit"); + NS_ASSERTION(userUnitsPerNewUnit >= 0 || !std::isfinite(userUnitsPerNewUnit), + "bad userUnitsPerNewUnit"); + float value = mValue * userUnitsPerCurrentUnit / userUnitsPerNewUnit; // userUnitsPerCurrentUnit could be infinity, or userUnitsPerNewUnit could @@ -169,29 +166,9 @@ float SVGLength::GetPixelsPerUnit(const UserSpaceMetrics& aMetrics, case SVG_LENGTHTYPE_PERCENTAGE: return aMetrics.GetAxisLength(aAxis) / 100.0f; case SVG_LENGTHTYPE_EMS: - return aMetrics.GetEmLength(UserSpaceMetrics::Type::This); + return aMetrics.GetEmLength(); case SVG_LENGTHTYPE_EXS: - return aMetrics.GetExLength(UserSpaceMetrics::Type::This); - case SVG_LENGTHTYPE_CH: - return aMetrics.GetChSize(UserSpaceMetrics::Type::This); - case SVG_LENGTHTYPE_REM: - return aMetrics.GetEmLength(UserSpaceMetrics::Type::Root); - case SVG_LENGTHTYPE_IC: - return aMetrics.GetIcWidth(UserSpaceMetrics::Type::This); - case SVG_LENGTHTYPE_CAP: - return aMetrics.GetCapHeight(UserSpaceMetrics::Type::This); - case SVG_LENGTHTYPE_VW: - return aMetrics.GetCSSViewportSize().width / 100.f; - case SVG_LENGTHTYPE_VH: - return aMetrics.GetCSSViewportSize().height / 100.f; - case SVG_LENGTHTYPE_VMIN: { - auto sz = aMetrics.GetCSSViewportSize(); - return std::min(sz.width, sz.height) / 100.f; - } - case SVG_LENGTHTYPE_VMAX: { - auto sz = aMetrics.GetCSSViewportSize(); - return std::max(sz.width, sz.height) / 100.f; - } + return aMetrics.GetExLength(); default: MOZ_ASSERT(IsAbsoluteUnit(aUnitType)); return GetAbsUnitsPerAbsUnit(SVG_LENGTHTYPE_PX, aUnitType); @@ -232,30 +209,6 @@ nsCSSUnit SVGLength::SpecifiedUnitTypeToCSSUnit(uint8_t aSpecifiedUnit) { case SVG_LENGTHTYPE_Q: return nsCSSUnit::eCSSUnit_Quarter; - case SVG_LENGTHTYPE_CH: - return nsCSSUnit::eCSSUnit_Char; - - case SVG_LENGTHTYPE_REM: - return nsCSSUnit::eCSSUnit_RootEM; - - case SVG_LENGTHTYPE_IC: - return nsCSSUnit::eCSSUnit_Ideographic; - - case SVG_LENGTHTYPE_CAP: - return nsCSSUnit::eCSSUnit_CapHeight; - - case SVG_LENGTHTYPE_VW: - return nsCSSUnit::eCSSUnit_VW; - - case SVG_LENGTHTYPE_VH: - return nsCSSUnit::eCSSUnit_VH; - - case SVG_LENGTHTYPE_VMIN: - return nsCSSUnit::eCSSUnit_VMin; - - case SVG_LENGTHTYPE_VMAX: - return nsCSSUnit::eCSSUnit_VMax; - default: MOZ_ASSERT_UNREACHABLE("Unknown unit type"); return nsCSSUnit::eCSSUnit_Pixel; @@ -298,30 +251,6 @@ void SVGLength::GetUnitString(nsAString& aUnit, uint16_t aUnitType) { case SVG_LENGTHTYPE_Q: aUnit.AssignLiteral("q"); return; - case SVG_LENGTHTYPE_CH: - aUnit.AssignLiteral("ch"); - return; - case SVG_LENGTHTYPE_REM: - aUnit.AssignLiteral("rem"); - return; - case SVG_LENGTHTYPE_IC: - aUnit.AssignLiteral("ic"); - return; - case SVG_LENGTHTYPE_CAP: - aUnit.AssignLiteral("cap"); - return; - case SVG_LENGTHTYPE_VW: - aUnit.AssignLiteral("vw"); - return; - case SVG_LENGTHTYPE_VH: - aUnit.AssignLiteral("vh"); - return; - case SVG_LENGTHTYPE_VMIN: - aUnit.AssignLiteral("vmin"); - return; - case SVG_LENGTHTYPE_VMAX: - aUnit.AssignLiteral("vmax"); - return; } MOZ_ASSERT_UNREACHABLE( "Unknown unit type! Someone's using an SVGLength " @@ -363,30 +292,6 @@ uint16_t SVGLength::GetUnitTypeForString(const nsAString& aUnit) { if (aUnit.LowerCaseEqualsLiteral("q")) { return SVG_LENGTHTYPE_Q; } - if (aUnit.LowerCaseEqualsLiteral("ch")) { - return SVG_LENGTHTYPE_CH; - } - if (aUnit.LowerCaseEqualsLiteral("rem")) { - return SVG_LENGTHTYPE_REM; - } - if (aUnit.LowerCaseEqualsLiteral("ic")) { - return SVG_LENGTHTYPE_IC; - } - if (aUnit.LowerCaseEqualsLiteral("cap")) { - return SVG_LENGTHTYPE_CAP; - } - if (aUnit.LowerCaseEqualsLiteral("vw")) { - return SVG_LENGTHTYPE_VW; - } - if (aUnit.LowerCaseEqualsLiteral("vh")) { - return SVG_LENGTHTYPE_VH; - } - if (aUnit.LowerCaseEqualsLiteral("vmin")) { - return SVG_LENGTHTYPE_VMIN; - } - if (aUnit.LowerCaseEqualsLiteral("vmax")) { - return SVG_LENGTHTYPE_VMAX; - } return SVG_LENGTHTYPE_UNKNOWN; } diff --git a/layout/style/nsCSSValue.h b/layout/style/nsCSSValue.h index bc8914bbc1bc..c364ec637df3 100644 --- a/layout/style/nsCSSValue.h +++ b/layout/style/nsCSSValue.h @@ -55,14 +55,12 @@ enum nsCSSUnit : uint32_t { // different behavior than percent) // Font relative measure - eCSSUnit_EM = 800, // == current font size - eCSSUnit_XHeight = 801, // distance from top of lower case x to - // baseline - eCSSUnit_Char = 802, // number of characters, used for width with - // monospace font - eCSSUnit_RootEM = 803, // == root element font size - eCSSUnit_Ideographic = 804, // == CJK water ideograph width - eCSSUnit_CapHeight = 805, // == Capital letter height + eCSSUnit_EM = 800, // == current font size + eCSSUnit_XHeight = 801, // distance from top of lower case x to + // baseline + eCSSUnit_Char = 802, // number of characters, used for width with + // monospace font + eCSSUnit_RootEM = 803, // == root element font size // Screen relative measure eCSSUnit_Point = 900, // 4/3 of a CSS pixel @@ -72,12 +70,6 @@ enum nsCSSUnit : uint32_t { eCSSUnit_Pica = 904, // 12 points == 16 CSS pixls eCSSUnit_Quarter = 905, // 96/101.6 CSS pixels eCSSUnit_Pixel = 906, // CSS pixel unit - - // Viewport percentage lengths - eCSSUnit_VW = 950, - eCSSUnit_VH = 951, - eCSSUnit_VMin = 952, - eCSSUnit_VMax = 953, }; struct nsCSSValuePair; diff --git a/servo/ports/geckolib/glue.rs b/servo/ports/geckolib/glue.rs index 1caefe721db9..4810ff1891f2 100644 --- a/servo/ports/geckolib/glue.rs +++ b/servo/ports/geckolib/glue.rs @@ -5341,7 +5341,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetLengthValue( use style::properties::PropertyDeclaration; use style::values::generics::length::{LengthPercentageOrAuto, Size}; use style::values::generics::NonNegative; - use style::values::specified::length::{FontRelativeLength, LengthPercentage, ViewportPercentageLength}; + use style::values::specified::length::{FontRelativeLength, LengthPercentage}; use style::values::specified::FontSize; let long = get_longhand_from_id!(property); @@ -5352,18 +5352,6 @@ pub extern "C" fn Servo_DeclarationBlock_SetLengthValue( structs::nsCSSUnit::eCSSUnit_XHeight => { NoCalcLength::FontRelative(FontRelativeLength::Ex(value)) }, - structs::nsCSSUnit::eCSSUnit_RootEM => { - NoCalcLength::FontRelative(FontRelativeLength::Rem(value)) - }, - structs::nsCSSUnit::eCSSUnit_Char => { - NoCalcLength::FontRelative(FontRelativeLength::Ch(value)) - }, - structs::nsCSSUnit::eCSSUnit_Ideographic => { - NoCalcLength::FontRelative(FontRelativeLength::Ic(value)) - }, - structs::nsCSSUnit::eCSSUnit_CapHeight => { - NoCalcLength::FontRelative(FontRelativeLength::Cap(value)) - }, structs::nsCSSUnit::eCSSUnit_Pixel => NoCalcLength::Absolute(AbsoluteLength::Px(value)), structs::nsCSSUnit::eCSSUnit_Inch => NoCalcLength::Absolute(AbsoluteLength::In(value)), structs::nsCSSUnit::eCSSUnit_Centimeter => { @@ -5375,18 +5363,6 @@ pub extern "C" fn Servo_DeclarationBlock_SetLengthValue( structs::nsCSSUnit::eCSSUnit_Point => NoCalcLength::Absolute(AbsoluteLength::Pt(value)), structs::nsCSSUnit::eCSSUnit_Pica => NoCalcLength::Absolute(AbsoluteLength::Pc(value)), structs::nsCSSUnit::eCSSUnit_Quarter => NoCalcLength::Absolute(AbsoluteLength::Q(value)), - structs::nsCSSUnit::eCSSUnit_VW => { - NoCalcLength::ViewportPercentage(ViewportPercentageLength::Vw(value)) - }, - structs::nsCSSUnit::eCSSUnit_VH => { - NoCalcLength::ViewportPercentage(ViewportPercentageLength::Vh(value)) - }, - structs::nsCSSUnit::eCSSUnit_VMin => { - NoCalcLength::ViewportPercentage(ViewportPercentageLength::Vmin(value)) - }, - structs::nsCSSUnit::eCSSUnit_VMax => { - NoCalcLength::ViewportPercentage(ViewportPercentageLength::Vmax(value)) - }, _ => unreachable!("Unknown unit passed to SetLengthValue"), }; diff --git a/testing/web-platform/meta/svg/types/scripted/SVGLength-ic.html.ini b/testing/web-platform/meta/svg/types/scripted/SVGLength-ic.html.ini index 6121aad6ad27..42dfef736ac6 100644 --- a/testing/web-platform/meta/svg/types/scripted/SVGLength-ic.html.ini +++ b/testing/web-platform/meta/svg/types/scripted/SVGLength-ic.html.ini @@ -1,3 +1,8 @@ [SVGLength-ic.html] expected: if (os == "android") and fission: [OK, TIMEOUT] + [ic unit in SVGLength] + expected: FAIL + + [Convert back to ic from new user unit value] + expected: FAIL diff --git a/testing/web-platform/tests/svg/types/scripted/SVGLength-cap.html b/testing/web-platform/tests/svg/types/scripted/SVGLength-cap.html deleted file mode 100644 index 7a41f4730c91..000000000000 --- a/testing/web-platform/tests/svg/types/scripted/SVGLength-cap.html +++ /dev/null @@ -1,23 +0,0 @@ - -SVGLength with 'cap' unit - - - -
- - - - diff --git a/testing/web-platform/tests/svg/types/scripted/SVGLength-ch.html b/testing/web-platform/tests/svg/types/scripted/SVGLength-ch.html deleted file mode 100644 index 67b699008010..000000000000 --- a/testing/web-platform/tests/svg/types/scripted/SVGLength-ch.html +++ /dev/null @@ -1,43 +0,0 @@ - -SVGLength with 'ch' unit - - - - -
- - - - diff --git a/testing/web-platform/tests/svg/types/scripted/SVGLength-rem.html b/testing/web-platform/tests/svg/types/scripted/SVGLength-rem.html deleted file mode 100644 index c89f937cf372..000000000000 --- a/testing/web-platform/tests/svg/types/scripted/SVGLength-rem.html +++ /dev/null @@ -1,30 +0,0 @@ - -SVGLength with 'rem' unit - - - - -
- - - - diff --git a/testing/web-platform/tests/svg/types/scripted/SVGLength-viewport.html b/testing/web-platform/tests/svg/types/scripted/SVGLength-viewport.html deleted file mode 100644 index 2a29c0ba5497..000000000000 --- a/testing/web-platform/tests/svg/types/scripted/SVGLength-viewport.html +++ /dev/null @@ -1,35 +0,0 @@ - -SVGLength with 'viewport' units - - - -
- - - - -- 2.11.4.GIT