本文整理汇总了C++中SVGSVGElement类的典型用法代码示例。如果您正苦于以下问题:C++ SVGSVGElement类的具体用法?C++ SVGSVGElement怎么用?C++ SVGSVGElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SVGSVGElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jsSVGSVGElementPrototypeFunctionGetBBox
JSValue JSC_HOST_CALL jsSVGSVGElementPrototypeFunctionGetBBox(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.isObject(&JSSVGSVGElement::s_info))
return throwError(exec, TypeError);
JSSVGSVGElement* castedThisObj = static_cast<JSSVGSVGElement*>(asObject(thisValue));
SVGSVGElement* imp = static_cast<SVGSVGElement*>(castedThisObj->impl());
JSC::JSValue result = toJS(exec, JSSVGStaticPODTypeWrapper<FloatRect>::create(imp->getBBox()).get(), imp);
return result;
}
示例2: jsSVGSVGElementPrototypeFunctionCreateSVGAngle
JSValue JSC_HOST_CALL jsSVGSVGElementPrototypeFunctionCreateSVGAngle(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.isObject(&JSSVGSVGElement::s_info))
return throwError(exec, TypeError);
JSSVGSVGElement* castedThisObj = static_cast<JSSVGSVGElement*>(asObject(thisValue));
SVGSVGElement* imp = static_cast<SVGSVGElement*>(castedThisObj->impl());
JSC::JSValue result = toJS(exec, WTF::getPtr(imp->createSVGAngle()), imp);
return result;
}
示例3: jsSVGSVGElementPrototypeFunctionSetCurrentTime
JSValue JSC_HOST_CALL jsSVGSVGElementPrototypeFunctionSetCurrentTime(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.isObject(&JSSVGSVGElement::s_info))
return throwError(exec, TypeError);
JSSVGSVGElement* castedThisObj = static_cast<JSSVGSVGElement*>(asObject(thisValue));
SVGSVGElement* imp = static_cast<SVGSVGElement*>(castedThisObj->impl());
float seconds = args.at(0).toFloat(exec);
imp->setCurrentTime(seconds);
return jsUndefined();
}
示例4: usesContainerSize
bool SVGImage::usesContainerSize() const
{
if (!m_page)
return false;
Frame* frame = m_page->mainFrame();
SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement();
if (!rootElement)
return false;
if (RenderSVGRoot* renderer = toRenderSVGRoot(rootElement->renderer()))
return !renderer->containerSize().isEmpty();
return false;
}
示例5: viewportTransform
TransformationMatrix RenderSVGViewportContainer::viewportTransform() const
{
if (element()->hasTagName(SVGNames::svgTag)) {
SVGSVGElement* svg = static_cast<SVGSVGElement*>(element());
return svg->viewBoxToViewTransform(viewport().width(), viewport().height());
} else if (element()->hasTagName(SVGNames::markerTag)) {
SVGMarkerElement* marker = static_cast<SVGMarkerElement*>(element());
return marker->viewBoxToViewTransform(viewport().width(), viewport().height());
}
return TransformationMatrix();
}
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:12,代码来源:RenderSVGViewportContainer.cpp
示例6: jsSVGSVGElementPrototypeFunctionGetCurrentTime
JSValue JSC_HOST_CALL jsSVGSVGElementPrototypeFunctionGetCurrentTime(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.isObject(&JSSVGSVGElement::s_info))
return throwError(exec, TypeError);
JSSVGSVGElement* castedThisObj = static_cast<JSSVGSVGElement*>(asObject(thisValue));
SVGSVGElement* imp = static_cast<SVGSVGElement*>(castedThisObj->impl());
JSC::JSValue result = jsNumber(exec, imp->getCurrentTime());
return result;
}
示例7: toSVGSVGElement
// RenderBox methods will expect coordinates w/o any transforms in coordinates
// relative to our borderBox origin. This method gives us exactly that.
void RenderSVGRoot::buildLocalToBorderBoxTransform()
{
SVGSVGElement* svg = toSVGSVGElement(node());
ASSERT(svg);
float scale = style()->effectiveZoom();
SVGPoint translate = svg->currentTranslate();
LayoutSize borderAndPadding(borderLeft() + paddingLeft(), borderTop() + paddingTop());
m_localToBorderBoxTransform = svg->viewBoxToViewTransform(contentWidth() / scale, contentHeight() / scale);
if (borderAndPadding.isEmpty() && scale == 1 && translate == SVGPoint::zero())
return;
m_localToBorderBoxTransform = AffineTransform(scale, 0, 0, scale, borderAndPadding.width() + translate.x(), borderAndPadding.height() + translate.y()) * m_localToBorderBoxTransform;
}
示例8: toSVGSVGElement
// LayoutBox methods will expect coordinates w/o any transforms in coordinates
// relative to our borderBox origin. This method gives us exactly that.
void LayoutSVGRoot::buildLocalToBorderBoxTransform()
{
SVGSVGElement* svg = toSVGSVGElement(node());
ASSERT(svg);
float scale = style()->effectiveZoom();
FloatPoint translate = svg->currentTranslate();
LayoutSize borderAndPadding(borderLeft() + paddingLeft(), borderTop() + paddingTop());
m_localToBorderBoxTransform = svg->viewBoxToViewTransform(contentWidth() / scale, contentHeight() / scale);
AffineTransform viewToBorderBoxTransform(scale, 0, 0, scale, borderAndPadding.width() + translate.x(), borderAndPadding.height() + translate.y());
m_localToBorderBoxTransform.preMultiply(viewToBorderBoxTransform);
}
示例9: toSVGSVGElement
void RenderSVGRoot::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
// An empty viewport disables rendering.
if (pixelSnappedBorderBoxRect().isEmpty())
return;
// Don't paint, if the context explicitly disabled it.
if (paintInfo.context->paintingDisabled())
return;
// An empty viewBox also disables rendering.
// (http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute)
SVGSVGElement* svg = toSVGSVGElement(node());
ASSERT(svg);
if (svg->hasEmptyViewBox())
return;
// Don't paint if we don't have kids, except if we have filters we should paint those.
if (!firstChild()) {
SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(this);
if (!resources || !resources->filter())
return;
}
// Make a copy of the PaintInfo because applyTransform will modify the damage rect.
PaintInfo childPaintInfo(paintInfo);
childPaintInfo.context->save();
// Apply initial viewport clip
if (shouldApplyViewportClip())
childPaintInfo.context->clip(pixelSnappedIntRect(overflowClipRect(paintOffset)));
// Convert from container offsets (html renderers) to a relative transform (svg renderers).
// Transform from our paint container's coordinate system to our local coords.
IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset);
childPaintInfo.applyTransform(AffineTransform::translation(adjustedPaintOffset.x(), adjustedPaintOffset.y()) * localToBorderBoxTransform());
// SVGRenderingContext must be destroyed before we restore the childPaintInfo.context, because a filter may have
// changed the context and it is only reverted when the SVGRenderingContext destructor finishes applying the filter.
{
SVGRenderingContext renderingContext;
bool continueRendering = true;
if (childPaintInfo.phase == PaintPhaseForeground) {
renderingContext.prepareToRenderSVGContent(this, childPaintInfo);
continueRendering = renderingContext.isRenderingPrepared();
}
if (continueRendering)
RenderBox::paint(childPaintInfo, LayoutPoint());
}
childPaintInfo.context->restore();
}
示例10: ASSERT
void SVGImage::drawSVGToImageBuffer(ImageBuffer* buffer, const IntSize& size, float zoom, ShouldClearBuffer shouldClear)
{
// FIXME: This doesn't work correctly with animations. If an image contains animations, that say run for 2 seconds,
// and we currently have one <img> that displays us. If we open another document referencing the same SVGImage it
// will display the document at a time where animations already ran - even though it has its own ImageBuffer.
// We currently don't implement SVGSVGElement::setCurrentTime, and can NOT go back in time, once animations started.
// There's no way to fix this besides avoiding style/attribute mutations from SVGAnimationElement.
ASSERT(buffer);
ASSERT(!size.isEmpty());
if (!m_page)
return;
Frame* frame = m_page->mainFrame();
SVGSVGElement* rootElement = static_cast<SVGDocument*>(frame->document())->rootElement();
if (!rootElement)
return;
RenderSVGRoot* renderer = toRenderSVGRoot(rootElement->renderer());
if (!renderer)
return;
// Draw image at requested size.
ImageObserver* observer = imageObserver();
ASSERT(observer);
// Temporarily reset image observer, we don't want to receive any changeInRect() calls due this relayout.
setImageObserver(0);
renderer->setContainerSize(size);
frame->view()->resize(this->size());
if (zoom != 1)
frame->setPageZoomFactor(zoom);
// Eventually clear image buffer.
IntRect rect(IntPoint(), size);
if (shouldClear == ClearImageBuffer)
buffer->context()->clearRect(rect);
// Draw SVG on top of ImageBuffer.
draw(buffer->context(), rect, rect, ColorSpaceDeviceRGB, CompositeSourceOver);
// Reset container size & zoom to initial state. Otherwhise the size() of this
// image would return whatever last size was set by drawSVGToImageBuffer().
if (zoom != 1)
frame->setPageZoomFactor(1);
renderer->setContainerSize(IntSize());
frame->view()->resize(this->size());
if (frame->view()->needsLayout())
frame->view()->layout();
setImageObserver(observer);
}
示例11: currentView
void SVGSVGElement::setupInitialView(const String& fragmentIdentifier, Element* anchorNode)
{
RenderObject* renderer = this->renderer();
SVGViewSpec* view = m_viewSpec.get();
if (view)
view->reset();
bool hadUseCurrentView = m_useCurrentView;
m_useCurrentView = false;
if (fragmentIdentifier.startsWith("xpointer(")) {
// FIXME: XPointer references are ignored (https://bugs.webkit.org/show_bug.cgi?id=17491)
if (renderer && hadUseCurrentView)
RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
return;
}
if (fragmentIdentifier.startsWith("svgView(")) {
if (!view)
view = currentView(); // Create the SVGViewSpec.
if (view->parseViewSpec(fragmentIdentifier))
m_useCurrentView = true;
else
view->reset();
if (renderer && (hadUseCurrentView || m_useCurrentView))
RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
return;
}
// Spec: If the SVG fragment identifier addresses a ‘view’ element within an SVG document (e.g., MyDrawing.svg#MyView
// or MyDrawing.svg#xpointer(id('MyView'))) then the closest ancestor ‘svg’ element is displayed in the viewport.
// Any view specification attributes included on the given ‘view’ element override the corresponding view specification
// attributes on the closest ancestor ‘svg’ element.
if (anchorNode && anchorNode->hasTagName(SVGNames::viewTag)) {
if (SVGViewElement* viewElement = anchorNode->hasTagName(SVGNames::viewTag) ? static_cast<SVGViewElement*>(anchorNode) : 0) {
SVGElement* element = SVGLocatable::nearestViewportElement(viewElement);
if (element->hasTagName(SVGNames::svgTag)) {
SVGSVGElement* svg = static_cast<SVGSVGElement*>(element);
svg->inheritViewAttributes(viewElement);
if (RenderObject* renderer = svg->renderer())
RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
}
}
return;
}
// FIXME: We need to decide which <svg> to focus on, and zoom to it.
// FIXME: We need to actually "highlight" the viewTarget(s).
}
示例12: jsSVGSVGElementPrototypeFunctionCreateSVGTransformFromMatrix
JSValue JSC_HOST_CALL jsSVGSVGElementPrototypeFunctionCreateSVGTransformFromMatrix(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.isObject(&JSSVGSVGElement::s_info))
return throwError(exec, TypeError);
JSSVGSVGElement* castedThisObj = static_cast<JSSVGSVGElement*>(asObject(thisValue));
SVGSVGElement* imp = static_cast<SVGSVGElement*>(castedThisObj->impl());
TransformationMatrix matrix = toSVGMatrix(args.at(0));
JSC::JSValue result = toJS(exec, JSSVGStaticPODTypeWrapper<SVGTransform>::create(imp->createSVGTransformFromMatrix(matrix)).get(), imp);
return result;
}
示例13: jsSVGSVGElementPrototypeFunctionSuspendRedraw
JSValue JSC_HOST_CALL jsSVGSVGElementPrototypeFunctionSuspendRedraw(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.isObject(&JSSVGSVGElement::s_info))
return throwError(exec, TypeError);
JSSVGSVGElement* castedThisObj = static_cast<JSSVGSVGElement*>(asObject(thisValue));
SVGSVGElement* imp = static_cast<SVGSVGElement*>(castedThisObj->impl());
unsigned maxWaitMilliseconds = args.at(0).toInt32(exec);
JSC::JSValue result = jsNumber(exec, imp->suspendRedraw(maxWaitMilliseconds));
return result;
}
示例14: jsSVGSVGElementPrototypeFunctionHasExtension
JSValue JSC_HOST_CALL jsSVGSVGElementPrototypeFunctionHasExtension(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.isObject(&JSSVGSVGElement::s_info))
return throwError(exec, TypeError);
JSSVGSVGElement* castedThisObj = static_cast<JSSVGSVGElement*>(asObject(thisValue));
SVGSVGElement* imp = static_cast<SVGSVGElement*>(castedThisObj->impl());
const UString& extension = args.at(0).toString(exec);
JSC::JSValue result = jsBoolean(imp->hasExtension(extension));
return result;
}
示例15: jsSVGSVGElementPrototypeFunctionGetPresentationAttribute
JSValue JSC_HOST_CALL jsSVGSVGElementPrototypeFunctionGetPresentationAttribute(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.isObject(&JSSVGSVGElement::s_info))
return throwError(exec, TypeError);
JSSVGSVGElement* castedThisObj = static_cast<JSSVGSVGElement*>(asObject(thisValue));
SVGSVGElement* imp = static_cast<SVGSVGElement*>(castedThisObj->impl());
const UString& name = args.at(0).toString(exec);
JSC::JSValue result = toJS(exec, WTF::getPtr(imp->getPresentationAttribute(name)));
return result;
}