commit 40707c00d7669bd12c0020a9902ab8790dcfde43 parent 632ec351ec6fda3a7d97e1ff60f25c81c587c0e0 Author: agoloman <agoloman@mozilla.com> Date: Fri, 12 Dec 2025 18:45:06 +0200 Revert "Bug 840878 - Snap text decorations as border widths as per CSSWG resolution. r=layout-reviewers,jfkthame" for causing wr failures. This reverts commit 207b6109c87df91dd33b9e3e4b9c9731a24d0299. Diffstat:
19 files changed, 343 insertions(+), 512 deletions(-)
diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp @@ -40,7 +40,6 @@ #include "mozilla/intl/Bidi.h" #include "mozilla/intl/Segmenter.h" #include "mozilla/intl/UnicodeProperties.h" -#include "mozilla/widget/ThemeDrawing.h" #include "nsBlockFrame.h" #include "nsCOMPtr.h" #include "nsCSSColorUtils.h" @@ -5691,14 +5690,14 @@ static gfxFloat ComputeDecorationLineThickness( const gfxFont::Metrics& aFontMetrics, const gfxFloat aAppUnitsPerDevPixel, const nsIFrame* aFrame) { if (aThickness.IsAuto()) { - return widget::ThemeDrawing::SnapBorderWidth(aAutoValue); + return aAutoValue; } + if (aThickness.IsFromFont()) { - return widget::ThemeDrawing::SnapBorderWidth(aFontMetrics.underlineSize); + return aFontMetrics.underlineSize; } auto em = [&] { return aFrame->StyleFont()->mSize.ToAppUnits(); }; - return widget::ThemeDrawing::SnapBorderWidth( - aThickness.AsLengthPercentage().Resolve(em) / aAppUnitsPerDevPixel); + return aThickness.AsLengthPercentage().Resolve(em) / aAppUnitsPerDevPixel; } // Helper function for implementing text-underline-offset and -position @@ -6006,6 +6005,7 @@ void nsTextFrame::UnionAdditionalOverflow(nsPresContext* aPresContext, decorationStyle = StyleTextDecorationStyle::Solid; } nsCSSRendering::DecorationRectParams params; + bool useVerticalMetrics = verticalRun && mTextRun->UseCenterBaseline(); nsFontMetrics* fontMetrics = aProvider.GetFontMetrics(); RefPtr<gfxFont> font = diff --git a/layout/painting/nsCSSRendering.cpp b/layout/painting/nsCSSRendering.cpp @@ -4207,10 +4207,11 @@ void nsCSSRendering::PaintDecorationLine( void nsCSSRendering::PaintDecorationLineInternal( nsIFrame* aFrame, DrawTarget& aDrawTarget, const PaintDecorationLineParams& aParams, Rect aRect) { - const Float lineThickness = aParams.lineSize.height; + Float lineThickness = std::max(NS_round(aParams.lineSize.height), 1.0); + DeviceColor color = ToDeviceColor(aParams.color); ColorPattern colorPat(color); - StrokeOptions strokeOptions(aParams.lineSize.height); + StrokeOptions strokeOptions(lineThickness); DrawOptions drawOptions; Float dash[2]; @@ -4488,7 +4489,8 @@ Rect nsCSSRendering::DecorationLineToPath( return path; } - const Float lineThickness = aParams.lineSize.height; + Float lineThickness = std::max(NS_round(aParams.lineSize.height), 1.0); + // The block-direction position should be set to the middle of the line. if (aParams.vertical) { rect.x += lineThickness / 2; @@ -4544,7 +4546,8 @@ gfxRect nsCSSRendering::GetTextDecorationRectInternal( // and horizontal coordinates at the end if vertical was requested. gfxRect r(left, 0, right - left, 0); - const gfxFloat lineThickness = aParams.lineSize.height; + gfxFloat lineThickness = NS_round(aParams.lineSize.height); + lineThickness = std::max(lineThickness, 1.0); gfxFloat defaultLineThickness = NS_round(aParams.defaultLineThickness); defaultLineThickness = std::max(defaultLineThickness, 1.0); diff --git a/layout/reftests/text-decoration/line-through-thickness-rounding-1-ref.html b/layout/reftests/text-decoration/line-through-thickness-rounding-1-ref.html @@ -1,18 +0,0 @@ -<!doctype html> -<meta charset="utf-8"> -<title>Reference: Line-through thickness 1px</title> -<style> - html, body { margin: 0; background: white; } - .test { - font: 40px/1 sans-serif; - color: black; - text-decoration-line: line-through; - text-decoration-style: solid; - text-decoration-color: black; - text-decoration-skip-ink: none; - text-decoration-thickness: 1px; - } - .pad { height: 40px; } -</style> -<div class="pad"></div> -<div class="test">TEST TEST TEST</div> diff --git a/layout/reftests/text-decoration/line-through-thickness-rounding-1.html b/layout/reftests/text-decoration/line-through-thickness-rounding-1.html @@ -1,18 +0,0 @@ -<!doctype html> -<meta charset="utf-8"> -<title>Line-through thickness upward rounding test (0.6px should equal 1px)</title> -<style> - html, body { margin: 0; background: white; } - .test { - font: 40px/1 sans-serif; - color: black; - text-decoration-line: line-through; - text-decoration-style: solid; - text-decoration-color: black; - text-decoration-skip-ink: none; - text-decoration-thickness: 0.6px; /* Rounds via ceil(t * DPR) with a minimum of 1 device px; here 0.6 CSS px → 1 device px at DPR=1 */ - } - .pad { height: 40px; } -</style> -<div class="pad"></div> -<div class="test">TEST TEST TEST</div> diff --git a/layout/reftests/text-decoration/overline-thickness-rounding-1-ref.html b/layout/reftests/text-decoration/overline-thickness-rounding-1-ref.html @@ -1,18 +0,0 @@ -<!doctype html> -<meta charset="utf-8"> -<title>Reference: Overline thickness 1px</title> -<style> - html, body { margin: 0; background: white; } - .test { - font: 40px/1 sans-serif; - color: black; - text-decoration-line: overline; - text-decoration-style: solid; - text-decoration-color: black; - text-decoration-skip-ink: none; - text-decoration-thickness: 1px; - } - .pad { height: 40px; } -</style> -<div class="pad"></div> -<div class="test">TEST TEST TEST</div> diff --git a/layout/reftests/text-decoration/overline-thickness-rounding-1.html b/layout/reftests/text-decoration/overline-thickness-rounding-1.html @@ -1,18 +0,0 @@ -<!doctype html> -<meta charset="utf-8"> -<title>Overline thickness upward rounding test (0.1px should equal 1 device pixel)</title> -<style> - html, body { margin: 0; background: white; } - .test { - font: 40px/1 sans-serif; - color: black; - text-decoration-line: overline; - text-decoration-style: solid; - text-decoration-color: black; - text-decoration-skip-ink: none; - text-decoration-thickness: 0.1px; - } - .pad { height: 40px; } -</style> -<div class="pad"></div> -<div class="test">TEST TEST TEST</div> diff --git a/layout/reftests/text-decoration/reftest.list b/layout/reftests/text-decoration/reftest.list @@ -121,7 +121,3 @@ fuzzy(0-94,0-4) == skip-ink-cjk-1.html skip-ink-cjk-1-ref.html == skip-ink-cjk-3.html skip-ink-cjk-3-ref.html != always-underline-links.html always-underline-links-ref.html pref(layout.css.always_underline_links,true) == always-underline-links.html always-underline-links-ref.html -== underline-thickness-rounding-1.html underline-thickness-rounding-1-ref.html -== overline-thickness-rounding-1.html overline-thickness-rounding-1-ref.html -== line-through-thickness-rounding-1.html line-through-thickness-rounding-1-ref.html -== underline-thickness-rounding-dppx2-1.html underline-thickness-rounding-dppx2-1-ref.html # needs drawSnapshot; headless SWGL (no widget layers) makes drawWindow fail at forced DPR 2.0 diff --git a/layout/reftests/text-decoration/underline-thickness-rounding-1-ref.html b/layout/reftests/text-decoration/underline-thickness-rounding-1-ref.html @@ -1,18 +0,0 @@ -<!doctype html> -<meta charset="utf-8"> -<title>Reference: Underline thickness 1px</title> -<style> - html, body { margin: 0; background: white; } - .test { - font: 40px/1 sans-serif; - color: black; - text-decoration-line: underline; - text-decoration-style: solid; - text-decoration-color: black; - text-decoration-skip-ink: none; - text-decoration-thickness: 1px; - } - .pad { height: 40px; } -</style> -<div class="pad"></div> -<div class="test">TEST TEST TEST</div> diff --git a/layout/reftests/text-decoration/underline-thickness-rounding-1.html b/layout/reftests/text-decoration/underline-thickness-rounding-1.html @@ -1,18 +0,0 @@ -<!doctype html> -<meta charset="utf-8"> -<title>Underline thickness upward rounding test (0.1px should equal 1 device px)</title> -<style> - html, body { margin: 0; background: white; } - .test { - font: 40px/1 sans-serif; - color: black; - text-decoration-line: underline; - text-decoration-style: solid; - text-decoration-color: black; - text-decoration-skip-ink: none; - text-decoration-thickness: 0.1px; - } - .pad { height: 40px; } -</style> -<div class="pad"></div> -<div class="test">TEST TEST TEST</div> diff --git a/layout/reftests/text-decoration/underline-thickness-rounding-dppx2-1-ref.html b/layout/reftests/text-decoration/underline-thickness-rounding-dppx2-1-ref.html @@ -1,23 +0,0 @@ -<!doctype html> -<html reftest-zoom="2.0"> -<meta charset="utf-8"> -<title>Reference: Underline thickness 1px at effective 2x zoom (2 device px)</title> -<style> - html, body { margin: 0; background: white; } - .test { - font: 40px/1 sans-serif; - color: black; - text-decoration-line: underline; - text-decoration-style: solid; - text-decoration-color: black; - text-decoration-skip-ink: none; - /* 0.5 CSS px -> 1 device px at 2x zoom */ - text-decoration-thickness: 0.5px; - } - .pad { height: 40px; } -</style> -<div style="width:240px"> - <div class="pad"></div> - <div class="test">TEST TEST TEST</div> -</div> -</html> diff --git a/layout/reftests/text-decoration/underline-thickness-rounding-dppx2-1.html b/layout/reftests/text-decoration/underline-thickness-rounding-dppx2-1.html @@ -1,28 +0,0 @@ -<!doctype html> -<html reftest-zoom="2.0"> -<meta charset="utf-8"> -<title>Underline thickness upward rounding test at effective 2x zoom (0.6px should equal 1px => 2 device px)</title> -<!-- - High-DPI (2.0 dppx) underline thickness rounding test. - DPR 2.0 is forced via reftest-zoom. - 0.6 CSS px -> 1.2 device px at 2.0 dppx, which should floor to 1 (matching 1 dev px). ---> -<style> - html, body { margin: 0; background: white; } - .test { - font: 40px/1 sans-serif; - color: black; - text-decoration-line: underline; - text-decoration-style: solid; - text-decoration-color: black; - text-decoration-skip-ink: none; - /* 0.6 CSS px -> 1.2 device px at 2.0 dppx; should floor to 1 device px */ - text-decoration-thickness: 0.6px; - } - .pad { height: 40px; } -</style> -<div style="width:240px"> - <div class="pad"></div> - <div class="test">TEST TEST TEST</div> - </div> -</html> diff --git a/testing/web-platform/meta/svg/text/reftests/dominant-baseline-central-large-font-size.svg.ini b/testing/web-platform/meta/svg/text/reftests/dominant-baseline-central-large-font-size.svg.ini @@ -1,4 +1,3 @@ [dominant-baseline-central-large-font-size.svg] - # Underline anti-aliasing. expected: - fuzzy: maxDifference=0-5;totalPixels=0-100 + if (os == "win") and not debug: [PASS, FAIL] diff --git a/testing/web-platform/tests/css/css-text-decor/text-decoration-thickness-length-rounding-001.html b/testing/web-platform/tests/css/css-text-decor/text-decoration-thickness-length-rounding-001.html @@ -1,163 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title> - CSS Text Decoration Test: text-decoration-thickness length rounding down - </title> - - <link rel="author" title="Traian Captan" href="mailto:tcaptan@chromium.org"> - <link rel="help" href="https://drafts.csswg.org/css-text-decor-4/#text-decoration-width-property"> - <link rel="match" href="reference/text-decoration-thickness-length-rounding-ref.tentative.html"> - - <meta name="assert" content="text-decoration-thickness length is rounded down to 2px"> - <!-- NOTE: This test assumes DPI of 1 --> - - <style> - table { - border: 3px solid gray; - border-collapse: collapse; - } - - th, - td{ - border: 2px solid gray; - padding: 10px; - text-align: center; - } - - .two_point3_px { - text-decoration-thickness: 2.3px; - } - - .solid { - text-decoration-style: solid; - } - - .double { - text-decoration-style: double; - } - - .dotted { - text-decoration-style: dotted; - } - - .dashed { - text-decoration-style: dashed; - } - - .wavy { - text-decoration-style: wavy; - } - - .underline { - text-decoration-line: underline; - } - - .line_through { - text-decoration-line: line-through; - } - - .overline { - text-decoration-line: overline; - } - </style> - </head> - - <body> - <h1> - Test passes if text-decoration-thickness length is rounded to 2px - </h1> - - <table> - <thead> - <tr> - <th rowspan="2"> - Line Type - </th> - <th colspan="5"> - Line Style - </th> - </tr> - <tr> - <th> - Solid - </th> - <th> - Double - </th> - <th> - Dotted - </th> - <th> - Dashed - </th> - <th> - Wavy - </th> - </tr> - </thead> - <tbody> - <tr> - <th> - Underline - </th> - <td class="two_point3_px solid underline"> - Thickness test. - </td> - <td class="two_point3_px double underline"> - Thickness test. - </td> - <td class="two_point3_px dotted underline"> - Thickness test. - </td> - <td class="two_point3_px dashed underline"> - Thickness test. - </td> - <td class="two_point3_px wavy underline"> - Thickness test. - </td> - </tr> - <tr> - <th> - Line-through - </th> - <td class="two_point3_px solid line_through"> - Thickness test. - </td> - <td class="two_point3_px double line_through"> - Thickness test. - </td> - <td class="two_point3_px dotted line_through"> - Thickness test. - </td> - <td class="two_point3_px dashed line_through"> - Thickness test. - </td> - <td class="two_point3_px wavy line_through"> - Thickness test. - </td> - </tr> - <tr> - <th> - Overline - </th> - <td class="two_point3_px solid overline"> - Thickness test. - </td> - <td class="two_point3_px double overline"> - Thickness test. - </td> - <td class="two_point3_px dotted overline"> - Thickness test. - </td> - <td class="two_point3_px dashed overline"> - Thickness test. - </td> - <td class="two_point3_px wavy overline"> - Thickness test. - </td> - </tr> - </tbody> - </table> - </body> -</html> diff --git a/testing/web-platform/tests/css/css-text-decor/text-decoration-thickness-length-rounding-002.html b/testing/web-platform/tests/css/css-text-decor/text-decoration-thickness-length-rounding-002.html @@ -1,163 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <title> - CSS Text Decoration Test: text-decoration-thickness length rounding up - </title> - - <link rel="author" title="Traian Captan" href="mailto:tcaptan@chromium.org"> - <link rel="help" href="https://drafts.csswg.org/css-text-decor-4/#text-decoration-width-property"> - <link rel="match" href="reference/text-decoration-thickness-length-rounding-ref.tentative.html"> - - <meta name="assert" content="text-decoration-thickness length is floored to 2px"> - <!-- NOTE: This test assumes DPI of 1 --> - - <style> - table { - border: 3px solid gray; - border-collapse: collapse; - } - - th, - td{ - border: 2px solid gray; - padding: 10px; - text-align: center; - } - - .two_point7_px { - text-decoration-thickness: 2.7px; - } - - .solid { - text-decoration-style: solid; - } - - .double { - text-decoration-style: double; - } - - .dotted { - text-decoration-style: dotted; - } - - .dashed { - text-decoration-style: dashed; - } - - .wavy { - text-decoration-style: wavy; - } - - .underline { - text-decoration-line: underline; - } - - .line_through { - text-decoration-line: line-through; - } - - .overline { - text-decoration-line: overline; - } - </style> - </head> - - <body> - <h1> - Test passes if text-decoration-thickness length is rounded to 2px - </h1> - - <table> - <thead> - <tr> - <th rowspan="2"> - Line Type - </th> - <th colspan="5"> - Line Style - </th> - </tr> - <tr> - <th> - Solid - </th> - <th> - Double - </th> - <th> - Dotted - </th> - <th> - Dashed - </th> - <th> - Wavy - </th> - </tr> - </thead> - <tbody> - <tr> - <th> - Underline - </th> - <td class="two_point7_px solid underline"> - Thickness test. - </td> - <td class="two_point7_px double underline"> - Thickness test. - </td> - <td class="two_point7_px dotted underline"> - Thickness test. - </td> - <td class="two_point7_px dashed underline"> - Thickness test. - </td> - <td class="two_point7_px wavy underline"> - Thickness test. - </td> - </tr> - <tr> - <th> - Line-through - </th> - <td class="two_point7_px solid line_through"> - Thickness test. - </td> - <td class="two_point7_px double line_through"> - Thickness test. - </td> - <td class="two_point7_px dotted line_through"> - Thickness test. - </td> - <td class="two_point7_px dashed line_through"> - Thickness test. - </td> - <td class="two_point7_px wavy line_through"> - Thickness test. - </td> - </tr> - <tr> - <th> - Overline - </th> - <td class="two_point7_px solid overline"> - Thickness test. - </td> - <td class="two_point7_px double overline"> - Thickness test. - </td> - <td class="two_point7_px dotted overline"> - Thickness test. - </td> - <td class="two_point7_px dashed overline"> - Thickness test. - </td> - <td class="two_point7_px wavy overline"> - Thickness test. - </td> - </tr> - </tbody> - </table> - </body> -</html> diff --git a/testing/web-platform/tests/css/css-text-decor/text-decoration-thickness-length-rounding-down.tentative.html b/testing/web-platform/tests/css/css-text-decor/text-decoration-thickness-length-rounding-down.tentative.html @@ -0,0 +1,162 @@ +<!DOCTYPE html> +<html> + <head> + <title> + CSS Text Decoration Test: text-decoration-thickness length rounding down + </title> + + <link rel="author" title="Traian Captan" href="mailto:tcaptan@chromium.org"> + <link rel="help" href="https://drafts.csswg.org/css-text-decor-4/#text-decoration-width-property"> + <link rel="match" href="reference/text-decoration-thickness-length-rounding-ref.tentative.html"> + + <meta name="assert" content="text-decoration-thickness length is rounded down to 2px"> + + <style> + table { + border: 3px solid gray; + border-collapse: collapse; + } + + th, + td{ + border: 2px solid gray; + padding: 10px; + text-align: center; + } + + .two_point3_px { + text-decoration-thickness: 2.3px; + } + + .solid { + text-decoration-style: solid; + } + + .double { + text-decoration-style: double; + } + + .dotted { + text-decoration-style: dotted; + } + + .dashed { + text-decoration-style: dashed; + } + + .wavy { + text-decoration-style: wavy; + } + + .underline { + text-decoration-line: underline; + } + + .line_through { + text-decoration-line: line-through; + } + + .overline { + text-decoration-line: overline; + } + </style> + </head> + + <body> + <h1> + Test passes if text-decoration-thickness length is rounded to 2px + </h1> + + <table> + <thead> + <tr> + <th rowspan="2"> + Line Type + </th> + <th colspan="5"> + Line Style + </th> + </tr> + <tr> + <th> + Solid + </th> + <th> + Double + </th> + <th> + Dotted + </th> + <th> + Dashed + </th> + <th> + Wavy + </th> + </tr> + </thead> + <tbody> + <tr> + <th> + Underline + </th> + <td class="two_point3_px solid underline"> + Thickness test. + </td> + <td class="two_point3_px double underline"> + Thickness test. + </td> + <td class="two_point3_px dotted underline"> + Thickness test. + </td> + <td class="two_point3_px dashed underline"> + Thickness test. + </td> + <td class="two_point3_px wavy underline"> + Thickness test. + </td> + </tr> + <tr> + <th> + Line-through + </th> + <td class="two_point3_px solid line_through"> + Thickness test. + </td> + <td class="two_point3_px double line_through"> + Thickness test. + </td> + <td class="two_point3_px dotted line_through"> + Thickness test. + </td> + <td class="two_point3_px dashed line_through"> + Thickness test. + </td> + <td class="two_point3_px wavy line_through"> + Thickness test. + </td> + </tr> + <tr> + <th> + Overline + </th> + <td class="two_point3_px solid overline"> + Thickness test. + </td> + <td class="two_point3_px double overline"> + Thickness test. + </td> + <td class="two_point3_px dotted overline"> + Thickness test. + </td> + <td class="two_point3_px dashed overline"> + Thickness test. + </td> + <td class="two_point3_px wavy overline"> + Thickness test. + </td> + </tr> + </tbody> + </table> + </body> +</html> diff --git a/testing/web-platform/tests/css/css-text-decor/text-decoration-thickness-length-rounding-up.tentative.html b/testing/web-platform/tests/css/css-text-decor/text-decoration-thickness-length-rounding-up.tentative.html @@ -0,0 +1,162 @@ +<!DOCTYPE html> +<html> + <head> + <title> + CSS Text Decoration Test: text-decoration-thickness length rounding up + </title> + + <link rel="author" title="Traian Captan" href="mailto:tcaptan@chromium.org"> + <link rel="help" href="https://drafts.csswg.org/css-text-decor-4/#text-decoration-width-property"> + <link rel="match" href="reference/text-decoration-thickness-length-rounding-ref.tentative.html"> + + <meta name="assert" content="text-decoration-thickness length is rounded up to 2px"> + + <style> + table { + border: 3px solid gray; + border-collapse: collapse; + } + + th, + td{ + border: 2px solid gray; + padding: 10px; + text-align: center; + } + + .one_point7_px { + text-decoration-thickness: 1.7px; + } + + .solid { + text-decoration-style: solid; + } + + .double { + text-decoration-style: double; + } + + .dotted { + text-decoration-style: dotted; + } + + .dashed { + text-decoration-style: dashed; + } + + .wavy { + text-decoration-style: wavy; + } + + .underline { + text-decoration-line: underline; + } + + .line_through { + text-decoration-line: line-through; + } + + .overline { + text-decoration-line: overline; + } + </style> + </head> + + <body> + <h1> + Test passes if text-decoration-thickness length is rounded to 2px + </h1> + + <table> + <thead> + <tr> + <th rowspan="2"> + Line Type + </th> + <th colspan="5"> + Line Style + </th> + </tr> + <tr> + <th> + Solid + </th> + <th> + Double + </th> + <th> + Dotted + </th> + <th> + Dashed + </th> + <th> + Wavy + </th> + </tr> + </thead> + <tbody> + <tr> + <th> + Underline + </th> + <td class="one_point7_px solid underline"> + Thickness test. + </td> + <td class="one_point7_px double underline"> + Thickness test. + </td> + <td class="one_point7_px dotted underline"> + Thickness test. + </td> + <td class="one_point7_px dashed underline"> + Thickness test. + </td> + <td class="one_point7_px wavy underline"> + Thickness test. + </td> + </tr> + <tr> + <th> + Line-through + </th> + <td class="one_point7_px solid line_through"> + Thickness test. + </td> + <td class="one_point7_px double line_through"> + Thickness test. + </td> + <td class="one_point7_px dotted line_through"> + Thickness test. + </td> + <td class="one_point7_px dashed line_through"> + Thickness test. + </td> + <td class="one_point7_px wavy line_through"> + Thickness test. + </td> + </tr> + <tr> + <th> + Overline + </th> + <td class="one_point7_px solid overline"> + Thickness test. + </td> + <td class="one_point7_px double overline"> + Thickness test. + </td> + <td class="one_point7_px dotted overline"> + Thickness test. + </td> + <td class="one_point7_px dashed overline"> + Thickness test. + </td> + <td class="one_point7_px wavy overline"> + Thickness test. + </td> + </tr> + </tbody> + </table> + </body> +</html> diff --git a/widget/ThemeDrawing.cpp b/widget/ThemeDrawing.cpp @@ -25,16 +25,12 @@ void ThemeDrawing::FillRect(WebRenderBackendData& aWrData, } /*static*/ -LayoutDeviceIntCoord ThemeDrawing::SnapBorderWidth(CSSCoord aCssWidth, - DPIRatio aDpiRatio) { - return SnapBorderWidth(aCssWidth * aDpiRatio); -} - -LayoutDeviceIntCoord ThemeDrawing::SnapBorderWidth(LayoutDeviceCoord aWidth) { - if (aWidth == 0.0f) { +LayoutDeviceIntCoord ThemeDrawing::SnapBorderWidth(const CSSCoord& aCssWidth, + const DPIRatio& aDpiRatio) { + if (aCssWidth == 0.0f) { return 0; } - return std::max(LayoutDeviceIntCoord(1), aWidth.Truncated()); + return std::max(LayoutDeviceIntCoord(1), (aCssWidth * aDpiRatio).Truncated()); } /*static*/ diff --git a/widget/ThemeDrawing.h b/widget/ThemeDrawing.h @@ -41,9 +41,8 @@ class ThemeDrawing { return std::min(aRect.width, aRect.height) / aSize; } - static LayoutDeviceIntCoord SnapBorderWidth(CSSCoord aCssWidth, - DPIRatio aDpiRatio); - static LayoutDeviceIntCoord SnapBorderWidth(LayoutDeviceCoord); + static LayoutDeviceIntCoord SnapBorderWidth(const CSSCoord& aCssWidth, + const DPIRatio& aDpiRatio); static void PaintArrow(DrawTarget&, const LayoutDeviceRect&, const float aArrowPolygonX[], diff --git a/widget/moz.build b/widget/moz.build @@ -234,7 +234,6 @@ EXPORTS.mozilla.widget += [ "ScreenManager.h", "TextRecognition.h", "ThemeChangeKind.h", - "ThemeDrawing.h", "WidgetLogging.h", "WidgetMessageUtils.h", "WindowOcclusionState.h",