本文整理汇总了C++中SVGSVGElement::hasRelativeValues方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGSVGElement::hasRelativeValues方法的具体用法?C++ SVGSVGElement::hasRelativeValues怎么用?C++ SVGSVGElement::hasRelativeValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVGSVGElement
的用法示例。
在下文中一共展示了SVGSVGElement::hasRelativeValues方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: layout
void RenderSVGRoot::layout()
{
ASSERT(needsLayout());
// Arbitrary affine transforms are incompatible with LayoutState.
view()->disableLayoutState();
LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && selfNeedsLayout());
int oldWidth = width();
calcWidth();
int oldHeight = height();
calcHeight();
SVGSVGElement* svg = static_cast<SVGSVGElement*>(node());
setWidth(static_cast<int>(width() * svg->currentScale()));
setHeight(static_cast<int>(height() * svg->currentScale()));
calcViewport();
// RenderSVGRoot needs to take special care to propagate window size changes to the children,
// if the outermost <svg> is using relative x/y/width/height values. Hence the additonal parameters.
layoutChildren(this, selfNeedsLayout() || (svg->hasRelativeValues() && (width() != oldWidth || height() != oldHeight)));
repainter.repaintAfterLayout();
view()->enableLayoutState();
setNeedsLayout(false);
}
示例2: calcViewport
void RenderSVGContainer::calcViewport()
{
SVGElement* svgelem = static_cast<SVGElement*>(element());
if (svgelem->hasTagName(SVGNames::svgTag)) {
SVGSVGElement* svg = static_cast<SVGSVGElement*>(element());
if (!selfNeedsLayout() && !svg->hasRelativeValues())
return;
float x = 0.0f;
float y = 0.0f;
if (parent()->isSVGContainer()) {
x = svg->x().value();
y = svg->y().value();
}
float w = svg->width().value();
float h = svg->height().value();
m_viewport = FloatRect(x, y, w, h);
} else if (svgelem->hasTagName(SVGNames::markerTag)) {
if (!selfNeedsLayout())
return;
SVGMarkerElement* svg = static_cast<SVGMarkerElement*>(element());
float w = svg->markerWidth().value();
float h = svg->markerHeight().value();
m_viewport = FloatRect(0.0f, 0.0f, w, h);
}
}
示例3: calcViewport
void RenderSVGRoot::calcViewport()
{
SVGSVGElement* svg = static_cast<SVGSVGElement*>(node());
if (!selfNeedsLayout() && !svg->hasRelativeValues())
return;
if (!svg->hasSetContainerSize()) {
// In the normal case of <svg> being stand-alone or in a CSSBoxModel object we use
// RenderBox::width()/height() (which pulls data from RenderStyle)
m_viewportSize = FloatSize(width(), height());
} else {
// In the SVGImage case grab the SVGLength values off of SVGSVGElement and use
// the special relativeWidthValue accessors which respect the specified containerSize
SVGLength width = svg->width();
SVGLength height = svg->height();
float viewportWidth = (width.unitType() == LengthTypePercentage) ? svg->relativeWidthValue() : width.value(svg);
float viewportHeight = (height.unitType() == LengthTypePercentage) ? svg->relativeHeightValue() : height.value(svg);
m_viewportSize = FloatSize(viewportWidth, viewportHeight);
}
}