Ejemplo n.º 1
0
bool LayoutSVGImage::updateBoundingBox() {
  FloatRect oldObjectBoundingBox = m_objectBoundingBox;

  SVGLengthContext lengthContext(element());
  m_objectBoundingBox =
      FloatRect(lengthContext.valueForLength(styleRef().svgStyle().x(),
                                             styleRef(), SVGLengthMode::Width),
                lengthContext.valueForLength(styleRef().svgStyle().y(),
                                             styleRef(), SVGLengthMode::Height),
                lengthContext.valueForLength(styleRef().width(), styleRef(),
                                             SVGLengthMode::Width),
                lengthContext.valueForLength(styleRef().height(), styleRef(),
                                             SVGLengthMode::Height));

  if (styleRef().width().isAuto() || styleRef().height().isAuto())
    m_objectBoundingBox.setSize(calculateObjectSize());

  if (oldObjectBoundingBox != m_objectBoundingBox) {
    setShouldDoFullPaintInvalidation();
    m_needsBoundariesUpdate = true;
  }

  if (element())
    element()->setNeedsResizeObserverUpdate();

  return oldObjectBoundingBox.size() != m_objectBoundingBox.size();
}
void LayoutSVGImage::imageChanged(WrappedImagePtr, const IntRect*)
{
    // Notify parent resources that we've changed. This also invalidates
    // references from resources (filters) that may have a cached
    // representation of this image/layout object.
    LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(this, false);

    setShouldDoFullPaintInvalidation();
}
Ejemplo n.º 3
0
void RenderImage::layout()
{
    LayoutRect oldContentRect = replacedContentRect();
    RenderReplaced::layout();
    if (replacedContentRect() != oldContentRect) {
        setShouldDoFullPaintInvalidation(true);
        updateInnerContentRect();
    }
}
Ejemplo n.º 4
0
void RenderView::invalidatePaintForViewAndCompositedLayers()
{
    setShouldDoFullPaintInvalidation();

    // The only way we know how to hit these ASSERTS below this point is via the Chromium OS login screen.
    DisableCompositingQueryAsserts disabler;

    if (compositor()->inCompositingMode())
        compositor()->fullyInvalidatePaint();
}
Ejemplo n.º 5
0
void LayoutProgress::updateFromElement() {
  HTMLProgressElement* element = progressElement();
  if (m_position == element->position())
    return;
  m_position = element->position();

  updateAnimationState();
  setShouldDoFullPaintInvalidation();
  LayoutBlockFlow::updateFromElement();
}
Ejemplo n.º 6
0
void LayoutListMarker::imageChanged(WrappedImagePtr o, const IntRect*)
{
    // A list marker can't have a background or border image, so no need to call the base class method.
    if (o != m_image->data())
        return;

    LayoutSize imageSize = isImage() ? imageBulletSize() : LayoutSize();
    if (size() != imageSize || m_image->errorOccurred())
        setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(LayoutInvalidationReason::ImageChanged);
    else
        setShouldDoFullPaintInvalidation();
}
Ejemplo n.º 7
0
void LayoutSVGImage::imageChanged(WrappedImagePtr, const IntRect*) {
  // Notify parent resources that we've changed. This also invalidates
  // references from resources (filters) that may have a cached
  // representation of this image/layout object.
  LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(this,
                                                                         false);

  if (styleRef().width().isAuto() || styleRef().height().isAuto()) {
    if (updateBoundingBox())
      setNeedsLayout(LayoutInvalidationReason::SizeChanged);
  }

  setShouldDoFullPaintInvalidation();
}
void LayoutSliderContainer::layout()
{
    HTMLInputElement* input = toHTMLInputElement(node()->shadowHost());
    bool isVertical = hasVerticalAppearance(input);
    mutableStyleRef().setFlexDirection(isVertical ? FlowColumn : FlowRow);
    TextDirection oldTextDirection = style()->direction();
    if (isVertical) {
        // FIXME: Work around rounding issues in RTL vertical sliders. We want them to
        // render identically to LTR vertical sliders. We can remove this work around when
        // subpixel rendering is enabled on all ports.
        mutableStyleRef().setDirection(LTR);
    }

    Element* thumbElement = input->userAgentShadowRoot()->getElementById(ShadowElementNames::sliderThumb());
    Element* trackElement = input->userAgentShadowRoot()->getElementById(ShadowElementNames::sliderTrack());
    LayoutBox* thumb = thumbElement ? thumbElement->layoutBox() : 0;
    LayoutBox* track = trackElement ? trackElement->layoutBox() : 0;

    SubtreeLayoutScope layoutScope(*this);
    // Force a layout to reset the position of the thumb so the code below doesn't move the thumb to the wrong place.
    // FIXME: Make a custom layout class for the track and move the thumb positioning code there.
    if (track)
        layoutScope.setChildNeedsLayout(track);

    LayoutFlexibleBox::layout();

    mutableStyleRef().setDirection(oldTextDirection);
    // These should always exist, unless someone mutates the shadow DOM (e.g., in the inspector).
    if (!thumb || !track)
        return;

    double percentageOffset = sliderPosition(input).toDouble();
    LayoutUnit availableExtent = isVertical ? track->contentHeight() : track->contentWidth();
    availableExtent -= isVertical ? thumb->size().height() : thumb->size().width();
    LayoutUnit offset = percentageOffset * availableExtent;
    LayoutPoint thumbLocation = thumb->location();
    if (isVertical)
        thumbLocation.setY(thumbLocation.y() + track->contentHeight() - thumb->size().height() - offset);
    else if (style()->isLeftToRightDirection())
        thumbLocation.setX(thumbLocation.x() + offset);
    else
        thumbLocation.setX(thumbLocation.x() - offset);
    thumb->setLocation(thumbLocation);

    // We need one-off invalidation code here because painting of the timeline element does not go through style.
    // Instead it has a custom implementation in C++ code.
    // Therefore the style system cannot understand when it needs to be paint invalidated.
    setShouldDoFullPaintInvalidation();
}
Ejemplo n.º 9
0
void LayoutSVGImage::imageChanged(WrappedImagePtr, const IntRect*)
{
    // Notify parent resources that we've changed. This also invalidates
    // references from resources (filters) that may have a cached
    // representation of this image/layout object.
    LayoutSVGResourceContainer::markForLayoutAndParentResourceInvalidation(this, false);

    // Update the SVGImageCache sizeAndScales entry in case image loading finished after layout.
    // (https://bugs.webkit.org/show_bug.cgi?id=99489)
    updateImageContainerSize();

    m_bufferedForeground.clear();

    setShouldDoFullPaintInvalidation();
}
void LayoutPart::updateOnWidgetChange()
{
    Widget* widget = this->widget();
    if (!widget)
        return;

    if (!style())
        return;

    if (!needsLayout())
        updateWidgetGeometryInternal();

    if (style()->visibility() != VISIBLE) {
        widget->hide();
    } else {
        widget->show();
        // FIXME: Why do we issue a full paint invalidation in this case, but not the other?
        setShouldDoFullPaintInvalidation();
    }
}
Ejemplo n.º 11
0
void RenderReplaced::layout()
{
    ASSERT(needsLayout());

    LayoutRect oldContentRect = replacedContentRect();

    setHeight(minimumReplacedHeight());

    updateLogicalWidth();
    updateLogicalHeight();

    m_overflow.clear();
    addVisualEffectOverflow();
    updateLayerTransformAfterLayout();
    invalidateBackgroundObscurationStatus();

    clearNeedsLayout();

    if (replacedContentRect() != oldContentRect)
        setShouldDoFullPaintInvalidation();
}
Ejemplo n.º 12
0
void LayoutSVGShape::layout() {
  LayoutAnalyzer::Scope analyzer(*this);

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

  bool updateParentBoundaries = false;
  // updateShapeFromElement() also updates the object & stroke bounds - which
  // feeds into the visual rect - so we need to call it for both the
  // shape-update and the bounds-update flag.
  if (m_needsShapeUpdate || m_needsBoundariesUpdate) {
    FloatRect oldObjectBoundingBox = objectBoundingBox();
    updateShapeFromElement();
    if (oldObjectBoundingBox != objectBoundingBox())
      setShouldDoFullPaintInvalidation();
    m_needsShapeUpdate = false;

    m_localVisualRect = strokeBoundingBox();
    SVGLayoutSupport::adjustVisualRectWithResources(this, m_localVisualRect);
    m_needsBoundariesUpdate = false;

    updateParentBoundaries = true;
  }

  if (m_needsTransformUpdate) {
    updateLocalTransform();
    m_needsTransformUpdate = false;
    updateParentBoundaries = true;
  }

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

  ASSERT(!m_needsShapeUpdate);
  ASSERT(!m_needsBoundariesUpdate);
  ASSERT(!m_needsTransformUpdate);
  clearNeedsLayout();
}
Ejemplo n.º 13
0
void LayoutReplaced::layout()
{
    ASSERT(needsLayout());
    LayoutAnalyzer::Scope analyzer(*this);

    LayoutRect oldContentRect = replacedContentRect();

    setHeight(minimumReplacedHeight());

    updateLogicalWidth();
    updateLogicalHeight();

    m_overflow.clear();
    addVisualEffectOverflow();
    updateLayerTransformAfterLayout();
    invalidateBackgroundObscurationStatus();

    clearNeedsLayout();

    if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && replacedContentRect() != oldContentRect)
        setShouldDoFullPaintInvalidation();
}
void LayoutTableBoxComponent::imageChanged(WrappedImagePtr, const IntRect*)
{
    setShouldDoFullPaintInvalidation();
    m_backgroundChangedSinceLastPaintInvalidation = true;
}
Ejemplo n.º 15
0
void LayoutProgress::animationTimerFired(Timer<LayoutProgress>*)
{
    setShouldDoFullPaintInvalidation();
    if (!m_animationTimer.isActive() && m_animating)
        m_animationTimer.startOneShot(m_animationRepeatInterval, BLINK_FROM_HERE);
}