Changeset 107760 in webkit
- Timestamp:
- Feb 14, 2012 5:20:32 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r107758 r107760 1 2012-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 1 68 2012-02-14 Anders Carlsson <andersca@apple.com> 2 69 -
trunk/Source/WebCore/rendering/RenderBox.h
r107032 r107760 152 152 // but it is on the right in vertical-rl. 153 153 LayoutRect layoutOverflowRect() const { return m_overflow ? m_overflow->layoutOverflowRect() : clientBoxRect(); } 154 IntRect pixelSnappedLayoutOverflowRect() const { return pixelSnappedIntRect(layoutOverflowRect()); } 154 155 LayoutUnit minYLayoutOverflow() const { return m_overflow? m_overflow->minYLayoutOverflow() : borderTop(); } 155 156 LayoutUnit maxYLayoutOverflow() const { return m_overflow ? m_overflow->maxYLayoutOverflow() : borderTop() + clientHeight(); } -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r107461 r107760 71 71 static bool hasBoxDecorationsOrBackground(const RenderObject*); 72 72 static bool hasBoxDecorationsOrBackgroundImage(const RenderStyle*); 73 static LayoutRect clipBox(RenderBox* renderer);73 static IntRect clipBox(RenderBox* renderer); 74 74 75 75 static inline bool isAcceleratedCanvas(RenderObject* renderer) … … 230 230 void RenderLayerBacking::updateCompositedBounds() 231 231 { 232 LayoutRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer);232 IntRect layerBounds = compositor()->calculateCompositedBounds(m_owningLayer, m_owningLayer); 233 233 234 234 // Clip to the size of the document or enclosing overflow-scroll layer. … … 255 255 clippingBounds.move(-delta.x(), -delta.y()); 256 256 257 layerBounds.intersect( clippingBounds);257 layerBounds.intersect(pixelSnappedIntRect(clippingBounds)); 258 258 } 259 259 … … 372 372 } 373 373 374 static LayoutRect clipBox(RenderBox* renderer)374 static IntRect clipBox(RenderBox* renderer) 375 375 { 376 376 LayoutRect result = PaintInfo::infiniteRect(); … … 381 381 result.intersect(renderer->clipRect(LayoutPoint(), 0)); // FIXME: Incorrect for CSS regions. 382 382 383 return result;383 return pixelSnappedIntRect(result); 384 384 } 385 385 … … 427 427 IntRect relativeCompositingBounds(localCompositingBounds); 428 428 IntPoint delta; 429 m_owningLayer->convertTo LayerCoords(compAncestor, delta);429 m_owningLayer->convertToPixelSnappedLayerCoords(compAncestor, delta); 430 430 relativeCompositingBounds.moveBy(delta); 431 431 432 LayoutPoint graphicsLayerParentLocation;432 IntPoint graphicsLayerParentLocation; 433 433 if (compAncestor && compAncestor->backing()->hasClippingLayer()) { 434 434 // If the compositing ancestor has a layer to clip children, we parent in that, and therefore 435 435 // position relative to it. 436 IntRect clippingBox = pixelSnappedIntRect(clipBox(toRenderBox(compAncestor->renderer())));436 IntRect clippingBox = clipBox(toRenderBox(compAncestor->renderer())); 437 437 graphicsLayerParentLocation = clippingBox.location(); 438 438 } else if (compAncestor) … … 473 473 IntRect clippingBox; 474 474 if (m_clippingLayer) { 475 clippingBox = pixelSnappedIntRect(clipBox(toRenderBox(renderer())));475 clippingBox = clipBox(toRenderBox(renderer())); 476 476 m_clippingLayer->setPosition(FloatPoint() + (clippingBox.location() - localCompositingBounds.location())); 477 477 m_clippingLayer->setSize(clippingBox.size()); 478 m_clippingLayer->setOffsetFromRenderer(clippingBox.location() - LayoutPoint());478 m_clippingLayer->setOffsetFromRenderer(clippingBox.location() - IntPoint()); 479 479 } 480 480 … … 549 549 } 550 550 551 m_graphicsLayer->setContentsRect( pixelSnappedIntRect(contentsBox()));551 m_graphicsLayer->setContentsRect(contentsBox()); 552 552 updateDrawsContent(); 553 553 updateAfterWidgetResize(); … … 1003 1003 } 1004 1004 1005 FloatPoint3D RenderLayerBacking::computeTransformOrigin(const LayoutRect& borderBox) const1005 FloatPoint3D RenderLayerBacking::computeTransformOrigin(const IntRect& borderBox) const 1006 1006 { 1007 1007 RenderStyle* style = renderer()->style(); … … 1015 1015 } 1016 1016 1017 FloatPoint RenderLayerBacking::computePerspectiveOrigin(const LayoutRect& borderBox) const1017 FloatPoint RenderLayerBacking::computePerspectiveOrigin(const IntRect& borderBox) const 1018 1018 { 1019 1019 RenderStyle* style = renderer()->style(); … … 1030 1030 1031 1031 // Return the offset from the top-left of this compositing layer at which the renderer's contents are painted. 1032 LayoutSize RenderLayerBacking::contentOffsetInCompostingLayer() const1033 { 1034 return LayoutSize(-m_compositedBounds.x(), -m_compositedBounds.y());1035 } 1036 1037 LayoutRect RenderLayerBacking::contentsBox() const1032 IntSize RenderLayerBacking::contentOffsetInCompostingLayer() const 1033 { 1034 return IntSize(-m_compositedBounds.x(), -m_compositedBounds.y()); 1035 } 1036 1037 IntRect RenderLayerBacking::contentsBox() const 1038 1038 { 1039 1039 if (!renderer()->isBox()) 1040 return LayoutRect();1041 1042 LayoutRect contentsRect;1040 return IntRect(); 1041 1042 IntRect contentsRect; 1043 1043 #if ENABLE(VIDEO) 1044 1044 if (renderer()->isVideo()) { … … 1047 1047 } else 1048 1048 #endif 1049 contentsRect = toRenderBox(renderer())->contentBoxRect();1050 1051 LayoutSize contentOffset = contentOffsetInCompostingLayer();1049 contentsRect = pixelSnappedIntRect(toRenderBox(renderer())->contentBoxRect()); 1050 1051 IntSize contentOffset = contentOffsetInCompostingLayer(); 1052 1052 contentsRect.move(contentOffset); 1053 1053 return contentsRect; … … 1078 1078 1079 1079 // r is in the coordinate space of the layer's render object 1080 void RenderLayerBacking::setContentsNeedDisplayInRect(const LayoutRect& r)1080 void RenderLayerBacking::setContentsNeedDisplayInRect(const IntRect& r) 1081 1081 { 1082 1082 if (m_graphicsLayer && m_graphicsLayer->drawsContent()) { 1083 LayoutRect layerDirtyRect = r;1083 IntRect layerDirtyRect = r; 1084 1084 layerDirtyRect.move(-m_graphicsLayer->offsetFromRenderer()); 1085 1085 m_graphicsLayer->setNeedsDisplayInRect(layerDirtyRect); … … 1087 1087 1088 1088 if (m_foregroundLayer && m_foregroundLayer->drawsContent()) { 1089 LayoutRect layerDirtyRect = r;1089 IntRect layerDirtyRect = r; 1090 1090 layerDirtyRect.move(-m_foregroundLayer->offsetFromRenderer()); 1091 1091 m_foregroundLayer->setNeedsDisplayInRect(layerDirtyRect); … … 1093 1093 1094 1094 if (m_maskLayer && m_maskLayer->drawsContent()) { 1095 LayoutRect layerDirtyRect = r;1095 IntRect layerDirtyRect = r; 1096 1096 layerDirtyRect.move(-m_maskLayer->offsetFromRenderer()); 1097 1097 m_maskLayer->setNeedsDisplayInRect(layerDirtyRect); … … 1100 1100 1101 1101 void RenderLayerBacking::paintIntoLayer(RenderLayer* rootLayer, GraphicsContext* context, 1102 const LayoutRect& paintDirtyRect, // In the coords of rootLayer.1102 const IntRect& paintDirtyRect, // In the coords of rootLayer. 1103 1103 PaintBehavior paintBehavior, GraphicsLayerPaintingPhase paintingPhase, 1104 1104 RenderObject* paintingRoot) … … 1125 1125 } 1126 1126 1127 static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const LayoutRect& clip)1127 static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip) 1128 1128 { 1129 1129 if (!scrollbar) … … 1131 1131 1132 1132 context.save(); 1133 const LayoutRect& scrollbarRect = scrollbar->frameRect();1133 const IntRect& scrollbarRect = scrollbar->frameRect(); 1134 1134 context.translate(-scrollbarRect.x(), -scrollbarRect.y()); 1135 LayoutRect transformedClip = clip;1135 IntRect transformedClip = clip; 1136 1136 transformedClip.moveBy(scrollbarRect.location()); 1137 scrollbar->paint(&context, pixelSnappedIntRect(transformedClip));1137 scrollbar->paint(&context, transformedClip); 1138 1138 context.restore(); 1139 1139 } 1140 1140 1141 1141 // Up-call from compositing layer drawing callback. 1142 void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const LayoutRect& clip)1142 void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const IntRect& clip) 1143 1143 { 1144 1144 if (graphicsLayer == m_graphicsLayer.get() || graphicsLayer == m_foregroundLayer.get() || graphicsLayer == m_maskLayer.get()) { … … 1146 1146 1147 1147 // The dirtyRect is in the coords of the painting root. 1148 LayoutRect dirtyRect = compositedBounds();1148 IntRect dirtyRect = compositedBounds(); 1149 1149 dirtyRect.intersect(clip); 1150 1150 … … 1158 1158 paintScrollbar(m_owningLayer->verticalScrollbar(), context, clip); 1159 1159 } else if (graphicsLayer == layerForScrollCorner()) { 1160 const LayoutRect& scrollCornerAndResizer = m_owningLayer->scrollCornerAndResizerRect();1160 const IntRect& scrollCornerAndResizer = m_owningLayer->scrollCornerAndResizerRect(); 1161 1161 context.save(); 1162 1162 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); 1167 1167 context.restore(); 1168 1168 } … … 1244 1244 #endif 1245 1245 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)) { 1247 1247 didAnimateTransform = true; 1248 1248 compositor()->didStartAcceleratedAnimation(CSSPropertyWebkitTransform); 1249 1249 } 1250 1250 1251 if (hasOpacity && m_graphicsLayer->addAnimation(opacityVector, LayoutSize(), anim, keyframes.animationName(), timeOffset)) {1251 if (hasOpacity && m_graphicsLayer->addAnimation(opacityVector, IntSize(), anim, keyframes.animationName(), timeOffset)) { 1252 1252 didAnimateOpacity = true; 1253 1253 compositor()->didStartAcceleratedAnimation(CSSPropertyOpacity); … … 1255 1255 1256 1256 #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)) { 1258 1258 didAnimateFilter = true; 1259 1259 compositor()->didStartAcceleratedAnimation(CSSPropertyWebkitFilter); … … 1295 1295 opacityVector.insert(new FloatAnimationValue(1, compositingOpacity(toStyle->opacity()))); 1296 1296 // 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)) { 1298 1298 // To ensure that the correct opacity is visible when the animation ends, also set the final opacity. 1299 1299 updateLayerOpacity(toStyle); … … 1309 1309 transformVector.insert(new TransformAnimationValue(0, &fromStyle->transform())); 1310 1310 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)) { 1312 1312 // To ensure that the correct transform is visible when the animation ends, also set the final transform. 1313 1313 updateLayerTransform(toStyle); … … 1324 1324 filterVector.insert(new FilterAnimationValue(0, &fromStyle->filter())); 1325 1325 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)) { 1327 1327 // To ensure that the correct filter is visible when the animation ends, also set the final filter. 1328 1328 updateLayerFilters(toStyle); … … 1387 1387 } 1388 1388 1389 LayoutRect RenderLayerBacking::compositedBounds() const1389 IntRect RenderLayerBacking::compositedBounds() const 1390 1390 { 1391 1391 return m_compositedBounds; 1392 1392 } 1393 1393 1394 void RenderLayerBacking::setCompositedBounds(const LayoutRect& bounds)1394 void RenderLayerBacking::setCompositedBounds(const IntRect& bounds) 1395 1395 { 1396 1396 m_compositedBounds = bounds; -
trunk/Source/WebCore/rendering/RenderLayerBacking.h
r105757 r107760 100 100 void setContentsNeedDisplay(); 101 101 // r is in the coordinate space of the layer's render object 102 void setContentsNeedDisplayInRect(const LayoutRect&);102 void setContentsNeedDisplayInRect(const IntRect&); 103 103 104 104 // Notification from the renderer that its content changed. … … 117 117 void resumeAnimations(); 118 118 119 LayoutRect compositedBounds() const;120 void setCompositedBounds(const LayoutRect&);119 IntRect compositedBounds() const; 120 void setCompositedBounds(const IntRect&); 121 121 void updateCompositedBounds(); 122 122 … … 128 128 virtual void notifySyncRequired(const GraphicsLayer*); 129 129 130 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const LayoutRect& clip);130 virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& clip); 131 131 132 132 virtual float deviceScaleFactor() const; … … 137 137 virtual bool showRepaintCounter(const GraphicsLayer*) const; 138 138 139 LayoutRect contentsBox() const;139 IntRect contentsBox() const; 140 140 141 141 // For informative purposes only. … … 170 170 GraphicsLayerPaintingPhase paintingPhaseForPrimaryLayer() const; 171 171 172 LayoutSize contentOffsetInCompostingLayer() const;172 IntSize contentOffsetInCompostingLayer() const; 173 173 // Result is transform origin in pixels. 174 FloatPoint3D computeTransformOrigin(const LayoutRect& borderBox) const;174 FloatPoint3D computeTransformOrigin(const IntRect& borderBox) const; 175 175 // Result is perspective origin in pixels. 176 FloatPoint computePerspectiveOrigin(const LayoutRect& borderBox) const;176 FloatPoint computePerspectiveOrigin(const IntRect& borderBox) const; 177 177 178 178 void updateLayerOpacity(const RenderStyle*); … … 201 201 bool hasVisibleNonCompositingDescendantLayers() const; 202 202 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); 204 204 205 205 static int graphicsLayerToCSSProperty(AnimatedPropertyID); … … 222 222 OwnPtr<GraphicsLayer> m_layerForScrollCorner; 223 223 224 LayoutRect m_compositedBounds;224 IntRect m_compositedBounds; 225 225 226 226 bool m_artificiallyInflatedBounds; // bounds had to be made non-zero to make transform-origin work -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r107657 r107760 457 457 // The bounds of the GraphicsLayer created for a compositing layer is the union of the bounds of all the descendant 458 458 // RenderLayers that are rendered by the composited RenderLayer. 459 LayoutRect RenderLayerCompositor::calculateCompositedBounds(const RenderLayer* layer, const RenderLayer* ancestorLayer)459 IntRect RenderLayerCompositor::calculateCompositedBounds(const RenderLayer* layer, const RenderLayer* ancestorLayer) 460 460 { 461 461 if (!canBeComposited(layer)) 462 return LayoutRect();462 return IntRect(); 463 463 464 464 LayoutRect boundingBoxRect = layer->localBoundingBox(); … … 468 468 // to the code in RenderBox::paintRootBoxFillLayers(). 469 469 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(); 472 472 473 473 boundingBoxRect.setWidth(max(boundingBoxRect.width(), rw - boundingBoxRect.x())); … … 583 583 } 584 584 585 void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer* layer, LayoutRect& layerBounds, bool& boundsComputed)585 void RenderLayerCompositor::addToOverlapMap(OverlapMap& overlapMap, RenderLayer* layer, IntRect& layerBounds, bool& boundsComputed) 586 586 { 587 587 if (layer->isRootLayer()) … … 592 592 // Empty rects never intersect, but we need them to for the purposes of overlap testing. 593 593 if (layerBounds.isEmpty()) 594 layerBounds.setSize( LayoutSize(1, 1));594 layerBounds.setSize(IntSize(1, 1)); 595 595 boundsComputed = true; 596 596 } 597 597 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. 599 599 clipRect.scale(pageScaleFactor()); 600 600 clipRect.intersect(layerBounds); … … 607 607 return; 608 608 609 LayoutRect bounds;609 IntRect bounds; 610 610 bool haveComputedBounds = false; 611 611 addToOverlapMap(overlapMap, layer, bounds, haveComputedBounds); … … 641 641 } 642 642 643 bool RenderLayerCompositor::overlapsCompositedLayers(OverlapMap& overlapMap, const LayoutRect& layerBounds)643 bool RenderLayerCompositor::overlapsCompositedLayers(OverlapMap& overlapMap, const IntRect& layerBounds) 644 644 { 645 645 RenderLayerCompositor::OverlapMap::const_iterator end = overlapMap.end(); 646 646 for (RenderLayerCompositor::OverlapMap::const_iterator it = overlapMap.begin(); it != end; ++it) { 647 const LayoutRect& bounds = it->second;647 const IntRect& bounds = it->second; 648 648 if (layerBounds.intersects(bounds)) 649 649 return true; … … 674 674 675 675 bool haveComputedBounds = false; 676 LayoutRect absBounds;676 IntRect absBounds; 677 677 if (overlapMap && !overlapMap->isEmpty()) { 678 678 // If we're testing for overlap, we only need to composite if we overlap something that is already composited. … … 680 680 // Empty rects never intersect, but we need them to for the purposes of overlap testing. 681 681 if (absBounds.isEmpty()) 682 absBounds.setSize( LayoutSize(1, 1));682 absBounds.setSize(IntSize(1, 1)); 683 683 haveComputedBounds = true; 684 684 mustOverlapCompositedLayers = overlapsCompositedLayers(*overlapMap, absBounds); … … 954 954 } 955 955 956 void RenderLayerCompositor::frameViewDidChangeLocation(const LayoutPoint& contentsOffset)956 void RenderLayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsOffset) 957 957 { 958 958 if (m_overflowControlsHostLayer) … … 979 979 { 980 980 FrameView* frameView = m_renderView->frameView(); 981 LayoutPoint scrollPosition = frameView->scrollPosition();981 IntPoint scrollPosition = frameView->scrollPosition(); 982 982 983 983 if (RenderLayerBacking* backing = rootRenderLayer()->backing()) … … 1138 1138 1139 1139 1140 void RenderLayerCompositor::repaintCompositedLayersAbsoluteRect(const LayoutRect& absRect)1140 void RenderLayerCompositor::repaintCompositedLayersAbsoluteRect(const IntRect& absRect) 1141 1141 { 1142 1142 recursiveRepaintLayerRect(rootRenderLayer(), absRect); 1143 1143 } 1144 1144 1145 void RenderLayerCompositor::recursiveRepaintLayerRect(RenderLayer* layer, const LayoutRect& rect)1145 void RenderLayerCompositor::recursiveRepaintLayerRect(RenderLayer* layer, const IntRect& rect) 1146 1146 { 1147 1147 // FIXME: This method does not work correctly with transforms. … … 1154 1154 for (size_t i = 0; i < listSize; ++i) { 1155 1155 RenderLayer* curLayer = negZOrderList->at(i); 1156 LayoutRect childRect(rect);1157 curLayer->convertTo LayerCoords(layer, childRect);1156 IntRect childRect(rect); 1157 curLayer->convertToPixelSnappedLayerCoords(layer, childRect); 1158 1158 recursiveRepaintLayerRect(curLayer, childRect); 1159 1159 } … … 1164 1164 for (size_t i = 0; i < listSize; ++i) { 1165 1165 RenderLayer* curLayer = posZOrderList->at(i); 1166 LayoutRect childRect(rect);1167 curLayer->convertTo LayerCoords(layer, childRect);1166 IntRect childRect(rect); 1167 curLayer->convertToPixelSnappedLayerCoords(layer, childRect); 1168 1168 recursiveRepaintLayerRect(curLayer, childRect); 1169 1169 } … … 1174 1174 for (size_t i = 0; i < listSize; ++i) { 1175 1175 RenderLayer* curLayer = normalFlowList->at(i); 1176 LayoutRect childRect(rect);1177 curLayer->convertTo LayerCoords(layer, childRect);1176 IntRect childRect(rect); 1177 curLayer->convertToPixelSnappedLayerCoords(layer, childRect); 1178 1178 recursiveRepaintLayerRect(curLayer, childRect); 1179 1179 } … … 1235 1235 { 1236 1236 if (m_rootContentLayer) { 1237 const LayoutRect& documentRect = m_renderView->documentRect();1237 const IntRect& documentRect = m_renderView->documentRect(); 1238 1238 m_rootContentLayer->setSize(documentRect.size()); 1239 1239 m_rootContentLayer->setPosition(documentRect.location()); … … 1475 1475 1476 1476 // 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()); 1478 1478 return contentBox.height() * contentBox.width() > 1; 1479 1479 } … … 1500 1500 1501 1501 // Don't go into compositing mode if height or width are zero. 1502 LayoutRect contentBox = frameRenderer->contentBoxRect();1502 IntRect contentBox = pixelSnappedIntRect(frameRenderer->contentBoxRect()); 1503 1503 return contentBox.height() * contentBox.width() > 0; 1504 1504 } … … 1609 1609 } 1610 1610 1611 static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const LayoutRect& clip)1611 static void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip) 1612 1612 { 1613 1613 if (!scrollbar) … … 1615 1615 1616 1616 context.save(); 1617 const LayoutRect& scrollbarRect = scrollbar->frameRect();1617 const IntRect& scrollbarRect = scrollbar->frameRect(); 1618 1618 context.translate(-scrollbarRect.x(), -scrollbarRect.y()); 1619 LayoutRect transformedClip = clip;1619 IntRect transformedClip = clip; 1620 1620 transformedClip.moveBy(scrollbarRect.location()); 1621 1621 scrollbar->paint(&context, transformedClip); … … 1623 1623 } 1624 1624 1625 void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase, const LayoutRect& clip)1625 void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& clip) 1626 1626 { 1627 1627 if (graphicsLayer == layerForHorizontalScrollbar()) … … 1630 1630 paintScrollbar(m_renderView->frameView()->verticalScrollbar(), context, clip); 1631 1631 else if (graphicsLayer == layerForScrollCorner()) { 1632 const LayoutRect& scrollCorner = m_renderView->frameView()->scrollCornerRect();1632 const IntRect& scrollCorner = m_renderView->frameView()->scrollCornerRect(); 1633 1633 context.save(); 1634 1634 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()); 1637 1637 m_renderView->frameView()->paintScrollCorner(&context, transformedClip); 1638 1638 context.restore(); … … 1899 1899 m_rootContentLayer->setName("content root"); 1900 1900 #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())); 1902 1903 m_rootContentLayer->setPosition(FloatPoint()); 1903 1904 … … 1975 1976 m_layerForHorizontalScrollbar = nullptr; 1976 1977 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())); 1978 1979 } 1979 1980 … … 1982 1983 m_layerForVerticalScrollbar = nullptr; 1983 1984 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())); 1985 1986 } 1986 1987 -
trunk/Source/WebCore/rendering/RenderLayerCompositor.h
r107657 r107760 122 122 // Return the bounding box required for compositing layer and its childern, relative to ancestorLayer. 123 123 // 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); 125 125 126 126 // Repaint the appropriate layers when the given RenderLayer starts or stops being composited. … … 135 135 136 136 // Repaint parts of all composited layers that intersect the given absolute rectangle. 137 void repaintCompositedLayersAbsoluteRect(const LayoutRect&);137 void repaintCompositedLayersAbsoluteRect(const IntRect&); 138 138 139 139 RenderLayer* rootRenderLayer() const; … … 184 184 185 185 // 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); 187 187 void frameViewDidChangeSize(); 188 188 void frameViewDidScroll(); … … 216 216 virtual void notifyAnimationStarted(const GraphicsLayer*, double) { } 217 217 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&); 219 219 220 220 virtual bool showDebugBorders(const GraphicsLayer*) const; … … 234 234 235 235 // 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); 240 240 void addToOverlapMapRecursive(OverlapMap&, RenderLayer*); 241 static bool overlapsCompositedLayers(OverlapMap&, const LayoutRect& layerBounds);241 static bool overlapsCompositedLayers(OverlapMap&, const IntRect& layerBounds); 242 242 243 243 void updateCompositingLayersTimerFired(Timer<RenderLayerCompositor>*);
Note: See TracChangeset
for help on using the changeset viewer.