Changeset 194775 in webkit
- Timestamp:
- Jan 8, 2016 12:05:08 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r194771 r194775 1 2016-01-08 Zalan Bujtas <zalan@apple.com> 2 3 Hovering link on http://help.apple.com/appletv/#/ does not show text underline. 4 https://bugs.webkit.org/show_bug.cgi?id=152906 5 <rdar://problem/23339617> 6 7 Reviewed by Simon Fraser. 8 9 GraphicsContext::computeLineBoundsAndAntialiasingModeForText() always integral ceils the origin y position to offset underline text. 10 This additional visual overflow offset is not taken into account by visualOverflowForDecorations(). 11 Unfortunately we can't compute the exact same offset value while collecting repaint rects, because 12 computeLineBoundsAndAntialiasingModeForText() uses CTM scaling before adjusting the offset position. 13 Use 1px (css) bottom offset to cover this underling overflow. 14 15 * fast/css3-text/css3-text-decoration/text-underline-position/underline-visual-overflow-with-subpixel-position-expected.txt: Added. 16 * fast/css3-text/css3-text-decoration/text-underline-position/underline-visual-overflow-with-subpixel-position.html: Added. 17 1 18 2016-01-08 Brady Eidson <beidson@apple.com> 2 19 -
trunk/Source/WebCore/ChangeLog
r194771 r194775 1 2016-01-08 Zalan Bujtas <zalan@apple.com> 2 3 Hovering link on http://help.apple.com/appletv/#/ does not show text underline. 4 https://bugs.webkit.org/show_bug.cgi?id=152906 5 <rdar://problem/23339617> 6 7 Reviewed by Simon Fraser. 8 9 GraphicsContext::computeLineBoundsAndAntialiasingModeForText() always integral ceils the origin y position to offset underline text. 10 This additional visual overflow offset is not taken into account by visualOverflowForDecorations(). 11 Unfortunately we can't compute the exact same offset value while collecting repaint rects, because 12 computeLineBoundsAndAntialiasingModeForText() uses CTM scaling before adjusting the offset position. 13 Use 1px (css) bottom offset to cover this underling overflow. 14 15 Test: fast/css3-text/css3-text-decoration/text-underline-position/underline-visual-overflow-with-subpixel-position.html 16 17 * platform/graphics/GraphicsContext.cpp: 18 (WebCore::GraphicsContext::computeLineBoundsAndAntialiasingModeForText): 19 * rendering/SimpleLineLayoutResolver.cpp: Add visual overflow to simple line layout. 20 (WebCore::SimpleLineLayout::RunResolver::Run::rect): 21 (WebCore::SimpleLineLayout::RunResolver::RunResolver): 22 * rendering/SimpleLineLayoutResolver.h: 23 * style/InlineTextBoxStyle.cpp: 24 (WebCore::visualOverflowForDecorations): 25 1 26 2016-01-08 Brady Eidson <beidson@apple.com> 2 27 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp
r194757 r194775 996 996 FloatPoint origin = point; 997 997 float thickness = std::max(strokeThickness(), 0.5f); 998 999 if (!printing) { 1000 AffineTransform transform = getCTM(GraphicsContext::DefinitelyIncludeDeviceScale); 998 if (printing) 999 return FloatRect(origin, FloatSize(width, thickness)); 1000 1001 AffineTransform transform = getCTM(GraphicsContext::DefinitelyIncludeDeviceScale); 1002 // Just compute scale in x dimension, assuming x and y scales are equal. 1003 float scale = transform.b() ? sqrtf(transform.a() * transform.a() + transform.b() * transform.b()) : transform.a(); 1004 if (scale < 1.0) { 1001 1005 // This code always draws a line that is at least one-pixel line high, 1002 1006 // which tends to visually overwhelm text at small scales. To counter this 1003 1007 // effect, an alpha is applied to the underline color when text is at small scales. 1004 1005 // Just compute scale in x dimension, assuming x and y scales are equal. 1006 float scale = transform.b() ? sqrtf(transform.a() * transform.a() + transform.b() * transform.b()) : transform.a(); 1007 if (scale < 1.0) { 1008 static const float minimumUnderlineAlpha = 0.4f; 1009 float shade = scale > minimumUnderlineAlpha ? scale : minimumUnderlineAlpha; 1010 int alpha = color.alpha() * shade; 1011 color = Color(color.red(), color.green(), color.blue(), alpha); 1012 } 1013 1014 FloatPoint devicePoint = transform.mapPoint(point); 1015 FloatPoint deviceOrigin = FloatPoint(roundf(devicePoint.x()), ceilf(devicePoint.y())); 1016 if (auto inverse = transform.inverse()) 1017 origin = inverse.value().mapPoint(deviceOrigin); 1018 } 1019 return FloatRect(origin.x(), origin.y(), width, thickness); 1020 } 1021 1022 } 1008 static const float minimumUnderlineAlpha = 0.4f; 1009 float shade = scale > minimumUnderlineAlpha ? scale : minimumUnderlineAlpha; 1010 int alpha = color.alpha() * shade; 1011 color = Color(color.red(), color.green(), color.blue(), alpha); 1012 } 1013 1014 FloatPoint devicePoint = transform.mapPoint(point); 1015 // Visual overflow might occur here due to integral roundf/ceilf. visualOverflowForDecorations adjusts the overflow value for underline decoration. 1016 FloatPoint deviceOrigin = FloatPoint(roundf(devicePoint.x()), ceilf(devicePoint.y())); 1017 if (auto inverse = transform.inverse()) 1018 origin = inverse.value().mapPoint(deviceOrigin); 1019 return FloatRect(origin, FloatSize(width, thickness)); 1020 } 1021 1022 } -
trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp
r189030 r194775 27 27 #include "SimpleLineLayoutResolver.h" 28 28 29 #include "InlineTextBoxStyle.h" 29 30 #include "RenderBlockFlow.h" 30 31 #include "RenderObject.h" … … 55 56 float baseline = computeBaselinePosition(); 56 57 FloatPoint position = linePosition(run.logicalLeft, baseline - resolver.m_ascent); 57 FloatSize size = lineSize(run.logicalLeft, run.logicalRight, resolver.m_ascent + resolver.m_descent );58 FloatSize size = lineSize(run.logicalLeft, run.logicalRight, resolver.m_ascent + resolver.m_descent + resolver.m_visualOverflowOffset); 58 59 bool moveLineBreakToBaseline = false; 59 60 if (run.start == run.end && m_iterator != resolver.begin() && m_iterator.inQuirksMode()) { … … 119 120 , m_ascent(flow.style().fontCascade().fontMetrics().ascent()) 120 121 , m_descent(flow.style().fontCascade().fontMetrics().descent()) 122 , m_visualOverflowOffset(visualOverflowForDecorations(flow.style(), nullptr).bottom) 121 123 , m_inQuirksMode(flow.document().inQuirksMode()) 122 124 { -
trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.h
r189030 r194775 124 124 const float m_ascent; 125 125 const float m_descent; 126 const float m_visualOverflowOffset; 126 127 const bool m_inQuirksMode; 127 128 }; -
trunk/Source/WebCore/style/InlineTextBoxStyle.cpp
r194447 r194775 124 124 // These metrics must match where underlines get drawn. 125 125 if (decoration & TextDecorationUnderline) { 126 float underlineOffset = computeUnderlineOffset(lineStyle.textUnderlinePosition(), lineStyle.fontMetrics(), inlineTextBox, strokeThickness); 126 // Compensate for the integral ceiling in GraphicsContext::computeLineBoundsAndAntialiasingModeForText() 127 int underlineOffset = 1; 128 underlineOffset += computeUnderlineOffset(lineStyle.textUnderlinePosition(), lineStyle.fontMetrics(), inlineTextBox, strokeThickness); 127 129 if (decorationStyle == TextDecorationStyleWavy) { 128 130 extendIntToFloat(overflowResult.bottom, underlineOffset + wavyOffset + controlPointDistance + strokeThickness - height);
Note: See TracChangeset
for help on using the changeset viewer.