WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
better partial fix
fraction.patch (text/plain), 9.65 KB, created by
Eric Seidel (no email)
on 2006-12-25 22:59:17 PST
(
hide
)
Description:
better partial fix
Filename:
MIME Type:
Creator:
Eric Seidel (no email)
Created:
2006-12-25 22:59:17 PST
Size:
9.65 KB
patch
obsolete
>Index: ChangeLog >=================================================================== >--- ChangeLog (revision 18418) >+++ ChangeLog (working copy) >@@ -1,3 +1,19 @@ >+2006-12-25 Eric Seidel <eric@eseidel.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Remove bogus SVGLength::isFraction() method and callsites to fix >+ http://bugs.webkit.org/show_bug.cgi?id=11973 >+ >+ * ksvg2/svg/SVGLength.cpp: remove isFraction >+ * ksvg2/svg/SVGLength.h: remove isFraction >+ * ksvg2/svg/SVGLinearGradientElement.cpp: >+ (WebCore::SVGLinearGradientElement::buildGradient): >+ * ksvg2/svg/SVGPatternElement.cpp: >+ (WebCore::SVGPatternElement::drawPatternContentIntoTile): >+ * ksvg2/svg/SVGRadialGradientElement.cpp: >+ (WebCore::SVGRadialGradientElement::buildGradient): >+ > 2006-12-26 Nikolas Zimmermann <zimmermann@kde.org> > > Reviewed by Oliver. >Index: ksvg2/svg/SVGLength.cpp >=================================================================== >--- ksvg2/svg/SVGLength.cpp (revision 18418) >+++ ksvg2/svg/SVGLength.cpp (working copy) >@@ -227,7 +227,15 @@ void SVGLength::setValueInSpecifiedUnits > float SVGLength::valueInSpecifiedUnits() const > { > return m_valueInSpecifiedUnits; >-} >+} >+ >+float SVGLength::valueAsPercentage() const >+{ >+ // 100% = 100.0 instead of 1.0 for historical reasons, this could eventually be changed >+ if (extractType(m_unit) == LengthTypePercentage) >+ return valueInSpecifiedUnits(); >+ return valueInSpecifiedUnits() * 100.f; >+} > > void SVGLength::setValueAsString(const String& s) > { >@@ -265,11 +273,6 @@ void SVGLength::convertToSpecifiedUnits( > setValue(valueInUserUnits); > } > >-bool SVGLength::isFraction(const SVGLength& length) >-{ >- return (length.unitType() == LengthTypeNumber && length.value() >= 0 && length.value() <= 1); >-} >- > double SVGLength::dpi() const > { > /* FIXME: DPI detection >Index: ksvg2/svg/SVGLength.h >=================================================================== >--- ksvg2/svg/SVGLength.h (revision 18418) >+++ ksvg2/svg/SVGLength.h (working copy) >@@ -78,6 +78,8 @@ namespace WebCore { > > float valueInSpecifiedUnits() const; > void setValueInSpecifiedUnits(float); >+ >+ float valueAsPercentage() const; > > String valueAsString() const; > void setValueAsString(const String&); >@@ -86,7 +88,6 @@ namespace WebCore { > void convertToSpecifiedUnits(unsigned short); > > // Helper functions >- static bool isFraction(const SVGLength&); > static float PercentageOfViewport(float value, const SVGStyledElement*, SVGLengthMode); > > private: >Index: ksvg2/svg/SVGLinearGradientElement.cpp >=================================================================== >--- ksvg2/svg/SVGLinearGradientElement.cpp (revision 18418) >+++ ksvg2/svg/SVGLinearGradientElement.cpp (working copy) >@@ -78,21 +78,10 @@ void SVGLinearGradientElement::buildGrad > float _x1, _y1, _x2, _y2; > > if (bbox) { >- _x1 = x1().valueInSpecifiedUnits(); >- if (SVGLength::isFraction(x1())) >- _x1 *= 100.0; >- >- _y1 = y1().valueInSpecifiedUnits(); >- if (SVGLength::isFraction(y1())) >- _y1 *= 100.0; >- >- _x2 = x2().valueInSpecifiedUnits(); >- if (SVGLength::isFraction(x2())) >- _x2 *= 100.0; >- >- _y2 = y2().valueInSpecifiedUnits(); >- if (SVGLength::isFraction(y2())) >- _y2 *= 100.0; >+ _x1 = x1().valueAsPercentage(); >+ _y1 = y1().valueAsPercentage(); >+ _x2 = x2().valueAsPercentage(); >+ _y2 = y2().valueAsPercentage(); > } else { > _x1 = x1().value(); > _y1 = y1().value(); >@@ -105,8 +94,7 @@ void SVGLinearGradientElement::buildGrad > if (gradientTransform()->numberOfItems() > 0) > mat = gradientTransform()->consolidate()->matrix(); > >- DeprecatedString ref = href().deprecatedString(); >- RefPtr<SVGPaintServer> pserver = getPaintServerById(document(), ref.mid(1)); >+ RefPtr<SVGPaintServer> pserver = getPaintServerById(document(), href().substring(1)); > > if (pserver && (pserver->type() == RadialGradientPaintServer || pserver->type() == LinearGradientPaintServer)) { > bool isLinear = pserver->type() == LinearGradientPaintServer; >Index: ksvg2/svg/SVGPatternElement.cpp >=================================================================== >--- ksvg2/svg/SVGPatternElement.cpp (revision 18418) >+++ ksvg2/svg/SVGPatternElement.cpp (working copy) >@@ -158,21 +158,10 @@ void SVGPatternElement::drawPatternConte > > float _x, _y, w, h; > if (bbox) { >- _x = x().valueInSpecifiedUnits(); >- if (SVGLength::isFraction(x())) >- _x *= 100.0; >- >- _y = y().valueInSpecifiedUnits(); >- if (SVGLength::isFraction(y())) >- _y *= 100.0; >- >- w = width().valueInSpecifiedUnits(); >- if (SVGLength::isFraction(width())) >- w *= 100.0; >- >- h = height().valueInSpecifiedUnits(); >- if (SVGLength::isFraction(height())) >- h *= 100.0; >+ _x = x().valueAsPercentage(); >+ _y = y().valueAsPercentage(); >+ w = width().valueAsPercentage(); >+ h = height().valueAsPercentage(); > } else { > _x = x().value(); > _y = y().value(); >@@ -180,7 +169,7 @@ void SVGPatternElement::drawPatternConte > h = height().value(); > } > >- ImageBuffer* patternImage(GraphicsContext::createImageBuffer(IntSize(lroundf(w), lroundf(h)), false)); >+ ImageBuffer* patternImage = GraphicsContext::createImageBuffer(IntSize(lroundf(w), lroundf(h)), false); > if (!patternImage) > return; > >Index: ksvg2/svg/SVGRadialGradientElement.cpp >=================================================================== >--- ksvg2/svg/SVGRadialGradientElement.cpp (revision 18418) >+++ ksvg2/svg/SVGRadialGradientElement.cpp (working copy) >@@ -87,31 +87,11 @@ void SVGRadialGradientElement::buildGrad > float _cx, _cy, _r, _fx, _fy; > > if (bbox) { >- _cx = cx().valueInSpecifiedUnits(); >- if (SVGLength::isFraction(cx())) >- _cx *= 100.0; >- >- _cy = cy().valueInSpecifiedUnits(); >- if (SVGLength::isFraction(cy())) >- _cy *= 100.0; >- >- _r = r().valueInSpecifiedUnits(); >- if (SVGLength::isFraction(r())) >- _r *= 100.0; >- >- if (fxSet) { >- _fx = fx().valueInSpecifiedUnits(); >- if (SVGLength::isFraction(fx())) >- _fx *= 100.0; >- } else >- _fx = _cx; >- >- if (fySet) { >- _fy = fy().valueInSpecifiedUnits(); >- if (SVGLength::isFraction(fy())) >- _fy *= 100.0; >- } else >- _fy = _cy; >+ _cx = cx().valueAsPercentage(); >+ _cy = cy().valueAsPercentage(); >+ _r = r().valueAsPercentage(); >+ _fx = fxSet ? (fx().valueAsPercentage()) : _cx; >+ _fy = fySet ? (fy().valueAsPercentage()) : _cy; > } else { > _cx = cx().value(); > _cy = cy().value(); >@@ -125,8 +105,7 @@ void SVGRadialGradientElement::buildGrad > if (gradientTransform()->numberOfItems() > 0) > mat = gradientTransform()->consolidate()->matrix(); > >- DeprecatedString ref = href().deprecatedString(); >- RefPtr<SVGPaintServer> pserver = getPaintServerById(document(), ref.mid(1)); >+ RefPtr<SVGPaintServer> pserver = getPaintServerById(document(), href().substring(1)); > > if (pserver && (pserver->type() == RadialGradientPaintServer || pserver->type() == LinearGradientPaintServer)) { > bool isRadial = pserver->type() == RadialGradientPaintServer; >Index: platform/graphics/cg/GraphicsContextCG.cpp >=================================================================== >--- platform/graphics/cg/GraphicsContextCG.cpp (revision 18418) >+++ platform/graphics/cg/GraphicsContextCG.cpp (working copy) >@@ -779,6 +779,8 @@ ImageBuffer* GraphicsContext::createImag > bytesPerRow *= 4; > > void* imageBuffer = fastMalloc(bytesPerRow * size.height()); >+ if (!imageBuffer) >+ return 0; > memset(imageBuffer, 0, bytesPerRow * size.height()); > > CGColorSpaceRef colorSpace = grayScale ? CGColorSpaceCreateDeviceGray() : CGColorSpaceCreateDeviceRGB(); >Index: platform/graphics/svg/cg/SVGPaintServerGradientCg.cpp >=================================================================== >--- platform/graphics/svg/cg/SVGPaintServerGradientCg.cpp (revision 18418) >+++ platform/graphics/svg/cg/SVGPaintServerGradientCg.cpp (working copy) >@@ -267,7 +267,8 @@ bool SVGPaintServerGradient::setup(Graph > IntRect maskRect = const_cast<RenderObject*>(object)->absoluteBoundingBoxRect(); > maskRect = object->absoluteTransform().inverse().mapRect(maskRect); > >- ImageBuffer* maskImage(GraphicsContext::createImageBuffer(IntSize(maskRect.width(), maskRect.height()), false)); >+ ImageBuffer* maskImage = GraphicsContext::createImageBuffer(IntSize(maskRect.width(), maskRect.height()), false); >+ // FIXME: maskImage could be NULL > GraphicsContext* maskImageContext = maskImage->context(); > > maskImageContext->save(); >Index: platform/graphics/svg/cg/SVGResourceMaskerCg.mm >=================================================================== >--- platform/graphics/svg/cg/SVGResourceMaskerCg.mm (revision 18418) >+++ platform/graphics/svg/cg/SVGResourceMaskerCg.mm (working copy) >@@ -101,6 +101,8 @@ void SVGResourceMasker::applyMask(Graphi > > // Create new graphics context in gray scale mode for image rendering > OwnPtr<ImageBuffer> grayScaleImage(GraphicsContext::createImageBuffer(maskSize, true)); >+ if (!grayScaleImage) >+ return; > CGContextRef grayScaleContext = grayScaleImage->context()->platformContext(); > > // Wrap CG context in CI context
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 11973
:
12023
|
12024
|
12025
|
12029