Changeset 107760 in webkit


Ignore:
Timestamp:
Feb 14, 2012 5:20:32 PM (12 years ago)
Author:
leviw@chromium.org
Message:

Prepare RenderLayerBacking and RenderLayerCompositor for subpixel layout
https://bugs.webkit.org/show_bug.cgi?id=78630

Reviewed by Simon Fraser.

In our transition to subpixel layout in the render tree, we continue to pass RenderLayerBacking
and RenderLayerCompositor integer (pixel) sizes and positions. This patch moves nearly all
methods and members on these two classes back to integers, and applies pixel snapping logic to
LayoutUnits pulled in.

No new tests. No change in behavior.

  • rendering/RenderBox.h:

(WebCore::RenderBox::pixelSnappedLayoutOverflowRect): Convenience function for getting pixel
snapped overflow bounds.

  • rendering/RenderLayerBacking.cpp:

(WebCore):
(WebCore::RenderLayerBacking::updateCompositedBounds): Switch to integers and pixel snapping the
clipping bounds.
(WebCore::clipBox): Returns a pixel snapped rect.
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): Using pixelSnappedLayerCoords. Removing
pixelSnappedIntRect calls to clipBox since this is now an IntRect.
(WebCore::RenderLayerBacking::computeTransformOrigin): Switching to operate on a pixel snapped rect.
(WebCore::RenderLayerBacking::computePerspectiveOrigin): Ditto.
(WebCore::RenderLayerBacking::contentOffsetInCompostingLayer): Returns a size based on m_compositingBounds,
which is now an IntSize.
(WebCore::RenderLayerBacking::contentsBox): Switching to use pixel snapped values from the render tree.
(WebCore::RenderLayerBacking::setContentsNeedDisplayInRect): This now takes in and outputs integers.
(WebCore::RenderLayerBacking::paintIntoLayer): Uses a pixel snapped rect for the dirty rect.
(WebCore::paintScrollbar): Scrollbars are Widgets & painted natively, so they should use integers.
(WebCore::RenderLayerBacking::paintContents): We now properly take in an integer clip rect, as it's
used for the scrollbars.
(WebCore::RenderLayerBacking::startAnimation): Using pixel snapped values for animations and transitions.
(WebCore::RenderLayerBacking::startTransition): Ditto.
(WebCore::RenderLayerBacking::compositedBounds): Composited bounds are now properly stored as integers.
(WebCore::RenderLayerBacking::setCompositedBounds): Ditto.

  • rendering/RenderLayerBacking.h:

(RenderLayerBacking):

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::calculateCompositedBounds): Composited bounds are pixel snapped, but
we use LayoutUnits up until we snap and return.
(WebCore::RenderLayerCompositor::addToOverlapMap): Overlap mapping uses our integer positions. Switching
it back to operating on them.
(WebCore::RenderLayerCompositor::addToOverlapMapRecursive): Ditto.
(WebCore::RenderLayerCompositor::overlapsCompositedLayers): Ditto.
(WebCore::RenderLayerCompositor::computeCompositingRequirements): Using integers.
(WebCore::RenderLayerCompositor::frameViewDidChangeLocation): FrameViews are on integer bounds. We now
properly use these as integers.
(WebCore::RenderLayerCompositor::frameViewDidScroll): Ditto.
(WebCore::RenderLayerCompositor::recursiveRepaintLayerRect): Switching to use integers and
pixelSnappedLayerCoords.
(WebCore::RenderLayerCompositor::repaintCompositedLayersAbsoluteRect): Ditto.
(WebCore::RenderLayerCompositor::updateRootLayerPosition): Using integer positions, which are what
the apis used already returned.
(WebCore::RenderLayerCompositor::requiresCompositingForPlugin): Using pixel snapped values.
(WebCore::RenderLayerCompositor::requiresCompositingForFrame): Ditto.
(WebCore::paintScrollbar): Scrollbars should always use integers.
(WebCore::RenderLayerCompositor::paintContents): Switching to use an integer clip rect.
(WebCore::RenderLayerCompositor::ensureRootLayer): Using values from new pixelSnappedLayoutOverflowRect
method on RenderBox to ensure we're using values that are pixel snapped to the proper location.
(WebCore::RenderLayerCompositor::destroyRootLayer): Properly calling scrollbar invalidation methods
with integers.

  • rendering/RenderLayerCompositor.h:

