Changeset 200807 in webkit
- Timestamp:
- May 12, 2016 6:55:40 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r200804 r200807 1 2016-05-12 Myles C. Maxfield <mmaxfield@apple.com> 2 3 Text shadow sometimes clipped unexpectedly 4 https://bugs.webkit.org/show_bug.cgi?id=108929 5 6 Reviewed by Dean Jackson. 7 8 Add a font which draws dramatically far outside of its layout rect. 9 10 * fast/text/multiple-text-shadow-overflow-layout-rect-expected.html: Added. 11 * fast/text/multiple-text-shadow-overflow-layout-rect.html: Added. 12 * fast/text/resources/font-overflow-layout-rect.svg: Added. 13 1 14 2016-05-12 Ryan Haddad <ryanhaddad@apple.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r200803 r200807 1 2016-05-12 Myles C. Maxfield <mmaxfield@apple.com> 2 3 [Cocoa] Text shadow sometimes clipped unexpectedly 4 https://bugs.webkit.org/show_bug.cgi?id=108929 5 6 Reviewed by Dean Jackson. 7 8 CoreGraphics can only draw one text shadow at a time. We work around that by drawing 9 the text multiple times, one for each shadow. However, we want to make sure that the 10 original text isn't also drawn multiple times, so we bump up the shadow offsets so 11 the text and the shadow don't intersect, and then we clip out the original text (so 12 only the shadow remains). 13 14 Unfortunately, this clipping requires knowing where the visual extent of the text is, 15 which WebKit currently has trouble with. In particular, we often use layout extents 16 in lieu of visual extents, which is a problem when the glyphs draw outside of their 17 layout boxes. In this case, it causes us to think the text shadow is much smaller 18 than it really is, so our clipping operation clips to an area which is too small. 19 20 A quick solution to this is to inflate the clip rect by an amount proportional to the 21 font size, and offset the text shadow accordingly. If this amount is large enough, 22 this bug will occur on few enough sites that it is reasonable to consider this bug 23 fixed without the real solution of educating WebKit properly about the difference 24 between text layout rects and text visual extent rects. 25 26 Test: fast/text/multiple-text-shadow-overflow-layout-rect.html 27 28 * rendering/TextPainter.cpp: 29 (WebCore::ShadowApplier::ShadowApplier): 30 1 31 2016-05-12 Myles C. Maxfield <mmaxfield@apple.com> 2 32 -
trunk/Source/WebCore/rendering/TextPainter.cpp
r199304 r200807 55 55 if (m_onlyDrawsShadow) { 56 56 FloatRect shadowRect(textRect); 57 shadowRect.inflate(shadow->paintingExtent() );57 shadowRect.inflate(shadow->paintingExtent() + 3 * textRect.height()); 58 58 shadowRect.move(shadowOffset); 59 59 context.save(); … … 61 61 62 62 m_didSaveContext = true; 63 m_extraOffset = FloatSize(0, 2 * textRect.height() + std::max(0.0f, shadowOffset.height()) + shadowRadius);63 m_extraOffset = FloatSize(0, 2 * shadowRect.height() + std::max(0.0f, shadowOffset.height()) + shadowRadius); 64 64 shadowOffset -= m_extraOffset; 65 65 }
Note: See TracChangeset
for help on using the changeset viewer.