зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1153845 - For CSS filters, make the primitive subregions big enough to contain the whole pre-filter visual overflow rect. r=roc
The BBox of the SVG element only includes its contents, not the SVG element's background color.
This commit is contained in:
Родитель
bd011ed848
Коммит
5eeefa16c7
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>There should be a 200x200 lime square on this page.</title>
|
||||
|
||||
<style>
|
||||
|
||||
svg {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background-color: lime;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<svg></svg>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>There should be a 200x200 lime square on this page.</title>
|
||||
|
||||
<style>
|
||||
|
||||
svg {
|
||||
width: 200px;
|
||||
height: 200px;
|
||||
background-color: lime;
|
||||
filter: brightness(100%);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<svg></svg>
|
|
@ -1923,4 +1923,5 @@ skip-if(!asyncPanZoom) fuzzy-if(B2G,101,887) == 1133905-6-vh-rtl.html 1133905-re
|
|||
skip-if(B2G||Mulet) == 1150021-1.xul 1150021-1-ref.xul
|
||||
== 1151145-1.html 1151145-1-ref.html
|
||||
== 1151306-1.html 1151306-1-ref.html
|
||||
== 1153845-1.html 1153845-1-ref.html
|
||||
== 1156129-1.html 1156129-1-ref.html
|
||||
|
|
|
@ -30,11 +30,11 @@ static float ClampFactor(float aFactor)
|
|||
|
||||
nsCSSFilterInstance::nsCSSFilterInstance(const nsStyleFilter& aFilter,
|
||||
nscolor aShadowFallbackColor,
|
||||
const nsIntRect& aTargetBBoxInFilterSpace,
|
||||
const nsIntRect& aTargetBoundsInFilterSpace,
|
||||
const gfxMatrix& aFrameSpaceInCSSPxToFilterSpaceTransform)
|
||||
: mFilter(aFilter)
|
||||
, mShadowFallbackColor(aShadowFallbackColor)
|
||||
, mTargetBBoxInFilterSpace(aTargetBBoxInFilterSpace)
|
||||
, mTargetBoundsInFilterSpace(aTargetBoundsInFilterSpace)
|
||||
, mFrameSpaceInCSSPxToFilterSpaceTransform(aFrameSpaceInCSSPxToFilterSpaceTransform)
|
||||
{
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ nsCSSFilterInstance::SetBounds(FilterPrimitiveDescription& aDescr,
|
|||
{
|
||||
int32_t inputIndex = GetLastResultIndex(aPrimitiveDescrs);
|
||||
nsIntRect inputBounds = (inputIndex < 0) ?
|
||||
mTargetBBoxInFilterSpace : aPrimitiveDescrs[inputIndex].PrimitiveSubregion();
|
||||
mTargetBoundsInFilterSpace : aPrimitiveDescrs[inputIndex].PrimitiveSubregion();
|
||||
|
||||
nsTArray<nsIntRegion> inputExtents;
|
||||
inputExtents.AppendElement(inputBounds);
|
||||
|
|
|
@ -36,14 +36,14 @@ public:
|
|||
* aFilter during the lifetime of nsCSSFilterInstance.
|
||||
* @param aShadowFallbackColor The color that should be used for
|
||||
* drop-shadow() filters that don't specify a shadow color.
|
||||
* @param aTargetBBoxInFilterSpace The frame of element being filtered, in
|
||||
* filter space.
|
||||
* @param aTargetBoundsInFilterSpace The pre-filter visual overflow rect of
|
||||
* the frame being filtered, in filter space.
|
||||
* @param aFrameSpaceInCSSPxToFilterSpaceTransform The transformation from
|
||||
* the filtered element's frame space in CSS pixels to filter space.
|
||||
*/
|
||||
nsCSSFilterInstance(const nsStyleFilter& aFilter,
|
||||
nscolor aShadowFallbackColor,
|
||||
const nsIntRect& aTargetBBoxInFilterSpace,
|
||||
const nsIntRect& aTargetBoundsInFilterSpace,
|
||||
const gfxMatrix& aFrameSpaceInCSSPxToFilterSpaceTransform);
|
||||
|
||||
/**
|
||||
|
@ -119,10 +119,10 @@ private:
|
|||
nscolor mShadowFallbackColor;
|
||||
|
||||
/**
|
||||
* The bounding box of the element being filtered, in filter space. Used for
|
||||
* input bounds if this CSS filter is the first in the filter chain.
|
||||
* The pre-filter overflow rect of the frame being filtered, in filter space.
|
||||
* Used for input bounds if this CSS filter is the first in the filter chain.
|
||||
*/
|
||||
nsIntRect mTargetBBoxInFilterSpace;
|
||||
nsIntRect mTargetBoundsInFilterSpace;
|
||||
|
||||
/**
|
||||
* The transformation from the filtered element's frame space in CSS pixels to
|
||||
|
|
|
@ -202,6 +202,16 @@ nsFilterInstance::nsFilterInstance(nsIFrame *aTargetFrame,
|
|||
mFilterSpaceToFrameSpaceInCSSPxTransform;
|
||||
mFrameSpaceInCSSPxToFilterSpaceTransform.Invert();
|
||||
|
||||
nsIntRect targetBounds;
|
||||
if (aPreFilterVisualOverflowRectOverride) {
|
||||
targetBounds =
|
||||
FrameSpaceToFilterSpace(aPreFilterVisualOverflowRectOverride);
|
||||
} else if (mTargetFrame) {
|
||||
nsRect preFilterVOR = mTargetFrame->GetPreEffectsVisualOverflowRect();
|
||||
targetBounds = FrameSpaceToFilterSpace(&preFilterVOR);
|
||||
}
|
||||
mTargetBounds.UnionRect(mTargetBBoxInFilterSpace, targetBounds);
|
||||
|
||||
// Build the filter graph.
|
||||
rv = BuildPrimitives(aFilterChain);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -217,16 +227,6 @@ nsFilterInstance::nsFilterInstance(nsIFrame *aTargetFrame,
|
|||
mPostFilterDirtyRegion = FrameSpaceToFilterSpace(aPostFilterDirtyRegion);
|
||||
mPreFilterDirtyRegion = FrameSpaceToFilterSpace(aPreFilterDirtyRegion);
|
||||
|
||||
nsIntRect targetBounds;
|
||||
if (aPreFilterVisualOverflowRectOverride) {
|
||||
targetBounds =
|
||||
FrameSpaceToFilterSpace(aPreFilterVisualOverflowRectOverride);
|
||||
} else if (mTargetFrame) {
|
||||
nsRect preFilterVOR = mTargetFrame->GetPreEffectsVisualOverflowRect();
|
||||
targetBounds = FrameSpaceToFilterSpace(&preFilterVOR);
|
||||
}
|
||||
mTargetBounds.UnionRect(mTargetBBoxInFilterSpace, targetBounds);
|
||||
|
||||
mInitialized = true;
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ nsFilterInstance::BuildPrimitivesForFilter(const nsStyleFilter& aFilter)
|
|||
mTargetFrame ? mTargetFrame->StyleColor()->mColor : NS_RGB(0,0,0);
|
||||
|
||||
nsCSSFilterInstance cssFilterInstance(aFilter, shadowFallbackColor,
|
||||
mTargetBBoxInFilterSpace,
|
||||
mTargetBounds,
|
||||
mFrameSpaceInCSSPxToFilterSpaceTransform);
|
||||
return cssFilterInstance.BuildPrimitives(mPrimitiveDescriptions);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче