Skip to content

Commit

Permalink
Merge r221212 - InlineTextBox::paintDocumentMarker() does not need to…
Browse files Browse the repository at this point in the history
… special case painting of grammar and

dictation alternatives
https://bugs.webkit.org/show_bug.cgi?id=175966

Reviewed by Tim Horton.

Remove code that forced computing the marker rect for grammar and dictation alternative
regardless of whether the marker spans the entire width of the line box. InlineTextBox::paintDocumentMarker()
has performance optimizations to avoid computing the marker rect if it spans the entire line box.
Prior to r190363 we had to opt out of these optimizations for grammar and dictation alternative
markers so that we could store their computed marker rect. In r190363 we removed the logic in
InlineTextBox::paintDocumentMarker() to store the computed marker rect and hence no longer
needed to opt out of the optimization for these marker types, but inadvertently left in the
conditional code that opts them out.

No functionality changed. So no new tests.

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintDocumentMarker): Remove unnecessary argument grammar and
code that special cased handling of grammar an dictation alternative markers.
(WebCore::InlineTextBox::paintDocumentMarkers): Update as necessary.
* rendering/InlineTextBox.h:
  • Loading branch information
dydz authored and carlosgcampos committed Aug 30, 2017
1 parent 35aed2f commit 8f07099
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
25 changes: 25 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,28 @@
2017-08-25 Daniel Bates <dabates@apple.com>

InlineTextBox::paintDocumentMarker() does not need to special case painting of grammar and
dictation alternatives
https://bugs.webkit.org/show_bug.cgi?id=175966

Reviewed by Tim Horton.

Remove code that forced computing the marker rect for grammar and dictation alternative
regardless of whether the marker spans the entire width of the line box. InlineTextBox::paintDocumentMarker()
has performance optimizations to avoid computing the marker rect if it spans the entire line box.
Prior to r190363 we had to opt out of these optimizations for grammar and dictation alternative
markers so that we could store their computed marker rect. In r190363 we removed the logic in
InlineTextBox::paintDocumentMarker() to store the computed marker rect and hence no longer
needed to opt out of the optimization for these marker types, but inadvertently left in the
conditional code that opts them out.

No functionality changed. So no new tests.

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::paintDocumentMarker): Remove unnecessary argument grammar and
code that special cased handling of grammar an dictation alternative markers.
(WebCore::InlineTextBox::paintDocumentMarkers): Update as necessary.
* rendering/InlineTextBox.h:

2017-08-25 Miguel Gomez <magomez@igalia.com>

[GTK] Completely garbled display in Transifex in accelerated compositing mode
Expand Down
11 changes: 5 additions & 6 deletions Source/WebCore/rendering/InlineTextBox.cpp
Expand Up @@ -804,7 +804,7 @@ static GraphicsContext::DocumentMarkerLineStyle lineStyleForMarkerType(DocumentM
}
}

void InlineTextBox::paintDocumentMarker(GraphicsContext& context, const FloatPoint& boxOrigin, RenderedDocumentMarker& marker, const RenderStyle& style, const FontCascade& font, bool grammar)
void InlineTextBox::paintDocumentMarker(GraphicsContext& context, const FloatPoint& boxOrigin, RenderedDocumentMarker& marker, const RenderStyle& style, const FontCascade& font)
{
// Never print spelling/grammar markers (5327887)
if (renderer().document().printing())
Expand All @@ -825,8 +825,7 @@ void InlineTextBox::paintDocumentMarker(GraphicsContext& context, const FloatPoi
if (m_truncation != cNoTruncation)
markerSpansWholeBox = false;

bool isDictationMarker = marker.type() == DocumentMarker::DictationAlternatives;
if (!markerSpansWholeBox || grammar || isDictationMarker) {
if (!markerSpansWholeBox) {
unsigned startPosition = clampedOffset(marker.startOffset());
unsigned endPosition = clampedOffset(marker.endOffset());

Expand Down Expand Up @@ -940,15 +939,15 @@ void InlineTextBox::paintDocumentMarkers(GraphicsContext& context, const FloatPo
case DocumentMarker::Spelling:
case DocumentMarker::CorrectionIndicator:
case DocumentMarker::DictationAlternatives:
paintDocumentMarker(context, boxOrigin, *marker, style, font, false);
paintDocumentMarker(context, boxOrigin, *marker, style, font);
break;
case DocumentMarker::Grammar:
paintDocumentMarker(context, boxOrigin, *marker, style, font, true);
paintDocumentMarker(context, boxOrigin, *marker, style, font);
break;
#if PLATFORM(IOS)
// FIXME: See <rdar://problem/8933352>. Also, remove the PLATFORM(IOS)-guard.
case DocumentMarker::DictationPhraseWithAlternatives:
paintDocumentMarker(context, boxOrigin, *marker, style, font, true);
paintDocumentMarker(context, boxOrigin, *marker, style, font);
break;
#endif
case DocumentMarker::TextMatch:
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/InlineTextBox.h
Expand Up @@ -161,7 +161,7 @@ class InlineTextBox : public InlineBox {
void paintDecoration(GraphicsContext&, const FontCascade&, RenderCombineText*, const TextRun&, const FloatPoint& textOrigin, const FloatRect& boxRect,
TextDecoration, TextPaintStyle, const ShadowData*, const FloatRect& clipOutRect);
void paintSelection(GraphicsContext&, const FloatPoint& boxOrigin, const RenderStyle&, const FontCascade&, const Color& textColor);
void paintDocumentMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const FontCascade&, bool grammar);
void paintDocumentMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const FontCascade&);
void paintTextMatchMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const FontCascade&);

ExpansionBehavior expansionBehavior() const;
Expand Down

0 comments on commit 8f07099

Please sign in to comment.