void SVGSVGElement::inheritViewAttributes(const SVGViewElement& viewElement) { SVGViewSpec& view = currentView(); m_useCurrentView = true; if (viewElement.hasAttribute(SVGNames::viewBoxAttr)) view.setViewBoxBaseValue(viewElement.viewBox()); else view.setViewBoxBaseValue(viewBox()); if (viewElement.hasAttribute(SVGNames::preserveAspectRatioAttr)) view.setPreserveAspectRatioBaseValue(viewElement.preserveAspectRatioBaseValue()); else view.setPreserveAspectRatioBaseValue(preserveAspectRatioBaseValue()); if (viewElement.hasAttribute(SVGNames::zoomAndPanAttr)) view.setZoomAndPanBaseValue(viewElement.zoomAndPan()); else view.setZoomAndPanBaseValue(zoomAndPan()); }
JSValue jsSVGViewElementZoomAndPan(ExecState* exec, const Identifier&, const PropertySlot& slot) { UNUSED_PARAM(exec); SVGViewElement* imp = static_cast<SVGViewElement*>(static_cast<JSSVGViewElement*>(asObject(slot.slotBase()))->impl()); return jsNumber(exec, imp->zoomAndPan()); }
static v8::Handle<v8::Value> zoomAndPanAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { SVGViewElement* imp = V8SVGViewElement::toNative(info.Holder()); return v8Integer(imp->zoomAndPan(), info.GetIsolate()); }
JSValue* JSSVGViewElement::getValueProperty(ExecState* exec, int token) const { switch (token) { case ViewTargetAttrNum: { SVGViewElement* imp = static_cast<SVGViewElement*>(impl()); return toJS(exec, WTF::getPtr(imp->viewTarget())); } case ExternalResourcesRequiredAttrNum: { SVGViewElement* imp = static_cast<SVGViewElement*>(impl()); ASSERT(exec && exec->dynamicInterpreter()); RefPtr<SVGAnimatedBoolean> obj = imp->externalResourcesRequiredAnimated(); Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); if (activeFrame) { SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); if (extensions) { if (extensions->hasGenericContext<SVGAnimatedBoolean>(obj.get())) ASSERT(extensions->genericContext<SVGAnimatedBoolean>(obj.get()) == imp); else extensions->setGenericContext<SVGAnimatedBoolean>(obj.get(), imp); } } return toJS(exec, obj.get()); } case ViewBoxAttrNum: { SVGViewElement* imp = static_cast<SVGViewElement*>(impl()); ASSERT(exec && exec->dynamicInterpreter()); RefPtr<SVGAnimatedRect> obj = imp->viewBoxAnimated(); Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); if (activeFrame) { SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); if (extensions) { if (extensions->hasGenericContext<SVGAnimatedRect>(obj.get())) ASSERT(extensions->genericContext<SVGAnimatedRect>(obj.get()) == imp); else extensions->setGenericContext<SVGAnimatedRect>(obj.get(), imp); } } return toJS(exec, obj.get()); } case PreserveAspectRatioAttrNum: { SVGViewElement* imp = static_cast<SVGViewElement*>(impl()); ASSERT(exec && exec->dynamicInterpreter()); RefPtr<SVGAnimatedPreserveAspectRatio> obj = imp->preserveAspectRatioAnimated(); Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame(); if (activeFrame) { SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); if (extensions) { if (extensions->hasGenericContext<SVGAnimatedPreserveAspectRatio>(obj.get())) ASSERT(extensions->genericContext<SVGAnimatedPreserveAspectRatio>(obj.get()) == imp); else extensions->setGenericContext<SVGAnimatedPreserveAspectRatio>(obj.get(), imp); } } return toJS(exec, obj.get()); } case ZoomAndPanAttrNum: { SVGViewElement* imp = static_cast<SVGViewElement*>(impl()); return jsNumber(imp->zoomAndPan()); } } return 0; }