mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-26 13:58:49 +00:00
@@ -0,0 +1,16 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS Masking: Test clip-path property and circle function on circle 021</title>
|
||||
<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
|
||||
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
|
||||
</head>
|
||||
<body>
|
||||
<p>The test passes if there is a green circle.</p>
|
||||
<div style="width: 600px; height: 600px; background-color: green; clip-path: circle();"></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,20 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CSS Masking: Test clip-path property and circle function on circle 021</title>
|
||||
<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
|
||||
<link rel="author" title="Mozilla" href="http://www.mozilla.org/">
|
||||
<link rel="help" href="http://www.w3.org/TR/css-masking-1/#clipping-paths">
|
||||
<link rel="help" href="http://www.w3.org/TR/css-masking-1/#propdef-clip-path">
|
||||
<link rel="match" href="clip-path-circle-021-ref.html">
|
||||
<meta name="assert" content="The clip-path property takes the basic shape circle() with large reference box and percentage radius.">
|
||||
</head>
|
||||
<body>
|
||||
<p>The test passes if there is a green circle.</p>
|
||||
<div style="width: 600px; height: 600px; background-color: green; clip-path: circle(50%);"></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -38,6 +38,7 @@ default-preferences pref(layout.css.clip-path-shapes.enabled,true)
|
||||
== clip-path-circle-018.html clip-path-circle-010-ref.html
|
||||
== clip-path-circle-019.html clip-path-circle-002-ref.html
|
||||
== clip-path-circle-020.html clip-path-circle-002-ref.html
|
||||
== clip-path-circle-021.html clip-path-circle-021-ref.html
|
||||
|
||||
== clip-path-ellipse-001.html clip-path-ellipse-001-ref.html
|
||||
== clip-path-ellipse-002.html clip-path-ellipse-001-ref.html
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "mozilla/gfx/PathHelpers.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsMathUtils.h"
|
||||
#include "nsRenderingContext.h"
|
||||
#include "nsRuleNode.h"
|
||||
|
||||
@@ -135,8 +136,6 @@ nsCSSClipPathInstance::CreateClipPathCircle(DrawTarget* aDrawTarget,
|
||||
|
||||
const nsTArray<nsStyleCoord>& coords = basicShape->Coordinates();
|
||||
MOZ_ASSERT(coords.Length() == 1, "wrong number of arguments");
|
||||
float referenceLength = sqrt((aRefBox.width * aRefBox.width +
|
||||
aRefBox.height * aRefBox.height) / 2.0);
|
||||
nscoord r = 0;
|
||||
if (coords[0].GetUnit() == eStyleUnit_Enumerated) {
|
||||
nscoord horizontal, vertical;
|
||||
@@ -150,7 +149,12 @@ nsCSSClipPathInstance::CreateClipPathCircle(DrawTarget* aDrawTarget,
|
||||
r = horizontal < vertical ? horizontal : vertical;
|
||||
}
|
||||
} else {
|
||||
r = nsRuleNode::ComputeCoordPercentCalc(coords[0], referenceLength);
|
||||
// We resolve percent <shape-radius> value for circle() as defined here:
|
||||
// https://drafts.csswg.org/css-shapes/#funcdef-circle
|
||||
const double sqrt2 = std::sqrt(2.0);
|
||||
double referenceLength = NS_hypot(aRefBox.width, aRefBox.height) / sqrt2;
|
||||
r = nsRuleNode::ComputeCoordPercentCalc(coords[0],
|
||||
NSToCoordRound(referenceLength));
|
||||
}
|
||||
|
||||
nscoord appUnitsPerDevPixel =
|
||||
|
||||
Reference in New Issue
Block a user