diff options
| author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-17 16:21:14 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-17 16:21:14 +0200 |
| commit | 8995b83bcbfbb68245f779b64e5517627c6cc6ea (patch) | |
| tree | 17985605dab9263cc2444bd4d45f189e142cca7c /Source/WebCore/rendering/svg | |
| parent | b9c9652036d5e9f1e29c574f40bc73a35c81ace6 (diff) | |
| download | qtwebkit-8995b83bcbfbb68245f779b64e5517627c6cc6ea.tar.gz | |
Imported WebKit commit cf4f8fc6f19b0629f51860cb2d4b25e139d07e00 (http://svn.webkit.org/repository/webkit/trunk@131592)
New snapshot that includes the build fixes for Mac OS X 10.6 and earlier as well
as the previously cherry-picked changes
Diffstat (limited to 'Source/WebCore/rendering/svg')
33 files changed, 197 insertions, 180 deletions
diff --git a/Source/WebCore/rendering/svg/RenderSVGBlock.cpp b/Source/WebCore/rendering/svg/RenderSVGBlock.cpp index 361279415..9f39357c1 100644 --- a/Source/WebCore/rendering/svg/RenderSVGBlock.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGBlock.cpp @@ -61,9 +61,9 @@ void RenderSVGBlock::setStyle(PassRefPtr<RenderStyle> style) RenderBlock::setStyle(useStyle.release()); } -void RenderSVGBlock::updateBoxModelInfoFromStyle() +void RenderSVGBlock::updateFromStyle() { - RenderBlock::updateBoxModelInfoFromStyle(); + RenderBlock::updateFromStyle(); // RenderSVGlock, used by Render(SVGText|ForeignObject), is not allowed to call setHasOverflowClip(true). // RenderBlock assumes a layer to be present when the overflow clip functionality is requested. Both diff --git a/Source/WebCore/rendering/svg/RenderSVGBlock.h b/Source/WebCore/rendering/svg/RenderSVGBlock.h index 7f5b78532..222d5ee20 100644 --- a/Source/WebCore/rendering/svg/RenderSVGBlock.h +++ b/Source/WebCore/rendering/svg/RenderSVGBlock.h @@ -39,7 +39,7 @@ protected: private: virtual void setStyle(PassRefPtr<RenderStyle>); - virtual void updateBoxModelInfoFromStyle(); + virtual void updateFromStyle() OVERRIDE; virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const; diff --git a/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp b/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp index fe0d9a12b..3b39a8335 100644 --- a/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp @@ -88,12 +88,12 @@ void RenderSVGForeignObject::paint(PaintInfo& paintInfo, const LayoutPoint&) } } -LayoutRect RenderSVGForeignObject::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const +LayoutRect RenderSVGForeignObject::clippedOverflowRectForRepaint(RenderLayerModelObject* repaintContainer) const { return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer); } -void RenderSVGForeignObject::computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const +void RenderSVGForeignObject::computeFloatRectForRepaint(RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const { SVGRenderSupport::computeFloatRectForRepaint(this, repaintContainer, repaintRect, fixed); } @@ -112,11 +112,13 @@ void RenderSVGForeignObject::updateLogicalWidth() setWidth(static_cast<int>(roundf(m_viewport.width()))); } -void RenderSVGForeignObject::updateLogicalHeight() +void RenderSVGForeignObject::computeLogicalHeight(LayoutUnit, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const { // FIXME: Investigate in size rounding issues // FIXME: Remove unnecessary rounding when layout is off ints: webkit.org/b/63656 - setHeight(static_cast<int>(roundf(m_viewport.height()))); + // FIXME: Is this correct for vertical writing mode? + computedValues.m_extent = static_cast<int>(roundf(m_viewport.height())); + computedValues.m_position = logicalTop; } void RenderSVGForeignObject::layout() @@ -190,12 +192,12 @@ bool RenderSVGForeignObject::nodeAtPoint(const HitTestRequest&, HitTestResult&, return false; } -void RenderSVGForeignObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, TransformState& transformState, MapLocalToContainerFlags mode, bool* wasFixed) const +void RenderSVGForeignObject::mapLocalToContainer(RenderLayerModelObject* repaintContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) const { SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, mode & SnapOffsetForTransforms, wasFixed); } -const RenderObject* RenderSVGForeignObject::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const +const RenderObject* RenderSVGForeignObject::pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const { return SVGRenderSupport::pushMappingToContainer(this, ancestorToStopAt, geometryMap); } diff --git a/Source/WebCore/rendering/svg/RenderSVGForeignObject.h b/Source/WebCore/rendering/svg/RenderSVGForeignObject.h index 1f37a3fcf..e20ab47c5 100644 --- a/Source/WebCore/rendering/svg/RenderSVGForeignObject.h +++ b/Source/WebCore/rendering/svg/RenderSVGForeignObject.h @@ -40,8 +40,8 @@ public: virtual void paint(PaintInfo&, const LayoutPoint&); - virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const; - virtual void computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect&, bool fixed = false) const; + virtual LayoutRect clippedOverflowRectForRepaint(RenderLayerModelObject* repaintContainer) const OVERRIDE; + virtual void computeFloatRectForRepaint(RenderLayerModelObject* repaintContainer, FloatRect&, bool fixed = false) const OVERRIDE; virtual bool requiresLayer() const { return false; } virtual void layout(); @@ -54,13 +54,13 @@ public: virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE; virtual bool isSVGForeignObject() const { return true; } - virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, TransformState&, MapLocalToContainerFlags mode = ApplyContainerFlip | SnapOffsetForTransforms, bool* wasFixed = 0) const OVERRIDE; - virtual const RenderObject* pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&) const; + virtual void mapLocalToContainer(RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip | SnapOffsetForTransforms, bool* wasFixed = 0) const OVERRIDE; + virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE; virtual void setNeedsTransformUpdate() { m_needsTransformUpdate = true; } private: virtual void updateLogicalWidth() OVERRIDE; - virtual void updateLogicalHeight() OVERRIDE; + virtual void computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues&) const OVERRIDE; virtual const AffineTransform& localToParentTransform() const; virtual AffineTransform localTransform() const { return m_localTransform; } diff --git a/Source/WebCore/rendering/svg/RenderSVGGradientStop.h b/Source/WebCore/rendering/svg/RenderSVGGradientStop.h index b90ab5081..af8b89891 100644 --- a/Source/WebCore/rendering/svg/RenderSVGGradientStop.h +++ b/Source/WebCore/rendering/svg/RenderSVGGradientStop.h @@ -43,7 +43,7 @@ public: // This overrides are needed to prevent ASSERTs on <svg><stop /></svg> // RenderObject's default implementations ASSERT_NOT_REACHED() // https://bugs.webkit.org/show_bug.cgi?id=20400 - virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject*) const { return LayoutRect(); } + virtual LayoutRect clippedOverflowRectForRepaint(RenderLayerModelObject*) const OVERRIDE { return LayoutRect(); } virtual FloatRect objectBoundingBox() const { return FloatRect(); } virtual FloatRect strokeBoundingBox() const { return FloatRect(); } virtual FloatRect repaintRectInLocalCoordinates() const { return FloatRect(); } diff --git a/Source/WebCore/rendering/svg/RenderSVGHiddenContainer.h b/Source/WebCore/rendering/svg/RenderSVGHiddenContainer.h index f26c5fc61..b301ea23e 100644 --- a/Source/WebCore/rendering/svg/RenderSVGHiddenContainer.h +++ b/Source/WebCore/rendering/svg/RenderSVGHiddenContainer.h @@ -43,7 +43,7 @@ private: virtual void paint(PaintInfo&, const LayoutPoint&); - virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject*) const { return LayoutRect(); } + virtual LayoutRect clippedOverflowRectForRepaint(RenderLayerModelObject*) const OVERRIDE { return LayoutRect(); } virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const; virtual bool nodeAtFloatPoint(const HitTestRequest&, HitTestResult&, const FloatPoint& pointInParent, HitTestAction); diff --git a/Source/WebCore/rendering/svg/RenderSVGInline.cpp b/Source/WebCore/rendering/svg/RenderSVGInline.cpp index 21bed4a15..df0b2dce5 100644 --- a/Source/WebCore/rendering/svg/RenderSVGInline.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGInline.cpp @@ -69,22 +69,22 @@ FloatRect RenderSVGInline::repaintRectInLocalCoordinates() const return FloatRect(); } -LayoutRect RenderSVGInline::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const +LayoutRect RenderSVGInline::clippedOverflowRectForRepaint(RenderLayerModelObject* repaintContainer) const { return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer); } -void RenderSVGInline::computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const +void RenderSVGInline::computeFloatRectForRepaint(RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const { SVGRenderSupport::computeFloatRectForRepaint(this, repaintContainer, repaintRect, fixed); } -void RenderSVGInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, TransformState& transformState, MapLocalToContainerFlags mode, bool* wasFixed) const +void RenderSVGInline::mapLocalToContainer(RenderLayerModelObject* repaintContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) const { SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, mode & SnapOffsetForTransforms, wasFixed); } -const RenderObject* RenderSVGInline::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const +const RenderObject* RenderSVGInline::pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const { return SVGRenderSupport::pushMappingToContainer(this, ancestorToStopAt, geometryMap); } diff --git a/Source/WebCore/rendering/svg/RenderSVGInline.h b/Source/WebCore/rendering/svg/RenderSVGInline.h index 8ef9ced7a..ea47a3652 100644 --- a/Source/WebCore/rendering/svg/RenderSVGInline.h +++ b/Source/WebCore/rendering/svg/RenderSVGInline.h @@ -45,10 +45,10 @@ public: virtual FloatRect strokeBoundingBox() const; virtual FloatRect repaintRectInLocalCoordinates() const; - virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const; - virtual void computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect&, bool fixed = false) const; - virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, TransformState&, MapLocalToContainerFlags mode = ApplyContainerFlip | SnapOffsetForTransforms, bool* wasFixed = 0) const OVERRIDE; - virtual const RenderObject* pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&) const; + virtual LayoutRect clippedOverflowRectForRepaint(RenderLayerModelObject* repaintContainer) const OVERRIDE; + virtual void computeFloatRectForRepaint(RenderLayerModelObject* repaintContainer, FloatRect&, bool fixed = false) const OVERRIDE; + virtual void mapLocalToContainer(RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip | SnapOffsetForTransforms, bool* wasFixed = 0) const OVERRIDE; + virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE; virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const; private: diff --git a/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp b/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp index 454f7aa6d..2371d1abf 100644 --- a/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp @@ -158,7 +158,7 @@ bool RenderSVGInlineText::characterStartsNewTextChunk(int position) const if (it == m_layoutAttributes.characterDataMap().end()) return false; - return it->second.x != SVGTextLayoutAttributes::emptyValue() || it->second.y != SVGTextLayoutAttributes::emptyValue(); + return it->value.x != SVGTextLayoutAttributes::emptyValue() || it->value.y != SVGTextLayoutAttributes::emptyValue(); } VisiblePosition RenderSVGInlineText::positionForPoint(const LayoutPoint& point) diff --git a/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp b/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp index 56372b49f..7bdcd7466 100644 --- a/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp @@ -33,6 +33,7 @@ #if ENABLE(SVG) #include "RenderSVGModelObject.h" +#include "RenderLayerModelObject.h" #include "RenderSVGResource.h" #include "SVGNames.h" #include "SVGResourcesCache.h" @@ -45,22 +46,22 @@ RenderSVGModelObject::RenderSVGModelObject(SVGStyledElement* node) { } -LayoutRect RenderSVGModelObject::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const +LayoutRect RenderSVGModelObject::clippedOverflowRectForRepaint(RenderLayerModelObject* repaintContainer) const { return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer); } -void RenderSVGModelObject::computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const +void RenderSVGModelObject::computeFloatRectForRepaint(RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const { SVGRenderSupport::computeFloatRectForRepaint(this, repaintContainer, repaintRect, fixed); } -void RenderSVGModelObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, TransformState& transformState, MapLocalToContainerFlags mode, bool* wasFixed) const +void RenderSVGModelObject::mapLocalToContainer(RenderLayerModelObject* repaintContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) const { SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, mode & SnapOffsetForTransforms, wasFixed); } -const RenderObject* RenderSVGModelObject::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const +const RenderObject* RenderSVGModelObject::pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const { return SVGRenderSupport::pushMappingToContainer(this, ancestorToStopAt, geometryMap); } @@ -68,7 +69,7 @@ const RenderObject* RenderSVGModelObject::pushMappingToContainer(const RenderBox // Copied from RenderBox, this method likely requires further refactoring to work easily for both SVG and CSS Box Model content. // FIXME: This may also need to move into SVGRenderSupport as the RenderBox version depends // on borderBoundingBox() which SVG RenderBox subclases (like SVGRenderBlock) do not implement. -LayoutRect RenderSVGModelObject::outlineBoundsForRepaint(RenderBoxModelObject* repaintContainer, LayoutPoint*) const +LayoutRect RenderSVGModelObject::outlineBoundsForRepaint(RenderLayerModelObject* repaintContainer, LayoutPoint*) const { LayoutRect box = enclosingLayoutRect(repaintRectInLocalCoordinates()); adjustRectForOutlineAndShadow(box); @@ -86,7 +87,7 @@ void RenderSVGModelObject::absoluteRects(Vector<IntRect>& rects, const LayoutPoi void RenderSVGModelObject::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const { - quads.append(localToAbsoluteQuad(strokeBoundingBox(), false, wasFixed)); + quads.append(localToAbsoluteQuad(strokeBoundingBox(), 0 /* mode */, wasFixed)); } void RenderSVGModelObject::willBeDestroyed() diff --git a/Source/WebCore/rendering/svg/RenderSVGModelObject.h b/Source/WebCore/rendering/svg/RenderSVGModelObject.h index b83ca0fcb..0c4ec5b90 100644 --- a/Source/WebCore/rendering/svg/RenderSVGModelObject.h +++ b/Source/WebCore/rendering/svg/RenderSVGModelObject.h @@ -51,15 +51,15 @@ public: virtual bool requiresLayer() const { return false; } - virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const; - virtual void computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect&, bool fixed = false) const; - virtual LayoutRect outlineBoundsForRepaint(RenderBoxModelObject* repaintContainer, LayoutPoint*) const; + virtual LayoutRect clippedOverflowRectForRepaint(RenderLayerModelObject* repaintContainer) const OVERRIDE; + virtual void computeFloatRectForRepaint(RenderLayerModelObject* repaintContainer, FloatRect&, bool fixed = false) const OVERRIDE; + virtual LayoutRect outlineBoundsForRepaint(RenderLayerModelObject* repaintContainer, LayoutPoint*) const OVERRIDE; virtual void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const; virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const; - virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, TransformState&, MapLocalToContainerFlags mode = ApplyContainerFlip | SnapOffsetForTransforms, bool* wasFixed = 0) const OVERRIDE; - virtual const RenderObject* pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&) const; + virtual void mapLocalToContainer(RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip | SnapOffsetForTransforms, bool* wasFixed = 0) const OVERRIDE; + virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE; virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h b/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h index f2f4b0543..59157fa46 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h +++ b/Source/WebCore/rendering/svg/RenderSVGResourceClipper.h @@ -52,6 +52,10 @@ public: virtual void removeClientFromCache(RenderObject*, bool markForInvalidation = true); virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode); + // clipPath can be clipped too, but don't have a boundingBox or repaintRect. So we can't call + // applyResource directly and use the rects from the object, since they are empty for RenderSVGResources + // FIXME: We made applyClippingToContext public because we cannot call applyResource on HTML elements (it asserts on RenderObject::objectBoundingBox) + bool applyClippingToContext(RenderObject*, const FloatRect&, const FloatRect&, GraphicsContext*); virtual FloatRect resourceBoundingBox(RenderObject*); virtual RenderSVGResourceType resourceType() const { return ClipperResourceType; } @@ -62,9 +66,6 @@ public: static RenderSVGResourceType s_resourceType; private: - // clipPath can be clipped too, but don't have a boundingBox or repaintRect. So we can't call - // applyResource directly and use the rects from the object, since they are empty for RenderSVGResources - bool applyClippingToContext(RenderObject*, const FloatRect&, const FloatRect&, GraphicsContext*); bool pathOnlyClipping(GraphicsContext*, const AffineTransform&, const FloatRect&); bool drawContentIntoMaskImage(ClipperData*, const FloatRect& objectBoundingBox); void calculateClipContentRepaintRect(); diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp b/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp index ee6a49db8..74e5b36d3 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp @@ -57,6 +57,25 @@ using namespace std; namespace WebCore { +class ApplyingFilterEffectGuard { +public: + ApplyingFilterEffectGuard(FilterData* data) + : m_filterData(data) + { + // The guard must be constructed when the filter is not applying. + ASSERT(!m_filterData->isApplying); + m_filterData->isApplying = true; + } + + ~ApplyingFilterEffectGuard() + { + ASSERT(m_filterData->isApplying); + m_filterData->isApplying = false; + } + + FilterData* m_filterData; +}; + RenderSVGResourceType RenderSVGResourceFilter::s_resourceType = FilterResourceType; RenderSVGResourceFilter::RenderSVGResourceFilter(SVGFilterElement* node) @@ -153,7 +172,7 @@ bool RenderSVGResourceFilter::applyResource(RenderObject* object, RenderStyle*, // draw the stored filter output, not the unfiltered object as well. if (m_filter.contains(object)) { FilterData* filterData = m_filter.get(object); - if (filterData->builded) + if (filterData->isBuilt || filterData->isApplying) return false; delete m_filter.take(object); // Oops, have to rebuild, go through normal code path @@ -278,7 +297,12 @@ void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsCo return; } - if (!filterData->builded) { + // We have a cycle if we are already applying the data. + // This can occur due to FeImage referencing a source that makes use of the FEImage itself. + if (filterData->isApplying) + return; + + if (!filterData->isBuilt) { if (!filterData->savedContext) { removeClientFromCache(object); return; @@ -288,16 +312,18 @@ void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsCo filterData->savedContext = 0; } + ApplyingFilterEffectGuard isApplyingGuard(filterData); + FilterEffect* lastEffect = filterData->builder->lastEffect(); if (lastEffect && !filterData->boundaries.isEmpty() && !lastEffect->filterPrimitiveSubregion().isEmpty()) { // This is the real filtering of the object. It just needs to be called on the // initial filtering process. We just take the stored filter result on a // second drawing. - if (!filterData->builded) + if (!filterData->isBuilt) filterData->filter->setSourceImage(filterData->sourceGraphicBuffer.release()); - // Always true if filterData is just built (filterData->builded is false). + // Always true if filterData is just built (filterData->isBuilt is false). if (!lastEffect->hasResult()) { lastEffect->apply(); lastEffect->correctFilterResultIfNeeded(); @@ -307,7 +333,7 @@ void RenderSVGResourceFilter::postApplyResource(RenderObject* object, GraphicsCo resultImage->transformColorSpace(lastEffect->colorSpace(), ColorSpaceDeviceRGB); #endif } - filterData->builded = true; + filterData->isBuilt = true; ImageBuffer* resultImage = lastEffect->asImageBuffer(); if (resultImage) { @@ -338,8 +364,8 @@ void RenderSVGResourceFilter::primitiveAttributeChanged(RenderObject* object, co SVGFilterPrimitiveStandardAttributes* primitve = static_cast<SVGFilterPrimitiveStandardAttributes*>(object->node()); for (; it != end; ++it) { - FilterData* filterData = it->second; - if (!filterData->builded) + FilterData* filterData = it->value; + if (!filterData->isBuilt) continue; SVGFilterBuilder* builder = filterData->builder.get(); @@ -353,7 +379,7 @@ void RenderSVGResourceFilter::primitiveAttributeChanged(RenderObject* object, co builder->clearResultsRecursive(effect); // Repaint the image on the screen. - markClientForInvalidation(it->first, RepaintInvalidation); + markClientForInvalidation(it->key, RepaintInvalidation); } } diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h b/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h index 22537b125..0101bbc1e 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h +++ b/Source/WebCore/rendering/svg/RenderSVGResourceFilter.h @@ -44,7 +44,8 @@ struct FilterData { public: FilterData() : savedContext(0) - , builded(false) + , isBuilt(false) + , isApplying(false) , markedForRemoval(false) { } @@ -56,7 +57,8 @@ public: AffineTransform shearFreeAbsoluteTransform; FloatRect boundaries; FloatSize scale; - bool builded : 1; + bool isBuilt : 1; + bool isApplying : 1; bool markedForRemoval : 1; }; diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp b/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp index 58e0079b2..30ce1b8cb 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResourceGradient.cpp @@ -140,7 +140,7 @@ bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle* if (gradientUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX && objectBoundingBox.isEmpty()) return false; - OwnPtr<GradientData>& gradientData = m_gradientMap.add(object, nullptr).iterator->second; + OwnPtr<GradientData>& gradientData = m_gradientMap.add(object, nullptr).iterator->value; if (!gradientData) gradientData = adoptPtr(new GradientData); diff --git a/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp b/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp index b4af99918..3a1882acf 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResourcePattern.cpp @@ -84,7 +84,7 @@ bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle* if (m_attributes.patternUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX && objectBoundingBox.isEmpty()) return false; - OwnPtr<PatternData>& patternData = m_patternMap.add(object, nullptr).iterator->second; + OwnPtr<PatternData>& patternData = m_patternMap.add(object, nullptr).iterator->value; if (!patternData) patternData = adoptPtr(new PatternData); diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceRadialGradient.cpp b/Source/WebCore/rendering/svg/RenderSVGResourceRadialGradient.cpp index b4adeced4..bc216bbd8 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceRadialGradient.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGResourceRadialGradient.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> * Copyright (C) Research In Motion Limited 2010. All rights reserved. + * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -60,37 +61,17 @@ float RenderSVGResourceRadialGradient::radius(const RadialGradientAttributes& at return SVGLengthContext::resolveLength(static_cast<const SVGElement*>(node()), attributes.gradientUnits(), attributes.r()); } -void RenderSVGResourceRadialGradient::adjustFocalPointIfNeeded(float radius, const FloatPoint& centerPoint, FloatPoint& focalPoint) const +float RenderSVGResourceRadialGradient::focalRadius(const RadialGradientAttributes& attributes) const { - // Eventually adjust focal points, as described below. - float deltaX = focalPoint.x() - centerPoint.x(); - float deltaY = focalPoint.y() - centerPoint.y(); - float radiusMax = 0.99f * radius; - - // Spec: If (fx, fy) lies outside the circle defined by (cx, cy) and r, set - // (fx, fy) to the point of intersection of the line through (fx, fy) and the circle. - // We scale the radius by 0.99 to match the behavior of FireFox. - if (sqrt(deltaX * deltaX + deltaY * deltaY) <= radiusMax) - return; - - float angle = atan2f(deltaY, deltaX); - deltaX = cosf(angle) * radiusMax; - deltaY = sinf(angle) * radiusMax; - focalPoint = FloatPoint(deltaX + centerPoint.x(), deltaY + centerPoint.y()); + return SVGLengthContext::resolveLength(static_cast<const SVGElement*>(node()), attributes.gradientUnits(), attributes.fr()); } void RenderSVGResourceRadialGradient::buildGradient(GradientData* gradientData) const { - // Determine gradient focal/center points and radius - float radius = this->radius(m_attributes); - FloatPoint centerPoint = this->centerPoint(m_attributes); - FloatPoint focalPoint = this->focalPoint(m_attributes); - adjustFocalPointIfNeeded(radius, centerPoint, focalPoint); - - gradientData->gradient = Gradient::create(focalPoint, - 0, // SVG does not support a "focus radius" - centerPoint, - radius); + gradientData->gradient = Gradient::create(this->focalPoint(m_attributes), + this->focalRadius(m_attributes), + this->centerPoint(m_attributes), + this->radius(m_attributes)); gradientData->gradient->setSpreadMethod(platformSpreadMethodFromSVGType(m_attributes.spreadMethod())); diff --git a/Source/WebCore/rendering/svg/RenderSVGResourceRadialGradient.h b/Source/WebCore/rendering/svg/RenderSVGResourceRadialGradient.h index 2a5e8cbda..6a76e80aa 100644 --- a/Source/WebCore/rendering/svg/RenderSVGResourceRadialGradient.h +++ b/Source/WebCore/rendering/svg/RenderSVGResourceRadialGradient.h @@ -47,7 +47,7 @@ public: FloatPoint centerPoint(const RadialGradientAttributes&) const; FloatPoint focalPoint(const RadialGradientAttributes&) const; float radius(const RadialGradientAttributes&) const; - void adjustFocalPointIfNeeded(float radius, const FloatPoint& centerPoint, FloatPoint& focalPoint) const; + float focalRadius(const RadialGradientAttributes&) const; private: RadialGradientAttributes m_attributes; diff --git a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp index 747679266..c47a7bb4e 100644 --- a/Source/WebCore/rendering/svg/RenderSVGRoot.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGRoot.cpp @@ -369,12 +369,12 @@ const AffineTransform& RenderSVGRoot::localToParentTransform() const return m_localToParentTransform; } -LayoutRect RenderSVGRoot::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const +LayoutRect RenderSVGRoot::clippedOverflowRectForRepaint(RenderLayerModelObject* repaintContainer) const { return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer); } -void RenderSVGRoot::computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const +void RenderSVGRoot::computeFloatRectForRepaint(RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const { // Apply our local transforms (except for x/y translation), then our shadow, // and then call RenderBox's method to handle all the normal CSS Box model bits @@ -395,7 +395,7 @@ void RenderSVGRoot::computeFloatRectForRepaint(RenderBoxModelObject* repaintCont // This method expects local CSS box coordinates. // Callers with local SVG viewport coordinates should first apply the localToBorderBoxTransform // to convert from SVG viewport coordinates to local CSS box coordinates. -void RenderSVGRoot::mapLocalToContainer(RenderBoxModelObject* repaintContainer, TransformState& transformState, MapLocalToContainerFlags mode, bool* wasFixed) const +void RenderSVGRoot::mapLocalToContainer(RenderLayerModelObject* repaintContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) const { ASSERT(mode & ~IsFixed); // We should have no fixed content in the SVG rendering tree. ASSERT(mode & UseTransforms); // mapping a point through SVG w/o respecting trasnforms is useless. @@ -403,7 +403,7 @@ void RenderSVGRoot::mapLocalToContainer(RenderBoxModelObject* repaintContainer, RenderReplaced::mapLocalToContainer(repaintContainer, transformState, mode | ApplyContainerFlip, wasFixed); } -const RenderObject* RenderSVGRoot::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const +const RenderObject* RenderSVGRoot::pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const { return RenderReplaced::pushMappingToContainer(ancestorToStopAt, geometryMap); } diff --git a/Source/WebCore/rendering/svg/RenderSVGRoot.h b/Source/WebCore/rendering/svg/RenderSVGRoot.h index cddd311fd..3fadc910b 100644 --- a/Source/WebCore/rendering/svg/RenderSVGRoot.h +++ b/Source/WebCore/rendering/svg/RenderSVGRoot.h @@ -92,11 +92,11 @@ private: virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE; - virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const; - virtual void computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const; + virtual LayoutRect clippedOverflowRectForRepaint(RenderLayerModelObject* repaintContainer) const OVERRIDE; + virtual void computeFloatRectForRepaint(RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const OVERRIDE; - virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, TransformState&, MapLocalToContainerFlags mode = ApplyContainerFlip | SnapOffsetForTransforms, bool* wasFixed = 0) const OVERRIDE; - virtual const RenderObject* pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&) const; + virtual void mapLocalToContainer(RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip | SnapOffsetForTransforms, bool* wasFixed = 0) const OVERRIDE; + virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE; virtual bool canBeSelectionLeaf() const { return false; } virtual bool canHaveChildren() const { return true; } diff --git a/Source/WebCore/rendering/svg/RenderSVGText.cpp b/Source/WebCore/rendering/svg/RenderSVGText.cpp index 2945fe48b..fd8bea043 100644 --- a/Source/WebCore/rendering/svg/RenderSVGText.cpp +++ b/Source/WebCore/rendering/svg/RenderSVGText.cpp @@ -94,29 +94,29 @@ const RenderSVGText* RenderSVGText::locateRenderSVGTextAncestor(const RenderObje return toRenderSVGText(start); } -LayoutRect RenderSVGText::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const +LayoutRect RenderSVGText::clippedOverflowRectForRepaint(RenderLayerModelObject* repaintContainer) const { return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer); } -void RenderSVGText::computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect& rect, bool fixed) const +void RenderSVGText::computeRectForRepaint(RenderLayerModelObject* repaintContainer, LayoutRect& rect, bool fixed) const { FloatRect repaintRect = rect; computeFloatRectForRepaint(repaintContainer, repaintRect, fixed); rect = enclosingLayoutRect(repaintRect); } -void RenderSVGText::computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const +void RenderSVGText::computeFloatRectForRepaint(RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const { SVGRenderSupport::computeFloatRectForRepaint(this, repaintContainer, repaintRect, fixed); } -void RenderSVGText::mapLocalToContainer(RenderBoxModelObject* repaintContainer, TransformState& transformState, MapLocalToContainerFlags mode, bool* wasFixed) const +void RenderSVGText::mapLocalToContainer(RenderLayerModelObject* repaintContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed) const { SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, mode & SnapOffsetForTransforms, wasFixed); } -const RenderObject* RenderSVGText::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const +const RenderObject* RenderSVGText::pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const { return SVGRenderSupport::pushMappingToContainer(this, ancestorToStopAt, geometryMap); } @@ -484,7 +484,7 @@ VisiblePosition RenderSVGText::positionForPoint(const LayoutPoint& pointInConten void RenderSVGText::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const { - quads.append(localToAbsoluteQuad(strokeBoundingBox(), false, wasFixed)); + quads.append(localToAbsoluteQuad(strokeBoundingBox(), 0 /* mode */, wasFixed)); } void RenderSVGText::paint(PaintInfo& paintInfo, const LayoutPoint&) diff --git a/Source/WebCore/rendering/svg/RenderSVGText.h b/Source/WebCore/rendering/svg/RenderSVGText.h index cd2e38f79..976a6a186 100644 --- a/Source/WebCore/rendering/svg/RenderSVGText.h +++ b/Source/WebCore/rendering/svg/RenderSVGText.h @@ -71,12 +71,12 @@ private: virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const; - virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const; - virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect&, bool fixed = false) const; - virtual void computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect&, bool fixed = false) const; + virtual LayoutRect clippedOverflowRectForRepaint(RenderLayerModelObject* repaintContainer) const OVERRIDE; + virtual void computeRectForRepaint(RenderLayerModelObject* repaintContainer, LayoutRect&, bool fixed = false) const OVERRIDE; + virtual void computeFloatRectForRepaint(RenderLayerModelObject* repaintContainer, FloatRect&, bool fixed = false) const OVERRIDE; - virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, TransformState&, MapLocalToContainerFlags mode = ApplyContainerFlip | SnapOffsetForTransforms, bool* wasFixed = 0) const OVERRIDE; - virtual const RenderObject* pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&) const; + virtual void mapLocalToContainer(RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip | SnapOffsetForTransforms, bool* wasFixed = 0) const OVERRIDE; + virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE; virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0); virtual void removeChild(RenderObject*) OVERRIDE; virtual void willBeDestroyed() OVERRIDE; diff --git a/Source/WebCore/rendering/svg/SVGRenderSupport.cpp b/Source/WebCore/rendering/svg/SVGRenderSupport.cpp index fc572ad6f..697a4395c 100644 --- a/Source/WebCore/rendering/svg/SVGRenderSupport.cpp +++ b/Source/WebCore/rendering/svg/SVGRenderSupport.cpp @@ -46,7 +46,7 @@ namespace WebCore { -LayoutRect SVGRenderSupport::clippedOverflowRectForRepaint(const RenderObject* object, RenderBoxModelObject* repaintContainer) +LayoutRect SVGRenderSupport::clippedOverflowRectForRepaint(const RenderObject* object, RenderLayerModelObject* repaintContainer) { // Return early for any cases where we don't actually paint if (object->style()->visibility() != VISIBLE && !object->enclosingLayer()->hasVisibleContent()) @@ -59,7 +59,7 @@ LayoutRect SVGRenderSupport::clippedOverflowRectForRepaint(const RenderObject* o return enclosingLayoutRect(repaintRect); } -void SVGRenderSupport::computeFloatRectForRepaint(const RenderObject* object, RenderBoxModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) +void SVGRenderSupport::computeFloatRectForRepaint(const RenderObject* object, RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) { const SVGRenderStyle* svgStyle = object->style()->svgStyle(); if (const ShadowData* shadow = svgStyle->shadow()) @@ -71,7 +71,7 @@ void SVGRenderSupport::computeFloatRectForRepaint(const RenderObject* object, Re object->parent()->computeFloatRectForRepaint(repaintContainer, repaintRect, fixed); } -void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, RenderBoxModelObject* repaintContainer, TransformState& transformState, bool snapOffsetForTransforms, bool* wasFixed) +void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, RenderLayerModelObject* repaintContainer, TransformState& transformState, bool snapOffsetForTransforms, bool* wasFixed) { transformState.applyTransform(object->localToParentTransform()); @@ -83,13 +83,13 @@ void SVGRenderSupport::mapLocalToContainer(const RenderObject* object, RenderBox if (parent->isSVGRoot()) transformState.applyTransform(toRenderSVGRoot(parent)->localToBorderBoxTransform()); - MapLocalToContainerFlags mode = UseTransforms; + MapCoordinatesFlags mode = UseTransforms; if (snapOffsetForTransforms) mode |= SnapOffsetForTransforms; parent->mapLocalToContainer(repaintContainer, transformState, mode, wasFixed); } -const RenderObject* SVGRenderSupport::pushMappingToContainer(const RenderObject* object, const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) +const RenderObject* SVGRenderSupport::pushMappingToContainer(const RenderObject* object, const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) { ASSERT_UNUSED(ancestorToStopAt, ancestorToStopAt != object); diff --git a/Source/WebCore/rendering/svg/SVGRenderSupport.h b/Source/WebCore/rendering/svg/SVGRenderSupport.h index b62ccfb2f..3286f8fe8 100644 --- a/Source/WebCore/rendering/svg/SVGRenderSupport.h +++ b/Source/WebCore/rendering/svg/SVGRenderSupport.h @@ -35,6 +35,7 @@ class FloatRect; class ImageBuffer; class RenderBoxModelObject; class RenderGeometryMap; +class RenderLayerModelObject; class RenderObject; class RenderStyle; class RenderSVGRoot; @@ -62,10 +63,10 @@ public: static bool paintInfoIntersectsRepaintRect(const FloatRect& localRepaintRect, const AffineTransform& localTransform, const PaintInfo&); // Important functions used by nearly all SVG renderers centralizing coordinate transformations / repaint rect calculations - static LayoutRect clippedOverflowRectForRepaint(const RenderObject*, RenderBoxModelObject* repaintContainer); - static void computeFloatRectForRepaint(const RenderObject*, RenderBoxModelObject* repaintContainer, FloatRect&, bool fixed); - static void mapLocalToContainer(const RenderObject*, RenderBoxModelObject* repaintContainer, TransformState&, bool snapOffsetForTransforms = true, bool* wasFixed = 0); - static const RenderObject* pushMappingToContainer(const RenderObject*, const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&); + static LayoutRect clippedOverflowRectForRepaint(const RenderObject*, RenderLayerModelObject* repaintContainer); + static void computeFloatRectForRepaint(const RenderObject*, RenderLayerModelObject* repaintContainer, FloatRect&, bool fixed); + static void mapLocalToContainer(const RenderObject*, RenderLayerModelObject* repaintContainer, TransformState&, bool snapOffsetForTransforms = true, bool* wasFixed = 0); + static const RenderObject* pushMappingToContainer(const RenderObject*, const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&); // Shared between SVG renderers and resources. static void applyStrokeStyleToContext(GraphicsContext*, const RenderStyle*, const RenderObject*); diff --git a/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp b/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp index 838d8a150..12352ae72 100755 --- a/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp +++ b/Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp @@ -573,9 +573,9 @@ void writeSVGResourceContainer(TextStream& ts, const RenderObject& object, int i FloatPoint focalPoint = gradient->focalPoint(attributes); FloatPoint centerPoint = gradient->centerPoint(attributes); float radius = gradient->radius(attributes); - gradient->adjustFocalPointIfNeeded(radius, centerPoint, focalPoint); + float focalRadius = gradient->focalRadius(attributes); - ts << " [center=" << centerPoint << "] [focal=" << focalPoint << "] [radius=" << radius << "]\n"; + ts << " [center=" << centerPoint << "] [focal=" << focalPoint << "] [radius=" << radius << "] [focalRadius=" << focalRadius << "]\n"; } else ts << "\n"; writeChildren(ts, object, indent); diff --git a/Source/WebCore/rendering/svg/SVGResources.cpp b/Source/WebCore/rendering/svg/SVGResources.cpp index 27120dc88..d9097409d 100644 --- a/Source/WebCore/rendering/svg/SVGResources.cpp +++ b/Source/WebCore/rendering/svg/SVGResources.cpp @@ -44,46 +44,46 @@ SVGResources::SVGResources() { } -static HashSet<AtomicStringImpl*>& clipperFilterMaskerTags() +static HashSet<AtomicString>& clipperFilterMaskerTags() { - DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ()); + DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ()); if (s_tagList.isEmpty()) { // "container elements": http://www.w3.org/TR/SVG11/intro.html#TermContainerElement // "graphics elements" : http://www.w3.org/TR/SVG11/intro.html#TermGraphicsElement - s_tagList.add(SVGNames::aTag.localName().impl()); - s_tagList.add(SVGNames::circleTag.localName().impl()); - s_tagList.add(SVGNames::ellipseTag.localName().impl()); - s_tagList.add(SVGNames::glyphTag.localName().impl()); - s_tagList.add(SVGNames::gTag.localName().impl()); - s_tagList.add(SVGNames::imageTag.localName().impl()); - s_tagList.add(SVGNames::lineTag.localName().impl()); - s_tagList.add(SVGNames::markerTag.localName().impl()); - s_tagList.add(SVGNames::maskTag.localName().impl()); - s_tagList.add(SVGNames::missing_glyphTag.localName().impl()); - s_tagList.add(SVGNames::pathTag.localName().impl()); - s_tagList.add(SVGNames::polygonTag.localName().impl()); - s_tagList.add(SVGNames::polylineTag.localName().impl()); - s_tagList.add(SVGNames::rectTag.localName().impl()); - s_tagList.add(SVGNames::svgTag.localName().impl()); - s_tagList.add(SVGNames::textTag.localName().impl()); - s_tagList.add(SVGNames::useTag.localName().impl()); + s_tagList.add(SVGNames::aTag.localName()); + s_tagList.add(SVGNames::circleTag.localName()); + s_tagList.add(SVGNames::ellipseTag.localName()); + s_tagList.add(SVGNames::glyphTag.localName()); + s_tagList.add(SVGNames::gTag.localName()); + s_tagList.add(SVGNames::imageTag.localName()); + s_tagList.add(SVGNames::lineTag.localName()); + s_tagList.add(SVGNames::markerTag.localName()); + s_tagList.add(SVGNames::maskTag.localName()); + s_tagList.add(SVGNames::missing_glyphTag.localName()); + s_tagList.add(SVGNames::pathTag.localName()); + s_tagList.add(SVGNames::polygonTag.localName()); + s_tagList.add(SVGNames::polylineTag.localName()); + s_tagList.add(SVGNames::rectTag.localName()); + s_tagList.add(SVGNames::svgTag.localName()); + s_tagList.add(SVGNames::textTag.localName()); + s_tagList.add(SVGNames::useTag.localName()); // Not listed in the definitions is the clipPath element, the SVG spec says though: // The "clipPath" element or any of its children can specify property "clip-path". // So we have to add clipPathTag here, otherwhise clip-path on clipPath will fail. // (Already mailed SVG WG, waiting for a solution) - s_tagList.add(SVGNames::clipPathTag.localName().impl()); + s_tagList.add(SVGNames::clipPathTag.localName()); // Not listed in the definitions are the text content elements, though filter/clipper/masker on tspan/text/.. is allowed. // (Already mailed SVG WG, waiting for a solution) - s_tagList.add(SVGNames::altGlyphTag.localName().impl()); - s_tagList.add(SVGNames::textPathTag.localName().impl()); - s_tagList.add(SVGNames::trefTag.localName().impl()); - s_tagList.add(SVGNames::tspanTag.localName().impl()); + s_tagList.add(SVGNames::altGlyphTag.localName()); + s_tagList.add(SVGNames::textPathTag.localName()); + s_tagList.add(SVGNames::trefTag.localName()); + s_tagList.add(SVGNames::tspanTag.localName()); // Not listed in the definitions is the foreignObject element, but clip-path // is a supported attribute. - s_tagList.add(SVGNames::foreignObjectTag.localName().impl()); + s_tagList.add(SVGNames::foreignObjectTag.localName()); // Elements that we ignore, as it doesn't make any sense. // defs, pattern, switch (FIXME: Mail SVG WG about these) @@ -93,48 +93,48 @@ static HashSet<AtomicStringImpl*>& clipperFilterMaskerTags() return s_tagList; } -static HashSet<AtomicStringImpl*>& markerTags() +static HashSet<AtomicString>& markerTags() { - DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ()); + DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ()); if (s_tagList.isEmpty()) { - s_tagList.add(SVGNames::lineTag.localName().impl()); - s_tagList.add(SVGNames::pathTag.localName().impl()); - s_tagList.add(SVGNames::polygonTag.localName().impl()); - s_tagList.add(SVGNames::polylineTag.localName().impl()); + s_tagList.add(SVGNames::lineTag.localName()); + s_tagList.add(SVGNames::pathTag.localName()); + s_tagList.add(SVGNames::polygonTag.localName()); + s_tagList.add(SVGNames::polylineTag.localName()); } return s_tagList; } -static HashSet<AtomicStringImpl*>& fillAndStrokeTags() +static HashSet<AtomicString>& fillAndStrokeTags() { - DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ()); + DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ()); if (s_tagList.isEmpty()) { - s_tagList.add(SVGNames::altGlyphTag.localName().impl()); - s_tagList.add(SVGNames::circleTag.localName().impl()); - s_tagList.add(SVGNames::ellipseTag.localName().impl()); - s_tagList.add(SVGNames::lineTag.localName().impl()); - s_tagList.add(SVGNames::pathTag.localName().impl()); - s_tagList.add(SVGNames::polygonTag.localName().impl()); - s_tagList.add(SVGNames::polylineTag.localName().impl()); - s_tagList.add(SVGNames::rectTag.localName().impl()); - s_tagList.add(SVGNames::textTag.localName().impl()); - s_tagList.add(SVGNames::textPathTag.localName().impl()); - s_tagList.add(SVGNames::trefTag.localName().impl()); - s_tagList.add(SVGNames::tspanTag.localName().impl()); + s_tagList.add(SVGNames::altGlyphTag.localName()); + s_tagList.add(SVGNames::circleTag.localName()); + s_tagList.add(SVGNames::ellipseTag.localName()); + s_tagList.add(SVGNames::lineTag.localName()); + s_tagList.add(SVGNames::pathTag.localName()); + s_tagList.add(SVGNames::polygonTag.localName()); + s_tagList.add(SVGNames::polylineTag.localName()); + s_tagList.add(SVGNames::rectTag.localName()); + s_tagList.add(SVGNames::textTag.localName()); + s_tagList.add(SVGNames::textPathTag.localName()); + s_tagList.add(SVGNames::trefTag.localName()); + s_tagList.add(SVGNames::tspanTag.localName()); } return s_tagList; } -static HashSet<AtomicStringImpl*>& chainableResourceTags() +static HashSet<AtomicString>& chainableResourceTags() { - DEFINE_STATIC_LOCAL(HashSet<AtomicStringImpl*>, s_tagList, ()); + DEFINE_STATIC_LOCAL(HashSet<AtomicString>, s_tagList, ()); if (s_tagList.isEmpty()) { - s_tagList.add(SVGNames::linearGradientTag.localName().impl()); - s_tagList.add(SVGNames::filterTag.localName().impl()); - s_tagList.add(SVGNames::patternTag.localName().impl()); - s_tagList.add(SVGNames::radialGradientTag.localName().impl()); + s_tagList.add(SVGNames::linearGradientTag.localName()); + s_tagList.add(SVGNames::filterTag.localName()); + s_tagList.add(SVGNames::patternTag.localName()); + s_tagList.add(SVGNames::radialGradientTag.localName()); } return s_tagList; @@ -202,12 +202,12 @@ bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen SVGDocumentExtensions* extensions = document->accessSVGExtensions(); ASSERT(extensions); - AtomicStringImpl* tagNameImpl = element->tagQName().localName().impl(); - if (!tagNameImpl) + const AtomicString& tagName = element->localName(); + if (tagName.isNull()) return false; bool foundResources = false; - if (clipperFilterMaskerTags().contains(tagNameImpl)) { + if (clipperFilterMaskerTags().contains(tagName)) { if (style->hasClipper()) { AtomicString id(style->clipperResource()); if (setClipper(getRenderSVGResourceById<RenderSVGResourceClipper>(document, id))) @@ -235,7 +235,7 @@ bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen } } - if (markerTags().contains(tagNameImpl) && style->hasMarkers()) { + if (markerTags().contains(tagName) && style->hasMarkers()) { AtomicString markerStartId(style->markerStartResource()); if (setMarkerStart(getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerStartId))) foundResources = true; @@ -255,7 +255,7 @@ bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen registerPendingResource(extensions, markerEndId, element); } - if (fillAndStrokeTags().contains(tagNameImpl)) { + if (fillAndStrokeTags().contains(tagName)) { if (style->hasFill()) { bool hasPendingResource = false; AtomicString id; @@ -275,7 +275,7 @@ bool SVGResources::buildCachedResources(const RenderObject* object, const SVGRen } } - if (chainableResourceTags().contains(tagNameImpl)) { + if (chainableResourceTags().contains(tagName)) { AtomicString id(targetReferenceFromResource(element)); if (setLinkedResource(getRenderSVGResourceContainerById(document, id))) foundResources = true; diff --git a/Source/WebCore/rendering/svg/SVGResourcesCache.cpp b/Source/WebCore/rendering/svg/SVGResourcesCache.cpp index 297c07b6a..8b48cf53e 100644 --- a/Source/WebCore/rendering/svg/SVGResourcesCache.cpp +++ b/Source/WebCore/rendering/svg/SVGResourcesCache.cpp @@ -198,11 +198,11 @@ void SVGResourcesCache::resourceDestroyed(RenderSVGResourceContainer* resource) HashMap<const RenderObject*, SVGResources*>::iterator end = cache->m_cache.end(); for (HashMap<const RenderObject*, SVGResources*>::iterator it = cache->m_cache.begin(); it != end; ++it) { - it->second->resourceDestroyed(resource); + it->value->resourceDestroyed(resource); // Mark users of destroyed resources as pending resolution based on the id of the old resource. Element* resourceElement = toElement(resource->node()); - SVGStyledElement* clientElement = toSVGStyledElement(it->first->node()); + SVGStyledElement* clientElement = toSVGStyledElement(it->key->node()); SVGDocumentExtensions* extensions = clientElement->document()->accessSVGExtensions(); extensions->addPendingResource(resourceElement->fastGetAttribute(HTMLNames::idAttr), clientElement); diff --git a/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp b/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp index 34e93a02e..546fec26c 100644 --- a/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp +++ b/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp @@ -226,17 +226,17 @@ static inline void swapItemsInLayoutAttributes(SVGTextLayoutAttributes* firstAtt return; if (firstPresent && lastPresent) { - std::swap(itFirst->second, itLast->second); + std::swap(itFirst->value, itLast->value); return; } if (firstPresent && !lastPresent) { - lastAttributes->characterDataMap().set(lastPosition + 1, itFirst->second); + lastAttributes->characterDataMap().set(lastPosition + 1, itFirst->value); return; } // !firstPresent && lastPresent - firstAttributes->characterDataMap().set(firstPosition + 1, itLast->second); + firstAttributes->characterDataMap().set(firstPosition + 1, itLast->value); } static inline void findFirstAndLastAttributesInVector(Vector<SVGTextLayoutAttributes*>& attributes, RenderSVGInlineText* firstContext, RenderSVGInlineText* lastContext, diff --git a/Source/WebCore/rendering/svg/SVGTextLayoutAttributes.cpp b/Source/WebCore/rendering/svg/SVGTextLayoutAttributes.cpp index a92596cee..67fa0fa98 100644 --- a/Source/WebCore/rendering/svg/SVGTextLayoutAttributes.cpp +++ b/Source/WebCore/rendering/svg/SVGTextLayoutAttributes.cpp @@ -62,8 +62,8 @@ void SVGTextLayoutAttributes::dump() const fprintf(stderr, "context: %p\n", m_context); const SVGCharacterDataMap::const_iterator end = m_characterDataMap.end(); for (SVGCharacterDataMap::const_iterator it = m_characterDataMap.begin(); it != end; ++it) { - const SVGCharacterData& data = it->second; - fprintf(stderr, " ---> pos=%i, data={", it->first); + const SVGCharacterData& data = it->value; + fprintf(stderr, " ---> pos=%i, data={", it->key); dumpSVGCharacterDataMapValue("x", data.x); dumpSVGCharacterDataMapValue("y", data.y); dumpSVGCharacterDataMapValue("dx", data.dx); diff --git a/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp b/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp index be2a12fe9..b969a5319 100644 --- a/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp +++ b/Source/WebCore/rendering/svg/SVGTextLayoutAttributesBuilder.cpp @@ -149,7 +149,7 @@ void SVGTextLayoutAttributesBuilder::buildCharacterDataMap(RenderSVGText* textRo data.y = 0; m_characterDataMap.set(1, data); } else { - SVGCharacterData& data = it->second; + SVGCharacterData& data = it->value; if (data.x == SVGTextLayoutAttributes::emptyValue()) data.x = 0; if (data.y == SVGTextLayoutAttributes::emptyValue()) @@ -213,7 +213,7 @@ void SVGTextLayoutAttributesBuilder::fillCharacterDataMap(const TextPosition& po continue; } - updateCharacterData(i, lastRotation, it->second, lengthContext, xListPtr, yListPtr, dxListPtr, dyListPtr, rotateListPtr); + updateCharacterData(i, lastRotation, it->value, lengthContext, xListPtr, yListPtr, dxListPtr, dyListPtr, rotateListPtr); } // The last rotation value always spans the whole scope. @@ -229,7 +229,7 @@ void SVGTextLayoutAttributesBuilder::fillCharacterDataMap(const TextPosition& po continue; } - it->second.rotate = lastRotation; + it->value.rotate = lastRotation; } } diff --git a/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp b/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp index 5c549b21c..ba2b7639d 100644 --- a/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp +++ b/Source/WebCore/rendering/svg/SVGTextLayoutEngine.cpp @@ -475,7 +475,7 @@ void SVGTextLayoutEngine::layoutTextOnLineOrPath(SVGInlineTextBox* textBox, Rend SVGCharacterData data; SVGCharacterDataMap::iterator it = characterDataMap.find(m_logicalCharacterOffset + 1); if (it != characterDataMap.end()) - data = it->second; + data = it->value; float x = data.x; float y = data.y; diff --git a/Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp b/Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp index ff9ca3073..dfeebb2f8 100644 --- a/Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp +++ b/Source/WebCore/rendering/svg/SVGTextMetricsBuilder.cpp @@ -58,7 +58,8 @@ bool SVGTextMetricsBuilder::advance() void SVGTextMetricsBuilder::advanceSimpleText() { - unsigned metricsLength = m_simpleWidthIterator->advance(m_textPosition + 1); + GlyphBuffer glyphBuffer; + unsigned metricsLength = m_simpleWidthIterator->advance(m_textPosition + 1, &glyphBuffer); if (!metricsLength) { m_currentMetrics = SVGTextMetrics(); return; @@ -161,7 +162,7 @@ void SVGTextMetricsBuilder::measureTextRenderer(RenderSVGInlineText* text, Measu if (data->allCharactersMap) { const SVGCharacterDataMap::const_iterator it = data->allCharactersMap->find(data->valueListPosition + m_textPosition - data->skippedCharacters - surrogatePairCharacters + 1); if (it != data->allCharactersMap->end()) - attributes->characterDataMap().set(m_textPosition + 1, it->second); + attributes->characterDataMap().set(m_textPosition + 1, it->value); } textMetricsValues->append(m_currentMetrics); } diff --git a/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp b/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp index 0124eda32..066ba31af 100644 --- a/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp +++ b/Source/WebCore/rendering/svg/SVGTextRunRenderingContext.cpp @@ -76,7 +76,8 @@ static inline RenderSVGResource* activePaintingResourceFromRun(const TextRun& ru float SVGTextRunRenderingContext::floatWidthUsingSVGFont(const Font& font, const TextRun& run, int& charsConsumed, String& glyphName) const { WidthIterator it(&font, run); - charsConsumed += it.advance(run.length()); + GlyphBuffer glyphBuffer; + charsConsumed += it.advance(run.length(), &glyphBuffer); glyphName = it.lastGlyphName(); return it.runWidthSoFar(); } @@ -188,6 +189,7 @@ GlyphData SVGTextRunRenderingContext::glyphDataForCharacter(const Font& font, co } // Characters enclosed by an <altGlyph> element, may not be registered in the GlyphPage. + const SimpleFontData* originalFontData = glyphData.fontData; if (glyphData.fontData && !glyphData.fontData->isSVGFont()) { if (TextRun::RenderingContext* renderingContext = run.renderingContext()) { RenderObject* renderObject = static_cast<SVGTextRunRenderingContext*>(renderingContext)->renderer(); @@ -239,7 +241,7 @@ GlyphData SVGTextRunRenderingContext::glyphDataForCharacter(const Font& font, co // Restore original state of the SVG Font glyph table and the current font fallback list, // to assure the next lookup of the same glyph won't immediately return the fallback glyph. - page->setGlyphDataForCharacter(character, glyphData.glyph, fontData); + page->setGlyphDataForCharacter(character, glyphData.glyph, originalFontData); fontList->setGlyphPageZero(originalGlyphPageZero); fontList->setGlyphPages(originalGlyphPages); ASSERT(fallbackGlyphData.fontData); |
