Changeset 90912 in webkit
- Timestamp:
- Jul 13, 2011 6:45:24 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r90911 r90912 1 2011-07-13 Alexandru Chiculita <achicu@adobe.com> 2 3 Bridge RenderBoxModelObject::calculateBackgroundImageGeometry parameters into a class 4 https://bugs.webkit.org/show_bug.cgi?id=63987 5 6 Reviewed by Hajime Morita. 7 8 Change doesn't add new functionality. No test needed. 9 10 * rendering/RenderBox.cpp: 11 (WebCore::RenderBox::maskClipRect): 12 (WebCore::RenderBox::repaintLayerRectsForImage): 13 * rendering/RenderBoxModelObject.cpp: 14 (WebCore::RenderBoxModelObject::paintFillLayerExtended): 15 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatX): 16 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatY): 17 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::useFixedAttachment): 18 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::clip): 19 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::relativePhase): 20 (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): 21 * rendering/RenderBoxModelObject.h: 22 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::destOrigin): 23 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setDestOrigin): 24 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::destRect): 25 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setDestRect): 26 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::phase): 27 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setPhase): 28 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::tileSize): 29 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setTileSize): 30 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setPhaseX): 31 (WebCore::RenderBoxModelObject::BackgroundImageGeometry::setPhaseY): 32 1 33 2011-07-13 MORITA Hajime <morrita@google.com> 2 34 -
trunk/Source/WebCore/rendering/RenderBox.cpp
r90833 r90912 970 970 for (const FillLayer* maskLayer = style()->maskLayers(); maskLayer; maskLayer = maskLayer->next()) { 971 971 if (maskLayer->image()) { 972 IntRect maskRect; 973 IntPoint phase; 974 IntSize tileSize; 975 calculateBackgroundImageGeometry(maskLayer, bbox, maskRect, phase, tileSize); 976 result.unite(maskRect); 972 BackgroundImageGeometry geometry; 973 calculateBackgroundImageGeometry(maskLayer, bbox, geometry); 974 result.unite(geometry.destRect()); 977 975 } 978 976 } … … 1064 1062 } 1065 1063 1066 IntRect repaintRect; 1067 IntPoint phase; 1068 IntSize tileSize; 1069 layerRenderer->calculateBackgroundImageGeometry(curLayer, rendererRect, repaintRect, phase, tileSize); 1070 layerRenderer->repaintRectangle(repaintRect); 1071 if (repaintRect == rendererRect) 1064 BackgroundImageGeometry geometry; 1065 layerRenderer->calculateBackgroundImageGeometry(curLayer, rendererRect, geometry); 1066 layerRenderer->repaintRectangle(geometry.destRect()); 1067 if (geometry.destRect() == rendererRect) 1072 1068 return true; 1073 1069 } -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r90832 r90912 764 764 // no progressive loading of the background image 765 765 if (shouldPaintBackgroundImage) { 766 LayoutRect destRect; 767 LayoutPoint phase; 768 LayoutSize tileSize; 769 770 calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, destRect, phase, tileSize); 771 LayoutPoint destOrigin = destRect.location(); 772 destRect.intersect(paintInfo.rect); 773 if (!destRect.isEmpty()) { 774 phase += destRect.location() - destOrigin; 766 BackgroundImageGeometry geometry; 767 calculateBackgroundImageGeometry(bgLayer, scrolledPaintRect, geometry); 768 geometry.clip(paintInfo.rect); 769 if (!geometry.destRect().isEmpty()) { 775 770 CompositeOperator compositeOp = op == CompositeSourceOver ? bgLayer->composite() : op; 776 771 RenderObject* clientForBackgroundImage = backgroundObject ? backgroundObject : this; 777 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, tileSize); 778 bool useLowQualityScaling = shouldPaintAtLowQuality(context, image.get(), bgLayer, tileSize); 779 context->drawTiledImage(image.get(), style()->colorSpace(), destRect, phase, tileSize, compositeOp, useLowQualityScaling); 772 RefPtr<Image> image = bgImage->image(clientForBackgroundImage, geometry.tileSize()); 773 bool useLowQualityScaling = shouldPaintAtLowQuality(context, image.get(), bgLayer, geometry.tileSize()); 774 context->drawTiledImage(image.get(), style()->colorSpace(), geometry.destRect(), geometry.relativePhase(), geometry.tileSize(), 775 compositeOp, useLowQualityScaling); 780 776 } 781 777 } … … 843 839 } 844 840 841 void RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatX(int xOffset) 842 { 843 m_destRect.move(max(xOffset, 0), 0); 844 m_phase.setX(-min(xOffset, 0)); 845 m_destRect.setWidth(m_tileSize.width() + min(xOffset, 0)); 846 } 847 void RenderBoxModelObject::BackgroundImageGeometry::setNoRepeatY(int yOffset) 848 { 849 m_destRect.move(0, max(yOffset, 0)); 850 m_phase.setY(-min(yOffset, 0)); 851 m_destRect.setHeight(m_tileSize.height() + min(yOffset, 0)); 852 } 853 854 void RenderBoxModelObject::BackgroundImageGeometry::useFixedAttachment(const LayoutPoint& attachmentPoint) 855 { 856 m_phase.move(max(attachmentPoint.x() - m_destRect.x(), 0), max(attachmentPoint.y() - m_destRect.y(), 0)); 857 } 858 859 void RenderBoxModelObject::BackgroundImageGeometry::clip(const LayoutRect& clipRect) 860 { 861 m_destRect.intersect(clipRect); 862 } 863 864 LayoutPoint RenderBoxModelObject::BackgroundImageGeometry::relativePhase() const 865 { 866 LayoutPoint phase = m_phase; 867 phase += m_destRect.location() - m_destOrigin; 868 return phase; 869 } 870 845 871 void RenderBoxModelObject::calculateBackgroundImageGeometry(const FillLayer* fillLayer, const IntRect& paintRect, 846 IntRect& destRect, IntPoint& phase, IntSize& tileSize)872 BackgroundImageGeometry& geometry) 847 873 { 848 874 int left = 0; … … 865 891 866 892 if (!fixedAttachment) { 867 destRect = paintRect;893 geometry.setDestRect(paintRect); 868 894 869 895 int right = 0; … … 893 919 positioningAreaSize = IntSize(paintRect.width() - left - right, paintRect.height() - top - bottom); 894 920 } else { 895 destRect = viewRect();896 positioningAreaSize = destRect.size();897 } 898 899 tileSize = calculateFillTileSize(fillLayer, positioningAreaSize);921 geometry.setDestRect(viewRect()); 922 positioningAreaSize = geometry.destRect().size(); 923 } 924 925 geometry.setTileSize(calculateFillTileSize(fillLayer, positioningAreaSize)); 900 926 901 927 EFillRepeat backgroundRepeatX = fillLayer->repeatX(); 902 928 EFillRepeat backgroundRepeatY = fillLayer->repeatY(); 903 929 904 int xPosition = fillLayer->xPosition().calcMinValue(positioningAreaSize.width() - tileSize.width(), true);930 int xPosition = fillLayer->xPosition().calcMinValue(positioningAreaSize.width() - geometry.tileSize().width(), true); 905 931 if (backgroundRepeatX == RepeatFill) 906 phase.setX(tileSize.width() ? tileSize.width() - (xPosition + left) % tileSize.width() : 0); 907 else { 908 destRect.move(max(xPosition + left, 0), 0); 909 phase.setX(-min(xPosition + left, 0)); 910 destRect.setWidth(tileSize.width() + min(xPosition + left, 0)); 911 } 912 913 int yPosition = fillLayer->yPosition().calcMinValue(positioningAreaSize.height() - tileSize.height(), true); 932 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().width() - (xPosition + left) % geometry.tileSize().width() : 0); 933 else 934 geometry.setNoRepeatX(xPosition + left); 935 936 int yPosition = fillLayer->yPosition().calcMinValue(positioningAreaSize.height() - geometry.tileSize().height(), true); 914 937 if (backgroundRepeatY == RepeatFill) 915 phase.setY(tileSize.height() ? tileSize.height() - (yPosition + top) % tileSize.height() : 0); 916 else { 917 destRect.move(0, max(yPosition + top, 0)); 918 phase.setY(-min(yPosition + top, 0)); 919 destRect.setHeight(tileSize.height() + min(yPosition + top, 0)); 920 } 938 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().height() - (yPosition + top) % geometry.tileSize().height() : 0); 939 else 940 geometry.setNoRepeatY(yPosition + top); 921 941 922 942 if (fixedAttachment) 923 phase.move(max(paintRect.x() - destRect.x(), 0), max(paintRect.y() - destRect.y(), 0)); 924 925 destRect.intersect(paintRect); 943 geometry.useFixedAttachment(paintRect.location()); 944 945 geometry.clip(paintRect); 946 geometry.setDestOrigin(geometry.destRect().location()); 926 947 } 927 948 -
trunk/Source/WebCore/rendering/RenderBoxModelObject.h
r90832 r90912 136 136 virtual void willBeDestroyed(); 137 137 138 void calculateBackgroundImageGeometry(const FillLayer*, const IntRect& paintRect, IntRect& destRect, IntPoint& phase, IntSize& tileSize); 138 class BackgroundImageGeometry { 139 public: 140 LayoutPoint destOrigin() const { return m_destOrigin; } 141 void setDestOrigin(const LayoutPoint& destOrigin) 142 { 143 m_destOrigin = destOrigin; 144 } 145 146 LayoutRect destRect() const { return m_destRect; } 147 void setDestRect(const LayoutRect& destRect) 148 { 149 m_destRect = destRect; 150 } 151 152 // Returns the phase relative to the destination rectangle. 153 LayoutPoint relativePhase() const; 154 155 LayoutPoint phase() const { return m_phase; } 156 void setPhase(const LayoutPoint& phase) 157 { 158 m_phase = phase; 159 } 160 161 LayoutSize tileSize() const { return m_tileSize; } 162 void setTileSize(const LayoutSize& tileSize) 163 { 164 m_tileSize = tileSize; 165 } 166 167 void setPhaseX(int x) { m_phase.setX(x); } 168 void setPhaseY(int y) { m_phase.setY(y); } 169 170 void setNoRepeatX(int xOffset); 171 void setNoRepeatY(int yOffset); 172 173 void useFixedAttachment(const LayoutPoint& attachmentPoint); 174 175 void clip(const LayoutRect&); 176 private: 177 LayoutRect m_destRect; 178 LayoutPoint m_destOrigin; 179 LayoutPoint m_phase; 180 LayoutSize m_tileSize; 181 }; 182 183 void calculateBackgroundImageGeometry(const FillLayer*, const IntRect& paintRect, BackgroundImageGeometry&); 139 184 void getBorderEdgeInfo(class BorderEdge[], bool includeLogicalLeftEdge = true, bool includeLogicalRightEdge = true) const; 140 185 bool borderObscuresBackgroundEdge(const FloatSize& contextScale) const;
Note: See TracChangeset
for help on using the changeset viewer.