Changeset 166784 in webkit
- Timestamp:
- Apr 4, 2014, 9:30:18 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 9 added
- 37 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/LayoutTests/ChangeLog ¶
r166781 r166784 1 2014-04-04 Zalan Bujtas <zalan@apple.com> 2 3 Subpixel rendering: Move background images to device pixel boundaries. 4 https://bugs.webkit.org/show_bug.cgi?id=131144 5 6 Reviewed by Simon Fraser. 7 8 Replace integral snapping with device pixel snapping. 9 Background image geometry calculation uses LayoutUnits and we snap to device pixels right before painting. 10 11 * css3/background/background-repeat-round-auto1-expected.html: 12 * css3/background/background-repeat-round-auto1.html: 13 * css3/background/background-repeat-round-auto2-expected.html: 14 * css3/background/background-repeat-round-auto2.html: 15 * css3/background/background-repeat-round-border-expected.html: 16 * css3/background/background-repeat-round-border.html: 17 * css3/background/background-repeat-round-content-expected.html: 18 * css3/background/background-repeat-round-content.html: 19 * css3/background/background-repeat-space-content-expected.html: 20 * css3/background/background-repeat-space-content.html: 21 * css3/background/background-repeat-space-padding-expected.html: 22 * css3/background/background-repeat-space-padding.html: 23 * css3/masking/mask-repeat-round-auto1-expected.html: 24 * css3/masking/mask-repeat-round-auto1.html: 25 * css3/masking/mask-repeat-round-auto2-expected.html: 26 * css3/masking/mask-repeat-round-auto2.html: 27 * css3/masking/mask-repeat-round-border-expected.html: 28 * css3/masking/mask-repeat-round-border.html: 29 * css3/masking/mask-repeat-round-content-expected.html: 30 * css3/masking/mask-repeat-round-content.html: 31 * css3/masking/mask-repeat-space-content-expected.html: 32 * css3/masking/mask-repeat-space-content.html: 33 * css3/masking/mask-repeat-space-padding-expected.html: 34 * css3/masking/mask-repeat-space-padding.html: 35 * fast/backgrounds/hidpi-bitmap-background-on-subpixel-position-expected.html: Added. 36 * fast/backgrounds/hidpi-bitmap-background-on-subpixel-position.html: Added. 37 * fast/backgrounds/hidpi-bitmap-background-origin-on-subpixel-position-expected.html: Added. 38 * fast/backgrounds/hidpi-bitmap-background-origin-on-subpixel-position.html: Added. 39 * fast/backgrounds/hidpi-bitmap-background-repeat-on-subpixel-position-expected.html: Added. 40 * fast/backgrounds/hidpi-bitmap-background-repeat-on-subpixel-position.html: Added. 41 * fast/backgrounds/hidpi-generated-gradient-background-on-subpixel-position-expected.html: Added. 42 * fast/backgrounds/hidpi-generated-gradient-background-on-subpixel-position.html: Added. 43 * fast/backgrounds/resources/black25x25.png: Added. 44 1 45 2014-04-04 Mihnea Ovidenie <mihnea@adobe.com> 2 46 -
TabularUnified trunk/LayoutTests/css3/background/background-repeat-round-auto1-expected.html ¶
r156322 r166784 10 10 border: 50px solid transparent; 11 11 background-image: url(resources/circle.png); 12 background-size: 111px 88px;12 background-size: 50px auto; 13 13 background-repeat: repeat; 14 14 background-origin: border-box; -
TabularUnified trunk/LayoutTests/css3/background/background-repeat-round-auto1.html ¶
r153582 r166784 10 10 border: 50px solid transparent; 11 11 background-image: url(resources/circle.png); 12 background-size: 106px auto;12 background-size: 50px auto; 13 13 background-repeat: round repeat; 14 14 background-origin: border-box; -
TabularUnified trunk/LayoutTests/css3/background/background-repeat-round-auto2-expected.html ¶
r156322 r166784 10 10 border: 50px solid transparent; 11 11 background-image: url(resources/circle.png); 12 background-size: 124px 100px;12 background-size: auto 50px; 13 13 background-repeat: repeat; 14 14 background-origin: border-box; -
TabularUnified trunk/LayoutTests/css3/background/background-repeat-round-auto2.html ¶
r153582 r166784 10 10 border: 50px solid transparent; 11 11 background-image: url(resources/circle.png); 12 background-size: auto 99px;12 background-size: auto 50px; 13 13 background-repeat: repeat round; 14 14 background-origin: border-box; -
TabularUnified trunk/LayoutTests/css3/background/background-repeat-round-border-expected.html ¶
r156322 r166784 10 10 border: 50px solid transparent; 11 11 background-image: url(resources/circle.png); 12 background-size: 111px 85px;12 background-size: 50px; 13 13 background-repeat: repeat; 14 14 background-origin: border-box; -
TabularUnified trunk/LayoutTests/css3/background/background-repeat-round-border.html ¶
r153582 r166784 10 10 border: 50px solid transparent; 11 11 background-image: url(resources/circle.png); 12 background-size: 106px;12 background-size: 50px; 13 13 background-repeat: round; 14 14 background-origin: border-box; -
TabularUnified trunk/LayoutTests/css3/background/background-repeat-round-content-expected.html ¶
r156322 r166784 10 10 border: 50px solid transparent; 11 11 background-image: url(resources/circle.png); 12 background-size: 72px 40px;12 background-size: 100px; 13 13 background-repeat: repeat; 14 14 background-origin: content-box; -
TabularUnified trunk/LayoutTests/css3/background/background-repeat-round-content.html ¶
r153582 r166784 10 10 border: 50px solid transparent; 11 11 background-image: url(resources/circle.png); 12 background-size: 70px 40px;12 background-size: 100px; 13 13 background-repeat: round; 14 14 background-origin: content-box; -
TabularUnified trunk/LayoutTests/css3/background/background-repeat-space-content-expected.html ¶
r161884 r166784 4 4 <style> 5 5 div { 6 width: 800px;6 width: 600px; 7 7 height: 400px; 8 8 border: 50px solid transparent; 9 9 padding: 50px; 10 } 10 background-origin: content-box; 11 background-clip: content-box; 12 background-repeat: no-repeat; 13 } 11 14 </style> 12 15 <script> 13 var sizeX = 1 21, sizeY = 93, spaceX = 14, spaceY = 9, width = 800, height = 400;16 var sizeX = 100, sizeY = 80, spaceX = 0, spaceY = 0, width = 600, height = 400; 14 17 15 18 var urls = Array(), size = Array(), position = Array(); … … 28 31 div.style.cssText += "background-image: " + urls.join(", ") + ";" + 29 32 "background-size: " + size.join(", ") + ";" + 30 "background-position: " + position.join(", ") + ";" + 31 "background-repeat: no-repeat;" + 32 "background-origin: content-box;" + 33 "background-clip: content-box;"; 33 "background-position: " + position.join(", ") + ";"; 34 34 } 35 35 </script> -
TabularUnified trunk/LayoutTests/css3/background/background-repeat-space-content.html ¶
r154875 r166784 4 4 <style> 5 5 div { 6 width: 800px;6 width: 600px; 7 7 height: 400px; 8 8 border: 50px solid transparent; 9 9 padding: 50px; 10 10 background-image: url("resources/circle.png"); 11 background-size: 1 21px 93px;11 background-size: 100px; 12 12 background-repeat: space space; 13 13 background-origin: content-box; -
TabularUnified trunk/LayoutTests/css3/background/background-repeat-space-padding-expected.html ¶
r161884 r166784 8 8 border: 50px solid transparent; 9 9 padding: 50px; 10 background-repeat: no-repeat; 11 background-origin: padding-box; 12 background-clip: padding-box; 10 13 } 11 14 </style> 12 15 <script> 13 var sizeX = 15 3, sizeY = 127, spaceX = 20, spaceY = 9, width = 700, height = 600;16 var sizeX = 150, sizeY = 120, spaceX = 25, spaceY = 20, width = 400, height = 300; 14 17 15 18 var urls = Array(), size = Array(), position = Array(); … … 28 31 div.style.cssText += "background-image: " + urls.join(", ") + ";" + 29 32 "background-size: " + size.join(", ") + ";" + 30 "background-position: " + position.join(", ") + ";" + 31 "background-repeat: no-repeat;" + 32 "background-origin: padding-box;" + 33 "background-clip: padding-box;"; 33 "background-position: " + position.join(", ") + ";"; 34 34 } 35 35 </script> -
TabularUnified trunk/LayoutTests/css3/background/background-repeat-space-padding.html ¶
r154875 r166784 9 9 padding: 50px; 10 10 background-image: url("resources/circle.png"); 11 background-size: 15 3px 127px;11 background-size: 150px; 12 12 background-repeat: space; 13 13 background-origin: padding-box; -
TabularUnified trunk/LayoutTests/css3/masking/mask-repeat-round-auto1-expected.html ¶
r156322 r166784 15 15 padding: 50px; 16 16 -webkit-mask-image: url(resources/circle.png); 17 -webkit-mask-size: 1 11px 88px;17 -webkit-mask-size: 100px; 18 18 -webkit-mask-repeat: repeat; 19 19 -webkit-mask-origin: border-box; -
TabularUnified trunk/LayoutTests/css3/masking/mask-repeat-round-auto1.html ¶
r153582 r166784 15 15 padding: 50px; 16 16 -webkit-mask-image: url(resources/circle.png); 17 -webkit-mask-size: 10 6px auto;17 -webkit-mask-size: 100px; 18 18 -webkit-mask-repeat: round repeat; 19 19 -webkit-mask-origin: border-box; -
TabularUnified trunk/LayoutTests/css3/masking/mask-repeat-round-auto2-expected.html ¶
r156322 r166784 15 15 padding: 50px; 16 16 -webkit-mask-image: url(resources/circle.png); 17 -webkit-mask-size: 124px 100px;17 -webkit-mask-size: 50px; 18 18 -webkit-mask-repeat: repeat; 19 19 -webkit-mask-origin: border-box; -
TabularUnified trunk/LayoutTests/css3/masking/mask-repeat-round-auto2.html ¶
r153582 r166784 15 15 padding: 50px; 16 16 -webkit-mask-image: url(resources/circle.png); 17 -webkit-mask-size: auto 99px;17 -webkit-mask-size: 50px; 18 18 -webkit-mask-repeat: repeat round; 19 19 -webkit-mask-origin: border-box; -
TabularUnified trunk/LayoutTests/css3/masking/mask-repeat-round-border-expected.html ¶
r156322 r166784 15 15 padding: 50px; 16 16 -webkit-mask-image: url(resources/circle.png); 17 -webkit-mask-size: 111px 85px;17 -webkit-mask-size: 50px; 18 18 -webkit-mask-repeat: repeat; 19 19 -webkit-mask-origin: border-box; -
TabularUnified trunk/LayoutTests/css3/masking/mask-repeat-round-border.html ¶
r153582 r166784 15 15 padding: 50px; 16 16 -webkit-mask-image: url(resources/circle.png); 17 -webkit-mask-size: 106px;17 -webkit-mask-size: 50px; 18 18 -webkit-mask-repeat: round; 19 19 -webkit-mask-origin: border-box; -
TabularUnified trunk/LayoutTests/css3/masking/mask-repeat-round-content-expected.html ¶
r156322 r166784 15 15 padding: 50px; 16 16 -webkit-mask-image: url(resources/circle.png); 17 -webkit-mask-size: 72px 40px;17 -webkit-mask-size: 50px; 18 18 -webkit-mask-repeat: repeat; 19 19 -webkit-mask-origin: content-box; -
TabularUnified trunk/LayoutTests/css3/masking/mask-repeat-round-content.html ¶
r153582 r166784 15 15 padding: 50px; 16 16 -webkit-mask-image: url(resources/circle.png); 17 -webkit-mask-size: 70px 40px;17 -webkit-mask-size: 50px; 18 18 -webkit-mask-repeat: round; 19 19 -webkit-mask-origin: content-box; -
TabularUnified trunk/LayoutTests/css3/masking/mask-repeat-space-content-expected.html ¶
r161884 r166784 14 14 border: 50px solid blue; 15 15 padding: 50px; 16 -webkit-mask-repeat: no-repeat; 17 -webkit-mask-origin: content-box; 18 -webkit-mask-clip: content-box; 16 19 } 17 20 </style> 18 21 <script> 19 var sizeX = 1 21, sizeY = 93, spaceX = 58, spaceY = 10, width = 300, height = 300;22 var sizeX = 100, sizeY = 80, spaceX = 0, spaceY = 30, width = 300, height = 300; 20 23 21 24 var urls = Array(), size = Array(), position = Array(); … … 24 27 for (var x = 0; x < width; x += sizeX + spaceX) { 25 28 for (var y = 0; y < height; y += sizeY + spaceY) { 26 urls.push("url(resources/circle. svg)");29 urls.push("url(resources/circle.png)"); 27 30 size.push(sizeX + "px " + sizeY + "px"); 28 31 position.push(x + "px " + y + "px"); … … 34 37 div.style.cssText += "-webkit-mask-image: " + urls.join(", ") + ";" + 35 38 "-webkit-mask-size: " + size.join(", ") + ";" + 36 "-webkit-mask-position: " + position.join(", ") + ";" + 37 "-webkit-mask-repeat: no-repeat;" + 38 "-webkit-mask-origin: content-box;" + 39 "-webkit-mask-clip: content-box;"; 39 "-webkit-mask-position: " + position.join(", ") + ";"; 40 40 } 41 41 </script> -
TabularUnified trunk/LayoutTests/css3/masking/mask-repeat-space-content.html ¶
r154875 r166784 14 14 border: 50px solid blue; 15 15 padding: 50px; 16 -webkit-mask-image: url("resources/circle. svg");17 -webkit-mask-size: 1 21px 93px;16 -webkit-mask-image: url("resources/circle.png"); 17 -webkit-mask-size: 100px; 18 18 -webkit-mask-repeat: space space; 19 19 -webkit-mask-origin: content-box; -
TabularUnified trunk/LayoutTests/css3/masking/mask-repeat-space-padding-expected.html ¶
r161884 r166784 14 14 border: 50px solid blue; 15 15 padding: 50px; 16 -webkit-mask-repeat: no-repeat; 17 -webkit-mask-origin: padding-box; 18 -webkit-mask-clip: padding-box; 16 19 } 17 20 </style> 18 21 <script> 19 var sizeX = 1 53, sizeY = 127, spaceX = 20, spaceY = 9, width = 700, height = 600;22 var sizeX = 100, sizeY = 80, spaceX = 0, spaceY = 0, width = 700, height = 600; 20 23 21 24 var urls = Array(), size = Array(), position = Array(); … … 34 37 div.style.cssText += "-webkit-mask-image: " + urls.join(", ") + ";" + 35 38 "-webkit-mask-size: " + size.join(", ") + ";" + 36 "-webkit-mask-position: " + position.join(", ") + ";" + 37 "-webkit-mask-repeat: no-repeat;" + 38 "-webkit-mask-origin: padding-box;" + 39 "-webkit-mask-clip: padding-box;"; 39 "-webkit-mask-position: " + position.join(", ") + ";"; 40 40 } 41 41 </script> -
TabularUnified trunk/LayoutTests/css3/masking/mask-repeat-space-padding.html ¶
r156097 r166784 15 15 padding: 50px; 16 16 -webkit-mask-image: url("resources/circle.png"); 17 -webkit-mask-size: 1 53px 127px;17 -webkit-mask-size: 100px; 18 18 -webkit-mask-repeat: space; 19 19 -webkit-mask-origin: padding-box; -
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r166783 r166784 1 2014-04-04 Zalan Bujtas <zalan@apple.com> 2 3 Subpixel rendering: Move background images to device pixel boundaries. 4 https://bugs.webkit.org/show_bug.cgi?id=131144 5 6 Reviewed by Simon Fraser. 7 8 Replace integral snapping with device pixel snapping. 9 Background image geometry calculation uses LayoutUnits and we snap to device pixels right before painting. 10 11 Tests: fast/backgrounds/hidpi-bitmap-background-on-subpixel-position.html 12 fast/backgrounds/hidpi-bitmap-background-origin-on-subpixel-position.html 13 fast/backgrounds/hidpi-bitmap-background-repeat-on-subpixel-position.html 14 fast/backgrounds/hidpi-generated-gradient-background-on-subpixel-position.html 15 16 * platform/graphics/GraphicsLayer.h: 17 (WebCore::GraphicsLayer::setContentsTilePhase): 18 (WebCore::GraphicsLayer::contentsTilePhase): 19 (WebCore::GraphicsLayer::setContentsTileSize): 20 (WebCore::GraphicsLayer::contentsTileSize): 21 * platform/graphics/texmap/TextureMapperLayer.cpp: 22 (WebCore::TextureMapperLayer::setContentsTileSize): 23 (WebCore::TextureMapperLayer::setContentsTilePhase): 24 * platform/graphics/texmap/TextureMapperLayer.h: 25 * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp: 26 (WebCore::CoordinatedGraphicsLayer::setContentsTileSize): 27 (WebCore::CoordinatedGraphicsLayer::setContentsTilePhase): 28 * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h: 29 * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h: 30 * rendering/RenderBox.cpp: 31 (WebCore::RenderBox::repaintLayerRectsForImage): 32 * rendering/RenderBoxModelObject.cpp: 33 (WebCore::RenderBoxModelObject::paintFillLayerExtended): 34 (WebCore::resolveWidthForRatio): 35 (WebCore::resolveHeightForRatio): 36 (WebCore::resolveAgainstIntrinsicWidthOrHeightAndRatio): 37 (WebCore::resolveAgainstIntrinsicRatio): 38 (WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions): 39 (WebCore::RenderBoxModelObject::calculateFillTileSize): 40 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatX): 41 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatY): 42 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::useFixedAttachment): 43 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::clip): 44 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::relativePhase): 45 (WebCore::getSpace): 46 (WebCore::RenderBoxModelObject::pixelSnapBackgroundImageGeometryForPainting): 47 (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): 48 (WebCore::RenderBoxModelObject::getGeometryForBackgroundImage): 49 (WebCore::RenderBoxModelObject::paintNinePieceImage): 50 (WebCore::applySubPixelHeuristicForTileSize): Deleted. 51 * rendering/RenderBoxModelObject.h: 52 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::destOrigin): 53 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setDestOrigin): 54 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::destRect): 55 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setDestRect): 56 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::phase): 57 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setPhase): 58 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::tileSize): 59 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setTileSize): 60 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::spaceSize): 61 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setSpaceSize): 62 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setPhaseX): 63 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setPhaseY): 64 * rendering/RenderLayerBacking.cpp: 65 (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage): 66 * rendering/shapes/ShapeOutsideInfo.cpp: 67 (WebCore::getShapeImageAndRect): 68 1 69 2014-04-04 Brent Fulgham <bfulgham@apple.com> 2 70 -
TabularUnified trunk/Source/WebCore/platform/graphics/GraphicsLayer.h ¶
r166308 r166784 369 369 370 370 // The tile phase is relative to the GraphicsLayer bounds. 371 virtual void setContentsTilePhase(const IntPoint& p) { m_contentsTilePhase = p; }372 IntPoint contentsTilePhase() const { return m_contentsTilePhase; }373 374 virtual void setContentsTileSize(const IntSize& s) { m_contentsTileSize = s; }375 IntSize contentsTileSize() const { return m_contentsTileSize; }371 virtual void setContentsTilePhase(const FloatPoint& p) { m_contentsTilePhase = p; } 372 FloatPoint contentsTilePhase() const { return m_contentsTilePhase; } 373 374 virtual void setContentsTileSize(const FloatSize& s) { m_contentsTileSize = s; } 375 FloatSize contentsTileSize() const { return m_contentsTileSize; } 376 376 bool hasContentsTiling() const { return !m_contentsTileSize.isEmpty(); } 377 377 … … 611 611 FloatRect m_contentsRect; 612 612 FloatRect m_contentsClippingRect; 613 IntPoint m_contentsTilePhase;614 IntSize m_contentsTileSize;613 FloatPoint m_contentsTilePhase; 614 FloatSize m_contentsTileSize; 615 615 616 616 int m_repaintCount; -
TabularUnified trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp ¶
r165665 r166784 569 569 } 570 570 571 void TextureMapperLayer::setContentsTileSize(const IntSize& size)571 void TextureMapperLayer::setContentsTileSize(const FloatSize& size) 572 572 { 573 573 if (size == m_state.contentsTileSize) … … 577 577 } 578 578 579 void TextureMapperLayer::setContentsTilePhase(const IntPoint& phase)579 void TextureMapperLayer::setContentsTilePhase(const FloatPoint& phase) 580 580 { 581 581 if (phase == m_state.contentsTilePhase) -
TabularUnified trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h ¶
r165341 r166784 100 100 void setOpacity(float); 101 101 void setSolidColor(const Color&); 102 void setContentsTileSize(const IntSize&);103 void setContentsTilePhase(const IntPoint&);102 void setContentsTileSize(const FloatSize&); 103 void setContentsTilePhase(const FloatPoint&); 104 104 #if ENABLE(CSS_FILTERS) 105 105 void setFilters(const FilterOperations&); … … 211 211 float opacity; 212 212 FloatRect contentsRect; 213 IntSize contentsTileSize;214 IntPoint contentsTilePhase;213 FloatSize contentsTileSize; 214 FloatPoint contentsTilePhase; 215 215 TextureMapperLayer* maskLayer; 216 216 TextureMapperLayer* replicaLayer; -
TabularUnified trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp ¶
r165354 r166784 347 347 } 348 348 349 void CoordinatedGraphicsLayer::setContentsTileSize(const IntSize& s)349 void CoordinatedGraphicsLayer::setContentsTileSize(const FloatSize& s) 350 350 { 351 351 if (contentsTileSize() == s) … … 358 358 } 359 359 360 void CoordinatedGraphicsLayer::setContentsTilePhase(const IntPoint& p)360 void CoordinatedGraphicsLayer::setContentsTilePhase(const FloatPoint& p) 361 361 { 362 362 if (contentsTilePhase() == p) -
TabularUnified trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h ¶
r165354 r166784 86 86 virtual void setOpacity(float) override; 87 87 virtual void setContentsRect(const FloatRect&) override; 88 virtual void setContentsTilePhase(const IntPoint&) override;89 virtual void setContentsTileSize(const IntSize&) override;88 virtual void setContentsTilePhase(const FloatPoint&) override; 89 virtual void setContentsTileSize(const FloatSize&) override; 90 90 virtual void setContentsToImage(Image*) override; 91 91 virtual void setContentsToSolidColor(const Color&) override; -
TabularUnified trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h ¶
r165341 r166784 143 143 TransformationMatrix childrenTransform; 144 144 FloatRect contentsRect; 145 IntPoint contentsTilePhase;146 IntSize contentsTileSize;145 FloatPoint contentsTilePhase; 146 FloatSize contentsTileSize; 147 147 float opacity; 148 148 Color solidColor; -
TabularUnified trunk/Source/WebCore/rendering/RenderBox.cpp ¶
r166422 r166784 1624 1624 } 1625 1625 1626 IntRect rectToRepaint = geometry.destRect();1626 LayoutRect rectToRepaint = geometry.destRect(); 1627 1627 bool shouldClipToLayer = true; 1628 1628 -
TabularUnified trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp ¶
r166138 r166784 774 774 // by verifying whether the background image covers the entire layout rect. 775 775 if (!bgLayer->next()) { 776 IntRect backgroundRect(pixelSnappedIntRect(scrolledPaintRect));776 LayoutRect backgroundRect(scrolledPaintRect); 777 777 bool boxShadowShouldBeAppliedToBackground = this->boxShadowShouldBeAppliedToBackground(bleedAvoidance, box); 778 778 if (boxShadowShouldBeAppliedToBackground || !shouldPaintBackgroundImage || !bgLayer->hasOpaqueImage(this) || !bgLayer->hasRepeatXY()) { 779 779 if (!boxShadowShouldBeAppliedToBackground) 780 backgroundRect.intersect(p ixelSnappedIntRect(paintInfo.rect));780 backgroundRect.intersect(paintInfo.rect); 781 781 782 782 // If we have an alpha and we are painting the root element, go ahead and blend with the base background color. … … 793 793 applyBoxShadowForBackground(context, &style()); 794 794 795 FloatRect backgroundRectForPainting = pixelSnappedForPainting(backgroundRect, deviceScaleFactor); 795 796 if (baseColor.alpha()) { 796 797 if (bgColor.alpha()) 797 798 baseColor = baseColor.blend(bgColor); 798 799 799 context->fillRect(backgroundRect , baseColor, style().colorSpace(), CompositeCopy);800 context->fillRect(backgroundRectForPainting, baseColor, style().colorSpace(), CompositeCopy); 800 801 } else if (bgColor.alpha()) { 801 802 CompositeOperator operation = shouldClearBackground ? CompositeCopy : context->compositeOperation(); 802 context->fillRect(backgroundRect , bgColor, style().colorSpace(), operation);803 context->fillRect(backgroundRectForPainting, bgColor, style().colorSpace(), operation); 803 804 } else if (shouldClearBackground) 804 context->clearRect(backgroundRect );805 context->clearRect(backgroundRectForPainting); 805 806 } 806 807 } … … 810 811 BackgroundImageGeometry geometry; 811 812 calculateBackgroundImageGeometry(paintInfo.paintContainer, bgLayer, scrolledPaintRect, geometry, backgroundObject); 812 geometry.clip( pixelSnappedIntRect(paintInfo.rect));813 geometry.clip(LayoutRect(pixelSnappedRect)); 813 814 if (!geometry.destRect().isEmpty()) { 814 815 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer->composite() : op; … … 819 820 if (image.get()) 820 821 image->setSpaceSize(geometry.spaceSize()); 821 context->drawTiledImage(image.get(), style().colorSpace(), geometry.destRect(), geometry.relativePhase(), geometry.tileSize(), 822 compositeOp, useLowQualityScaling, bgLayer->blendMode()); 822 context->drawTiledImage(image.get(), style().colorSpace(), geometry.destRect(), geometry.relativePhase(), geometry.tileSize(), compositeOp, useLowQualityScaling, bgLayer->blendMode()); 823 823 } 824 824 } … … 830 830 } 831 831 832 static inline int resolveWidthForRatio( int height, const FloatSize& intrinsicRatio)833 { 834 return ceilf(height * intrinsicRatio.width() / intrinsicRatio.height());835 } 836 837 static inline int resolveHeightForRatio( int width, const FloatSize& intrinsicRatio)838 { 839 return ceilf(width * intrinsicRatio.height() / intrinsicRatio.width());840 } 841 842 static inline IntSize resolveAgainstIntrinsicWidthOrHeightAndRatio(const IntSize& size, const FloatSize& intrinsicRatio, int useWidth, int useHeight)832 static inline int resolveWidthForRatio(LayoutUnit height, const FloatSize& intrinsicRatio) 833 { 834 return height * intrinsicRatio.width() / intrinsicRatio.height(); 835 } 836 837 static inline int resolveHeightForRatio(LayoutUnit width, const FloatSize& intrinsicRatio) 838 { 839 return width * intrinsicRatio.height() / intrinsicRatio.width(); 840 } 841 842 static inline LayoutSize resolveAgainstIntrinsicWidthOrHeightAndRatio(const LayoutSize& size, const FloatSize& intrinsicRatio, LayoutUnit useWidth, LayoutUnit useHeight) 843 843 { 844 844 if (intrinsicRatio.isEmpty()) { 845 845 if (useWidth) 846 return IntSize(useWidth, size.height());847 return IntSize(size.width(), useHeight);846 return LayoutSize(useWidth, size.height()); 847 return LayoutSize(size.width(), useHeight); 848 848 } 849 849 850 850 if (useWidth) 851 return IntSize(useWidth, resolveHeightForRatio(useWidth, intrinsicRatio));852 return IntSize(resolveWidthForRatio(useHeight, intrinsicRatio), useHeight);853 } 854 855 static inline IntSize resolveAgainstIntrinsicRatio(const IntSize& size, const FloatSize& intrinsicRatio)851 return LayoutSize(useWidth, resolveHeightForRatio(useWidth, intrinsicRatio)); 852 return LayoutSize(resolveWidthForRatio(useHeight, intrinsicRatio), useHeight); 853 } 854 855 static inline LayoutSize resolveAgainstIntrinsicRatio(const LayoutSize& size, const FloatSize& intrinsicRatio) 856 856 { 857 857 // Two possible solutions: (size.width(), solutionHeight) or (solutionWidth, size.height()) 858 858 // "... must be assumed to be the largest dimensions..." = easiest answer: the rect with the largest surface area. 859 859 860 int solutionWidth = resolveWidthForRatio(size.height(), intrinsicRatio);861 int solutionHeight = resolveHeightForRatio(size.width(), intrinsicRatio);860 LayoutUnit solutionWidth = resolveWidthForRatio(size.height(), intrinsicRatio); 861 LayoutUnit solutionHeight = resolveHeightForRatio(size.width(), intrinsicRatio); 862 862 if (solutionWidth <= size.width()) { 863 863 if (solutionHeight <= size.height()) { 864 864 // If both solutions fit, choose the one covering the larger area. 865 int areaOne = solutionWidth * size.height();866 int areaTwo = size.width() * solutionHeight;865 LayoutUnit areaOne = solutionWidth * size.height(); 866 LayoutUnit areaTwo = size.width() * solutionHeight; 867 867 if (areaOne < areaTwo) 868 return IntSize(size.width(), solutionHeight);869 return IntSize(solutionWidth, size.height());868 return LayoutSize(size.width(), solutionHeight); 869 return LayoutSize(solutionWidth, size.height()); 870 870 } 871 871 872 872 // Only the first solution fits. 873 return IntSize(solutionWidth, size.height());873 return LayoutSize(solutionWidth, size.height()); 874 874 } 875 875 876 876 // Only the second solution fits, assert that. 877 877 ASSERT(solutionHeight <= size.height()); 878 return IntSize(size.width(), solutionHeight);879 } 880 881 IntSize RenderBoxModelObject::calculateImageIntrinsicDimensions(StyleImage* image, const IntSize& positioningAreaSize, ScaleByEffectiveZoomOrNot shouldScaleOrNot) const878 return LayoutSize(size.width(), solutionHeight); 879 } 880 881 LayoutSize RenderBoxModelObject::calculateImageIntrinsicDimensions(StyleImage* image, const LayoutSize& positioningAreaSize, ScaleByEffectiveZoomOrNot shouldScaleOrNot) const 882 882 { 883 883 // A generated image without a fixed size, will always return the container size as intrinsic size. 884 884 if (image->isGeneratedImage() && image->usesImageContainerSize()) 885 return IntSize(positioningAreaSize.width(), positioningAreaSize.height());885 return LayoutSize(positioningAreaSize.width(), positioningAreaSize.height()); 886 886 887 887 Length intrinsicWidth; … … 896 896 if (intrinsicWidth.isPercent() && intrinsicHeight.isPercent() && intrinsicRatio.isEmpty()) { 897 897 // Resolve width/height percentages against positioningAreaSize, only if no intrinsic ratio is provided. 898 int resolvedWidth = static_cast<int>(round(positioningAreaSize.width() * intrinsicWidth.percent() / 100));899 int resolvedHeight = static_cast<int>(round(positioningAreaSize.height() * intrinsicHeight.percent() / 100));900 return IntSize(resolvedWidth, resolvedHeight);901 } 902 903 IntSize resolvedSize(intrinsicWidth.isFixed() ? intrinsicWidth.value() : 0, intrinsicHeight.isFixed() ? intrinsicHeight.value() : 0);904 IntSize minimumSize(resolvedSize.width() > 0 ? 1 : 0, resolvedSize.height() > 0 ? 1 : 0);898 float resolvedWidth = positioningAreaSize.width() * intrinsicWidth.percent() / 100; 899 float resolvedHeight = positioningAreaSize.height() * intrinsicHeight.percent() / 100; 900 return LayoutSize(resolvedWidth, resolvedHeight); 901 } 902 903 LayoutSize resolvedSize(intrinsicWidth.isFixed() ? intrinsicWidth.value() : 0, intrinsicHeight.isFixed() ? intrinsicHeight.value() : 0); 904 LayoutSize minimumSize(resolvedSize.width() > 0 ? 1 : 0, resolvedSize.height() > 0 ? 1 : 0); 905 905 if (shouldScaleOrNot == ScaleByEffectiveZoom) 906 906 resolvedSize.scale(style().effectiveZoom()); … … 928 928 } 929 929 930 static inline void applySubPixelHeuristicForTileSize(LayoutSize& tileSize, const IntSize& positioningAreaSize) 931 { 932 tileSize.setWidth(positioningAreaSize.width() - tileSize.width() <= 1 ? tileSize.width().ceil() : tileSize.width().floor()); 933 tileSize.setHeight(positioningAreaSize.height() - tileSize.height() <= 1 ? tileSize.height().ceil() : tileSize.height().floor()); 934 } 935 936 IntSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer, const IntSize& positioningAreaSize) const 930 LayoutSize RenderBoxModelObject::calculateFillTileSize(const FillLayer* fillLayer, const LayoutSize& positioningAreaSize) const 937 931 { 938 932 StyleImage* image = fillLayer->image(); 939 933 EFillSizeType type = fillLayer->size().type; 940 934 941 IntSize imageIntrinsicSize = calculateImageIntrinsicDimensions(image, positioningAreaSize, ScaleByEffectiveZoom);935 LayoutSize imageIntrinsicSize = calculateImageIntrinsicDimensions(image, positioningAreaSize, ScaleByEffectiveZoom); 942 936 imageIntrinsicSize.scale(1 / image->imageScaleFactor(), 1 / image->imageScaleFactor()); 943 937 switch (type) { … … 957 951 else if (layerHeight.isPercent() || layerHeight.isViewportPercentage()) 958 952 tileSize.setHeight(valueForLength(layerHeight, positioningAreaSize.height())); 959 960 applySubPixelHeuristicForTileSize(tileSize, positioningAreaSize);961 953 962 954 // If one of the values is auto we have to use the appropriate … … 974 966 975 967 tileSize.clampNegativeToZero(); 976 return flooredIntSize(tileSize);968 return tileSize; 977 969 } 978 970 case SizeNone: { … … 987 979 case Contain: 988 980 case Cover: { 989 float horizontalScaleFactor = imageIntrinsicSize.width() 990 ? static_cast<float>(positioningAreaSize.width()) / imageIntrinsicSize.width() : 1; 991 float verticalScaleFactor = imageIntrinsicSize.height() 992 ? static_cast<float>(positioningAreaSize.height()) / imageIntrinsicSize.height() : 1; 981 float horizontalScaleFactor = imageIntrinsicSize.width() ? (positioningAreaSize.width() / imageIntrinsicSize.width()).toFloat() : 1; 982 float verticalScaleFactor = imageIntrinsicSize.height() ? (positioningAreaSize.height() / imageIntrinsicSize.height()).toFloat() : 1; 993 983 float scaleFactor = type == Contain ? std::min(horizontalScaleFactor, verticalScaleFactor) : std::max(horizontalScaleFactor, verticalScaleFactor); 994 return IntSize(std::max(1, static_cast<int>(imageIntrinsicSize.width() * scaleFactor)), std::max(1, static_cast<int>(imageIntrinsicSize.height() * scaleFactor))); 984 float deviceScaleFactor = document().deviceScaleFactor(); 985 return LayoutSize(std::max<LayoutUnit>(1 / deviceScaleFactor, imageIntrinsicSize.width() * scaleFactor), 986 std::max<LayoutUnit>(1 / deviceScaleFactor, imageIntrinsicSize.height() * scaleFactor)); 995 987 } 996 988 } 997 989 998 990 ASSERT_NOT_REACHED(); 999 return IntSize();1000 } 1001 1002 void RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatX( int xOffset)1003 { 1004 m_destRect.move(std::max (xOffset, 0), 0);1005 m_phase.setX(-std::min (xOffset, 0));1006 m_destRect.setWidth(m_tileSize.width() + std::min (xOffset, 0));1007 } 1008 void RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatY( int yOffset)1009 { 1010 m_destRect.move(0, std::max (yOffset, 0));1011 m_phase.setY(-std::min (yOffset, 0));1012 m_destRect.setHeight(m_tileSize.height() + std::min (yOffset, 0));1013 } 1014 1015 void RenderBoxModelObject::BackgroundImageGeometry::useFixedAttachment(const IntPoint& attachmentPoint)1016 { 1017 IntPoint alignedPoint = attachmentPoint;1018 m_phase.move(std::max (alignedPoint.x() - m_destRect.x(), 0), std::max(alignedPoint.y() - m_destRect.y(), 0));1019 } 1020 1021 void RenderBoxModelObject::BackgroundImageGeometry::clip(const IntRect& clipRect)991 return LayoutSize(); 992 } 993 994 void RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatX(LayoutUnit xOffset) 995 { 996 m_destRect.move(std::max<LayoutUnit>(xOffset, 0), 0); 997 m_phase.setX(-std::min<LayoutUnit>(xOffset, 0)); 998 m_destRect.setWidth(m_tileSize.width() + std::min<float>(xOffset, 0)); 999 } 1000 void RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatY(LayoutUnit yOffset) 1001 { 1002 m_destRect.move(0, std::max<LayoutUnit>(yOffset, 0)); 1003 m_phase.setY(-std::min<LayoutUnit>(yOffset, 0)); 1004 m_destRect.setHeight(m_tileSize.height() + std::min<float>(yOffset, 0)); 1005 } 1006 1007 void RenderBoxModelObject::BackgroundImageGeometry::useFixedAttachment(const LayoutPoint& attachmentPoint) 1008 { 1009 FloatPoint alignedPoint = attachmentPoint; 1010 m_phase.move(std::max<LayoutUnit>(alignedPoint.x() - m_destRect.x(), 0), std::max<LayoutUnit>(alignedPoint.y() - m_destRect.y(), 0)); 1011 } 1012 1013 void RenderBoxModelObject::BackgroundImageGeometry::clip(const LayoutRect& clipRect) 1022 1014 { 1023 1015 m_destRect.intersect(clipRect); 1024 1016 } 1025 1017 1026 IntPoint RenderBoxModelObject::BackgroundImageGeometry::relativePhase() const1027 { 1028 IntPoint phase = m_phase;1018 LayoutPoint RenderBoxModelObject::BackgroundImageGeometry::relativePhase() const 1019 { 1020 LayoutPoint phase = m_phase; 1029 1021 phase += m_destRect.location() - m_destOrigin; 1030 1022 return phase; … … 1046 1038 } 1047 1039 1048 static inline int getSpace(int areaSize, int tileSize)1040 static inline LayoutUnit getSpace(LayoutUnit areaSize, LayoutUnit tileSize) 1049 1041 { 1050 1042 int numberOfTiles = areaSize / tileSize; 1051 int space = -1;1043 LayoutUnit space = -1; 1052 1044 1053 1045 if (numberOfTiles > 1) 1054 space = roundedLayoutUnit((float)(areaSize - numberOfTiles * tileSize) / (numberOfTiles - 1));1046 space = (areaSize - numberOfTiles * tileSize) / (numberOfTiles - 1); 1055 1047 1056 1048 return space; 1049 } 1050 1051 void RenderBoxModelObject::pixelSnapBackgroundImageGeometryForPainting(BackgroundImageGeometry& geometry) const 1052 { 1053 float deviceScaleFactor = document().deviceScaleFactor(); 1054 // FIXME: We need a better rounding strategy to round/space out tiles. 1055 geometry.setTileSize(LayoutSize(pixelSnappedForPainting(LayoutRect(geometry.destRect().location(), geometry.tileSize()), deviceScaleFactor).size())); 1056 geometry.setSpaceSize(LayoutSize(pixelSnappedForPainting(LayoutRect(LayoutPoint(), geometry.spaceSize()), deviceScaleFactor).size())); 1057 geometry.setDestOrigin(LayoutPoint(roundedForPainting(geometry.destOrigin(), deviceScaleFactor))); 1058 geometry.setDestRect(LayoutRect(pixelSnappedForPainting(geometry.destRect(), deviceScaleFactor))); 1059 geometry.setPhase(LayoutPoint(roundedForPainting(geometry.phase(), deviceScaleFactor))); 1057 1060 } 1058 1061 … … 1062 1065 LayoutUnit left = 0; 1063 1066 LayoutUnit top = 0; 1064 IntSize positioningAreaSize; 1065 IntRect snappedPaintRect = pixelSnappedIntRect(paintRect); 1066 1067 LayoutSize positioningAreaSize; 1067 1068 // Determine the background positioning area and set destRect to the background painting area. 1068 1069 // destRect will be adjusted later if the background is non-repeating. … … 1081 1082 1082 1083 if (!fixedAttachment) { 1083 geometry.setDestRect( snappedPaintRect);1084 geometry.setDestRect(paintRect); 1084 1085 1085 1086 LayoutUnit right = 0; … … 1103 1104 // the background positioning area. 1104 1105 if (isRoot()) { 1105 positioningAreaSize = pixelSnappedIntSize(toRenderBox(this)->size() - LayoutSize(left + right, top + bottom), toRenderBox(this)->location());1106 positioningAreaSize = toRenderBox(this)->size() - LayoutSize(left + right, top + bottom); 1106 1107 if (view().frameView().hasExtendedBackgroundRectForPainting()) { 1107 IntRect extendedBackgroundRect = view().frameView().extendedBackgroundRectForPainting();1108 LayoutRect extendedBackgroundRect = view().frameView().extendedBackgroundRectForPainting(); 1108 1109 left += (marginLeft() - extendedBackgroundRect.x()); 1109 1110 top += (marginTop() - extendedBackgroundRect.y()); 1110 1111 } 1111 1112 } else 1112 positioningAreaSize = p ixelSnappedIntSize(paintRect.size() - LayoutSize(left + right, top + bottom), paintRect.location());1113 positioningAreaSize = paintRect.size() - LayoutSize(left + right, top + bottom); 1113 1114 } else { 1114 1115 geometry.setHasNonLocalGeometry(); … … 1120 1121 viewportRect.setLocation(toLayoutPoint(view().frameView().scrollOffsetForFixedPosition())); 1121 1122 1122 if (paintContainer) { 1123 LayoutPoint absoluteContainerOffset = roundedLayoutPoint(paintContainer->localToAbsolute(FloatPoint())); 1124 viewportRect.moveBy(-absoluteContainerOffset); 1125 } 1126 1127 geometry.setDestRect(pixelSnappedIntRect(viewportRect)); 1123 if (paintContainer) 1124 viewportRect.moveBy(LayoutPoint(-paintContainer->localToAbsolute(FloatPoint()))); 1125 1126 geometry.setDestRect(viewportRect); 1128 1127 positioningAreaSize = geometry.destRect().size(); 1129 1128 } 1130 1129 1131 1130 auto clientForBackgroundImage = backgroundObject ? backgroundObject : this; 1132 IntSize fillTileSize = calculateFillTileSize(fillLayer, positioningAreaSize);1131 LayoutSize fillTileSize = calculateFillTileSize(fillLayer, positioningAreaSize); 1133 1132 fillLayer->image()->setContainerSizeForRenderer(clientForBackgroundImage, fillTileSize, style().effectiveZoom()); 1134 1133 geometry.setTileSize(fillTileSize); … … 1136 1135 EFillRepeat backgroundRepeatX = fillLayer->repeatX(); 1137 1136 EFillRepeat backgroundRepeatY = fillLayer->repeatY(); 1138 int availableWidth = positioningAreaSize.width() - geometry.tileSize().width();1139 int availableHeight = positioningAreaSize.height() - geometry.tileSize().height();1137 LayoutUnit availableWidth = positioningAreaSize.width() - geometry.tileSize().width(); 1138 LayoutUnit availableHeight = positioningAreaSize.height() - geometry.tileSize().height(); 1140 1139 1141 1140 LayoutUnit computedXPosition = minimumValueForLength(fillLayer->xPosition(), availableWidth, true); 1142 1141 if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > 0 && fillTileSize.width() > 0) { 1143 long nrTiles = lroundf((float)positioningAreaSize.width() / fillTileSize.width()); 1144 if (!nrTiles) 1145 nrTiles = 1; 1146 1142 int numTiles = std::max(1, roundToInt(positioningAreaSize.width() / fillTileSize.width())); 1147 1143 if (fillLayer->size().size.height().isAuto() && backgroundRepeatY != RoundFill) 1148 fillTileSize.setHeight(fillTileSize.height() * positioningAreaSize.width() / (n rTiles * fillTileSize.width()));1149 1150 fillTileSize.setWidth(positioningAreaSize.width() / n rTiles);1144 fillTileSize.setHeight(fillTileSize.height() * positioningAreaSize.width() / (numTiles * fillTileSize.width())); 1145 1146 fillTileSize.setWidth(positioningAreaSize.width() / numTiles); 1151 1147 geometry.setTileSize(fillTileSize); 1152 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - roundToInt(computedXPosition + left) % geometry.tileSize().width() : 0);1153 geometry.setSpaceSize( FloatSize());1148 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - fmodf((computedXPosition + left), geometry.tileSize().width()) : 0); 1149 geometry.setSpaceSize(LayoutSize()); 1154 1150 } 1155 1151 1156 1152 LayoutUnit computedYPosition = minimumValueForLength(fillLayer->yPosition(), availableHeight, true); 1157 1153 if (backgroundRepeatY == RoundFill && positioningAreaSize.height() > 0 && fillTileSize.height() > 0) { 1158 long nrTiles = lroundf((float)positioningAreaSize.height() / fillTileSize.height()); 1159 if (!nrTiles) 1160 nrTiles = 1; 1161 1154 int numTiles = std::max(1, roundToInt(positioningAreaSize.height() / fillTileSize.height())); 1162 1155 if (fillLayer->size().size.width().isAuto() && backgroundRepeatX != RoundFill) 1163 fillTileSize.setWidth(fillTileSize.width() * positioningAreaSize.height() / (n rTiles * fillTileSize.height()));1164 1165 fillTileSize.setHeight(positioningAreaSize.height() / n rTiles);1156 fillTileSize.setWidth(fillTileSize.width() * positioningAreaSize.height() / (numTiles * fillTileSize.height())); 1157 1158 fillTileSize.setHeight(positioningAreaSize.height() / numTiles); 1166 1159 geometry.setTileSize(fillTileSize); 1167 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0);1168 geometry.setSpaceSize( FloatSize());1160 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - fmodf((computedYPosition + top), geometry.tileSize().height()) : 0); 1161 geometry.setSpaceSize(LayoutSize()); 1169 1162 } 1170 1163 1171 1164 if (backgroundRepeatX == RepeatFill) { 1172 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - roundToInt(computedXPosition + left) % geometry.tileSize().width(): 0);1173 geometry.setSpaceSize( FloatSize(0, geometry.spaceSize().height()));1165 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - fmodf(computedXPosition + left, geometry.tileSize().width()): 0); 1166 geometry.setSpaceSize(LayoutSize(0, geometry.spaceSize().height())); 1174 1167 } else if (backgroundRepeatX == SpaceFill && fillTileSize.width() > 0) { 1175 int space = getSpace(positioningAreaSize.width(), geometry.tileSize().width());1176 int actualWidth = geometry.tileSize().width() + space;1168 LayoutUnit space = getSpace(positioningAreaSize.width(), geometry.tileSize().width()); 1169 LayoutUnit actualWidth = geometry.tileSize().width() + space; 1177 1170 1178 1171 if (space >= 0) { 1179 1172 computedXPosition = minimumValueForLength(Length(), availableWidth, true); 1180 geometry.setSpaceSize( FloatSize(space, 0));1181 geometry.setPhaseX(actualWidth ? actualWidth - roundToInt(computedXPosition + left) % actualWidth: 0);1173 geometry.setSpaceSize(LayoutSize(space, 0)); 1174 geometry.setPhaseX(actualWidth ? actualWidth - fmodf((computedXPosition + left), actualWidth) : 0); 1182 1175 } else 1183 1176 backgroundRepeatX = NoRepeatFill; 1184 1177 } 1185 1178 if (backgroundRepeatX == NoRepeatFill) { 1186 int xOffset = fillLayer->backgroundXOrigin() == RightEdge ? availableWidth - computedXPosition : computedXPosition;1179 LayoutUnit xOffset = fillLayer->backgroundXOrigin() == RightEdge ? availableWidth - computedXPosition : computedXPosition; 1187 1180 geometry.setNoRepeatX(left + xOffset); 1188 geometry.setSpaceSize( FloatSize(0, geometry.spaceSize().height()));1181 geometry.setSpaceSize(LayoutSize(0, geometry.spaceSize().height())); 1189 1182 } 1190 1183 1191 1184 if (backgroundRepeatY == RepeatFill) { 1192 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0);1193 geometry.setSpaceSize( FloatSize(geometry.spaceSize().width(), 0));1185 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - fmodf(computedYPosition + top, geometry.tileSize().height()) : 0); 1186 geometry.setSpaceSize(LayoutSize(geometry.spaceSize().width(), 0)); 1194 1187 } else if (backgroundRepeatY == SpaceFill && fillTileSize.height() > 0) { 1195 int space = getSpace(positioningAreaSize.height(), geometry.tileSize().height());1196 int actualHeight = geometry.tileSize().height() + space;1188 LayoutUnit space = getSpace(positioningAreaSize.height(), geometry.tileSize().height()); 1189 LayoutUnit actualHeight = geometry.tileSize().height() + space; 1197 1190 1198 1191 if (space >= 0) { 1199 1192 computedYPosition = minimumValueForLength(Length(), availableHeight, true); 1200 geometry.setSpaceSize( FloatSize(geometry.spaceSize().width(), space));1201 geometry.setPhaseY(actualHeight ? actualHeight - roundToInt(computedYPosition + top) % actualHeight: 0);1193 geometry.setSpaceSize(LayoutSize(geometry.spaceSize().width(), space)); 1194 geometry.setPhaseY(actualHeight ? actualHeight - fmodf((computedYPosition + top), actualHeight) : 0); 1202 1195 } else 1203 1196 backgroundRepeatY = NoRepeatFill; 1204 1197 } 1205 1198 if (backgroundRepeatY == NoRepeatFill) { 1206 int yOffset = fillLayer->backgroundYOrigin() == BottomEdge ? availableHeight - computedYPosition : computedYPosition;1199 LayoutUnit yOffset = fillLayer->backgroundYOrigin() == BottomEdge ? availableHeight - computedYPosition : computedYPosition; 1207 1200 geometry.setNoRepeatY(top + yOffset); 1208 geometry.setSpaceSize( FloatSize(geometry.spaceSize().width(), 0));1201 geometry.setSpaceSize(LayoutSize(geometry.spaceSize().width(), 0)); 1209 1202 } 1210 1203 1211 1204 if (fixedAttachment) 1212 geometry.useFixedAttachment( snappedPaintRect.location());1213 1214 geometry.clip( snappedPaintRect);1205 geometry.useFixedAttachment(paintRect.location()); 1206 1207 geometry.clip(paintRect); 1215 1208 geometry.setDestOrigin(geometry.destRect().location()); 1216 } 1217 1218 void RenderBoxModelObject::getGeometryForBackgroundImage(const RenderLayerModelObject* paintContainer, IntRect& destRect, IntPoint& phase, IntSize& tileSize) const 1209 1210 pixelSnapBackgroundImageGeometryForPainting(geometry); 1211 } 1212 1213 void RenderBoxModelObject::getGeometryForBackgroundImage(const RenderLayerModelObject* paintContainer, FloatRect& destRect, FloatPoint& phase, FloatSize& tileSize) const 1219 1214 { 1220 1215 const FillLayer* backgroundLayer = style().backgroundLayers(); 1221 1216 BackgroundImageGeometry geometry; 1222 calculateBackgroundImageGeometry(paintContainer, backgroundLayer, destRect, geometry); 1217 LayoutRect paintRect = LayoutRect(destRect); 1218 calculateBackgroundImageGeometry(paintContainer, backgroundLayer, paintRect, geometry); 1223 1219 phase = geometry.phase(); 1224 1220 tileSize = geometry.tileSize(); … … 1254 1250 IntRect borderImageRect = pixelSnappedIntRect(rectWithOutsets); 1255 1251 1256 IntSize imageSize = calculateImageIntrinsicDimensions(styleImage, borderImageRect.size(), DoNotScaleByEffectiveZoom);1252 LayoutSize imageSize = calculateImageIntrinsicDimensions(styleImage, borderImageRect.size(), DoNotScaleByEffectiveZoom); 1257 1253 1258 1254 // If both values are ‘auto’ then the intrinsic width and/or height of the image should be used, if any. -
TabularUnified trunk/Source/WebCore/rendering/RenderBoxModelObject.h ¶
r165689 r166784 184 184 bool canHaveBoxInfoInRegion() const { return !isFloating() && !isReplaced() && !isInline() && !hasColumns() && !isTableCell() && isRenderBlock() && !isRenderSVGBlock(); } 185 185 186 void getGeometryForBackgroundImage(const RenderLayerModelObject* paintContainer, IntRect& destRect, IntPoint& phase, IntSize& tileSize) const;186 void getGeometryForBackgroundImage(const RenderLayerModelObject* paintContainer, FloatRect& destRect, FloatPoint& phase, FloatSize& tileSize) const; 187 187 void contentChanged(ContentChangeType); 188 188 bool hasAcceleratedCompositing() const; … … 209 209 : m_hasNonLocalGeometry(false) 210 210 { } 211 IntPoint destOrigin() const { return m_destOrigin; } 212 void setDestOrigin(const IntPoint& destOrigin) 213 { 214 m_destOrigin = destOrigin; 215 } 216 217 IntRect destRect() const { return m_destRect; } 218 void setDestRect(const IntRect& destRect) 219 { 220 m_destRect = destRect; 221 } 211 LayoutPoint destOrigin() const { return m_destOrigin; } 212 void setDestOrigin(const LayoutPoint& destOrigin) { m_destOrigin = destOrigin; } 213 214 LayoutRect destRect() const { return m_destRect; } 215 void setDestRect(const LayoutRect& destRect) { m_destRect = destRect; } 222 216 223 217 // Returns the phase relative to the destination rectangle. 224 IntPoint relativePhase() const; 225 226 IntPoint phase() const { return m_phase; } 227 void setPhase(const IntPoint& phase) 228 { 229 m_phase = phase; 230 } 231 232 IntSize tileSize() const { return m_tileSize; } 233 void setTileSize(const IntSize& tileSize) 234 { 235 m_tileSize = tileSize; 236 } 237 FloatSize spaceSize() const { return m_space; } 238 void setSpaceSize(const FloatSize& space) 239 { 240 m_space = space; 241 } 242 243 void setPhaseX(int x) { m_phase.setX(x); } 244 void setPhaseY(int y) { m_phase.setY(y); } 245 246 void setNoRepeatX(int xOffset); 247 void setNoRepeatY(int yOffset); 248 249 void useFixedAttachment(const IntPoint& attachmentPoint); 250 251 void clip(const IntRect&); 218 LayoutPoint relativePhase() const; 219 220 LayoutPoint phase() const { return m_phase; } 221 void setPhase(const LayoutPoint& phase) { m_phase = phase; } 222 223 LayoutSize tileSize() const { return m_tileSize; } 224 void setTileSize(const LayoutSize& tileSize) { m_tileSize = tileSize; } 225 226 LayoutSize spaceSize() const { return m_space; } 227 void setSpaceSize(const LayoutSize& space) { m_space = space; } 228 229 void setPhaseX(LayoutUnit x) { m_phase.setX(x); } 230 void setPhaseY(LayoutUnit y) { m_phase.setY(y); } 231 232 void setNoRepeatX(LayoutUnit xOffset); 233 void setNoRepeatY(LayoutUnit yOffset); 234 235 void useFixedAttachment(const LayoutPoint& attachmentPoint); 236 237 void clip(const LayoutRect&); 252 238 253 239 void setHasNonLocalGeometry(bool hasNonLocalGeometry = true) { m_hasNonLocalGeometry = hasNonLocalGeometry; } … … 255 241 256 242 private: 257 IntRect m_destRect;258 IntPoint m_destOrigin;259 IntPoint m_phase;260 IntSize m_tileSize;261 FloatSize m_space;243 LayoutRect m_destRect; 244 LayoutPoint m_destOrigin; 245 LayoutPoint m_phase; 246 LayoutSize m_tileSize; 247 LayoutSize m_space; 262 248 bool m_hasNonLocalGeometry; // Has background-attachment: fixed. Implies that we can't always cheaply compute destRect. 263 249 }; … … 314 300 315 301 enum ScaleByEffectiveZoomOrNot { ScaleByEffectiveZoom, DoNotScaleByEffectiveZoom }; 316 IntSize calculateImageIntrinsicDimensions(StyleImage*, const IntSize& scaledPositioningAreaSize, ScaleByEffectiveZoomOrNot) const;302 LayoutSize calculateImageIntrinsicDimensions(StyleImage*, const LayoutSize& scaledPositioningAreaSize, ScaleByEffectiveZoomOrNot) const; 317 303 318 304 private: … … 321 307 virtual LayoutRect frameRectForStickyPositioning() const = 0; 322 308 323 IntSize calculateFillTileSize(const FillLayer*, const IntSize& scaledPositioningAreaSize) const;309 LayoutSize calculateFillTileSize(const FillLayer*, const LayoutSize& scaledPositioningAreaSize) const; 324 310 325 311 RoundedRect getBackgroundRoundedRect(const LayoutRect&, InlineFlowBox*, LayoutUnit inlineBoxWidth, LayoutUnit inlineBoxHeight, … … 343 329 Color, EBorderStyle, BackgroundBleedAvoidance, bool includeLogicalLeftEdge, bool includeLogicalRightEdge); 344 330 void paintMaskForTextFillBox(ImageBuffer*, const IntRect&, InlineFlowBox*, const LayoutRect&, RenderNamedFlowFragment*); 331 332 void pixelSnapBackgroundImageGeometryForPainting(BackgroundImageGeometry&) const; 345 333 }; 346 334 -
TabularUnified trunk/Source/WebCore/rendering/RenderLayerBacking.cpp ¶
r166566 r166784 1616 1616 } 1617 1617 1618 IntRect destRect = pixelSnappedIntRect(LayoutRect(backgroundBoxForPainting()));1619 IntPoint phase;1620 IntSize tileSize;1618 FloatRect destRect = backgroundBoxForPainting(); 1619 FloatPoint phase; 1620 FloatSize tileSize; 1621 1621 1622 1622 RefPtr<Image> image = style.backgroundLayers()->image()->cachedImage()->image(); -
TabularUnified trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp ¶
r166752 r166784 138 138 StyleImage* styleImage = shapeValue->image(); 139 139 140 const IntSize& imageSize = renderBox->calculateImageIntrinsicDimensions(styleImage, roundedIntSize(referenceBoxSize), RenderImage::ScaleByEffectiveZoom);140 const LayoutSize& imageSize = renderBox->calculateImageIntrinsicDimensions(styleImage, roundedIntSize(referenceBoxSize), RenderImage::ScaleByEffectiveZoom); 141 141 styleImage->setContainerSizeForRenderer(renderBox, imageSize, renderBox->style().effectiveZoom()); 142 142
Note:
See TracChangeset
for help on using the changeset viewer.