From 72849955dbed9734a1a192c2548c1da603cb74d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 2 Nov 2021 14:21:38 +0000 Subject: [PATCH] Bug 1738663 - Remove some unneeded special-cases in GenerateComputedDOMStyleGenerated. r=layout-reviewers,mats Depends on D130018 Differential Revision: https://phabricator.services.mozilla.com/D130026 --- .../GenerateComputedDOMStyleGenerated.py | 15 +------------ layout/style/nsComputedDOMStyle.cpp | 21 +++++++++---------- layout/style/nsComputedDOMStyle.h | 12 +++++------ 3 files changed, 17 insertions(+), 31 deletions(-) diff --git a/layout/style/GenerateComputedDOMStyleGenerated.py b/layout/style/GenerateComputedDOMStyleGenerated.py index d298600fb40f..a1c8f2fb7fd4 100644 --- a/layout/style/GenerateComputedDOMStyleGenerated.py +++ b/layout/style/GenerateComputedDOMStyleGenerated.py @@ -34,22 +34,9 @@ static constexpr Entry kEntries[] = { return False return True - # Some special cases we may get rid of later. See bug 1471423. - def method(p): - if p.id.startswith("margin_"): - return "{}Width".format(p.method) - if p.id.startswith("_moz_"): - method = p.method[3:] - else: - method = p.method - if p.id.startswith("_moz_outline_radius_"): - method = method.replace("left", "Left") - method = method.replace("right", "Right") - return method - def getter_entry(p): if has_cpp_getter(p): - return "DoGet" + method(p) + return "DoGet" + p.method # Put a dummy getter here instead of nullptr because MSVC seems # to have bug which ruins the table when we put nullptr for # pointer-to-member-function. See bug 1471426. diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 2b2a4750749b..2b634a4d8e90 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -1317,7 +1317,7 @@ already_AddRefed nsComputedDOMStyle::MatrixToCSSValue( return val.forget(); } -already_AddRefed nsComputedDOMStyle::DoGetOsxFontSmoothing() { +already_AddRefed nsComputedDOMStyle::DoGetMozOsxFontSmoothing() { if (nsContentUtils::ShouldResistFingerprinting( mPresShell->GetPresContext()->GetDocShell())) { return nullptr; @@ -1794,20 +1794,20 @@ already_AddRefed nsComputedDOMStyle::DoGetBorderRightWidth() { return GetBorderWidthFor(eSideRight); } -already_AddRefed nsComputedDOMStyle::DoGetMarginTopWidth() { - return GetMarginWidthFor(eSideTop); +already_AddRefed nsComputedDOMStyle::DoGetMarginTop() { + return GetMarginFor(eSideTop); } -already_AddRefed nsComputedDOMStyle::DoGetMarginBottomWidth() { - return GetMarginWidthFor(eSideBottom); +already_AddRefed nsComputedDOMStyle::DoGetMarginBottom() { + return GetMarginFor(eSideBottom); } -already_AddRefed nsComputedDOMStyle::DoGetMarginLeftWidth() { - return GetMarginWidthFor(eSideLeft); +already_AddRefed nsComputedDOMStyle::DoGetMarginLeft() { + return GetMarginFor(eSideLeft); } -already_AddRefed nsComputedDOMStyle::DoGetMarginRightWidth() { - return GetMarginWidthFor(eSideRight); +already_AddRefed nsComputedDOMStyle::DoGetMarginRight() { + return GetMarginFor(eSideRight); } already_AddRefed nsComputedDOMStyle::DoGetLineHeight() { @@ -2174,8 +2174,7 @@ already_AddRefed nsComputedDOMStyle::GetBorderWidthFor( return val.forget(); } -already_AddRefed nsComputedDOMStyle::GetMarginWidthFor( - mozilla::Side aSide) { +already_AddRefed nsComputedDOMStyle::GetMarginFor(Side aSide) { RefPtr val = new nsROCSSPrimitiveValue; auto& margin = StyleMargin()->mMargin.Get(aSide); diff --git a/layout/style/nsComputedDOMStyle.h b/layout/style/nsComputedDOMStyle.h index 792536ef7677..d90c8e3d87c2 100644 --- a/layout/style/nsComputedDOMStyle.h +++ b/layout/style/nsComputedDOMStyle.h @@ -193,7 +193,7 @@ class nsComputedDOMStyle final : public nsDOMCSSDeclaration, already_AddRefed GetBorderWidthFor(mozilla::Side aSide); - already_AddRefed GetMarginWidthFor(mozilla::Side aSide); + already_AddRefed GetMarginFor(mozilla::Side aSide); already_AddRefed GetTransformValue(const mozilla::StyleTransform&); @@ -230,7 +230,7 @@ class nsComputedDOMStyle final : public nsDOMCSSDeclaration, already_AddRefed DoGetBottom(); /* Font properties */ - already_AddRefed DoGetOsxFontSmoothing(); + already_AddRefed DoGetMozOsxFontSmoothing(); /* Grid properties */ already_AddRefed DoGetGridTemplateColumns(); @@ -259,10 +259,10 @@ class nsComputedDOMStyle final : public nsDOMCSSDeclaration, already_AddRefed DoGetBorderRightWidth(); /* Margin Properties */ - already_AddRefed DoGetMarginTopWidth(); - already_AddRefed DoGetMarginBottomWidth(); - already_AddRefed DoGetMarginLeftWidth(); - already_AddRefed DoGetMarginRightWidth(); + already_AddRefed DoGetMarginTop(); + already_AddRefed DoGetMarginBottom(); + already_AddRefed DoGetMarginLeft(); + already_AddRefed DoGetMarginRight(); /* Text Properties */ already_AddRefed DoGetLineHeight();