Changeset 112977 in webkit
- Timestamp:
- Apr 2, 2012 7:44:44 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r112973 r112977 1 2012-04-02 Emil A Eklund <eae@chromium.org> 2 3 Fix usage of LayoutUnits and pixel snapping in RenderLayer 4 https://bugs.webkit.org/show_bug.cgi?id=82498 5 6 Reviewed by Julien Chaffraix. 7 8 Fix usage of subpixel types and snapping/rounding in RenderLayer in 9 preparation for turning on subpixel layout. 10 11 No new tests, no change in functionality. 12 13 * rendering/LayoutTypes.h: 14 (WebCore::pixelSnappedIntSize): 15 Add no-op implementation of pixelSnappedIntSize, will be replaced with a 16 real implementation once we make the switch. 17 18 * rendering/RenderLayer.cpp: 19 (WebCore::RenderLayer::updateLayerPosition): 20 Snap RenderBox size when updating the size of the layer. 21 22 (WebCore::RenderLayer::resize): 23 Round position when setting the inline style during resize operation. 24 25 (WebCore::RenderLayer::scrollCornerRect): 26 Remove unnecessary pixelSnappedIntRect call. 27 28 (WebCore::RenderLayer::positionOverflowControls): 29 Remove unnecessary pixelSnappedIntRect call. 30 31 (WebCore::RenderLayer::scrollWidth): 32 (WebCore::RenderLayer::scrollHeight): 33 Fix implementation of scrollWidth and Height to pixel snap the values. 34 35 (WebCore::RenderLayer::computeScrollDimensions): 36 (WebCore::RenderLayer::paintResizer): 37 (WebCore::RenderLayer::hitTestOverflowControls): 38 Remove unnecessary pixelSnappedIntRect calls. 39 40 (WebCore::RenderLayer::paintLayerContents): 41 Pixel snap values just before painting (instead of earlier on). 42 43 (WebCore::RenderLayer::hitTest): 44 (WebCore::RenderLayer::hitTestContents): 45 Change to use subpixel types. 46 1 47 2012-04-02 Abhishek Arya <inferno@chromium.org> 2 48 -
trunk/Source/WebCore/rendering/LayoutTypes.h
r110983 r112977 76 76 77 77 inline int snapSizeToPixel(LayoutUnit size, LayoutUnit location) 78 { 79 UNUSED_PARAM(location); 80 return size; 81 } 82 83 inline IntSize pixelSnappedIntSize(LayoutSize size, LayoutPoint location) 78 84 { 79 85 UNUSED_PARAM(location); -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r112919 r112977 766 766 localPoint += inlineBoundingBoxOffset; 767 767 } else if (RenderBox* box = renderBox()) { 768 setSize(box->size()); 768 // FIXME: Is snapping the size really needed here for the RenderBox case? 769 setSize(pixelSnappedIntSize(box->size(), box->location())); 769 770 localPoint += box->topLeftLocationOffset(); 770 771 } … … 1857 1858 LayoutUnit baseWidth = renderer->width() - (isBoxSizingBorder ? zeroLayoutUnit : renderer->borderAndPaddingWidth()); 1858 1859 baseWidth = baseWidth / zoomFactor; 1859 styledElement->setInlineStyleProperty(CSSPropertyWidth, String::number( baseWidth + difference.width()) + "px", false);1860 styledElement->setInlineStyleProperty(CSSPropertyWidth, String::number(roundToInt(baseWidth + difference.width())) + "px", false); 1860 1861 } 1861 1862 … … 1868 1869 LayoutUnit baseHeight = renderer->height() - (isBoxSizingBorder ? zeroLayoutUnit : renderer->borderAndPaddingHeight()); 1869 1870 baseHeight = baseHeight / zoomFactor; 1870 styledElement->setInlineStyleProperty(CSSPropertyHeight, String::number( baseHeight + difference.height()) + "px", false);1871 styledElement->setInlineStyleProperty(CSSPropertyHeight, String::number(roundToInt(baseHeight + difference.height())) + "px", false); 1871 1872 } 1872 1873 … … 1978 1979 bool hasResizer = renderer()->style()->resize() != RESIZE_NONE; 1979 1980 if ((hasHorizontalBar && hasVerticalBar) || (hasResizer && (hasHorizontalBar || hasVerticalBar))) 1980 return cornerRect(this, pixelSnappedIntRect(renderBox()->borderBoxRect()));1981 return cornerRect(this, renderBox()->borderBoxRect()); 1981 1982 return IntRect(); 1982 1983 } … … 2302 2303 return; 2303 2304 2304 const IntRect borderBox = pixelSnappedIntRect(box->borderBoxRect());2305 const IntRect borderBox = box->borderBoxRect(); 2305 2306 const IntRect& scrollCorner = scrollCornerRect(); 2306 2307 IntRect absBounds(borderBox.location() + offsetFromLayer, borderBox.size()); … … 2349 2350 int RenderLayer::scrollWidth() 2350 2351 { 2352 ASSERT(renderBox()); 2351 2353 if (m_scrollDimensionsDirty) 2352 2354 computeScrollDimensions(); 2353 return m_scrollSize.width();2355 return snapSizeToPixel(m_scrollSize.width(), renderBox()->clientLeft()); 2354 2356 } 2355 2357 2356 2358 int RenderLayer::scrollHeight() 2357 2359 { 2360 ASSERT(renderBox()); 2358 2361 if (m_scrollDimensionsDirty) 2359 2362 computeScrollDimensions(); 2360 return m_scrollSize.height();2363 return snapSizeToPixel(m_scrollSize.height(), renderBox()->clientTop()); 2361 2364 } 2362 2365 … … 2405 2408 m_scrollSize.setWidth(overflowRight() - overflowLeft()); 2406 2409 m_scrollSize.setHeight(overflowBottom() - overflowTop()); 2407 2410 2408 2411 setScrollOrigin(IntPoint(-m_scrollOverflow.width(), -m_scrollOverflow.height())); 2409 2412 … … 2634 2637 ASSERT(box); 2635 2638 2636 IntRect absRect = resizerCornerRect(this, pixelSnappedIntRect(box->borderBoxRect()));2639 IntRect absRect = resizerCornerRect(this, box->borderBoxRect()); 2637 2640 absRect.moveBy(paintOffset); 2638 2641 if (!absRect.intersects(damageRect)) … … 2689 2692 IntRect resizeControlRect; 2690 2693 if (renderer()->style()->resize() != RESIZE_NONE) { 2691 resizeControlRect = resizerCornerRect(this, pixelSnappedIntRect(box->borderBoxRect()));2694 resizeControlRect = resizerCornerRect(this, box->borderBoxRect()); 2692 2695 if (resizeControlRect.contains(localPoint)) 2693 2696 return true; … … 3020 3023 3021 3024 // Paint the background. 3022 PaintInfo paintInfo(context, damageRect.rect(), PaintPhaseBlockBackground, false, paintingRootForRenderer, region, 0);3025 PaintInfo paintInfo(context, pixelSnappedIntRect(damageRect.rect()), PaintPhaseBlockBackground, false, paintingRootForRenderer, region, 0); 3023 3026 renderer()->paint(paintInfo, paintOffset); 3024 3027 … … 3045 3048 } 3046 3049 3047 PaintInfo paintInfo(context, clipRectToApply.rect(),3050 PaintInfo paintInfo(context, pixelSnappedIntRect(clipRectToApply.rect()), 3048 3051 selectionOnly ? PaintPhaseSelection : PaintPhaseChildBlockBackgrounds, 3049 3052 forceBlackText, paintingRootForRenderer, region, 0); … … 3067 3070 if (shouldPaintOutline && !outlineRect.isEmpty()) { 3068 3071 // Paint our own outline 3069 PaintInfo paintInfo(context, outlineRect.rect(), PaintPhaseSelfOutline, false, paintingRootForRenderer, region, 0);3072 PaintInfo paintInfo(context, pixelSnappedIntRect(outlineRect.rect()), PaintPhaseSelfOutline, false, paintingRootForRenderer, region, 0); 3070 3073 clipToRect(rootLayer, context, paintDirtyRect, outlineRect, DoNotIncludeSelfForBorderRadius); 3071 3074 renderer()->paint(paintInfo, paintOffset); … … 3085 3088 3086 3089 // Paint the mask. 3087 PaintInfo paintInfo(context, damageRect.rect(), PaintPhaseMask, false, paintingRootForRenderer, region, 0);3090 PaintInfo paintInfo(context, pixelSnappedIntRect(damageRect.rect()), PaintPhaseMask, false, paintingRootForRenderer, region, 0); 3088 3091 renderer()->paint(paintInfo, paintOffset); 3089 3092 … … 3267 3270 renderer()->document()->updateLayout(); 3268 3271 3269 IntRect hitTestArea = renderer()->isRenderFlowThread() ? toRenderFlowThread(renderer())->borderBoxRect() : renderer()->view()->documentRect();3272 LayoutRect hitTestArea = renderer()->isRenderFlowThread() ? toRenderFlowThread(renderer())->borderBoxRect() : renderer()->view()->documentRect(); 3270 3273 if (!request.ignoreClipping()) 3271 hitTestArea.intersect( pixelSnappedIntRect(frameVisibleRect(renderer())));3274 hitTestArea.intersect(frameVisibleRect(renderer())); 3272 3275 3273 3276 RenderLayer* insideLayer = hitTestLayer(this, 0, request, result, hitTestArea, result.point(), false); … … 3559 3562 { 3560 3563 if (!renderer()->hitTest(request, result, hitTestPoint, 3561 to Point(layerBounds.location() - renderBoxLocation()),3564 toLayoutPoint(layerBounds.location() - renderBoxLocation()), 3562 3565 hitTestFilter)) { 3563 3566 // It's wrong to set innerNode, but then claim that you didn't hit anything, unless it is
Note: See TracChangeset
for help on using the changeset viewer.