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);
}
Example #2
0
void RenderSVGRoot::layout()
{
    ASSERT(needsLayout());

    // Arbitrary affine transforms are incompatible with LayoutState.
    LayoutStateDisabler layoutStateDisabler(view());

    bool needsLayout = selfNeedsLayout();
    LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && needsLayout);

    IntSize oldSize(width(), height());
    negotiateSizeWithHostDocumentIfNeeded();
    computeLogicalWidth();
    computeLogicalHeight();
    calcViewport();

    SVGSVGElement* svg = static_cast<SVGSVGElement*>(node());
    m_isLayoutSizeChanged = svg->hasRelativeLengths() && oldSize != size();

    SVGRenderSupport::layoutChildren(this, needsLayout);
    m_isLayoutSizeChanged = false;

    // At this point LayoutRepainter already grabbed the old bounds,
    // recalculate them now so repaintAfterLayout() uses the new bounds.
    if (m_needsBoundariesOrTransformUpdate) {
        updateCachedBoundaries();
        m_needsBoundariesOrTransformUpdate = false;
    }

    repainter.repaintAfterLayout();

    setNeedsLayout(false);
}
bool ImageViewport::loadImage(unsigned int *buffer, unsigned int size, unsigned int format, double ts)
{
	unsigned int *tmp_image;
	bool ret;

	// if scale was changed
	if (m_scaleChange) {
		// reset image
		init(m_capSize[0], m_capSize[1]);
	}

	// size must be identical
	if (size < getBuffSize())
		return false;

	if (m_avail) {
		// just copy
		return ImageBase::loadImage(buffer, size, format, ts);
	}
	else {
		tmp_image = m_image;
		m_image = buffer;
		calcViewport(0, ts, format);
		ret = m_avail;
		m_image = tmp_image;
		// since the image was not loaded to our buffer, it's not valid
		m_avail = false;
	}
	return ret;
}
Example #4
0
void RenderSVGContainer::layout()
{
    ASSERT(needsLayout());

    // Allow RenderSVGViewportContainer to update its viewport.
    calcViewport();

    // Allow RenderSVGTransformableContainer to update its transform.
    bool updatedTransform = calculateLocalTransform();

    // RenderSVGViewportContainer needs to set the 'layout size changed' flag.
    determineIfLayoutSizeChanged();

    SVGRenderSupport::layoutChildren(this, selfNeedsLayout() || SVGRenderSupport::filtersForceContainerLayout(this));

    // Invalidate all resources of this client if our layout changed.
    if (everHadLayout() && needsLayout())
        SVGResourcesCache::clientLayoutChanged(this);

    if (m_needsBoundariesUpdate || updatedTransform) {
        updateCachedBoundaries();
        m_needsBoundariesUpdate = false;

        // If our bounds changed, notify the parents.
        RenderSVGModelObject::setNeedsBoundariesUpdate();
    }

    clearNeedsLayout();
}
void RenderSVGViewportContainer::layout()
{
    ASSERT(needsLayout());

    calcViewport();

    // Arbitrary affine transforms are incompatible with LayoutState.
    view()->disableLayoutState();

    IntRect oldBounds = m_absoluteBounds;
    IntRect oldOutlineBox;
    bool checkForRepaint = checkForRepaintDuringLayout() && selfNeedsLayout();
    if (checkForRepaint)
        oldOutlineBox = absoluteOutlineBounds();

    calcBounds();

    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
        if (selfNeedsLayout())
            child->setNeedsLayout(true);

        child->layoutIfNeeded();
        ASSERT(!child->needsLayout());
    }

    if (checkForRepaint)
        repaintAfterLayoutIfNeeded(oldBounds, oldOutlineBox);

    view()->enableLayoutState();
    setNeedsLayout(false);
}
Example #6
0
void RenderSVGContainer::layout()
{
    ASSERT(needsLayout());

    // RenderSVGRoot disables layoutState for the SVG rendering tree.
    ASSERT(!view()->layoutStateEnabled());

    LayoutRepainter repainter(*this, checkForRepaintDuringLayout() || selfWillPaint());

    // Allow RenderSVGViewportContainer to update its viewport.
    calcViewport();

    // Allow RenderSVGTransformableContainer to update its transform.
    bool updatedTransform = calculateLocalTransform();

    SVGRenderSupport::layoutChildren(this, selfNeedsLayout() || SVGRenderSupport::filtersForceContainerLayout(this));

    // Invalidate all resources of this client if our layout changed.
    if (everHadLayout() && needsLayout())
        SVGResourcesCache::clientLayoutChanged(this);

    // At this point LayoutRepainter already grabbed the old bounds,
    // recalculate them now so repaintAfterLayout() uses the new bounds.
    if (m_needsBoundariesUpdate || updatedTransform) {
        updateCachedBoundaries();
        m_needsBoundariesUpdate = false;
    
        // If our bounds changed, notify the parents.
        RenderSVGModelObject::setNeedsBoundariesUpdate();
    }

    repainter.repaintAfterLayout();
    setNeedsLayout(false);
}
void RenderSVGContainer::layout()
{
    ASSERT(needsLayout());
    ASSERT(!view()->layoutStateEnabled()); // RenderSVGRoot disables layoutState for the SVG rendering tree.

    calcViewport(); // Allow RenderSVGViewportContainer to update its viewport

    LayoutRepainter repainter(*this, checkForRepaintDuringLayout() || selfWillPaint());
    calculateLocalTransform(); // Allow RenderSVGTransformableContainer to update its transform

    for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
        // Only force our kids to layout if we're being asked to relayout as a result of a parent changing
        // FIXME: We should be able to skip relayout of non-relative kids when only bounds size has changed
        // that's a possible future optimization using LayoutState
        // http://bugs.webkit.org/show_bug.cgi?id=15391
        if (selfNeedsLayout())
            child->setNeedsLayout(true);

        child->layoutIfNeeded();
        ASSERT(!child->needsLayout());
    }
    repainter.repaintAfterLayout();

    setNeedsLayout(false);
}
void RenderSVGContainer::layout()
{
    ASSERT(needsLayout());
    ASSERT(!view()->layoutStateEnabled()); // RenderSVGRoot disables layoutState for the SVG rendering tree.

    calcViewport(); // Allow RenderSVGViewportContainer to update its viewport

    LayoutRepainter repainter(*this, checkForRepaintDuringLayout() || selfWillPaint());
    calculateLocalTransform(); // Allow RenderSVGTransformableContainer to update its transform

    layoutChildren(this, selfNeedsLayout());
    repainter.repaintAfterLayout();

    setNeedsLayout(false);
}
void RenderSVGContainer::layout()
{
    ASSERT(needsLayout());

    calcViewport();

    // Arbitrary affine transforms are incompatible with LayoutState.
    view()->disableLayoutState();

    IntRect oldBounds;
    IntRect oldOutlineBox;
    bool checkForRepaint = checkForRepaintDuringLayout();
    if (selfNeedsLayout() && checkForRepaint) {
        oldBounds = m_absoluteBounds;
        oldOutlineBox = absoluteOutlineBox();
    }

    RenderObject* child = firstChild();
    while (child) {
        if (!child->isRenderPath() || static_cast<RenderPath*>(child)->hasRelativeValues())
            child->setNeedsLayout(true);

        child->layoutIfNeeded();
        ASSERT(!child->needsLayout());
        child = child->nextSibling();
    }

    calcWidth();
    calcHeight();

    m_absoluteBounds = absoluteClippedOverflowRect();
    if (!parent()->isSVGContainer()) {
        SVGSVGElement* svg = static_cast<SVGSVGElement*>(element());
        m_width = static_cast<int>(static_cast<float>(m_width) * svg->currentScale());
        m_height = static_cast<int>(static_cast<float>(m_height) * svg->currentScale());
    }

    if (selfNeedsLayout() && checkForRepaint)
        repaintAfterLayoutIfNeeded(oldBounds, oldOutlineBox);

    view()->enableLayoutState();
    setNeedsLayout(false);
}
Example #10
0
void LayoutSVGContainer::layout() {
  ASSERT(needsLayout());
  LayoutAnalyzer::Scope analyzer(*this);

  // Allow LayoutSVGViewportContainer to update its viewport.
  calcViewport();

  // Allow LayoutSVGTransformableContainer to update its transform.
  SVGTransformChange transformChange = calculateLocalTransform();
  m_didScreenScaleFactorChange =
      transformChange == SVGTransformChange::Full ||
      SVGLayoutSupport::screenScaleFactorChanged(parent());

  // LayoutSVGViewportContainer needs to set the 'layout size changed' flag.
  determineIfLayoutSizeChanged();

  // When hasRelativeLengths() is false, no descendants have relative lengths
  // (hence no one is interested in viewport size changes).
  bool layoutSizeChanged =
      element()->hasRelativeLengths() &&
      SVGLayoutSupport::layoutSizeOfNearestViewportChanged(this);

  SVGLayoutSupport::layoutChildren(
      firstChild(), false, m_didScreenScaleFactorChange, layoutSizeChanged);

  // Invalidate all resources of this client if our layout changed.
  if (everHadLayout() && needsLayout())
    SVGResourcesCache::clientLayoutChanged(this);

  if (m_needsBoundariesUpdate || transformChange != SVGTransformChange::None) {
    updateCachedBoundaries();
    m_needsBoundariesUpdate = false;

    // If our bounds changed, notify the parents.
    LayoutSVGModelObject::setNeedsBoundariesUpdate();
  }

  ASSERT(!m_needsBoundariesUpdate);
  clearNeedsLayout();
}