Пример #1
0
static v8::Handle<v8::Value> hasExtensionCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.SVGEllipseElement.hasExtension");
    SVGEllipseElement* imp = V8SVGEllipseElement::toNative(args.Holder());
    STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, extension, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined));
    return v8Boolean(imp->hasExtension(extension));
}
Пример #2
0
JSValue jsSVGEllipseElementExternalResourcesRequired(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    UNUSED_PARAM(exec);
    SVGEllipseElement* imp = static_cast<SVGEllipseElement*>(static_cast<JSSVGEllipseElement*>(asObject(slot.slotBase()))->impl());
    RefPtr<SVGAnimatedBoolean> obj = imp->externalResourcesRequiredAnimated();
    return toJS(exec, obj.get(), imp);
}
Пример #3
0
JSValue jsSVGEllipseElementTransform(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    UNUSED_PARAM(exec);
    SVGEllipseElement* imp = static_cast<SVGEllipseElement*>(static_cast<JSSVGEllipseElement*>(asObject(slot.slotBase()))->impl());
    RefPtr<SVGAnimatedTransformList> obj = imp->transformAnimated();
    return toJS(exec, obj.get(), imp);
}
Пример #4
0
static v8::Handle<v8::Value> getPresentationAttributeCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.SVGEllipseElement.getPresentationAttribute");
    SVGEllipseElement* imp = V8SVGEllipseElement::toNative(args.Holder());
    STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, name, MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined));
    return toV8(imp->getPresentationAttribute(name));
}
Пример #5
0
static void xmlspaceAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGEllipseElement.xmlspace._set");
    SVGEllipseElement* imp = V8SVGEllipseElement::toNative(info.Holder());
    STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value);
    imp->setXmlspace(v);
    return;
}
Пример #6
0
JSValue JSC_HOST_CALL jsSVGEllipseElementPrototypeFunctionGetBBox(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.isObject(&JSSVGEllipseElement::s_info))
        return throwError(exec, TypeError);
    JSSVGEllipseElement* castedThisObj = static_cast<JSSVGEllipseElement*>(asObject(thisValue));
    SVGEllipseElement* imp = static_cast<SVGEllipseElement*>(castedThisObj->impl());


    JSC::JSValue result = toJS(exec, JSSVGStaticPODTypeWrapper<FloatRect>::create(imp->getBBox()).get(), imp);
    return result;
}
Пример #7
0
JSValue JSC_HOST_CALL jsSVGEllipseElementPrototypeFunctionGetPresentationAttribute(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.isObject(&JSSVGEllipseElement::s_info))
        return throwError(exec, TypeError);
    JSSVGEllipseElement* castedThisObj = static_cast<JSSVGEllipseElement*>(asObject(thisValue));
    SVGEllipseElement* imp = static_cast<SVGEllipseElement*>(castedThisObj->impl());
    const UString& name = args.at(0).toString(exec);


    JSC::JSValue result = toJS(exec, WTF::getPtr(imp->getPresentationAttribute(name)));
    return result;
}
Пример #8
0
JSValue JSC_HOST_CALL jsSVGEllipseElementPrototypeFunctionHasExtension(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.isObject(&JSSVGEllipseElement::s_info))
        return throwError(exec, TypeError);
    JSSVGEllipseElement* castedThisObj = static_cast<JSSVGEllipseElement*>(asObject(thisValue));
    SVGEllipseElement* imp = static_cast<SVGEllipseElement*>(castedThisObj->impl());
    const UString& extension = args.at(0).toString(exec);


    JSC::JSValue result = jsBoolean(imp->hasExtension(extension));
    return result;
}
Пример #9
0
static void updatePathFromEllipseElement(SVGElement* element, Path& path)
{
    SVGEllipseElement* ellipse = toSVGEllipseElement(element);

    SVGLengthContext lengthContext(element);
    float rx = ellipse->rx().value(lengthContext);
    if (rx <= 0)
        return;
    float ry = ellipse->ry().value(lengthContext);
    if (ry <= 0)
        return;
    path.addEllipse(FloatRect(ellipse->cx().value(lengthContext) - rx, ellipse->cy().value(lengthContext) - ry, rx * 2, ry * 2));
}
Пример #10
0
static void updatePathFromEllipseElement(SVGElement* element, Path& path)
{
    ASSERT_WITH_SECURITY_IMPLICATION(element->hasTagName(SVGNames::ellipseTag));
    SVGEllipseElement* ellipse = static_cast<SVGEllipseElement*>(element);

    SVGLengthContext lengthContext(element);
    float rx = ellipse->rx().value(lengthContext);
    if (rx <= 0)
        return;
    float ry = ellipse->ry().value(lengthContext);
    if (ry <= 0)
        return;
    path.addEllipse(FloatRect(ellipse->cx().value(lengthContext) - rx, ellipse->cy().value(lengthContext) - ry, rx * 2, ry * 2));
}
Пример #11
0
static v8::Handle<v8::Value> getTransformToElementCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.SVGEllipseElement.getTransformToElement");
    SVGEllipseElement* imp = V8SVGEllipseElement::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    EXCEPTION_BLOCK(SVGElement*, element, V8SVGElement::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)) ? V8SVGElement::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))) : 0);
    SVGMatrix result = imp->getTransformToElement(element, ec);
    if (UNLIKELY(ec))
        goto fail;
    return toV8(WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(result)));
    }
    fail:
    V8Proxy::setDOMException(ec);
    return v8::Handle<v8::Value>();
}
static TextStream& operator<<(TextStream& ts, const RenderSVGShape& shape)
{
    writePositionAndStyle(ts, shape);

    ASSERT(shape.node()->isSVGElement());
    SVGElement* svgElement = toSVGElement(shape.node());
    SVGLengthContext lengthContext(svgElement);

    if (svgElement->hasTagName(SVGNames::rectTag)) {
        SVGRectElement* element = static_cast<SVGRectElement*>(svgElement);
        writeNameValuePair(ts, "x", element->x().value(lengthContext));
        writeNameValuePair(ts, "y", element->y().value(lengthContext));
        writeNameValuePair(ts, "width", element->width().value(lengthContext));
        writeNameValuePair(ts, "height", element->height().value(lengthContext));
    } else if (svgElement->hasTagName(SVGNames::lineTag)) {
        SVGLineElement* element = static_cast<SVGLineElement*>(svgElement);
        writeNameValuePair(ts, "x1", element->x1().value(lengthContext));
        writeNameValuePair(ts, "y1", element->y1().value(lengthContext));
        writeNameValuePair(ts, "x2", element->x2().value(lengthContext));
        writeNameValuePair(ts, "y2", element->y2().value(lengthContext));
    } else if (svgElement->hasTagName(SVGNames::ellipseTag)) {
        SVGEllipseElement* element = static_cast<SVGEllipseElement*>(svgElement);
        writeNameValuePair(ts, "cx", element->cx().value(lengthContext));
        writeNameValuePair(ts, "cy", element->cy().value(lengthContext));
        writeNameValuePair(ts, "rx", element->rx().value(lengthContext));
        writeNameValuePair(ts, "ry", element->ry().value(lengthContext));
    } else if (svgElement->hasTagName(SVGNames::circleTag)) {
        SVGCircleElement* element = static_cast<SVGCircleElement*>(svgElement);
        writeNameValuePair(ts, "cx", element->cx().value(lengthContext));
        writeNameValuePair(ts, "cy", element->cy().value(lengthContext));
        writeNameValuePair(ts, "r", element->r().value(lengthContext));
    } else if (svgElement->hasTagName(SVGNames::polygonTag) || svgElement->hasTagName(SVGNames::polylineTag)) {
        SVGPolyElement* element = static_cast<SVGPolyElement*>(svgElement);
        writeNameAndQuotedValue(ts, "points", element->pointList().valueAsString());
    } else if (svgElement->hasTagName(SVGNames::pathTag)) {
        SVGPathElement* element = toSVGPathElement(svgElement);
        String pathString;
        // FIXME: We should switch to UnalteredParsing here - this will affect the path dumping output of dozens of tests.
        buildStringFromByteStream(element->pathByteStream(), pathString, NormalizedParsing);
        writeNameAndQuotedValue(ts, "data", pathString);
    } else
        ASSERT_NOT_REACHED();
    return ts;
}
Пример #13
0
void RenderSVGEllipse::calculateRadiiAndCenter()
{
    ASSERT(element());
    if (element()->hasTagName(SVGNames::circleTag)) {
        SVGCircleElement* circle = toSVGCircleElement(element());

        SVGLengthContext lengthContext(circle);
        float radius = circle->rCurrentValue().value(lengthContext);
        m_radii = FloatSize(radius, radius);
        m_center = FloatPoint(circle->cxCurrentValue().value(lengthContext), circle->cyCurrentValue().value(lengthContext));
        return;
    }

    SVGEllipseElement* ellipse = toSVGEllipseElement(element());

    SVGLengthContext lengthContext(ellipse);
    m_radii = FloatSize(ellipse->rxCurrentValue().value(lengthContext), ellipse->ryCurrentValue().value(lengthContext));
    m_center = FloatPoint(ellipse->cxCurrentValue().value(lengthContext), ellipse->cyCurrentValue().value(lengthContext));
}
Пример #14
0
void RenderSVGEllipse::calculateRadiiAndCenter()
{
    ASSERT(node());
    if (node()->hasTagName(SVGNames::circleTag)) {

        SVGCircleElement* circle = static_cast<SVGCircleElement*>(node());

        SVGLengthContext lengthContext(circle);
        float radius = circle->r().value(lengthContext);
        m_radii = FloatSize(radius, radius);
        m_center = FloatPoint(circle->cx().value(lengthContext), circle->cy().value(lengthContext));
        return;
    }

    ASSERT(node()->hasTagName(SVGNames::ellipseTag));
    SVGEllipseElement* ellipse = static_cast<SVGEllipseElement*>(node());

    SVGLengthContext lengthContext(ellipse);
    m_radii = FloatSize(ellipse->rx().value(lengthContext), ellipse->ry().value(lengthContext));
    m_center = FloatPoint(ellipse->cx().value(lengthContext), ellipse->cy().value(lengthContext));
}
Пример #15
0
void RenderSVGEllipse::calculateRadiiAndCenter()
{
    ASSERT(element());
    if (isSVGCircleElement(element())) {

        SVGCircleElement* circle = toSVGCircleElement(element());

        SVGLengthContext lengthContext(circle);
        float radius = circle->r().value(lengthContext);
        m_radii = FloatSize(radius, radius);
        m_center = FloatPoint(circle->cx().value(lengthContext), circle->cy().value(lengthContext));
        return;
    }

    ASSERT(isSVGEllipseElement(element()));
    SVGEllipseElement* ellipse = toSVGEllipseElement(element());

    SVGLengthContext lengthContext(ellipse);
    m_radii = FloatSize(ellipse->rx().value(lengthContext), ellipse->ry().value(lengthContext));
    m_center = FloatPoint(ellipse->cx().value(lengthContext), ellipse->cy().value(lengthContext));
}
Пример #16
0
JSValue JSC_HOST_CALL jsSVGEllipseElementPrototypeFunctionGetTransformToElement(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
    UNUSED_PARAM(args);
    if (!thisValue.isObject(&JSSVGEllipseElement::s_info))
        return throwError(exec, TypeError);
    JSSVGEllipseElement* castedThisObj = static_cast<JSSVGEllipseElement*>(asObject(thisValue));
    SVGEllipseElement* imp = static_cast<SVGEllipseElement*>(castedThisObj->impl());
    ExceptionCode ec = 0;
    SVGElement* element = toSVGElement(args.at(0));


    JSC::JSValue result = toJS(exec, JSSVGStaticPODTypeWrapper<TransformationMatrix>::create(imp->getTransformToElement(element, ec)).get(), imp);
    setDOMException(exec, ec);
    return result;
}
Пример #17
0
//virtual
void PSVGEllipseElement::CalculateBounds()
{
	SVGEllipseElement* psvgElement = static_cast<SVGEllipseElement*>(m_pNode);

	gm::Matrix3d* matrix = psvgElement->transform_attr()->m_animVal->consolidateToMatrix();

	PSVGElement* pViewportElement = GetViewportElement();
	ASSERT(pViewportElement);

	gm::RectD viewBox = pViewportElement->GetViewBox();

	/*
	SVGLength* cxLength = psvgElement->m_cx->m_animated->m_animVal->m_value;
	SVGLength* cyLength = psvgElement->m_cy->m_animated->m_animVal->m_value;
	SVGLength* rxLength = psvgElement->m_rx->m_animated->m_animVal->m_value;
	SVGLength* ryLength = psvgElement->m_ry->m_animated->m_animVal->m_value;
	*/

	ISVGLength* cxLength = psvgElement->get_cx()->get_animVal();
	ISVGLength* cyLength = psvgElement->get_cy()->get_animVal();
	ISVGLength* rxLength = psvgElement->get_rx()->get_animVal();
	ISVGLength* ryLength = psvgElement->get_ry()->get_animVal();

	m_computedCx = LengthToUserUnits(cxLength, viewBox.Width);
	m_computedCy = LengthToUserUnits(cyLength, viewBox.Height);
	m_computedRx = LengthToUserUnits(rxLength, viewBox.Width);
	m_computedRy = LengthToUserUnits(ryLength, viewBox.Height);

	/*
	if (cxLength->m_unitType == SVG_LENGTHTYPE_PERCENTAGE)
	{
		m_computedCx = (cxLength->m_valueInSpecifiedUnits * viewBox.Width)/100;
	}
	else
	{
		m_computedCx = cxLength->m_value;
	}

	if (cyLength->m_unitType == SVG_LENGTHTYPE_PERCENTAGE)
	{
		m_computedCy = (cyLength->m_valueInSpecifiedUnits * viewBox.Height)/100;
	}
	else
	{
		m_computedCy = cyLength->m_value;
	}

	if (rxLength->m_unitType == SVG_LENGTHTYPE_PERCENTAGE)
	{
		m_computedRx = (rxLength->m_valueInSpecifiedUnits * viewBox.Width)/100;
	}
	else
	{
		m_computedRx = rxLength->m_value;
	}

	if (ryLength->m_unitType == SVG_LENGTHTYPE_PERCENTAGE)
	{
		m_computedRy = (ryLength->m_valueInSpecifiedUnits * viewBox.Height)/100;
	}
	else
	{
		m_computedRy = ryLength->m_value;
	}
	*/

	m_bounds.X = m_computedCx - m_computedRx;
	m_bounds.Y = m_computedCy - m_computedRy;
	m_bounds.Width = m_computedRx * 2;
	m_bounds.Height = m_computedRy * 2;

	m_xbounds = gm::CalcEllipseBBox(m_bounds.X, m_bounds.Y, m_bounds.Width, m_bounds.Height, matrix);

//	LDraw::GraphicsPathF GraphicsPathF;
//	GraphicsPathF.AddEllipse(float(m_bounds.X), float(m_bounds.Y), float(m_bounds.Width), float(m_bounds.Height));

//	LDraw::Pen pen(LDraw::Color(0,0,0), (float)m_computedStrokeWidth);

	/*
	LDraw::RectF bounds;
	GraphicsPathF.GetBounds(&bounds, NULL, &pen);
	*/
	m_expandedBBox.X = m_bounds.X - m_computedStrokeWidth/2;
	m_expandedBBox.Y = m_bounds.Y - m_computedStrokeWidth/2;
	m_expandedBBox.Width = m_bounds.Width + m_computedStrokeWidth;
	m_expandedBBox.Height = m_bounds.Height + m_computedStrokeWidth;
}
Пример #18
0
static v8::Handle<v8::Value> systemLanguageAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGEllipseElement.systemLanguage._get");
    SVGEllipseElement* imp = V8SVGEllipseElement::toNative(info.Holder());
    return toV8(WTF::getPtr(SVGStaticListPropertyTearOff<SVGStringList>::create(imp, imp->systemLanguage())));
}
Пример #19
0
static v8::Handle<v8::Value> ryAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGEllipseElement.ry._get");
    SVGEllipseElement* imp = V8SVGEllipseElement::toNative(info.Holder());
    return toV8(imp->ryAnimated());
}
Пример #20
0
JSValue jsSVGEllipseElementSystemLanguage(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    UNUSED_PARAM(exec);
    SVGEllipseElement* imp = static_cast<SVGEllipseElement*>(static_cast<JSSVGEllipseElement*>(asObject(slot.slotBase()))->impl());
    return toJS(exec, WTF::getPtr(imp->systemLanguage()), imp);
}
Пример #21
0
static v8::Handle<v8::Value> getScreenCTMCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.SVGEllipseElement.getScreenCTM");
    SVGEllipseElement* imp = V8SVGEllipseElement::toNative(args.Holder());
    return toV8(WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(imp->getScreenCTM())));
}
Пример #22
0
static v8::Handle<v8::Value> getBBoxCallback(const v8::Arguments& args)
{
    INC_STATS("DOM.SVGEllipseElement.getBBox");
    SVGEllipseElement* imp = V8SVGEllipseElement::toNative(args.Holder());
    return toV8(WTF::getPtr(SVGPropertyTearOff<FloatRect>::create(imp->getBBox())));
}
Пример #23
0
JSValue jsSVGEllipseElementXmlspace(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    UNUSED_PARAM(exec);
    SVGEllipseElement* imp = static_cast<SVGEllipseElement*>(static_cast<JSSVGEllipseElement*>(asObject(slot.slotBase()))->impl());
    return jsString(exec, imp->xmlspace());
}
Пример #24
0
JSValue jsSVGEllipseElementFarthestViewportElement(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
    UNUSED_PARAM(exec);
    SVGEllipseElement* imp = static_cast<SVGEllipseElement*>(static_cast<JSSVGEllipseElement*>(asObject(slot.slotBase()))->impl());
    return toJS(exec, WTF::getPtr(imp->farthestViewportElement()));
}
Пример #25
0
static v8::Handle<v8::Value> farthestViewportElementAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGEllipseElement.farthestViewportElement._get");
    SVGEllipseElement* imp = V8SVGEllipseElement::toNative(info.Holder());
    return toV8(imp->farthestViewportElement());
}
Пример #26
0
void setJSSVGEllipseElementXmlspace(ExecState* exec, JSObject* thisObject, JSValue value)
{
    SVGEllipseElement* imp = static_cast<SVGEllipseElement*>(static_cast<JSSVGEllipseElement*>(thisObject)->impl());
    imp->setXmlspace(value.toString(exec));
}
Пример #27
0
static v8::Handle<v8::Value> xmlspaceAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    INC_STATS("DOM.SVGEllipseElement.xmlspace._get");
    SVGEllipseElement* imp = V8SVGEllipseElement::toNative(info.Holder());
    return v8String(imp->xmlspace());
}