Changeset 173418 in webkit
- Timestamp:
- Sep 8, 2014 7:56:24 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r173416 r173418 1 2014-09-08 Myles C. Maxfield <mmaxfield@apple.com> 2 3 REGRESSION (r172153): Text drawn with wrong color when second text shadow has zero offset and blur (breaks buttons at aws.amazon.com) 4 https://bugs.webkit.org/show_bug.cgi?id=136612 5 6 Reviewed by Darin Adler. 7 8 Make sure that text is drawn with correct color when second text shadow has zero offset and blur 9 10 * fast/text/empty-shadow-with-color-expected.html: Added. 11 * fast/text/empty-shadow-with-color.html: Added. 12 1 13 2014-09-08 Roger Fong <roger_fong@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r173410 r173418 1 2014-09-08 Myles C. Maxfield <mmaxfield@apple.com> 2 3 REGRESSION (r172153): Text drawn with wrong color when second text shadow has zero offset and blur (breaks buttons at aws.amazon.com) 4 https://bugs.webkit.org/show_bug.cgi?id=136612 5 6 Reviewed by Darin Adler. 7 8 r172153 was fundamentally broken, and would restore graphics contexts that had never been saved. This patch 9 reimplements r172153 by using "continue" to skip loop iterations instead of changing the internal logic of 10 the loop. 11 12 In addition, I have refactored InlineTextBox::applyShadowToGraphicsContext() to take an extra boolean 13 reference as an out parameter in order to make it obvious it if saved a graphics context that needs 14 to be restored. This should make it less likely to make these kinds of mistakes in the future. 15 16 Test: fast/text/empty-shadow-with-color.html 17 18 * rendering/InlineTextBox.cpp: 19 (WebCore::InlineTextBox::applyShadowToGraphicsContext): Add bool reference out param. 20 * rendering/InlineTextBox.h: Ditto. 21 * rendering/TextPainter.cpp: 22 (WebCore::isEmptyShadow): Change logic to not skip loop iterations on a null shadow. 23 (WebCore::paintTextWithShadows): Use continue to skip loop iterations for empty shadows. In addition, 24 use the out param in InlineTextBox::applyShadowToGraphicsContext(). 25 * rendering/svg/SVGInlineTextBox.cpp: 26 (WebCore::SVGInlineTextBox::paintTextWithShadows): Update for new sigurature of 27 InlineTextBox::applyShadowToGraphicsContext(). 28 1 29 2014-09-08 Commit Queue <commit-queue@webkit.org> 2 30 -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r173114 r173418 425 425 } 426 426 427 FloatSize InlineTextBox::applyShadowToGraphicsContext(GraphicsContext* context, const ShadowData* shadow, const FloatRect& textRect, bool stroked, bool opaque, bool horizontal )427 FloatSize InlineTextBox::applyShadowToGraphicsContext(GraphicsContext* context, const ShadowData* shadow, const FloatRect& textRect, bool stroked, bool opaque, bool horizontal, bool& didSaveContext) 428 428 { 429 429 if (!shadow) … … 446 446 extraOffset = FloatSize(0, 2 * textRect.height() + std::max(0.0f, shadowOffset.height()) + shadowRadius); 447 447 shadowOffset -= extraOffset; 448 didSaveContext = true; 448 449 } 449 450 -
trunk/Source/WebCore/rendering/InlineTextBox.h
r173114 r173418 156 156 157 157 // Needs to be public, so the static paintTextWithShadows() function can use it. 158 static FloatSize applyShadowToGraphicsContext(GraphicsContext*, const ShadowData*, const FloatRect& textRect, bool stroked, bool opaque, bool horizontal );158 static FloatSize applyShadowToGraphicsContext(GraphicsContext*, const ShadowData*, const FloatRect& textRect, bool stroked, bool opaque, bool horizontal, bool& didSaveContext); 159 159 160 160 protected: -
trunk/Source/WebCore/rendering/TextPainter.cpp
r173241 r173418 64 64 { 65 65 if (!shadow) 66 return true;66 return false; 67 67 return shadow->location() == IntPoint() && !shadow->radius(); 68 68 } … … 79 79 80 80 do { 81 if (isEmptyShadow(shadow)) { 82 shadow = shadow->next(); 83 continue; 84 } 85 81 86 IntSize extraOffset; 82 bool shadowIsEmpty = isEmptyShadow(shadow);83 if ( !shadowIsEmpty)84 extraOffset = roundedIntSize(InlineTextBox::applyShadowToGraphicsContext(context, shadow, boxRect, stroked, opaque, horizontal ));87 bool didSaveContext = false; 88 if (shadow) 89 extraOffset = roundedIntSize(InlineTextBox::applyShadowToGraphicsContext(context, shadow, boxRect, stroked, opaque, horizontal, didSaveContext)); 85 90 else if (!opaque) 86 91 context->setFillColor(fillColor, fillColorSpace); … … 98 103 break; 99 104 100 if ( shadow->next() || stroked || !opaque)105 if (didSaveContext) 101 106 context->restore(); 102 else if (!shadowIsEmpty)107 else 103 108 context->clearShadow(); 104 109 -
trunk/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp
r173047 r173418 596 596 597 597 FloatSize extraOffset; 598 bool didSaveContext = false; 598 599 if (shadow) 599 extraOffset = applyShadowToGraphicsContext(context, shadow, shadowRect, false /* stroked */, true /* opaque */, true /* horizontal */ );600 extraOffset = applyShadowToGraphicsContext(context, shadow, shadowRect, false /* stroked */, true /* opaque */, true /* horizontal */, didSaveContext); 600 601 601 602 context->save(); … … 607 608 608 609 if (shadow) { 609 if ( shadow->next())610 if (didSaveContext) 610 611 context->restore(); 611 612 else
Note: See TracChangeset
for help on using the changeset viewer.