예제 #1
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();
}
예제 #2
0
void RenderSVGText::layout()
{
    ASSERT(needsLayout());
    
    // FIXME: This is a hack to avoid the RenderBlock::layout() partial repainting code which is not (yet) SVG aware
    setNeedsLayout(true);

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

    // Best guess for a relative starting point
    SVGTextElement* text = static_cast<SVGTextElement*>(element());
    int xOffset = (int)(text->x()->getFirst().value(text));
    int yOffset = (int)(text->y()->getFirst().value(text));
    setPos(xOffset, yOffset);
    
    calculateLocalTransform();

    RenderBlock::layout();

    m_absoluteBounds = absoluteClippedOverflowRect();

    bool repainted = false;
    if (checkForRepaint)
        repainted = repaintAfterLayoutIfNeeded(oldBounds, oldOutlineBox);
    
    setNeedsLayout(false);
}
예제 #3
0
void RenderForeignObject::layout()
{
    ASSERT(needsLayout());

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

    IntRect oldBounds;
    IntRect oldOutlineBox;
    bool checkForRepaint = checkForRepaintDuringLayout();
    if (checkForRepaint) {
        oldBounds = m_absoluteBounds;
        oldOutlineBox = absoluteOutlineBox();
    }
    
    calculateLocalTransform();
    
    RenderBlock::layout();

    m_absoluteBounds = absoluteClippedOverflowRect();

    if (checkForRepaint)
        repaintAfterLayoutIfNeeded(oldBounds, oldOutlineBox);

    view()->enableLayoutState();
    setNeedsLayout(false);
}
예제 #4
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);
}
예제 #5
0
void
Entity::update(float pDelta) {
    if ( mDirty ) {
        mUpdatedThisFrame = true;
        mLocalTransform = calculateLocalTransform();
        mDirty = false;
    }
    if ( mParent != NULL && mParent->isUpdatedThisFrame() ) {
        mUpdatedThisFrame = true;
    }
    if ( mUpdatedThisFrame ) {
        if ( mParent != NULL ) {
            mWorldTransform = mLocalTransform*mParent->getWorldTransform();
        } else {
            mWorldTransform = mLocalTransform;
        }
    }
    for ( auto it = mChildren.begin(); it != mChildren.end(); ++it ) {
        (*it)->update(pDelta);
    }
    for ( auto it = mComponents.begin(); it != mComponents.end(); ++it ) {
        (*it)->update(pDelta);
    }
    mUpdatedThisFrame = false;
}
예제 #6
0
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);
}
예제 #7
0
파일: Node.cpp 프로젝트: uudens/ouzel
        void Node::calculateTransform() const
        {
            if (localTransformDirty)
            {
                calculateLocalTransform();
            }

            transform = parentTransform * localTransform;
            transformDirty = false;

            updateChildrenTransform = true;
        }
예제 #8
0
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);
}
예제 #9
0
void RenderPath::layout()
{
    // FIXME: using m_absoluteBounds breaks if containerForRepaint() is not the root
    LayoutRepainter repainter(*this, checkForRepaintDuringLayout() && selfNeedsLayout(), &m_absoluteBounds);
    
    calculateLocalTransform();

    setPath(static_cast<SVGStyledTransformableElement*>(element())->toPathData());

    m_absoluteBounds = absoluteClippedOverflowRect();

    repainter.repaintAfterLayout();

    setNeedsLayout(false);
}
예제 #10
0
void    
Entity::init(Renderer* pRenderer, ResourceLoader* pResourceLoader) {
    mLocalTransform = calculateLocalTransform();
    if ( mParent ) {
        mWorldTransform = mLocalTransform*mParent->getWorldTransform();
    } else {
        mWorldTransform = mLocalTransform;
    }
    for ( auto it = mChildren.begin(); it != mChildren.end(); ++it ) {
        (*it)->init(pRenderer, pResourceLoader);
    }
    for ( auto it = mComponents.begin(); it != mComponents.end(); ++it ) {
        (*it)->init(pRenderer, pResourceLoader);
    }
}
void RenderForeignObject::layout()
{
    ASSERT(needsLayout());

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

    // FIXME: using m_absoluteBounds breaks if containerForRepaint() is not the root
    LayoutRepainter repainter(*this, checkForRepaintDuringLayout(), &m_absoluteBounds);
    
    calculateLocalTransform();
    
    RenderBlock::layout();

    m_absoluteBounds = absoluteClippedOverflowRect();

    repainter.repaintAfterLayout();

    view()->enableLayoutState();
    setNeedsLayout(false);
}
예제 #12
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();
}
예제 #13
0
void RenderSVGImage::layout()
{
    ASSERT(needsLayout());
    
    LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
    
    calculateLocalTransform();
    
    // minimum height
    setHeight(errorOccurred() ? intrinsicSize().height() : 0);

    calcWidth();
    calcHeight();

    SVGImageElement* image = static_cast<SVGImageElement*>(node());
    m_localBounds = FloatRect(image->x().value(image), image->y().value(image), image->width().value(image), image->height().value(image));

    calculateAbsoluteBounds();

    repainter.repaintAfterLayout();
    
    setNeedsLayout(false);
}
예제 #14
0
void RenderSVGContainer::layout()
{
    ASSERT(needsLayout());

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

    IntRect oldBounds;
    IntRect oldOutlineBox;
    bool checkForRepaint = checkForRepaintDuringLayout() && selfWillPaint();
    if (checkForRepaint) {
        oldBounds = m_absoluteBounds;
        oldOutlineBox = absoluteOutlineBounds();
    }
    
    calculateLocalTransform();

    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());
    }

    calcBounds();

    if (checkForRepaint)
        repaintAfterLayoutIfNeeded(oldBounds, oldOutlineBox);

    view()->enableLayoutState();
    setNeedsLayout(false);
}