зеркало из https://github.com/mozilla/gecko-dev.git
Bug 939942 - Reflow when bounds changes due to stroke creation/removal. r=jwatt
This commit is contained in:
Родитель
aed29b9919
Коммит
af8bb7fb29
|
@ -0,0 +1,21 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="reftest-wait">
|
||||
|
||||
<title>Test for changing stroke from none to a solid color value</title>
|
||||
|
||||
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=939942 -->
|
||||
|
||||
<rect width="100%" height="100%" fill="red"/>
|
||||
|
||||
<rect id="r" width="100%" height="50%" y="25%" stroke="none" stroke-width="75%" fill="lime"/>
|
||||
|
||||
<script>
|
||||
window.addEventListener("MozReftestInvalidate", function() {
|
||||
document.getElementById("r").style.stroke = "lime";
|
||||
document.documentElement.removeAttribute("class");
|
||||
}, false);
|
||||
</script>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 695 B |
|
@ -0,0 +1,21 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="reftest-wait">
|
||||
|
||||
<title>Test for changing stroke-opacity from 0 to non-zero</title>
|
||||
|
||||
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=939942 -->
|
||||
|
||||
<rect width="100%" height="100%" fill="red"/>
|
||||
|
||||
<rect id="r" width="100%" height="50%" y="25%" stroke-opacity="0" stroke="lime" stroke-width="75%" fill="lime"/>
|
||||
|
||||
<script>
|
||||
window.addEventListener("MozReftestInvalidate", function() {
|
||||
document.getElementById("r").style.strokeOpacity = "1";
|
||||
document.documentElement.removeAttribute("class");
|
||||
}, false);
|
||||
</script>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 712 B |
|
@ -0,0 +1,21 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="reftest-wait">
|
||||
|
||||
<title>Test for changing stroke-width from zero to non-zero</title>
|
||||
|
||||
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=939942 -->
|
||||
|
||||
<rect width="100%" height="100%" fill="red"/>
|
||||
|
||||
<rect id="r" width="100%" height="50%" y="25%" stroke="lime" stroke-width="0" fill="lime"/>
|
||||
|
||||
<script>
|
||||
window.addEventListener("MozReftestInvalidate", function() {
|
||||
document.getElementById("r").style.strokeWidth = "75%";
|
||||
document.documentElement.removeAttribute("class");
|
||||
}, false);
|
||||
</script>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 692 B |
|
@ -102,6 +102,9 @@ skip-if(B2G) == dynamic-pattern-contents-02.svg pass.svg
|
|||
== dynamic-reflow-01.svg dynamic-reflow-01-ref.svg
|
||||
== dynamic-small-object-scaled-up-01.svg pass.svg
|
||||
== dynamic-small-object-scaled-up-02.svg pass.svg
|
||||
== dynamic-stroke-01.svg pass.svg
|
||||
== dynamic-stroke-opacity-01.svg pass.svg
|
||||
== dynamic-stroke-width-01.svg pass.svg
|
||||
== dynamic-switch-01.svg pass.svg
|
||||
== dynamic-text-01.svg dynamic-text-01-ref.svg
|
||||
fuzzy-if(d2d&&layersGPUAccelerated,2,12739) == dynamic-text-02.svg dynamic-text-02-ref.svg # bug 776038 for Win7
|
||||
|
|
|
@ -944,8 +944,21 @@ nsChangeHint nsStyleSVG::CalcDifference(const nsStyleSVG& aOther) const
|
|||
}
|
||||
|
||||
if (mFill != aOther.mFill ||
|
||||
mStroke != aOther.mStroke) {
|
||||
mStroke != aOther.mStroke ||
|
||||
mFillOpacity != aOther.mFillOpacity ||
|
||||
mStrokeOpacity != aOther.mStrokeOpacity) {
|
||||
NS_UpdateHint(hint, nsChangeHint_RepaintFrame);
|
||||
if (HasStroke() != aOther.HasStroke() ||
|
||||
(!HasStroke() && HasFill() != aOther.HasFill())) {
|
||||
// Frame bounds and overflow rects depend on whether we "have" fill or
|
||||
// stroke. Whether we have stroke or not just changed, or else we have no
|
||||
// stroke (in which case whether we have fill or not is significant to frame
|
||||
// bounds) and whether we have fill or not just changed. In either case we
|
||||
// need to reflow so the frame rect is updated.
|
||||
// XXXperf this is a waste on non nsSVGPathGeometryFrames.
|
||||
NS_UpdateHint(hint, nsChangeHint_NeedReflow);
|
||||
NS_UpdateHint(hint, nsChangeHint_NeedDirtyReflow); // XXX remove me: bug 876085
|
||||
}
|
||||
if (PaintURIChanged(mFill, aOther.mFill) ||
|
||||
PaintURIChanged(mStroke, aOther.mStroke)) {
|
||||
NS_UpdateHint(hint, nsChangeHint_UpdateEffects);
|
||||
|
@ -975,8 +988,6 @@ nsChangeHint nsStyleSVG::CalcDifference(const nsStyleSVG& aOther) const
|
|||
}
|
||||
|
||||
if ( mStrokeDashoffset != aOther.mStrokeDashoffset ||
|
||||
mFillOpacity != aOther.mFillOpacity ||
|
||||
mStrokeOpacity != aOther.mStrokeOpacity ||
|
||||
mClipRule != aOther.mClipRule ||
|
||||
mColorInterpolation != aOther.mColorInterpolation ||
|
||||
mColorInterpolationFilters != aOther.mColorInterpolationFilters ||
|
||||
|
|
|
@ -2387,6 +2387,22 @@ struct nsStyleSVG {
|
|||
bool HasMarker() const {
|
||||
return mMarkerStart || mMarkerMid || mMarkerEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the stroke is not "none" and the stroke-opacity is greater
|
||||
* than zero. This ignores stroke-widths as that depends on the context.
|
||||
*/
|
||||
bool HasStroke() const {
|
||||
return mStroke.mType != eStyleSVGPaintType_None && mStrokeOpacity > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the fill is not "none" and the fill-opacity is greater
|
||||
* than zero.
|
||||
*/
|
||||
bool HasFill() const {
|
||||
return mFill.mType != eStyleSVGPaintType_None && mFillOpacity > 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct nsStyleFilter {
|
||||
|
|
|
@ -5052,11 +5052,10 @@ nsSVGTextFrame2::ShouldRenderAsPath(nsRenderingContext* aContext,
|
|||
}
|
||||
|
||||
// Text has a stroke.
|
||||
if (!(style->mStroke.mType == eStyleSVGPaintType_None ||
|
||||
style->mStrokeOpacity == 0 ||
|
||||
SVGContentUtils::CoordToFloat(PresContext(),
|
||||
static_cast<nsSVGElement*>(mContent),
|
||||
style->mStrokeWidth) == 0)) {
|
||||
if (style->HasStroke() &&
|
||||
SVGContentUtils::CoordToFloat(PresContext(),
|
||||
static_cast<nsSVGElement*>(mContent),
|
||||
style->mStrokeWidth) > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1245,9 +1245,7 @@ nsSVGUtils::CanOptimizeOpacity(nsIFrame *aFrame)
|
|||
if (style->HasMarker()) {
|
||||
return false;
|
||||
}
|
||||
if (style->mFill.mType == eStyleSVGPaintType_None ||
|
||||
style->mFillOpacity <= 0 ||
|
||||
!HasStroke(aFrame)) {
|
||||
if (!style->HasFill() || !HasStroke(aFrame)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1559,9 +1557,7 @@ bool
|
|||
nsSVGUtils::HasStroke(nsIFrame* aFrame, gfxTextContextPaint *aContextPaint)
|
||||
{
|
||||
const nsStyleSVG *style = aFrame->StyleSVG();
|
||||
return style->mStroke.mType != eStyleSVGPaintType_None &&
|
||||
style->mStrokeOpacity > 0 &&
|
||||
GetStrokeWidth(aFrame, aContextPaint) > 0;
|
||||
return style->HasStroke() && GetStrokeWidth(aFrame, aContextPaint) > 0;
|
||||
}
|
||||
|
||||
float
|
||||
|
|
Загрузка…
Ссылка в новой задаче