Clean up text decoration drawing code
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Nov 2018 04:32:44 +0000 (04:32 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Nov 2018 04:32:44 +0000 (04:32 +0000)
commit7be9c3be8840da3fc5723eb88d2ae973434edbd0
treeb1a9067b2b045c56cb2652da710571dcb246e9c7
parente05c968f85bc9ec5f20d824c42fe4db632eddae7
Clean up text decoration drawing code
https://bugs.webkit.org/show_bug.cgi?id=191245

Reviewed by Zalan Bujtas.

This is some general clean up of the text decorations code. There is no behavior change.

This patch modifies GraphicsContext::drawLineForText() & friends to accept a FloatRect instead of a FloatPoint + float width.
This is helpful because it allows for easier bounding box calculations.
This patch also removes some redundant computations that the skip:ink codepath was performing.
This patch also refactors the wavy decoration parameters to not use out params.

No new tests because there is no behavior change.

* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::computeUnderlineBoundsForText):
(WebCore::GraphicsContext::computeLineBoundsAndAntialiasingModeForText):
* platform/graphics/GraphicsContext.h:
* platform/graphics/GraphicsContextImpl.h:
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawLineForText):
(WebCore::GraphicsContext::drawLinesForText):
* platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::DrawLinesForText::apply const):
(WebCore::DisplayList::DrawLinesForText::localBounds const):
(WebCore::DisplayList::operator<<):
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::DrawLinesForText::create):
(WebCore::DisplayList::DrawLinesForText::thickness const):
(WebCore::DisplayList::DrawLinesForText::DrawLinesForText):
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::drawLinesForText):
* platform/graphics/displaylists/DisplayListRecorder.h:
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintMarkedTextDecoration):
(WebCore::InlineTextBox::paintCompositionUnderline const):
* rendering/SimpleLineLayoutFunctions.cpp:
(WebCore::SimpleLineLayout::paintFlow):
* rendering/TextDecorationPainter.cpp:
(WebCore::strokeWavyTextDecoration):
(WebCore::translateIntersectionPointsToSkipInkBoundaries):
(WebCore::TextDecorationPainter::TextDecorationPainter):
(WebCore::TextDecorationPainter::paintTextDecoration):
(WebCore::drawSkipInkUnderline): Deleted.
* rendering/TextDecorationPainter.h:
(WebCore::TextDecorationPainter::setInlineTextBox):
(WebCore::TextDecorationPainter::setWidth):
(WebCore::TextDecorationPainter::setFont): Deleted.
(WebCore::TextDecorationPainter::setBaseline): Deleted.
* style/InlineTextBoxStyle.cpp:
(WebCore::getWavyStrokeParameters):
(WebCore::visualOverflowForDecorations):
* style/InlineTextBoxStyle.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsContext.cpp
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/GraphicsContextImpl.h
Source/WebCore/platform/graphics/cairo/CairoOperations.cpp
Source/WebCore/platform/graphics/cairo/CairoOperations.h
Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.cpp
Source/WebCore/platform/graphics/cairo/GraphicsContextImplCairo.h
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp
Source/WebCore/platform/graphics/displaylists/DisplayListItems.h
Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp
Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h
Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.cpp
Source/WebCore/platform/graphics/nicosia/cairo/NicosiaCairoOperationRecorder.h
Source/WebCore/platform/win/WebCoreTextRenderer.cpp
Source/WebCore/rendering/InlineTextBox.cpp
Source/WebCore/rendering/SimpleLineLayoutFunctions.cpp
Source/WebCore/rendering/TextDecorationPainter.cpp
Source/WebCore/rendering/TextDecorationPainter.h
Source/WebCore/style/InlineTextBoxStyle.cpp
Source/WebCore/style/InlineTextBoxStyle.h