#include <math.h>
#include <memory>
-namespace WebCore {
+namespace blink {
/** class + iomanip to help streaming list separators, i.e. ", " in string "a, b, c, d"
* Can be used in cases where you don't know which item in the list is the first
static void writeStyle(TextStream& ts, const RenderObject& object)
{
const RenderStyle* style = object.style();
- const SVGRenderStyle* svgStyle = style->svgStyle();
+ const SVGRenderStyle& svgStyle = style->svgStyle();
if (!object.localTransform().isIdentity())
writeNameValuePair(ts, "transform", object.localTransform());
writeSVGPaintingResource(ts, strokePaintingResource);
SVGLengthContext lengthContext(shape.element());
- double dashOffset = svgStyle->strokeDashOffset()->value(lengthContext);
- double strokeWidth = svgStyle->strokeWidth()->value(lengthContext);
- RefPtr<SVGLengthList> dashes = svgStyle->strokeDashArray();
+ double dashOffset = svgStyle.strokeDashOffset()->value(lengthContext);
+ double strokeWidth = svgStyle.strokeWidth()->value(lengthContext);
+ RefPtr<SVGLengthList> dashes = svgStyle.strokeDashArray();
DashArray dashArray;
SVGLengthList::ConstIterator it = dashes->begin();
for (; it != itEnd; ++it)
dashArray.append(it->value(lengthContext));
- writeIfNotDefault(ts, "opacity", svgStyle->strokeOpacity(), 1.0f);
+ writeIfNotDefault(ts, "opacity", svgStyle.strokeOpacity(), 1.0f);
writeIfNotDefault(ts, "stroke width", strokeWidth, 1.0);
- writeIfNotDefault(ts, "miter limit", svgStyle->strokeMiterLimit(), 4.0f);
- writeIfNotDefault(ts, "line cap", svgStyle->capStyle(), ButtCap);
- writeIfNotDefault(ts, "line join", svgStyle->joinStyle(), MiterJoin);
+ writeIfNotDefault(ts, "miter limit", svgStyle.strokeMiterLimit(), 4.0f);
+ writeIfNotDefault(ts, "line cap", svgStyle.capStyle(), ButtCap);
+ writeIfNotDefault(ts, "line join", svgStyle.joinStyle(), MiterJoin);
writeIfNotDefault(ts, "dash offset", dashOffset, 0.0);
if (!dashArray.isEmpty())
writeNameValuePair(ts, "dash array", dashArray);
ts << " [fill={" << s;
writeSVGPaintingResource(ts, fillPaintingResource);
- writeIfNotDefault(ts, "opacity", svgStyle->fillOpacity(), 1.0f);
- writeIfNotDefault(ts, "fill rule", svgStyle->fillRule(), RULE_NONZERO);
+ writeIfNotDefault(ts, "opacity", svgStyle.fillOpacity(), 1.0f);
+ writeIfNotDefault(ts, "fill rule", svgStyle.fillRule(), RULE_NONZERO);
ts << "}]";
}
- writeIfNotDefault(ts, "clip rule", svgStyle->clipRule(), RULE_NONZERO);
+ writeIfNotDefault(ts, "clip rule", svgStyle.clipRule(), RULE_NONZERO);
}
- writeIfNotEmpty(ts, "start marker", svgStyle->markerStartResource());
- writeIfNotEmpty(ts, "middle marker", svgStyle->markerMidResource());
- writeIfNotEmpty(ts, "end marker", svgStyle->markerEndResource());
+ writeIfNotEmpty(ts, "start marker", svgStyle.markerStartResource());
+ writeIfNotEmpty(ts, "middle marker", svgStyle.markerMidResource());
+ writeIfNotEmpty(ts, "end marker", svgStyle.markerEndResource());
}
static TextStream& writePositionAndStyle(TextStream& ts, const RenderObject& object)
if (fragments.isEmpty())
return;
- RenderSVGInlineText& textRenderer = toRenderSVGInlineText(textBox->textRenderer());
+ RenderSVGInlineText& textRenderer = toRenderSVGInlineText(textBox->renderer());
- const SVGRenderStyle* svgStyle = textRenderer.style()->svgStyle();
- String text = textBox->textRenderer().text();
+ const SVGRenderStyle& svgStyle = textRenderer.style()->svgStyle();
+ String text = textBox->renderer().text();
unsigned fragmentsSize = fragments.size();
for (unsigned i = 0; i < fragmentsSize; ++i) {
// FIXME: Remove this hack, once the new text layout engine is completly landed. We want to preserve the old layout test results for now.
ts << "chunk 1 ";
- ETextAnchor anchor = svgStyle->textAnchor();
- bool isVerticalText = svgStyle->isVerticalWritingMode();
+ ETextAnchor anchor = svgStyle.textAnchor();
+ bool isVerticalText = svgStyle.isVerticalWritingMode();
if (anchor == TA_MIDDLE) {
ts << "(middle anchor";
if (isVerticalText)
void writeResources(TextStream& ts, const RenderObject& object, int indent)
{
const RenderStyle* style = object.style();
- const SVGRenderStyle* svgStyle = style->svgStyle();
+ const SVGRenderStyle& svgStyle = style->svgStyle();
// FIXME: We want to use SVGResourcesCache to determine which resources are present, instead of quering the resource <-> id cache.
// For now leave the DRT output as is, but later on we should change this so cycles are properly ignored in the DRT output.
RenderObject& renderer = const_cast<RenderObject&>(object);
- if (!svgStyle->maskerResource().isEmpty()) {
- if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(object.document(), svgStyle->maskerResource())) {
+ if (!svgStyle.maskerResource().isEmpty()) {
+ if (RenderSVGResourceMasker* masker = getRenderSVGResourceById<RenderSVGResourceMasker>(object.document(), svgStyle.maskerResource())) {
writeIndent(ts, indent);
ts << " ";
- writeNameAndQuotedValue(ts, "masker", svgStyle->maskerResource());
+ writeNameAndQuotedValue(ts, "masker", svgStyle.maskerResource());
ts << " ";
writeStandardPrefix(ts, *masker, 0);
ts << " " << masker->resourceBoundingBox(&renderer) << "\n";
}
}
- if (!svgStyle->clipperResource().isEmpty()) {
- if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(object.document(), svgStyle->clipperResource())) {
+ if (!svgStyle.clipperResource().isEmpty()) {
+ if (RenderSVGResourceClipper* clipper = getRenderSVGResourceById<RenderSVGResourceClipper>(object.document(), svgStyle.clipperResource())) {
writeIndent(ts, indent);
ts << " ";
- writeNameAndQuotedValue(ts, "clipPath", svgStyle->clipperResource());
+ writeNameAndQuotedValue(ts, "clipPath", svgStyle.clipperResource());
ts << " ";
writeStandardPrefix(ts, *clipper, 0);
ts << " " << clipper->resourceBoundingBox(&renderer) << "\n";
}
}
- if (!svgStyle->filterResource().isEmpty()) {
- if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(object.document(), svgStyle->filterResource())) {
+ if (!svgStyle.filterResource().isEmpty()) {
+ if (RenderSVGResourceFilter* filter = getRenderSVGResourceById<RenderSVGResourceFilter>(object.document(), svgStyle.filterResource())) {
writeIndent(ts, indent);
ts << " ";
- writeNameAndQuotedValue(ts, "filter", svgStyle->filterResource());
+ writeNameAndQuotedValue(ts, "filter", svgStyle.filterResource());
ts << " ";
writeStandardPrefix(ts, *filter, 0);
ts << " " << filter->resourceBoundingBox(&renderer) << "\n";
}
}
-} // namespace WebCore
+} // namespace blink