Backed out 9 changesets (bug 1289011) for Win8 clip-path-* reftest failures

CLOSED TREE

Backed out changeset dea9d3f8bfe0 (bug 1289011)
Backed out changeset 03572962add4 (bug 1289011)
Backed out changeset 4b8d3be7bdf8 (bug 1289011)
Backed out changeset d1b4d0b38cdb (bug 1289011)
Backed out changeset aa59aca85397 (bug 1289011)
Backed out changeset 43d1ec007a49 (bug 1289011)
Backed out changeset a623cab8e4a7 (bug 1289011)
Backed out changeset 34e7dd6acb4c (bug 1289011)
Backed out changeset 900800f54055 (bug 1289011)
This commit is contained in:
Phil Ringnalda 2016-09-02 19:46:39 -07:00
parent 5efd12c5f0
commit c3de252482
27 changed files with 6 additions and 656 deletions

View File

@ -1022,7 +1022,7 @@ SVGSVGElement::GetEnumInfo()
ArrayLength(sEnumInfo));
}
nsSVGViewBox*
nsSVGViewBox *
SVGSVGElement::GetViewBox()
{
return &mViewBox;

View File

@ -288,7 +288,6 @@ public:
already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
uint16_t ZoomAndPan();
void SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv);
virtual nsSVGViewBox* GetViewBox() override;
private:
// nsSVGElement overrides
@ -379,6 +378,7 @@ private:
static nsSVGEnumMapping sZoomAndPanMap[];
static EnumInfo sEnumInfo[1];
virtual nsSVGViewBox *GetViewBox() override;
virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio() override;
nsSVGViewBox mViewBox;

View File

@ -1,28 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path border-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-1-ref.html">
<meta name="assert" content="Test checks whether clip-path border-box works correctly or not. This test is for clip-path applied to an HTML element.">
<style type="text/css">
div {
position: absolute;
left: 50px;
top: 50px;
background-color: blue;
width: 30px;
height: 30px;
padding: 10px;
border: solid blue 25px;
clip-path: circle(farthest-side) border-box;
}
</style>
</head>
<body>
<div></div>
</body>
</html>

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path border-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-1-ref.html">
<meta name="assert" content="Test checks whether clip-path border-box works correctly or not. This test is for clip-path applied to an SVG element.">
</head>
<body>
<svg width="200" height="200" style="position: absolute; left: 15px; top: 10px;">
<rect x="35" y="40" width="100" height="100" fill="blue"
clip-path="circle(50%) border-box"/>
</svg>
</body>
</html>

View File

@ -1,30 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path border-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-1-ref.html">
<meta name="assert" content="Test checks whether clip-path border-box works correctly or not. This test is for clip-path applied to an SVG SVG element.">
<style type="text/css">
svg {
position: absolute;
left: 50px;
top: 50px;
background-color: blue;
width: 30px;
height: 30px;
padding: 10px;
border: solid blue 25px;
clip-path: circle(farthest-side) border-box;
}
</style>
</head>
<body>
<svg width="200" height="200">
<rect x="0" y="0" width="200" height="200" fill="blue">
</svg>
</body>
</html>

View File

@ -1,27 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path content-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-1-ref.html">
<meta name="assert" content="Test checks whether clip-path content-box works correctly or not. This test is for clip-path applied to an HTML element.">
<style type="text/css">
div {
background-color: blue;
position: absolute;
left: 10px;
top: 10px;
width: 100px;
height: 100px;
padding: 40px;
clip-path: circle(farthest-side) content-box;
}
</style>
</head>
<body>
<div></div>
</body>
</html>

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path content-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-1-ref.html">
<meta name="assert" content="Test checks whether clip-path content-box works correctly or not. This test is for clip-path applied to an SVG element.">
</head>
<body>
<svg width="200" height="200" style="position: absolute; left: 0px; top: 0px;">
<rect x="50" y="50" width="100" height="100" fill="blue"
clip-path="circle(50%) content-box"/>
</svg>
</body>
</html>

View File

