<rdar://problem/10870238> Box shadow drawing takes an unnecessarily slow code path...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Feb 2012 21:57:02 +0000 (21:57 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Feb 2012 21:57:02 +0000 (21:57 +0000)
commitcfb484aa7d789e49b37df55318c0d1d8610af2fe
tree8500eee39edd6642b93dadee76b282f35409296c
parent16baa524296f66b6af73101b5655aaa580e11773
<rdar://problem/10870238> Box shadow drawing takes an unnecessarily slow code path in some single-shadow, opaque-background cases
https://bugs.webkit.org/show_bug.cgi?id=78728

In some cases, when there is only one normal box shadow, and the box has an opaque background,
it is possible to draw the box shadow by having the background cast it directly. This appears
to be faster than the generic code path that uses a separate drawing pass to cast the shadow,
clipping out the border box and the shadow-casting box.

Reviewed by Dave Hyatt.

No new tests, because behavior is unchanged.

* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::paintBoxDecorations): Changed to not paint normal box shadows if
they are going to be cast by the background.
* rendering/RenderBox.cpp:
(WebCore::RenderBox::paintBoxDecorations): Ditto.
* rendering/RenderBox.h: Made determineBackgroundBleedAvoidance() protected.
* rendering/RenderBoxModelObject.cpp:
(WebCore::applyBoxShadowForBackground): Added this helper function, which applies the first
normal shadow from the given RenderStyle to the given GraphicsContext.
(WebCore::RenderBoxModelObject::paintFillLayerExtended): Added calls to
applyBoxShadowForBackground() before drawing the background color when needed.
(WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground): Added. Returns true
in some of the cases where the box shadow can be cast by the background directly.
* rendering/RenderBoxModelObject.h:
* rendering/RenderFieldset.cpp:
(WebCore::RenderFieldset::paintBoxDecorations): Changed to not paint normal box shadows if
they are going to be cast by the background.
* rendering/RenderTable.cpp:
(WebCore::RenderTable::paintBoxDecorations): Ditto.
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::boxShadowShouldBeAppliedToBackground): Added this override that
always returns false, because table cells sometimes apply a clip before drawing the background.
* rendering/RenderTableCell.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107836 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderBoxModelObject.h
Source/WebCore/rendering/RenderFieldset.cpp
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTableCell.cpp
Source/WebCore/rendering/RenderTableCell.h