Fixing background rectangle sizes for Flutter

Bug: skia:10982
Change-Id: Id5b352c1139293195ca421b069e8632079acf37b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/337181
Commit-Queue: Julia Lavrova <jlavrova@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Jason Simmons <jsimmons@google.com>
This commit is contained in:
Julia Lavrova 2020-11-20 15:48:36 -05:00 committed by Skia Commit-Bot
parent 8d09d4ace9
commit 36d06a806f

View File

@ -166,6 +166,12 @@ SkRect TextLine::paint(SkCanvas* textCanvas, SkScalar x, SkScalar y) {
}
if (fHasBackground) {
// TODO: Flutter only change
// Background boxes should ignore line height and height multiplier
auto ascentStyle = this->fAscentStyle;
auto descentStyle = this->fDescentStyle;
this->fAscentStyle = LineMetricStyle::Typographic;
this->fDescentStyle = LineMetricStyle::Typographic;
this->iterateThroughVisualRuns(false,
[textCanvas, x, y, this]
(const Run* run, SkScalar runOffsetInLine, TextRange textRange, SkScalar* runWidthInLine) {
@ -176,6 +182,8 @@ SkRect TextLine::paint(SkCanvas* textCanvas, SkScalar x, SkScalar y) {
});
return true;
});
this->fAscentStyle = ascentStyle;
this->fDescentStyle = descentStyle;
}
if (fHasShadows) {