(RenderLayerCompositor):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r107758 r107760  
     12012-02-14  Levi Weintraub  <leviw@chromium.org>
     2
     3        Prepare RenderLayerBacking and RenderLayerCompositor for subpixel layout
     4        https://bugs.webkit.org/show_bug.cgi?id=78630
     5
     6        Reviewed by Simon Fraser.
     7
     8        In our transition to subpixel layout in the render tree, we continue to pass RenderLayerBacking
     9        and RenderLayerCompositor integer (pixel) sizes and positions. This patch moves nearly all
     10        methods and members on these two classes back to integers, and applies pixel snapping logic to
     11        LayoutUnits pulled in.
     12
     13        No new tests. No change in behavior.
     14
     15        * rendering/RenderBox.h:
     16        (WebCore::RenderBox::pixelSnappedLayoutOverflowRect): Convenience function for getting pixel
     17        snapped overflow bounds.
     18        * rendering/RenderLayerBacking.cpp:
     19        (WebCore):
     20        (WebCore::RenderLayerBacking::updateCompositedBounds): Switch to integers and pixel snapping the
     21        clipping bounds.
     22        (WebCore::clipBox): Returns a pixel snapped rect.
     23        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): Using pixelSnappedLayerCoords. Removing
     24        pixelSnappedIntRect calls to clipBox since this is now an IntRect.
     25        (WebCore::RenderLayerBacking::computeTransformOrigin): Switching to operate on a pixel snapped rect.
     26        (WebCore::RenderLayerBacking::computePerspectiveOrigin): Ditto.
     27        (WebCore::RenderLayerBacking::contentOffsetInCompostingLayer): Returns a size based on m_compositingBounds,
     28        which is now an IntSize.
     29        (WebCore::RenderLayerBacking::contentsBox): Switching to use pixel snapped values from the render tree.
     30        (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect): This now takes in and outputs integers.
     31        (WebCore::RenderLayerBacking::paintIntoLayer): Uses a pixel snapped rect for the dirty rect.
     32        (WebCore::paintScrollbar): Scrollbars are Widgets & painted natively, so they should use integers.
     33        (WebCore::RenderLayerBacking::paintContents): We now properly take in an integer clip rect, as it's
     34        used for the scrollbars.
     35        (WebCore::RenderLayerBacking::startAnimation): Using pixel snapped values for animations and transitions.
     36        (WebCore::RenderLayerBacking::startTransition): Ditto.
     37        (WebCore::RenderLayerBacking::compositedBounds): Composited bounds are now properly stored as integers.
     38        (WebCore::RenderLayerBacking::setCompositedBounds): Ditto.
     39        * rendering/RenderLayerBacking.h:
     40        (RenderLayerBacking):
     41        * rendering/RenderLayerCompositor.cpp:
     42        (WebCore::RenderLayerCompositor::calculateCompositedBounds): Composited bounds are pixel snapped, but
     43        we use LayoutUnits up until we snap and return.
     44        (WebCore::RenderLayerCompositor::addToOverlapMap): Overlap mapping uses our integer positions. Switching
     45        it back to operating on them.
     46        (WebCore::RenderLayerCompositor::addToOverlapMapRecursive): Ditto.
     47        (WebCore::RenderLayerCompositor::overlapsCompositedLayers): Ditto.
     48        (WebCore::RenderLayerCompositor::computeCompositingRequirements): Using integers.
     49        (WebCore::RenderLayerCompositor::frameViewDidChangeLocation): FrameViews are on integer bounds. We now
     50        properly use these as integers.
     51        (WebCore::RenderLayerCompositor::frameViewDidScroll): Ditto.
     52        (WebCore::RenderLayerCompositor::recursiveRepaintLayerRect): Switching to use integers and
     53        pixelSnappedLayerCoords.
     54        (WebCore::RenderLayerCompositor::repaintCompositedLayersAbsoluteRect): Ditto.
     55        (WebCore::RenderLayerCompositor::updateRootLayerPosition): Using integer positions, which are what
     56        the apis used already returned.
     57        (WebCore::RenderLayerCompositor::requiresCompositingForPlugin): Using pixel snapped values.
     58        (WebCore::RenderLayerCompositor::requiresCompositingForFrame): Ditto.
     59        (WebCore::paintScrollbar): Scrollbars should always use integers.
     60        (WebCore::RenderLayerCompositor::paintContents): Switching to use an integer clip rect.
     61        (WebCore::RenderLayerCompositor::ensureRootLayer): Using values from new pixelSnappedLayoutOverflowRect
     62        method on RenderBox to ensure we're using values that are pixel snapped to the proper location.
     63        (WebCore::RenderLayerCompositor::destroyRootLayer): Properly calling scrollbar invalidation methods
     64        with integers.
     65        * rendering/RenderLayerCompositor.h:
     66        (RenderLayerCompositor):
     67
    1682012-02-14  Anders Carlsson  <andersca@apple.com>
    269
  • trunk/Source/WebCore/rendering/RenderBox.h

    r107032 r107760  
    152152    // but it is on the right in vertical-rl.
    153153    LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : clientBoxRect(); }
     154    IntRect pixelSnappedLayoutOverflowRect() const { return pixelSnappedIntRect(layoutOverflowRect()); }
    154155    LayoutUnit minYLayoutOverflow() const { return m_overflow? m_overflow->minYLayoutOverflow() : borderTop(); }
    155156    LayoutUnit maxYLayoutOverflow() const { return m_overflow ? m_overflow->maxYLayoutOverflow() : borderTop() + clientHeight(); }
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r107461 r107760  
    7171static bool hasBoxDecorationsOrBackground(const RenderObject*);
    7272static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle*);
    73 static LayoutRect clipBox(RenderBox* renderer);
     73static IntRect clipBox(RenderBox* renderer);
    7474
    7575static inline bool isAcceleratedCanvas(RenderObject* renderer)
     
    230230void RenderLayerBacking::updateCompositedBounds()
    231231{
    232     LayoutRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer);
     232    IntRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer);
    233233
    234234    // Clip to the size of the document or enclosing overflow-scroll layer.
     
    255255        clippingBounds.move(-delta.x(), -delta.y());
    256256
    257         layerBounds.intersect(clippingBounds);
     257        layerBounds.intersect(pixelSnappedIntRect(clippingBounds));
    258258    }
    259259   
     
    372372}
    373373
    374 static LayoutRect clipBox(RenderBox* renderer)
     374static IntRect clipBox(RenderBox* renderer)
    375375{
    376376    LayoutRect result = PaintInfo::infiniteRect();
     
    381381        result.intersect(renderer->clipRect(LayoutPoint(), 0)); // FIXME: Incorrect for CSS regions.
    382382
    383     return result;
     383    return pixelSnappedIntRect(result);
    384384}
    385385
     
    427427    IntRect relativeCompositingBounds(localCompositingBounds);
    428428    IntPoint delta;
    429     m_owningLayer->convertToLayerCoords(compAncestor, delta);
     429    m_owningLayer->convertToPixelSnappedLayerCoords(compAncestor, delta);
    430430    relativeCompositingBounds.moveBy(delta);
    431431
    432     LayoutPoint graphicsLayerParentLocation;
     432    IntPoint graphicsLayerParentLocation;
    433433    if (compAncestor && compAncestor->backing()->hasClippingLayer()) {
    434434        // If the compositing ancestor has a layer to clip children, we parent in that, and therefore
    435435        // position relative to it.
    436         IntRect clippingBox = pixelSnappedIntRect(clipBox(toRenderBox(compAncestor->renderer())));
     436        IntRect clippingBox = clipBox(toRenderBox(compAncestor->renderer()));
    437437        graphicsLayerParentLocation = clippingBox.location();
    438438    } else if (compAncestor)
     
    473473    IntRect clippingBox;
    474474    if (m_clippingLayer) {
    475         clippingBox = pixelSnappedIntRect(clipBox(toRenderBox(renderer())));
     475        clippingBox = clipBox(toRenderBox(renderer()));
    476476        m_clippingLayer->setPosition(FloatPoint() + (clippingBox.location() - localCompositingBounds.location()));
    477477        m_clippingLayer->setSize(clippingBox.size());
    478         m_clippingLayer->setOffsetFromRenderer(clippingBox.location() - LayoutPoint());
     478        m_clippingLayer->setOffsetFromRenderer(clippingBox.location() - IntPoint());
    479479    }
    480480   
     
    549549    }
    550550
    551     m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox()));
     551    m_graphicsLayer->setContentsRect(contentsBox());
    552552    updateDrawsContent();
    553553    updateAfterWidgetResize();
     
    10031003}
    10041004
    1005 FloatPoint3D RenderLayerBacking::computeTransformOrigin(const LayoutRect& borderBox) const
     1005FloatPoint3D RenderLayerBacking::computeTransformOrigin(const IntRect& borderBox) const
    10061006{
    10071007    RenderStyle* style = renderer()->style();
     
    10151015}
    10161016
    1017 FloatPoint RenderLayerBacking::computePerspectiveOrigin(const LayoutRect& borderBox) const
     1017FloatPoint RenderLayerBacking::computePerspectiveOrigin(const IntRect& borderBox) const
    10181018{
    10191019    RenderStyle* style = renderer()->style();
     
    10301030
    10311031// Return the offset from the top-left of this compositing layer at which the renderer's contents are painted.
    1032 LayoutSize RenderLayerBacking::contentOffsetInCompostingLayer() const
    1033 {
    1034     return LayoutSize(-m_compositedBounds.x(), -m_compositedBounds.y());
    1035 }
    1036 
    1037 LayoutRect RenderLayerBacking::contentsBox() const
     1032IntSize RenderLayerBacking::contentOffsetInCompostingLayer() const
     1033{
     1034    return IntSize(-m_compositedBounds.x(), -m_compositedBounds.y());
     1035}
     1036
     1037IntRect RenderLayerBacking::contentsBox() const
    10381038{
    10391039    if (!renderer()->isBox())
    1040         return LayoutRect();
    1041 
    1042     LayoutRect contentsRect;
     1040        return IntRect();
     1041
     1042    IntRect contentsRect;
    10431043#if ENABLE(VIDEO)
    10441044    if (renderer()->isVideo()) {
     
    10471047    } else
    10481048#endif
    1049         contentsRect = toRenderBox(renderer())->contentBoxRect();
    1050 
    1051     LayoutSize contentOffset = contentOffsetInCompostingLayer();
     1049        contentsRect = pixelSnappedIntRect(toRenderBox(renderer())->contentBoxRect());
     1050
     1051    IntSize contentOffset = contentOffsetInCompostingLayer();
    10521052    contentsRect.move(contentOffset);
    10531053    return contentsRect;
     
    10781078
    10791079// r is in the coordinate space of the layer's render object
    1080 void RenderLayerBacking::setContentsNeedDisplayInRect(const LayoutRect& r)
     1080void RenderLayerBacking::setContentsNeedDisplayInRect(const IntRect& r)
    10811081{
    10821082    if (m_graphicsLayer && m_graphicsLayer->drawsContent()) {
    1083         LayoutRect layerDirtyRect = r;
     1083        IntRect layerDirtyRect = r;
    10841084        layerDirtyRect.move(-m_graphicsLayer->offsetFromRenderer());
    10851085        m_graphicsLayer->setNeedsDisplayInRect(layerDirtyRect);
     
    10871087
    10881088    if (m_foregroundLayer && m_foregroundLayer->drawsContent()) {
    1089         LayoutRect layerDirtyRect = r;
     1089        IntRect layerDirtyRect = r;
    10901090        layerDirtyRect.move(-m_foregroundLayer->offsetFromRenderer());
    10911091        m_foregroundLayer->setNeedsDisplayInRect(layerDirtyRect);
     
    10931093
    10941094    if (m_maskLayer && m_maskLayer->drawsContent()) {
    1095         LayoutRect layerDirtyRect = r;
     1095        IntRect layerDirtyRect = r;
    10961096        layerDirtyRect.move(-m_maskLayer->offsetFromRenderer());
    10971097        m_maskLayer->setNeedsDisplayInRect(layerDirtyRect);
     
    11001100
    11011101void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* context,
    1102                     const LayoutRect& paintDirtyRect, // In the coords of rootLayer.
     1102                    const IntRect& paintDirtyRect, // In the coords of rootLayer.
    11031103                    PaintBehavior paintBehavior, GraphicsLayerPaintingPhase paintingPhase,
    11041104                    RenderObject* paintingRoot)
     
    11251125}
    11261126
    1127 static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const LayoutRect& clip)
     1127static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip)
    11281128{
    11291129    if (!scrollbar)
     
    11311131
    11321132    context.save();
    1133     const LayoutRect& scrollbarRect = scrollbar->frameRect();
     1133    const IntRect& scrollbarRect = scrollbar->frameRect();
    11341134    context.translate(-scrollbarRect.x(), -scrollbarRect.y());
    1135     LayoutRect transformedClip = clip;
     1135    IntRect transformedClip = clip;
    11361136    transformedClip.moveBy(scrollbarRect.location());
    1137     scrollbar->paint(&context, pixelSnappedIntRect(transformedClip));
     1137    scrollbar->paint(&context, transformedClip);
    11381138    context.restore();
    11391139}
    11401140
    11411141// Up-call from compositing layer drawing callback.
    1142 void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const LayoutRect& clip)
     1142void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const IntRect& clip)
    11431143{
    11441144    if (graphicsLayer == m_graphicsLayer.get() || graphicsLayer == m_foregroundLayer.get() || graphicsLayer == m_maskLayer.get()) {
     
    11461146
    11471147        // The dirtyRect is in the coords of the painting root.
    1148         LayoutRect dirtyRect = compositedBounds();
     1148        IntRect dirtyRect = compositedBounds();
    11491149        dirtyRect.intersect(clip);
    11501150
     
    11581158        paintScrollbar(m_owningLayer->verticalScrollbar(), context, clip);
    11591159    } else if (graphicsLayer == layerForScrollCorner()) {
    1160         const LayoutRect& scrollCornerAndResizer = m_owningLayer->scrollCornerAndResizerRect();
     1160        const IntRect& scrollCornerAndResizer = m_owningLayer->scrollCornerAndResizerRect();
    11611161        context.save();
    11621162        context.translate(-scrollCornerAndResizer.x(), -scrollCornerAndResizer.y());
    1163         LayoutRect transformedClip = clip;
    1164         transformedClip.moveBy(roundedIntPoint(scrollCornerAndResizer.location()));
    1165         m_owningLayer->paintScrollCorner(&context, LayoutPoint(), transformedClip);
    1166         m_owningLayer->paintResizer(&context, LayoutPoint(), transformedClip);
     1163        IntRect transformedClip = clip;
     1164        transformedClip.moveBy(scrollCornerAndResizer.location());
     1165        m_owningLayer->paintScrollCorner(&context, IntPoint(), transformedClip);
     1166        m_owningLayer->paintResizer(&context, IntPoint(), transformedClip);
    11671167        context.restore();
    11681168    }
     
    12441244#endif
    12451245   
    1246     if (hasTransform && m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->borderBoxRect().size(), anim, keyframes.animationName(), timeOffset)) {
     1246    if (hasTransform && m_graphicsLayer->addAnimation(transformVector, pixelSnappedIntRect(toRenderBox(renderer())->borderBoxRect()).size(), anim, keyframes.animationName(), timeOffset)) {
    12471247        didAnimateTransform = true;
    12481248        compositor()->didStartAcceleratedAnimation(CSSPropertyWebkitTransform);
    12491249    }
    12501250
    1251     if (hasOpacity && m_graphicsLayer->addAnimation(opacityVector, LayoutSize(), anim, keyframes.animationName(), timeOffset)) {
     1251    if (hasOpacity && m_graphicsLayer->addAnimation(opacityVector, IntSize(), anim, keyframes.animationName(), timeOffset)) {
    12521252        didAnimateOpacity = true;
    12531253        compositor()->didStartAcceleratedAnimation(CSSPropertyOpacity);
     
    12551255
    12561256#if ENABLE(CSS_FILTERS)
    1257     if (hasFilter && m_graphicsLayer->addAnimation(filterVector, LayoutSize(), anim, keyframes.animationName(), timeOffset)) {
     1257    if (hasFilter && m_graphicsLayer->addAnimation(filterVector, IntSize(), anim, keyframes.animationName(), timeOffset)) {
    12581258        didAnimateFilter = true;
    12591259        compositor()->didStartAcceleratedAnimation(CSSPropertyWebkitFilter);
     
    12951295            opacityVector.insert(new FloatAnimationValue(1, compositingOpacity(toStyle->opacity())));
    12961296            // The boxSize param is only used for transform animations (which can only run on RenderBoxes), so we pass an empty size here.
    1297             if (m_graphicsLayer->addAnimation(opacityVector, LayoutSize(), opacityAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyOpacity), timeOffset)) {
     1297            if (m_graphicsLayer->addAnimation(opacityVector, IntSize(), opacityAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyOpacity), timeOffset)) {
    12981298                // To ensure that the correct opacity is visible when the animation ends, also set the final opacity.
    12991299                updateLayerOpacity(toStyle);
     
    13091309            transformVector.insert(new TransformAnimationValue(0, &fromStyle->transform()));
    13101310            transformVector.insert(new TransformAnimationValue(1, &toStyle->transform()));
    1311             if (m_graphicsLayer->addAnimation(transformVector, toRenderBox(renderer())->borderBoxRect().size(), transformAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitTransform), timeOffset)) {
     1311            if (m_graphicsLayer->addAnimation(transformVector, pixelSnappedIntRect(toRenderBox(renderer())->borderBoxRect()).size(), transformAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitTransform), timeOffset)) {
    13121312                // To ensure that the correct transform is visible when the animation ends, also set the final transform.
    13131313                updateLayerTransform(toStyle);
     
    13241324            filterVector.insert(new FilterAnimationValue(0, &fromStyle->filter()));
    13251325            filterVector.insert(new FilterAnimationValue(1, &toStyle->filter()));
    1326             if (m_graphicsLayer->addAnimation(filterVector, LayoutSize(), filterAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitFilter), timeOffset)) {
     1326            if (m_graphicsLayer->addAnimation(filterVector, IntSize(), filterAnim, GraphicsLayer::animationNameForTransition(AnimatedPropertyWebkitFilter), timeOffset)) {
    13271327                // To ensure that the correct filter is visible when the animation ends, also set the final filter.
    13281328                updateLayerFilters(toStyle);
     
    13871387}
    13881388
    1389 LayoutRect RenderLayerBacking::compositedBounds() const
     1389IntRect RenderLayerBacking::compositedBounds() const
    13901390{
    13911391    return m_compositedBounds;
    13921392}
    13931393
    1394 void RenderLayerBacking::setCompositedBounds(const LayoutRect& bounds)
     1394void RenderLayerBacking::setCompositedBounds(const IntRect& bounds)
    13951395{
    13961396    m_compositedBounds = bounds;
  • trunk/Source/WebCore/rendering/RenderLayerBacking.h

    r105757 r107760  
    100100    void setContentsNeedDisplay();
    101101    // r is in the coordinate space of the layer's render object
    102     void setContentsNeedDisplayInRect(const LayoutRect&);
     102    void setContentsNeedDisplayInRect(const IntRect&);
    103103
    104104    // Notification from the renderer that its content changed.
     
    117117    void resumeAnimations();
    118118
    119     LayoutRect compositedBounds() const;
    120     void setCompositedBounds(const LayoutRect&);
     119    IntRect compositedBounds() const;
     120    void setCompositedBounds(const IntRect&);
    121121    void updateCompositedBounds();
    122122   
     
    128128    virtual void notifySyncRequired(const GraphicsLayer*);
    129129
    130     virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const LayoutRect& clip);
     130    virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& clip);
    131131
    132132    virtual float deviceScaleFactor() const;
     
    137137    virtual bool showRepaintCounter(const GraphicsLayer*) const;
    138138
    139     LayoutRect contentsBox() const;
     139    IntRect contentsBox() const;
    140140   
    141141    // For informative purposes only.
     
    170170    GraphicsLayerPaintingPhase paintingPhaseForPrimaryLayer() const;
    171171   
    172     LayoutSize contentOffsetInCompostingLayer() const;
     172    IntSize contentOffsetInCompostingLayer() const;
    173173    // Result is transform origin in pixels.
    174     FloatPoint3D computeTransformOrigin(const LayoutRect& borderBox) const;
     174    FloatPoint3D computeTransformOrigin(const IntRect& borderBox) const;
    175175    // Result is perspective origin in pixels.
    176     FloatPoint computePerspectiveOrigin(const LayoutRect& borderBox) const;
     176    FloatPoint computePerspectiveOrigin(const IntRect& borderBox) const;
    177177
    178178    void updateLayerOpacity(const RenderStyle*);
     
    201201    bool hasVisibleNonCompositingDescendantLayers() const;
    202202   
    203     void paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*, const LayoutRect& paintDirtyRect, PaintBehavior, GraphicsLayerPaintingPhase, RenderObject* paintingRoot);
     203    void paintIntoLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect, PaintBehavior, GraphicsLayerPaintingPhase, RenderObject* paintingRoot);
    204204
    205205    static int graphicsLayerToCSSProperty(AnimatedPropertyID);
     
    222222    OwnPtr<GraphicsLayer> m_layerForScrollCorner;
    223223
    224     LayoutRect m_compositedBounds;
     224    IntRect m_compositedBounds;
    225225
    226226    bool m_artificiallyInflatedBounds;      // bounds had to be made non-zero to make transform-origin work
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r107657 r107760  
    457457// The bounds of the GraphicsLayer created for a compositing layer is the union of the bounds of all the descendant
    458458// RenderLayers that are rendered by the composited RenderLayer.
    459 LayoutRect RenderLayerCompositor::calculateCompositedBounds(const RenderLayer* layer, const RenderLayer* ancestorLayer)
     459IntRect RenderLayerCompositor::calculateCompositedBounds(const RenderLayer* layer, const RenderLayer* ancestorLayer)
    460460{
    461461    if (!canBeComposited(layer))
    462         return LayoutRect();
     462        return IntRect();
    463463
    464464    LayoutRect boundingBoxRect = layer->localBoundingBox();
     
    468468        // to the code in RenderBox::paintRootBoxFillLayers().
    469469        if (m_renderView->frameView()) {
    470             int rw = m_renderView->frameView()->contentsWidth();
    471             int rh = m_renderView->frameView()->contentsHeight();
     470            LayoutUnit rw = m_renderView->frameView()->contentsWidth();
     471            LayoutUnit rh = m_renderView->frameView()->contentsHeight();
    472472           
    473473            boundingBoxRect.setWidth(max(boundingBoxRect.width(), rw - boundingBoxRect.x()));
     
    583583}
    584584
    585 void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer* layer, LayoutRect& layerBounds, bool& boundsComputed)
     585void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer* layer, IntRect& layerBounds, bool& boundsComputed)
    586586{
    587587    if (layer->isRootLayer())
     
    592592        // Empty rects never intersect, but we need them to for the purposes of overlap testing.
    593593        if (layerBounds.isEmpty())
    594             layerBounds.setSize(LayoutSize(1, 1));
     594            layerBounds.setSize(IntSize(1, 1));
    595595        boundsComputed = true;
    596596    }
    597597
    598     LayoutRect clipRect = layer->backgroundClipRect(rootRenderLayer(), 0, true).rect(); // FIXME: Incorrect for CSS regions.
     598    IntRect clipRect = pixelSnappedIntRect(layer->backgroundClipRect(rootRenderLayer(), 0, true).rect()); // FIXME: Incorrect for CSS regions.
    599599    clipRect.scale(pageScaleFactor());
    600600    clipRect.intersect(layerBounds);
     
    607607        return;
    608608
    609     LayoutRect bounds;
     609    IntRect bounds;
    610610    bool haveComputedBounds = false;
    611611    addToOverlapMap(overlapMap, layer, bounds, haveComputedBounds);
     
    641641}
    642642
    643 bool RenderLayerCompositor::overlapsCompositedLayers(OverlapMap& overlapMap, const LayoutRect& layerBounds)
     643bool RenderLayerCompositor::overlapsCompositedLayers(OverlapMap& overlapMap, const IntRect& layerBounds)
    644644{
    645645    RenderLayerCompositor::OverlapMap::const_iterator end = overlapMap.end();
    646646    for (RenderLayerCompositor::OverlapMap::const_iterator it = overlapMap.begin(); it != end; ++it) {
    647         const LayoutRect& bounds = it->second;
     647        const IntRect& bounds = it->second;
    648648        if (layerBounds.intersects(bounds))
    649649            return true;
     
    674674
    675675    bool haveComputedBounds = false;
    676     LayoutRect absBounds;
     676    IntRect absBounds;
    677677    if (overlapMap && !overlapMap->isEmpty()) {
    678678        // If we're testing for overlap, we only need to composite if we overlap something that is already composited.
     
    680680        // Empty rects never intersect, but we need them to for the purposes of overlap testing.
    681681        if (absBounds.isEmpty())
    682             absBounds.setSize(LayoutSize(1, 1));
     682            absBounds.setSize(IntSize(1, 1));
    683683        haveComputedBounds = true;
    684684        mustOverlapCompositedLayers = overlapsCompositedLayers(*overlapMap, absBounds);
     
    954954}
    955955
    956 void RenderLayerCompositor::frameViewDidChangeLocation(const LayoutPoint& contentsOffset)
     956void RenderLayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsOffset)
    957957{
    958958    if (m_overflowControlsHostLayer)
     
    979979{
    980980    FrameView* frameView = m_renderView->frameView();
    981     LayoutPoint scrollPosition = frameView->scrollPosition();
     981    IntPoint scrollPosition = frameView->scrollPosition();
    982982
    983983    if (RenderLayerBacking* backing = rootRenderLayer()->backing())
     
    11381138
    11391139
    1140 void RenderLayerCompositor::repaintCompositedLayersAbsoluteRect(const LayoutRect& absRect)
     1140void RenderLayerCompositor::repaintCompositedLayersAbsoluteRect(const IntRect& absRect)
    11411141{
    11421142    recursiveRepaintLayerRect(rootRenderLayer(), absRect);
    11431143}
    11441144
    1145 void RenderLayerCompositor::recursiveRepaintLayerRect(RenderLayer* layer, const LayoutRect& rect)
     1145void RenderLayerCompositor::recursiveRepaintLayerRect(RenderLayer* layer, const IntRect& rect)
    11461146{
    11471147    // FIXME: This method does not work correctly with transforms.
     
    11541154            for (size_t i = 0; i < listSize; ++i) {
    11551155                RenderLayer* curLayer = negZOrderList->at(i);
    1156                 LayoutRect childRect(rect);
    1157                 curLayer->convertToLayerCoords(layer, childRect);
     1156                IntRect childRect(rect);
     1157                curLayer->convertToPixelSnappedLayerCoords(layer, childRect);
    11581158                recursiveRepaintLayerRect(curLayer, childRect);
    11591159            }
     
    11641164            for (size_t i = 0; i < listSize; ++i) {
    11651165                RenderLayer* curLayer = posZOrderList->at(i);
    1166                 LayoutRect childRect(rect);
    1167                 curLayer->convertToLayerCoords(layer, childRect);
     1166                IntRect childRect(rect);
     1167                curLayer->convertToPixelSnappedLayerCoords(layer, childRect);
    11681168                recursiveRepaintLayerRect(curLayer, childRect);
    11691169            }
     
    11741174        for (size_t i = 0; i < listSize; ++i) {
    11751175            RenderLayer* curLayer = normalFlowList->at(i);
    1176             LayoutRect childRect(rect);
    1177             curLayer->convertToLayerCoords(layer, childRect);
     1176            IntRect childRect(rect);
     1177            curLayer->convertToPixelSnappedLayerCoords(layer, childRect);
    11781178            recursiveRepaintLayerRect(curLayer, childRect);
    11791179        }
     
    12351235{
    12361236    if (m_rootContentLayer) {
    1237         const LayoutRect& documentRect = m_renderView->documentRect();
     1237        const IntRect& documentRect = m_renderView->documentRect();
    12381238        m_rootContentLayer->setSize(documentRect.size());
    12391239        m_rootContentLayer->setPosition(documentRect.location());
     
    14751475
    14761476    // Don't go into compositing mode if height or width are zero, or size is 1x1.
    1477     LayoutRect contentBox = pluginRenderer->contentBoxRect();
     1477    IntRect contentBox = pixelSnappedIntRect(pluginRenderer->contentBoxRect());
    14781478    return contentBox.height() * contentBox.width() > 1;
    14791479}
     
    15001500   
    15011501    // Don't go into compositing mode if height or width are zero.
    1502     LayoutRect contentBox = frameRenderer->contentBoxRect();
     1502    IntRect contentBox = pixelSnappedIntRect(frameRenderer->contentBoxRect());
    15031503    return contentBox.height() * contentBox.width() > 0;
    15041504}
     
    16091609}
    16101610
    1611 static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const LayoutRect& clip)
     1611static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip)
    16121612{
    16131613    if (!scrollbar)
     
    16151615
    16161616    context.save();
    1617     const LayoutRect& scrollbarRect = scrollbar->frameRect();
     1617    const IntRect& scrollbarRect = scrollbar->frameRect();
    16181618    context.translate(-scrollbarRect.x(), -scrollbarRect.y());
    1619     LayoutRect transformedClip = clip;
     1619    IntRect transformedClip = clip;
    16201620    transformedClip.moveBy(scrollbarRect.location());
    16211621    scrollbar->paint(&context, transformedClip);
     
    16231623}
    16241624
    1625 void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase, const LayoutRect& clip)
     1625void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& clip)
    16261626{
    16271627    if (graphicsLayer == layerForHorizontalScrollbar())
     
    16301630        paintScrollbar(m_renderView->frameView()->verticalScrollbar(), context, clip);
    16311631    else if (graphicsLayer == layerForScrollCorner()) {
    1632         const LayoutRect& scrollCorner = m_renderView->frameView()->scrollCornerRect();
     1632        const IntRect& scrollCorner = m_renderView->frameView()->scrollCornerRect();
    16331633        context.save();
    16341634        context.translate(-scrollCorner.x(), -scrollCorner.y());
    1635         LayoutRect transformedClip = clip;
    1636         transformedClip.moveBy(roundedIntPoint(scrollCorner.location()));
     1635        IntRect transformedClip = clip;
     1636        transformedClip.moveBy(scrollCorner.location());
    16371637        m_renderView->frameView()->paintScrollCorner(&context, transformedClip);
    16381638        context.restore();
     
    18991899        m_rootContentLayer->setName("content root");
    19001900#endif
    1901         m_rootContentLayer->setSize(FloatSize(m_renderView->maxXLayoutOverflow(), m_renderView->maxYLayoutOverflow()));
     1901        IntRect overflowRect = m_renderView->pixelSnappedLayoutOverflowRect();
     1902        m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect.maxY()));
    19021903        m_rootContentLayer->setPosition(FloatPoint());
    19031904
     
    19751976        m_layerForHorizontalScrollbar = nullptr;
    19761977        if (Scrollbar* horizontalScrollbar = m_renderView->frameView()->verticalScrollbar())
    1977             m_renderView->frameView()->invalidateScrollbar(horizontalScrollbar, LayoutRect(LayoutPoint(0, 0), horizontalScrollbar->frameRect().size()));
     1978            m_renderView->frameView()->invalidateScrollbar(horizontalScrollbar, IntRect(IntPoint(0, 0), horizontalScrollbar->frameRect().size()));
    19781979    }
    19791980
     
    19821983        m_layerForVerticalScrollbar = nullptr;
    19831984        if (Scrollbar* verticalScrollbar = m_renderView->frameView()->verticalScrollbar())
    1984             m_renderView->frameView()->invalidateScrollbar(verticalScrollbar, LayoutRect(LayoutPoint(0, 0), verticalScrollbar->frameRect().size()));
     1985            m_renderView->frameView()->invalidateScrollbar(verticalScrollbar, IntRect(IntPoint(0, 0), verticalScrollbar->frameRect().size()));
    19851986    }
    19861987
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.h

    r107657 r107760  
    122122    // Return the bounding box required for compositing layer and its childern, relative to ancestorLayer.
    123123    // If layerBoundingBox is not 0, on return it contains the bounding box of this layer only.
    124     LayoutRect calculateCompositedBounds(const RenderLayer*, const RenderLayer* ancestorLayer);
     124    IntRect calculateCompositedBounds(const RenderLayer*, const RenderLayer* ancestorLayer);
    125125
    126126    // Repaint the appropriate layers when the given RenderLayer starts or stops being composited.
     
    135135
    136136    // Repaint parts of all composited layers that intersect the given absolute rectangle.
    137     void repaintCompositedLayersAbsoluteRect(const LayoutRect&);
     137    void repaintCompositedLayersAbsoluteRect(const IntRect&);
    138138
    139139    RenderLayer* rootRenderLayer() const;
     
    184184
    185185    // Update the geometry of the layers used for clipping and scrolling in frames.
    186     void frameViewDidChangeLocation(const LayoutPoint& contentsOffset);
     186    void frameViewDidChangeLocation(const IntPoint& contentsOffset);
    187187    void frameViewDidChangeSize();
    188188    void frameViewDidScroll();
     
    216216    virtual void notifyAnimationStarted(const GraphicsLayer*, double) { }
    217217    virtual void notifySyncRequired(const GraphicsLayer*) { scheduleLayerFlush(); }
    218     virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const LayoutRect&);
     218    virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect&);
    219219
    220220    virtual bool showDebugBorders(const GraphicsLayer*) const;
     
    234234
    235235    // Repaint the given rect (which is layer's coords), and regions of child layers that intersect that rect.
    236     void recursiveRepaintLayerRect(RenderLayer*, const LayoutRect&);
    237 
    238     typedef HashMap<RenderLayer*, LayoutRect> OverlapMap;
    239     void addToOverlapMap(OverlapMap&, RenderLayer*, LayoutRect& layerBounds, bool& boundsComputed);
     236    void recursiveRepaintLayerRect(RenderLayer*, const IntRect&);
     237
     238    typedef HashMap<RenderLayer*, IntRect> OverlapMap;
     239    void addToOverlapMap(OverlapMap&, RenderLayer*, IntRect& layerBounds, bool& boundsComputed);
    240240    void addToOverlapMapRecursive(OverlapMap&, RenderLayer*);
    241     static bool overlapsCompositedLayers(OverlapMap&, const LayoutRect& layerBounds);
     241    static bool overlapsCompositedLayers(OverlapMap&, const IntRect& layerBounds);
    242242
    243243    void updateCompositingLayersTimerFired(Timer<RenderLayerCompositor>*);
Note: See TracChangeset for help on using the changeset viewer.