REGRESSION: Text with a zero offset, zero blur shadow vanishes
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Sep 2014 02:32:06 +0000 (02:32 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Sep 2014 02:32:06 +0000 (02:32 +0000)
commitf69d8e9d2435b232969d6f664469bedc7b9f1f9d
treec5d49c7649741a59aa329e23076d68afc902b6f2
parentfa2e8121a126215655d0990999bda537ad9589af
REGRESSION: Text with a zero offset, zero blur shadow vanishes
https://bugs.webkit.org/show_bug.cgi?id=136801

Reviewed by Darin Adler.

Source/WebCore:

This patch performs some cleanup regarding TextPainter's shadow logic and handles an
additional case of empty shadows. Previously, there was tight coupling between
applyShadowToGraphicalContext() and paintTextWithShadows(), as they both used a
collection of variables to determine how shadows are to be drawn. This complexity has
been moved into a helper class, ShadowApplier, which performs what
applyShadowToGraphicsContext() used to do, and cleans up correctly in its destructor.
This removes the tight coupling mentioned earlier.

Test: fast/text/empty-shadow.html

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::applyShadowToGraphicsContext): Moved to ShadowApplier.
* rendering/InlineTextBox.h: Deleted applyShadowToGraphicsContext signature.
* rendering/TextPainter.cpp:
(WebCore::ShadowApplier::ShadowApplier): Perform the contents of applyShadowToGraphicsContext()
(WebCore::ShadowApplier::~ShadowApplier): Undo the work done previously
(WebCore::paintTextWithShadows): Create a ShadowApplier to do the relevant shadow work. In addition,
refactor some boolean flags to more meaningful ones with relation to the computation at hand.
(WebCore::isEmptyShadow): Moved to TextPainter.h, named shadowIsCompletelyCoveredByText()
* rendering/TextPainter.h:
(WebCore::ShadowApplier::ShadowApplier): Moved from InlineTextBox::applyShadowToGraphicsContext().
(WebCore::ShadowApplier::extraOffset): Getter.
(WebCore::ShadowApplier::~ShadowApplier): Moved from TextPainter::paintTextWithShadows().
(WebCore::isLastShadowIteration): Helper function.
(WebCore::shadowIsCompletelyCoveredByText): Determines whether or not we should not draw the shadow.
* rendering/svg/SVGInlineTextBox.cpp:
(WebCore::SVGInlineTextBox::paintTextWithShadows): Update to use ShadowApplier.

LayoutTests:

This test should be a comprehensive test of empty shadows. It tests every
combination of one and two shadows being empty, as well as transparent and
opaque text.

After updating fast/text/empty-shadow.html, fast/text/empty-shadow-with-color.html
is no longer necessary.

* fast/text/empty-shadow-expected.html:
* fast/text/empty-shadow-with-color-expected.html: Removed.
* fast/text/empty-shadow-with-color.html: Removed.
* fast/text/empty-shadow.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173941 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/text/empty-shadow-expected.html
LayoutTests/fast/text/empty-shadow-with-color-expected.html [deleted file]
LayoutTests/fast/text/empty-shadow-with-color.html [deleted file]
LayoutTests/fast/text/empty-shadow.html
Source/WebCore/ChangeLog
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/InlineTextBox.h
Source/WebCore/rendering/TextPainter.cpp
Source/WebCore/rendering/TextPainter.h
Source/WebCore/rendering/svg/SVGInlineTextBox.cpp