@ -1,28 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path content-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-1-ref.html">
<meta name="assert" content="Test checks whether clip-path content-box works correctly or not.">
</head>
<style type="text/css">
svg {
position: absolute;
left: 10px;
top: 10px;
width: 100px;
height: 100px;
padding: 40px;
clip-path: circle(farthest-side) content-box;
}
</style>
<body>
<svg width="200" height="200">
<rect x="0" y="0" width="200" height="200" fill="blue">
</svg>
</body>
</html>

View File

@ -1,31 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path fill-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-1-ref.html">
<meta name="assert" content="Test checks whether clip-path fill-box works correctly or not. This test is for clip-path applied to an SVG SVG element.">
<style type="text/css">
svg {
position: absolute;
left: 40px;
top: 40px;
background-color: blue;
width: 30px;
height: 30px;
margin: 10px;
padding: 10px;
border: solid blue 25px;
clip-path: circle(farthest-side) fill-box;
}
</style>
</head>
<body>
<svg width="200" height="200">
<rect x="0" y="0" width="200" height="200" fill="blue">
</svg>
</body>
</html>

View File

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path geometry box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
</head>
<body>
<svg width="200" height="200" style="position: absolute; left: 0px; top: 0px;">
<circle cx="100" cy="100" r="50" fill="blue">
</svg>
</body>
</html>

View File

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path geometry box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
</head>
<body>
<svg width="200" height="200" style="position: absolute; left: 0px; top: 0px;">
<polygon points="100,50 150,100 150,150 50,150 50,100" fill="blue"/>
</svg>
</body>
</html>

View File

@ -1,27 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path content-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-2-ref.html">
<meta name="assert" content="Test checks whether clip-path content-box works correctly or not.">
<style type="text/css">
div {
position: absolute;
left: 0px;
top: 0px;
background-color: blue;
width: 100px;
height: 100px;
padding: 50px;
clip-path: polygon(50% 0%, 100% 50%, 100% 100%, 0% 100%, 0% 50%) content-box;
}
</style>
</head>
<body>
<div></div>
</body>
</html>

View File

@ -1,27 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path padding-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-2-ref.html">
<meta name="assert" content="Test checks whether clip-path padding-box works correctly or not.">
<style type="text/css">
div {
position: absolute;
left: 0px;
top: 0px;
background-color: blue;
width: 100px;
height: 100px;
padding: 50px;
clip-path: polygon(25% 50%, 50% 25%, 75% 50%, 75% 75%, 25% 75%) padding-box;
}
</style>
</head>
<body>
<div></div>
</body>
</html>

View File

@ -1,27 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path border-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-2-ref.html">
<meta name="assert" content="Test checks whether clip-path border-box works correctly or not.">
<style type="text/css">
div {
position: absolute;
left: 0px;
top: 0px;
background-color: blue;
width: 100px;
height: 100px;
border: solid blue 50px;
clip-path: polygon(25% 50%, 50% 25%, 75% 50%, 75% 75%, 25% 75%) border-box;
}
</style>
</head>
<body>
<div></div>
</body>
</html>

View File

@ -1,27 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path margin-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-2-ref.html">
<meta name="assert" content="Test checks whether clip-path margin-box works correctly or not.">
<style type="text/css">
div {
position: absolute;
left: 0px;
top: 0px;
background-color: blue;
width: 100px;
height: 100px;
margin: 50px;
clip-path: polygon(0% 75%, 50% 25%, 100% 75%) margin-box;
}
</style>
</head>
<body>
<div></div>
</body>
</html>

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path margin-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-1-ref.html">
<meta name="assert" content="Test checks whether clip-path margin-box works correctly or not. This test is for clip-path applied to an SVG element.">
</head>
<body>
<svg width="200" height="200" style="position: absolute; left: 10px; top: 15px;">
<rect x="40" y="35" width="100" height="100" fill="blue"
clip-path="circle(50%) margin-box"/>
</svg>
</body>
</html>

View File

