Changeset 169620 in webkit
- Timestamp:
- Jun 5, 2014 11:18:40 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r169617 r169620 1 2014-06-05 Zalan Bujtas <zalan@apple.com> 2 3 Subpixel rendering: border-radius painting falls back to rectangle when the snapped rounded rect becomes non-renderable. 4 https://bugs.webkit.org/show_bug.cgi?id=133491 5 6 Reviewed by Simon Fraser. 7 8 Pixel snapping can change the rectangle's size when it is on a certain subpixel position. (usually it does not) 9 This patch ensures that the snapped rect is still renderable by adjusting the radii as well. 10 11 * fast/borders/hidpi-border-radius-with-subpixel-margin-not-renderable-expected.html: Added. 12 * fast/borders/hidpi-border-radius-with-subpixel-margin-not-renderable.html: Added. 13 1 14 2014-06-05 Frédéric Wang <fred.wang@free.fr> 2 15 -
trunk/Source/WebCore/ChangeLog
r169619 r169620 1 2014-06-05 Zalan Bujtas <zalan@apple.com> 2 3 Subpixel rendering: border-radius painting falls back to rectangle when the snapped rounded rect becomes non-renderable. 4 https://bugs.webkit.org/show_bug.cgi?id=133491 5 6 Reviewed by Simon Fraser. 7 8 Pixel snapping can change the rectangle's size when it is on a certain subpixel position. (usually it does not) 9 This patch ensures that the snapped rect is still renderable by adjusting the radii as well. 10 11 Test: fast/borders/hidpi-border-radius-with-subpixel-margin-not-renderable.html 12 13 * platform/graphics/RoundedRect.cpp: 14 (WebCore::RoundedRect::Radii::scale): 15 (WebCore::RoundedRect::pixelSnappedRoundedRectForPainting): 16 * platform/graphics/RoundedRect.h: 17 1 18 2014-06-05 Commit Queue <commit-queue@webkit.org> 2 19 -
trunk/Source/WebCore/platform/graphics/RoundedRect.cpp
r165671 r169620 44 44 void RoundedRect::Radii::scale(float factor) 45 45 { 46 if (factor == 1) 46 scale(factor, factor); 47 } 48 49 void RoundedRect::Radii::scale(float horizontalFactor, float verticalFactor) 50 { 51 if (horizontalFactor == 1 && verticalFactor == 1) 47 52 return; 48 53 49 54 // If either radius on a corner becomes zero, reset both radii on that corner. 50 m_topLeft.scale( factor);55 m_topLeft.scale(horizontalFactor, verticalFactor); 51 56 if (!m_topLeft.width() || !m_topLeft.height()) 52 57 m_topLeft = LayoutSize(); 53 m_topRight.scale( factor);58 m_topRight.scale(horizontalFactor, verticalFactor); 54 59 if (!m_topRight.width() || !m_topRight.height()) 55 60 m_topRight = LayoutSize(); 56 m_bottomLeft.scale( factor);61 m_bottomLeft.scale(horizontalFactor, verticalFactor); 57 62 if (!m_bottomLeft.width() || !m_bottomLeft.height()) 58 63 m_bottomLeft = LayoutSize(); 59 m_bottomRight.scale( factor);64 m_bottomRight.scale(horizontalFactor, verticalFactor); 60 65 if (!m_bottomRight.width() || !m_bottomRight.height()) 61 66 m_bottomRight = LayoutSize(); 62 63 67 } 64 68 … … 241 245 { 242 246 LayoutRect originalRect = rect(); 243 FloatRect paintingRect = pixelSnappedForPainting(rect(), deviceScaleFactor); 244 FloatRoundedRect::Radii paintingRadii = radii(); 245 paintingRadii.shrink(paintingRect.y() - originalRect.y(), originalRect.maxY() - paintingRect.maxY(), paintingRect.x() - originalRect.x(), originalRect.maxX() - paintingRect.maxX()); 246 return FloatRoundedRect(paintingRect, paintingRadii); 247 FloatRect pixelSnappedRect = pixelSnappedForPainting(originalRect, deviceScaleFactor); 248 Radii adjustedRadii = radii(); 249 // Snapping usually does not alter size, but when it does, we need to make sure that the final rect is still renderable by distributing the size delta proportionally. 250 adjustedRadii.scale(pixelSnappedRect.width() / originalRect.width(), pixelSnappedRect.height() / originalRect.height()); 251 return FloatRoundedRect(pixelSnappedRect, adjustedRadii); 247 252 } 248 253 -
trunk/Source/WebCore/platform/graphics/RoundedRect.h
r166383 r169620 65 65 66 66 void scale(float factor); 67 void scale(float horizontalFactor, float verticalFactor); 67 68 void expand(const LayoutUnit& topWidth, const LayoutUnit& bottomWidth, const LayoutUnit& leftWidth, const LayoutUnit& rightWidth); 68 69 void expand(const LayoutUnit& size) { expand(size, size, size, size); }
Note: See TracChangeset
for help on using the changeset viewer.