mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-27 04:05:32 +00:00
Backed out changeset a0b872e47ecf (bug 1285320)
This commit is contained in:
parent
ec408ccc8a
commit
491983e333
@ -3953,15 +3953,6 @@ DrawBorderImage(nsPresContext* aPresContext,
|
|||||||
|
|
||||||
DrawResult result = DrawResult::SUCCESS;
|
DrawResult result = DrawResult::SUCCESS;
|
||||||
|
|
||||||
// intrinsicSize.CanComputeConcreteSize() return false means we can not
|
|
||||||
// read intrinsic size from aStyleBorder.mBorderImageSource.
|
|
||||||
// In this condition, we pass imageSize(a resolved size comes from
|
|
||||||
// default sizing algorithm) to renderer as the viewport size.
|
|
||||||
Maybe<nsSize> svgViewportSize = intrinsicSize.CanComputeConcreteSize() ?
|
|
||||||
Nothing() : Some(imageSize);
|
|
||||||
bool hasIntrinsicRatio = intrinsicSize.HasRatio();
|
|
||||||
renderer.PurgeCacheForViewportChange(svgViewportSize, hasIntrinsicRatio);
|
|
||||||
|
|
||||||
for (int i = LEFT; i <= RIGHT; i++) {
|
for (int i = LEFT; i <= RIGHT; i++) {
|
||||||
for (int j = TOP; j <= BOTTOM; j++) {
|
for (int j = TOP; j <= BOTTOM; j++) {
|
||||||
uint8_t fillStyleH, fillStyleV;
|
uint8_t fillStyleH, fillStyleV;
|
||||||
@ -4048,6 +4039,12 @@ DrawBorderImage(nsPresContext* aPresContext,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
nsIntRect intSubArea = subArea.ToOutsidePixels(nsPresContext::AppUnitsPerCSSPixel());
|
nsIntRect intSubArea = subArea.ToOutsidePixels(nsPresContext::AppUnitsPerCSSPixel());
|
||||||
|
// intrinsicSize.CanComputeConcreteSize() return false means we can not
|
||||||
|
// read intrinsic size from aStyleBorder.mBorderImageSource.
|
||||||
|
// In this condition, we pass imageSize(a resolved size comes from
|
||||||
|
// default sizing algorithm) to renderer as the viewport size.
|
||||||
|
Maybe<nsSize> svgViewportSize = intrinsicSize.CanComputeConcreteSize() ?
|
||||||
|
Nothing() : Some(imageSize);
|
||||||
result &=
|
result &=
|
||||||
renderer.DrawBorderImageComponent(aPresContext,
|
renderer.DrawBorderImageComponent(aPresContext,
|
||||||
aRenderingContext, aDirtyRect,
|
aRenderingContext, aDirtyRect,
|
||||||
@ -4057,7 +4054,7 @@ DrawBorderImage(nsPresContext* aPresContext,
|
|||||||
intSubArea.height),
|
intSubArea.height),
|
||||||
fillStyleH, fillStyleV,
|
fillStyleH, fillStyleV,
|
||||||
unitSize, j * (RIGHT + 1) + i,
|
unitSize, j * (RIGHT + 1) + i,
|
||||||
svgViewportSize, hasIntrinsicRatio);
|
svgViewportSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5684,8 +5681,7 @@ nsImageRenderer::DrawBorderImageComponent(nsPresContext* aPresContext,
|
|||||||
uint8_t aVFill,
|
uint8_t aVFill,
|
||||||
const nsSize& aUnitSize,
|
const nsSize& aUnitSize,
|
||||||
uint8_t aIndex,
|
uint8_t aIndex,
|
||||||
const Maybe<nsSize>& aSVGViewportSize,
|
const Maybe<nsSize>& aSVGViewportSize)
|
||||||
const bool aHasIntrinsicRatio)
|
|
||||||
{
|
{
|
||||||
if (!IsReady()) {
|
if (!IsReady()) {
|
||||||
NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
|
NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
|
||||||
@ -5709,7 +5705,7 @@ nsImageRenderer::DrawBorderImageComponent(nsPresContext* aPresContext,
|
|||||||
// For those SVG image sources which don't have fixed aspect ratio (i.e.
|
// For those SVG image sources which don't have fixed aspect ratio (i.e.
|
||||||
// without viewport size and viewBox), we should scale the source uniformly
|
// without viewport size and viewBox), we should scale the source uniformly
|
||||||
// after the viewport size is decided by "Default Sizing Algorithm".
|
// after the viewport size is decided by "Default Sizing Algorithm".
|
||||||
if (!aHasIntrinsicRatio) {
|
if (!ComputeIntrinsicSize().HasRatio()) {
|
||||||
drawFlags = drawFlags | imgIContainer::FLAG_FORCE_UNIFORM_SCALING;
|
drawFlags = drawFlags | imgIContainer::FLAG_FORCE_UNIFORM_SCALING;
|
||||||
}
|
}
|
||||||
// Retrieve or create the subimage we'll draw.
|
// Retrieve or create the subimage we'll draw.
|
||||||
@ -5808,18 +5804,6 @@ nsImageRenderer::GetImage()
|
|||||||
return image.forget();
|
return image.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
nsImageRenderer::PurgeCacheForViewportChange(
|
|
||||||
const Maybe<nsSize>& aSVGViewportSize, const bool aHasIntrinsicRatio)
|
|
||||||
{
|
|
||||||
// Check if we should flush the cached data - only vector images need to do
|
|
||||||
// the check since they might not have fixed ratio.
|
|
||||||
if (mImageContainer &&
|
|
||||||
mImageContainer->GetType() == imgIContainer::TYPE_VECTOR) {
|
|
||||||
mImage->PurgeCacheForViewportChange(aSVGViewportSize, aHasIntrinsicRatio);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MAX_BLUR_RADIUS 300
|
#define MAX_BLUR_RADIUS 300
|
||||||
#define MAX_SPREAD_RADIUS 50
|
#define MAX_SPREAD_RADIUS 50
|
||||||
|
|
||||||
|
@ -236,8 +236,6 @@ public:
|
|||||||
* Pass Nothing() if we can read a valid viewport size or aspect-ratio from
|
* Pass Nothing() if we can read a valid viewport size or aspect-ratio from
|
||||||
* the drawing image directly, otherwise, pass Some() with viewport size
|
* the drawing image directly, otherwise, pass Some() with viewport size
|
||||||
* evaluated from default sizing algorithm.
|
* evaluated from default sizing algorithm.
|
||||||
* aHasIntrinsicRatio is used to record if the source image has fixed
|
|
||||||
* intrinsic ratio.
|
|
||||||
*/
|
*/
|
||||||
DrawResult
|
DrawResult
|
||||||
DrawBorderImageComponent(nsPresContext* aPresContext,
|
DrawBorderImageComponent(nsPresContext* aPresContext,
|
||||||
@ -249,8 +247,7 @@ public:
|
|||||||
uint8_t aVFill,
|
uint8_t aVFill,
|
||||||
const nsSize& aUnitSize,
|
const nsSize& aUnitSize,
|
||||||
uint8_t aIndex,
|
uint8_t aIndex,
|
||||||
const mozilla::Maybe<nsSize>& aSVGViewportSize,
|
const mozilla::Maybe<nsSize>& aSVGViewportSize);
|
||||||
const bool aHasIntrinsicRatio);
|
|
||||||
|
|
||||||
bool IsRasterImage();
|
bool IsRasterImage();
|
||||||
bool IsAnimatedImage();
|
bool IsAnimatedImage();
|
||||||
@ -262,8 +259,6 @@ public:
|
|||||||
DrawResult PrepareResult() const { return mPrepareResult; }
|
DrawResult PrepareResult() const { return mPrepareResult; }
|
||||||
void SetExtendMode(mozilla::gfx::ExtendMode aMode) { mExtendMode = aMode; }
|
void SetExtendMode(mozilla::gfx::ExtendMode aMode) { mExtendMode = aMode; }
|
||||||
void SetMaskOp(uint8_t aMaskOp) { mMaskOp = aMaskOp; }
|
void SetMaskOp(uint8_t aMaskOp) { mMaskOp = aMaskOp; }
|
||||||
void PurgeCacheForViewportChange(const mozilla::Maybe<nsSize>& aSVGViewportSize,
|
|
||||||
const bool aHasRatio);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
@ -89,4 +89,3 @@ fuzzy(125,5808) fuzzy-if(B2G,151,5809) == border-image-element.html border-image
|
|||||||
== svg-as-border-image-1c.html svg-as-border-image-1-ref.html
|
== svg-as-border-image-1c.html svg-as-border-image-1-ref.html
|
||||||
== svg-as-border-image-2.html svg-as-border-image-2-ref.html
|
== svg-as-border-image-2.html svg-as-border-image-2-ref.html
|
||||||
== svg-as-border-image-3.html svg-as-border-image-3-ref.html
|
== svg-as-border-image-3.html svg-as-border-image-3-ref.html
|
||||||
== svg-as-border-image-4.html svg-as-border-image-4-ref.html
|
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>reference of svg-as-border-image</title>
|
|
||||||
<style type="text/css">
|
|
||||||
div {
|
|
||||||
width: 100px;
|
|
||||||
height: 100px;
|
|
||||||
margin: 30px;
|
|
||||||
border-width: 30px;
|
|
||||||
border-style: solid;
|
|
||||||
border-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"><circle cx="50%" cy="50%" r="50%" fill="red"/></svg>') 5% stretch;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,26 +0,0 @@
|
|||||||
<html class="reftest-wait">
|
|
||||||
<head>
|
|
||||||
<title>test of svg-as-border-image</title>
|
|
||||||
<style type="text/css">
|
|
||||||
div {
|
|
||||||
width: 400px;
|
|
||||||
height: 100px;
|
|
||||||
margin: 30px;
|
|
||||||
border-width: 30px;
|
|
||||||
border-style: solid;
|
|
||||||
border-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"><circle cx="50%" cy="50%" r="50%" fill="red"/></svg>') 5% stretch;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<script>
|
|
||||||
function resizeDiv() {
|
|
||||||
document.getElementById('borderdiv').style.width = '100px';
|
|
||||||
document.documentElement.removeAttribute('class');
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener('MozReftestInvalidate', resizeDiv, false);
|
|
||||||
</script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="borderdiv"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1912,19 +1912,6 @@ nsStyleGradient::HasCalc()
|
|||||||
// --------------------
|
// --------------------
|
||||||
// CachedBorderImageData
|
// CachedBorderImageData
|
||||||
//
|
//
|
||||||
void
|
|
||||||
CachedBorderImageData::SetCachedSVGViewportSize(
|
|
||||||
const mozilla::Maybe<nsSize>& aSVGViewportSize)
|
|
||||||
{
|
|
||||||
mCachedSVGViewportSize = aSVGViewportSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
const mozilla::Maybe<nsSize>&
|
|
||||||
CachedBorderImageData::GetCachedSVGViewportSize()
|
|
||||||
{
|
|
||||||
return mCachedSVGViewportSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CachedBorderImageData::PurgeCachedImages()
|
CachedBorderImageData::PurgeCachedImages()
|
||||||
{
|
{
|
||||||
@ -2308,26 +2295,6 @@ nsStyleImage::operator==(const nsStyleImage& aOther) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
nsStyleImage::PurgeCacheForViewportChange(
|
|
||||||
const mozilla::Maybe<nsSize>& aSVGViewportSize,
|
|
||||||
const bool aHasIntrinsicRatio) const
|
|
||||||
{
|
|
||||||
EnsureCachedBIData();
|
|
||||||
|
|
||||||
// If we're redrawing with a different viewport-size than we used for our
|
|
||||||
// cached subimages, then we can't trust that our subimages are valid;
|
|
||||||
// any percent sizes/positions in our SVG doc may be different now. Purge!
|
|
||||||
// (We don't have to purge if the SVG document has an intrinsic ratio,
|
|
||||||
// though, because the actual size of elements in SVG documant's coordinate
|
|
||||||
// axis are fixed in this case.)
|
|
||||||
if (aSVGViewportSize != mCachedBIData->GetCachedSVGViewportSize() &&
|
|
||||||
!aHasIntrinsicRatio) {
|
|
||||||
mCachedBIData->PurgeCachedImages();
|
|
||||||
mCachedBIData->SetCachedSVGViewportSize(aSVGViewportSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------
|
// --------------------
|
||||||
// nsStyleImageLayers
|
// nsStyleImageLayers
|
||||||
//
|
//
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
#include "mozilla/ArenaObjectID.h"
|
#include "mozilla/ArenaObjectID.h"
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "mozilla/CSSVariableValues.h"
|
#include "mozilla/CSSVariableValues.h"
|
||||||
#include "mozilla/Maybe.h"
|
|
||||||
#include "mozilla/SheetType.h"
|
#include "mozilla/SheetType.h"
|
||||||
#include "mozilla/StaticPtr.h"
|
#include "mozilla/StaticPtr.h"
|
||||||
#include "mozilla/StyleStructContext.h"
|
#include "mozilla/StyleStructContext.h"
|
||||||
@ -250,19 +249,11 @@ enum nsStyleImageType {
|
|||||||
|
|
||||||
struct CachedBorderImageData
|
struct CachedBorderImageData
|
||||||
{
|
{
|
||||||
// Caller are expected to ensure that the value of aSVGViewportSize is
|
|
||||||
// different from the cached one since the method won't do the check.
|
|
||||||
void SetCachedSVGViewportSize(const mozilla::Maybe<nsSize>& aSVGViewportSize);
|
|
||||||
const mozilla::Maybe<nsSize>& GetCachedSVGViewportSize();
|
|
||||||
void PurgeCachedImages();
|
void PurgeCachedImages();
|
||||||
void SetSubImage(uint8_t aIndex, imgIContainer* aSubImage);
|
void SetSubImage(uint8_t aIndex, imgIContainer* aSubImage);
|
||||||
imgIContainer* GetSubImage(uint8_t aIndex);
|
imgIContainer* GetSubImage(uint8_t aIndex);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// If this is a SVG border-image, we save the size of the SVG viewport that
|
|
||||||
// we used when rasterizing any cached border-image subimages. (The viewport
|
|
||||||
// size matters for percent-valued sizes & positions in inner SVG doc).
|
|
||||||
mozilla::Maybe<nsSize> mCachedSVGViewportSize;
|
|
||||||
nsCOMArray<imgIContainer> mSubImages;
|
nsCOMArray<imgIContainer> mSubImages;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -378,9 +369,6 @@ struct nsStyleImage
|
|||||||
// during a border-image paint operation
|
// during a border-image paint operation
|
||||||
inline void SetSubImage(uint8_t aIndex, imgIContainer* aSubImage) const;
|
inline void SetSubImage(uint8_t aIndex, imgIContainer* aSubImage) const;
|
||||||
inline imgIContainer* GetSubImage(uint8_t aIndex) const;
|
inline imgIContainer* GetSubImage(uint8_t aIndex) const;
|
||||||
void PurgeCacheForViewportChange(
|
|
||||||
const mozilla::Maybe<nsSize>& aSVGViewportSize,
|
|
||||||
const bool aHasIntrinsicRatio) const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DoCopy(const nsStyleImage& aOther);
|
void DoCopy(const nsStyleImage& aOther);
|
||||||
|
Loading…
Reference in New Issue
Block a user