@ -1,27 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path padding-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-1-ref.html">
<meta name="assert" content="Test checks whether clip-path padding-box works correctly or not. This test is for clip-path applied to an HTML element.">
<style type="text/css">
div {
position: absolute;
left: 50px;
top: 50px;
background-color: blue;
width: 50px;
height: 50px;
padding: 25px;
clip-path: circle(farthest-side) padding-box;
}
</style>
</head>
<body>
<div></div>
</body>
</html>

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path padding-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-1-ref.html">
<meta name="assert" content="Test checks whether clip-path padding-box works correctly or not. This test is for clip-path applied to an SVG element.">
</head>
<body>
<svg width="200" height="200" style="position: absolute; left: 0px; top: 0px;">
<rect x="50" y="50" width="100" height="100" fill="blue"
clip-path="circle(50%) padding-box"/>
</svg>
</body>
</html>

View File

@ -1,29 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path padding-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-1-ref.html">
<meta name="assert" content="Test checks whether clip-path padding-box works correctly or not. This test is for clip-path applied to an SVG SVG element.">
<style type="text/css">
svg {
position: absolute;
left: 50px;
top: 50px;
background-color: blue;
width: 50px;
height: 50px;
padding: 25px;
clip-path: circle(farthest-side) padding-box;
}
</style>
</head>
<body>
<svg width="200" height="200">
<rect x="0" y="0" width="200" height="200" fill="blue">
</svg>
</body>
</html>

View File

@ -1,31 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path stroke-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-1-ref.html">
<meta name="assert" content="Test checks whether clip-path stroke-box works correctly or not. This test is for clip-path applied to an SVG SVG element.">
<style type="text/css">
svg {
position: absolute;
left: 40px;
top: 40px;
background-color: blue;
width: 30px;
height: 30px;
margin: 10px;
padding: 10px;
border: solid blue 25px;
clip-path: circle(farthest-side) stroke-box;
}
</style>
</head>
<body>
<svg width="200" height="200">
<rect x="0" y="0" width="200" height="200" fill="blue">
</svg>
</body>
</html>

View File

@ -1,17 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path stroke-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-1-ref.html">
<meta name="assert" content="Test checks whether clip-path stroke-box works correctly or not.">
</head>
<body>
<svg width="200" height="200" style="position: absolute; left: 0px; top: 0px;">
<rect x="60" y="60" width="80" height="80" fill="blue" stroke="blue" stroke-width="20" clip-path="circle(50%) stroke-box"/>
</svg>
</body>
</html>

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path view-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-1-ref.html">
<meta name="assert" content="Test checks whether clip-path view-box works correctly or not.">
</head>
<body>
<svg width="200" height="200" style="position: absolute; left: 10px; top: 10px;">
<rect x="20" y="20" width="135" height="135" fill="blue"
clip-path="circle(25% at calc(50% - 10px) calc(50% - 10px)) view-box">
</svg>
</body>
</html>

View File

@ -1,18 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path view-box with viewbox</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-1-ref.html">
<meta name="assert" content="Test checks whether clip-path view-box with viewbox works correctly or not.">
</head>
<body>
<svg width="200" height="200" viewBox="50 50 100 100" preserveAspectRatio="none" style="position: absolute; left: 10px; top: 10px;">
<rect x="0" y="0" width="200" height="200" fill="blue"
clip-path="circle(25% at calc(50% - 5px) calc(50% - 5px)) view-box">
</svg>
</body>
</html>

View File

@ -1,31 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Masking: clip-path: clip path view-box</title>
<link rel="author" title="CJ Ku" href="mailto:cku@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
<link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-clip-path">
<link rel="match" href="clip-path-geometryBox-1-ref.html">
<meta name="assert" content="Test checks whether clip-path view-box works correctly or not. This test is for clip-path applied to an SVG SVG element.">
<style type="text/css">
svg {
position: absolute;
left: 40px;
top: 40px;
background-color: blue;
width: 30px;
height: 30px;
margin: 10px;
padding: 10px;
border: solid blue 25px;
clip-path: circle(farthest-side) view-box;
}
</style>
</head>
<body>
<svg width="200" height="200">
<rect x="0" y="0" width="200" height="200" fill="blue">
</svg>
</body>
</html>

View File

