Changeset 194421 in webkit
- Timestamp:
- Dec 25, 2015 9:28:15 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r194418 r194421 1 2015-12-25 Zalan Bujtas <zalan@apple.com> 2 3 Subpixel rendering: Add subpixel support for outline. 4 https://bugs.webkit.org/show_bug.cgi?id=152560 5 6 Unable to ref-test other outline types. 7 8 Reviewed by Simon Fraser. 9 10 * fast/borders/hidpi-outline-hairline-painting-expected.html: Added. 11 * fast/borders/hidpi-outline-hairline-painting.html: Added. 12 1 13 2015-12-24 Zalan Bujtas <zalan@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r194420 r194421 1 2015-12-25 Zalan Bujtas <zalan@apple.com> 2 3 Subpixel rendering: Add subpixel support for outline. 4 https://bugs.webkit.org/show_bug.cgi?id=152560 5 6 Reviewed by Simon Fraser. 7 8 This patch adds support for subpixel outline-width/outline-offset. 9 10 Test: fast/borders/hidpi-outline-hairline-painting.html 11 12 * css/CSSPropertyNames.in: 13 * page/animation/CSSPropertyAnimation.cpp: 14 (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): 15 * platform/graphics/GraphicsContext.h: 16 * platform/graphics/mac/GraphicsContextMac.mm: 17 (WebCore::GraphicsContext::drawFocusRing): 18 * rendering/RenderElement.cpp: 19 (WebCore::RenderElement::computeMaxOutlineSize): 20 (WebCore::RenderElement::paintOutline): 21 * rendering/RenderImage.cpp: 22 (WebCore::RenderImage::paintAreaElementFocusRing): 23 * rendering/RenderInline.cpp: 24 (WebCore::RenderInline::paintOutlineForLine): 25 * rendering/RenderObject.cpp: 26 (WebCore::RenderObject::adjustRectForOutlineAndShadow): 27 * rendering/RenderView.cpp: 28 (WebCore::RenderView::setMaximalOutlineSize): 29 * rendering/RenderView.h: 30 * rendering/style/OutlineValue.h: 31 (WebCore::OutlineValue::offset): 32 (WebCore::OutlineValue::OutlineValue): Deleted. 33 * rendering/style/RenderStyle.h: 34 1 35 2015-12-25 Alexey Proskuryakov <ap@apple.com> 2 36 -
trunk/Source/WebCore/css/CSSPropertyNames.in
r192992 r194421 278 278 outline [Longhands=outline-color|outline-style|outline-width] 279 279 outline-color [VisitedLinkColorSupport, Initial=invalidColor] 280 outline-offset [Converter=ComputedLength< int>]280 outline-offset [Converter=ComputedLength<float>] 281 281 outline-style [Custom=All] 282 outline-width [Converter=LineWidth< unsigned short>]282 outline-width [Converter=LineWidth<float>] 283 283 overflow [Longhands=overflow-x|overflow-y] 284 284 overflow-wrap -
trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp
r193610 r194421 1293 1293 new PropertyWrapper<short>(CSSPropertyWidows, &RenderStyle::widows, &RenderStyle::setWidows), 1294 1294 new LengthPropertyWrapper<Length>(CSSPropertyLineHeight, &RenderStyle::specifiedLineHeight, &RenderStyle::setLineHeight), 1295 new PropertyWrapper< int>(CSSPropertyOutlineOffset, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset),1296 new PropertyWrapper< unsigned short>(CSSPropertyOutlineWidth, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth),1295 new PropertyWrapper<float>(CSSPropertyOutlineOffset, &RenderStyle::outlineOffset, &RenderStyle::setOutlineOffset), 1296 new PropertyWrapper<float>(CSSPropertyOutlineWidth, &RenderStyle::outlineWidth, &RenderStyle::setOutlineWidth), 1297 1297 new PropertyWrapper<float>(CSSPropertyLetterSpacing, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing), 1298 1298 new LengthPropertyWrapper<Length>(CSSPropertyWordSpacing, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing), -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r194025 r194421 390 390 #endif 391 391 392 void drawFocusRing(const Vector<IntRect>&, int width, int offset, const Color&);393 void drawFocusRing(const Path&, int width, int offset, const Color&);392 void drawFocusRing(const Vector<IntRect>&, float width, float offset, const Color&); 393 void drawFocusRing(const Path&, float width, float offset, const Color&); 394 394 #if PLATFORM(MAC) 395 void drawFocusRing(const Vector<IntRect>&, int width, int offset, double timeOffset, bool& needsRedraw);395 void drawFocusRing(const Vector<IntRect>&, float width, float offset, double timeOffset, bool& needsRedraw); 396 396 #endif 397 397 -
trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
r193743 r194421 523 523 } 524 524 525 static inline void adjustFocusRingLineWidth( int& width)525 static inline void adjustFocusRingLineWidth(float& width) 526 526 { 527 527 #if PLATFORM(GTK) … … 541 541 } 542 542 543 void GraphicsContext::drawFocusRing(const Path& path, int width, int /* offset */, const Color& color)543 void GraphicsContext::drawFocusRing(const Path& path, float width, float /* offset */, const Color& color) 544 544 { 545 545 // FIXME: We should draw paths that describe a rectangle with rounded corners … … 559 559 } 560 560 561 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int /* offset */, const Color& color)561 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, float width, float /* offset */, const Color& color) 562 562 { 563 563 if (paintingDisabled()) -
trunk/Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm
r192712 r194421 73 73 #endif // !PLATFORM(IOS) 74 74 75 void GraphicsContext::drawFocusRing(const Path& path, int /* width */, int /* offset */, const Color&)75 void GraphicsContext::drawFocusRing(const Path& path, float /* width */, float /* offset */, const Color&) 76 76 { 77 77 #if PLATFORM(MAC) … … 86 86 87 87 #if PLATFORM(MAC) 88 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int, int offset, double timeOffset, bool& needsRedraw)88 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, float, float offset, double timeOffset, bool& needsRedraw) 89 89 { 90 90 if (paintingDisabled()) … … 99 99 #endif 100 100 101 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int, int offset, const Color&)101 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, float, float offset, const Color&) 102 102 { 103 103 #if !PLATFORM(IOS) -
trunk/Source/WebCore/platform/graphics/win/GraphicsContextCGWin.cpp
r192140 r194421 131 131 } 132 132 133 void GraphicsContext::drawFocusRing(const Path& path, int width, int offset, const Color& color)133 void GraphicsContext::drawFocusRing(const Path& path, float width, float offset, const Color& color) 134 134 { 135 135 // FIXME: implement … … 138 138 // FIXME: This is nearly identical to the GraphicsContext::drawFocusRing function in GraphicsContextMac.mm. 139 139 // The code could move to GraphicsContextCG.cpp and be shared. 140 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, int width, int offset, const Color& color)140 void GraphicsContext::drawFocusRing(const Vector<IntRect>& rects, float width, float offset, const Color& color) 141 141 { 142 142 if (paintingDisabled()) -
trunk/Source/WebCore/rendering/RenderElement.cpp
r194418 r194421 378 378 if (!style.outlineWidth()) 379 379 return; 380 int maxOutlineSize = style.outlineSize();380 float maxOutlineSize = style.outlineSize(); 381 381 if (style.outlineStyleIsAuto()) 382 382 maxOutlineSize = std::max(theme().platformFocusRingWidth() + style.outlineOffset(), maxOutlineSize); … … 2108 2108 2109 2109 RenderStyle& styleToUse = style(); 2110 LayoutUnit outlineWidth = styleToUse.outlineWidth(); 2111 2112 int outlineOffset = styleToUse.outlineOffset(); 2110 float outlineWidth = floorToDevicePixel(styleToUse.outlineWidth(), document().deviceScaleFactor()); 2111 float outlineOffset = floorToDevicePixel(styleToUse.outlineOffset(), document().deviceScaleFactor()); 2113 2112 2114 2113 // Only paint the focus ring by hand if the theme isn't able to draw it. -
trunk/Source/WebCore/rendering/RenderImage.cpp
r192140 r194421 517 517 518 518 RenderStyle* areaElementStyle = areaElement.computedStyle(); 519 unsigned short outlineWidth = areaElementStyle->outlineWidth();519 float outlineWidth = areaElementStyle->outlineWidth(); 520 520 if (!outlineWidth) 521 521 return; -
trunk/Source/WebCore/rendering/RenderInline.cpp
r194016 r194421 1643 1643 { 1644 1644 const RenderStyle& styleToUse = style(); 1645 int outlineWidth = styleToUse.outlineWidth();1645 float outlineWidth = styleToUse.outlineWidth(); 1646 1646 EBorderStyle outlineStyle = styleToUse.outlineStyle(); 1647 1647 1648 1648 bool antialias = shouldAntialiasLines(graphicsContext); 1649 1649 1650 int offset = style().outlineOffset();1650 float offset = style().outlineOffset(); 1651 1651 1652 1652 LayoutRect box(LayoutPoint(paintOffset.x() + thisline.x() - offset, paintOffset.y() + thisline.y() - offset), … … 1687 1687 FloatRect(FloatPoint(pixelSnappedBox.x() - outlineWidth, 1688 1688 pixelSnappedBox.y() - outlineWidth), 1689 FloatPoint(std::min (pixelSnappedBox.maxX() + outlineWidth, (lastline.isEmpty() ? 1000000 : pixelSnappedLastLine.x())),1689 FloatPoint(std::min<float>(pixelSnappedBox.maxX() + outlineWidth, (lastline.isEmpty() ? 1000000 : pixelSnappedLastLine.x())), 1690 1690 pixelSnappedBox.y())), 1691 1691 BSTop, outlineColor, outlineStyle, … … 1696 1696 if (lastline.maxX() < thisline.maxX()) 1697 1697 drawLineForBoxSide(graphicsContext, 1698 FloatRect(FloatPoint(std::max (lastline.isEmpty() ? -1000000 : pixelSnappedLastLine.maxX(), pixelSnappedBox.x() - outlineWidth),1698 FloatRect(FloatPoint(std::max<float>(lastline.isEmpty() ? -1000000 : pixelSnappedLastLine.maxX(), pixelSnappedBox.x() - outlineWidth), 1699 1699 pixelSnappedBox.y() - outlineWidth), 1700 1700 FloatPoint(pixelSnappedBox.maxX() + outlineWidth, … … 1720 1720 FloatRect(FloatPoint(pixelSnappedBox.x() - outlineWidth, 1721 1721 pixelSnappedBox.maxY()), 1722 FloatPoint(std::min (pixelSnappedBox.maxX() + outlineWidth, !nextline.isEmpty() ? pixelSnappedNextLine.x() + 1 : 1000000),1722 FloatPoint(std::min<float>(pixelSnappedBox.maxX() + outlineWidth, !nextline.isEmpty() ? pixelSnappedNextLine.x() + 1 : 1000000), 1723 1723 pixelSnappedBox.maxY() + outlineWidth)), 1724 1724 BSBottom, outlineColor, outlineStyle, … … 1729 1729 if (nextline.maxX() < thisline.maxX()) 1730 1730 drawLineForBoxSide(graphicsContext, 1731 FloatRect(FloatPoint(std::max (!nextline.isEmpty() ? pixelSnappedNextLine.maxX() : -1000000, pixelSnappedBox.x() - outlineWidth),1731 FloatRect(FloatPoint(std::max<float>(!nextline.isEmpty() ? pixelSnappedNextLine.maxX() : -1000000, pixelSnappedBox.x() - outlineWidth), 1732 1732 pixelSnappedBox.maxY()), 1733 1733 FloatPoint(pixelSnappedBox.maxX() + outlineWidth, -
trunk/Source/WebCore/rendering/RenderObject.cpp
r192966 r194421 1944 1944 void RenderObject::adjustRectForOutlineAndShadow(LayoutRect& rect) const 1945 1945 { 1946 int outlineSize = outlineStyleForRepaint().outlineSize();1946 float outlineSize = outlineStyleForRepaint().outlineSize(); 1947 1947 if (outlineStyleForRepaint().outlineStyleIsAuto()) 1948 1948 outlineSize = std::max(theme().platformFocusRingWidth() + outlineStyleForRepaint().outlineOffset(), outlineSize); -
trunk/Source/WebCore/rendering/RenderView.cpp
r194155 r194421 827 827 // bounds when it changes. 828 828 // FIXME: This is ugly; it would be nice to have a better way to do this. 829 void RenderView::setMaximalOutlineSize( int outlineSize)829 void RenderView::setMaximalOutlineSize(float outlineSize) 830 830 { 831 831 if (outlineSize == m_maximalOutlineSize) -
trunk/Source/WebCore/rendering/RenderView.h
r192966 r194421 99 99 virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override; 100 100 101 void setMaximalOutlineSize( int);102 int maximalOutlineSize() const { return m_maximalOutlineSize; }101 void setMaximalOutlineSize(float); 102 float maximalOutlineSize() const { return m_maximalOutlineSize; } 103 103 104 104 LayoutRect viewRect() const; … … 352 352 353 353 // Used to inflate compositing layers and repaint rects. 354 int m_maximalOutlineSize { 0 };354 float m_maximalOutlineSize { 0 }; 355 355 356 356 bool shouldUsePrintingLayout() const; -
trunk/Source/WebCore/rendering/style/OutlineValue.h
r111076 r194421 33 33 friend class RenderStyle; 34 34 public: 35 OutlineValue()36 : m_offset(0)37 {38 }39 40 35 bool operator==(const OutlineValue& o) const 41 36 { … … 48 43 } 49 44 50 int offset() const { return m_offset; }45 float offset() const { return m_offset; } 51 46 OutlineIsAuto isAuto() const { return static_cast<OutlineIsAuto>(m_isAuto); } 52 47 53 48 private: 54 int m_offset;49 float m_offset { 0 }; 55 50 }; 56 51 -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r192389 r194421 675 675 float borderEndWidth() const; 676 676 677 unsigned short outlineSize() const { return std::max(0, outlineWidth() + outlineOffset()); }678 unsigned short outlineWidth() const677 float outlineSize() const { return std::max<float>(0, outlineWidth() + outlineOffset()); } 678 float outlineWidth() const 679 679 { 680 680 if (m_background->outline().style() == BNONE) … … 888 888 // CSS3 Getter Methods 889 889 890 int outlineOffset() const890 float outlineOffset() const 891 891 { 892 892 if (m_background->outline().style() == BNONE) … … 1326 1326 void setBorderBottomColor(const Color& v) { SET_BORDERVALUE_COLOR(surround, border.m_bottom, v); } 1327 1327 1328 void setOutlineWidth( unsigned short v) { SET_VAR(m_background, m_outline.m_width, v); }1328 void setOutlineWidth(float v) { SET_VAR(m_background, m_outline.m_width, v); } 1329 1329 void setOutlineStyleIsAuto(OutlineIsAuto isAuto) { SET_VAR(m_background, m_outline.m_isAuto, isAuto); } 1330 1330 void setOutlineStyle(EBorderStyle v) { SET_VAR(m_background, m_outline.m_style, v); } … … 1500 1500 1501 1501 // CSS3 Setters 1502 void setOutlineOffset( int v) { SET_VAR(m_background, m_outline.m_offset, v); }1502 void setOutlineOffset(float v) { SET_VAR(m_background, m_outline.m_offset, v); } 1503 1503 void setTextShadow(std::unique_ptr<ShadowData>, bool add = false); 1504 1504 void setTextStrokeColor(const Color& c) { SET_VAR(rareInheritedData, textStrokeColor, c); } … … 1923 1923 static float initialBorderWidth() { return 3; } 1924 1924 static unsigned short initialColumnRuleWidth() { return 3; } 1925 static unsigned short initialOutlineWidth() { return 3; }1925 static float initialOutlineWidth() { return 3; } 1926 1926 static float initialLetterSpacing() { return 0; } 1927 1927 static Length initialWordSpacing() { return Length(Fixed); } … … 1956 1956 static float initialZoom() { return 1.0f; } 1957 1957 static TextZoom initialTextZoom() { return TextZoomNormal; } 1958 static int initialOutlineOffset() { return 0; }1958 static float initialOutlineOffset() { return 0; } 1959 1959 static float initialOpacity() { return 1.0f; } 1960 1960 static EBoxAlignment initialBoxAlign() { return BSTRETCH; }
Note: See TracChangeset
for help on using the changeset viewer.