@ -77,27 +77,3 @@ fails == mask-origin-2.html mask-origin-2-ref.html # bug 1260094
== mask-size-percent-length.html mask-size-percent-percent-ref.html
== mask-size-percent-percent.html mask-size-percent-percent-ref.html
== mask-size-percent-percent-stretch.html mask-size-percent-percent-stretch-ref.html
default-preferences pref(layout.css.clip-path-shapes.enabled,true)
== clip-path-contentBox-1a.html clip-path-geometryBox-1-ref.html
== clip-path-contentBox-1b.html clip-path-geometryBox-1-ref.html
== clip-path-contentBox-1c.html clip-path-geometryBox-1-ref.html
== clip-path-paddingBox-1a.html clip-path-geometryBox-1-ref.html
== clip-path-paddingBox-1b.html clip-path-geometryBox-1-ref.html
== clip-path-paddingBox-1c.html clip-path-geometryBox-1-ref.html
fuzzy(64,311) == clip-path-borderBox-1a.html clip-path-geometryBox-1-ref.html
== clip-path-borderBox-1b.html clip-path-geometryBox-1-ref.html
fuzzy(64,311) == clip-path-borderBox-1c.html clip-path-geometryBox-1-ref.html
== clip-path-marginBox-1a.html clip-path-geometryBox-1-ref.html
== clip-path-viewBox-1a.html clip-path-geometryBox-1-ref.html
== clip-path-viewBox-1b.html clip-path-geometryBox-1-ref.html
fuzzy(64,311) == clip-path-viewBox-1c.html clip-path-geometryBox-1-ref.html
fuzzy(64,311) == clip-path-fillBox-1a.html clip-path-geometryBox-1-ref.html
fuzzy(64,311) == clip-path-strokeBox-1a.html clip-path-geometryBox-1-ref.html
fuzzy(64,311) == clip-path-strokeBox-1b.html clip-path-geometryBox-1-ref.html
== clip-path-geometryBox-2a.html clip-path-geometryBox-2-ref.html
== clip-path-geometryBox-2b.html clip-path-geometryBox-2-ref.html
== clip-path-geometryBox-2c.html clip-path-geometryBox-2-ref.html
== clip-path-geometryBox-2d.html clip-path-geometryBox-2-ref.html

View File

@ -62,87 +62,11 @@ nsCSSClipPathInstance::HitTestBasicShapeClip(nsIFrame* aFrame,
return path->ContainsPoint(ToPoint(aPoint) * pixelRatio, Matrix());
}
nsRect
nsCSSClipPathInstance::ComputeSVGReferenceRect()
{
MOZ_ASSERT(mTargetFrame->GetContent()->IsSVGElement());
nsRect r;
// For SVG elements without associated CSS layout box, the used value for
// content-box, padding-box, border-box and margin-box is fill-box.
switch (mClipPathStyle.GetReferenceBox()) {
case StyleClipPathGeometryBox::Stroke: {
// XXX Bug 1299876
// The size of srtoke-box is not correct if this graphic element has
// specific stroke-linejoin or stroke-linecap.
gfxRect bbox = nsSVGUtils::GetBBox(mTargetFrame,
nsSVGUtils::eBBoxIncludeFill | nsSVGUtils::eBBoxIncludeStroke);
r = nsLayoutUtils::RoundGfxRectToAppRect(bbox,
nsPresContext::AppUnitsPerCSSPixel());
break;
}
case StyleClipPathGeometryBox::View: {
nsIContent* content = mTargetFrame->GetContent();
nsSVGElement* element = static_cast<nsSVGElement*>(content);
SVGSVGElement* svgElement = element->GetCtx();
MOZ_ASSERT(svgElement);
if (svgElement && svgElement->HasViewBoxRect()) {
// If a viewBox attribute is specified for the SVG viewport creating
// element:
// 1. The reference box is positioned at the origin of the coordinate
// system established by the viewBox attribute.
// 2. The dimension of the reference box is set to the width and height
// values of the viewBox attribute.
nsSVGViewBox* viewBox = svgElement->GetViewBox();
const nsSVGViewBoxRect& value = viewBox->GetAnimValue();
r = nsRect(nsPresContext::CSSPixelsToAppUnits(value.x),
nsPresContext::CSSPixelsToAppUnits(value.y),
nsPresContext::CSSPixelsToAppUnits(value.width),
nsPresContext::CSSPixelsToAppUnits(value.height));
} else {
// No viewBox is specified, uses the nearest SVG viewport as reference
// box.
svgFloatSize viewportSize = svgElement->GetViewportSize();
r = nsRect(0, 0,
nsPresContext::CSSPixelsToAppUnits(viewportSize.width),
nsPresContext::CSSPixelsToAppUnits(viewportSize.height));
}
break;
}
case StyleClipPathGeometryBox::NoBox:
case StyleClipPathGeometryBox::Border:
case StyleClipPathGeometryBox::Content:
case StyleClipPathGeometryBox::Padding:
case StyleClipPathGeometryBox::Margin:
case StyleClipPathGeometryBox::Fill: {
gfxRect bbox = nsSVGUtils::GetBBox(mTargetFrame,
nsSVGUtils::eBBoxIncludeFill);
r = nsLayoutUtils::RoundGfxRectToAppRect(bbox,
nsPresContext::AppUnitsPerCSSPixel());
break;
}
default:{
MOZ_ASSERT_UNREACHABLE("unknown StyleClipPathGeometryBox type");
gfxRect bbox = nsSVGUtils::GetBBox(mTargetFrame,
nsSVGUtils::eBBoxIncludeFill);
r = nsLayoutUtils::RoundGfxRectToAppRect(bbox,
nsPresContext::AppUnitsPerCSSPixel());
break;
}
}
return r;
}
nsRect
nsCSSClipPathInstance::ComputeHTMLReferenceRect()
already_AddRefed<Path>
nsCSSClipPathInstance::CreateClipPath(DrawTarget* aDrawTarget)
{
nsRect r;
// For elements with associated CSS layout box, the used value for fill-box,
// stroke-box and view-box is border-box.
// XXXkrit SVG needs to use different boxes.
switch (mClipPathStyle.GetReferenceBox()) {
case StyleClipPathGeometryBox::Content:
r = mTargetFrame->GetContentRectRelativeToSelf();
@ -153,32 +77,10 @@ nsCSSClipPathInstance::ComputeHTMLReferenceRect()
case StyleClipPathGeometryBox::Margin:
r = mTargetFrame->GetMarginRectRelativeToSelf();
break;
case StyleClipPathGeometryBox::NoBox:
case StyleClipPathGeometryBox::Border:
case StyleClipPathGeometryBox::Fill:
case StyleClipPathGeometryBox::Stroke:
case StyleClipPathGeometryBox::View:
default: // Use the border box
r = mTargetFrame->GetRectRelativeToSelf();
break;
default:
MOZ_ASSERT_UNREACHABLE("unknown StyleClipPathGeometryBox type");
r = mTargetFrame->GetRectRelativeToSelf();
break;
}
return r;
}
already_AddRefed<Path>
nsCSSClipPathInstance::CreateClipPath(DrawTarget* aDrawTarget)
{
// We use ComputeSVGReferenceRect for all SVG elements, except <svg>
// element, which does have an associated CSS layout box. In this case we
// should still use ComputeHTMLReferenceRect for region computing.
nsRect r = mTargetFrame->IsFrameOfType(nsIFrame::eSVG) &&
(mTargetFrame->GetType() != nsGkAtoms::svgOuterSVGFrame)
? ComputeSVGReferenceRect() : ComputeHTMLReferenceRect();
if (mClipPathStyle.GetType() != StyleShapeSourceType::Shape) {
// TODO Clip to border-radius/reference box if no shape
// was specified.

View File

@ -47,11 +47,6 @@ private:
already_AddRefed<Path> CreateClipPathInset(DrawTarget* aDrawTarget,
const nsRect& aRefBox);
nsRect ComputeHTMLReferenceRect();
nsRect ComputeSVGReferenceRect();
/**
* The frame for the element that is currently being clipped.
*/