Commit 3be7af49 authored by ckocagil's avatar ckocagil Committed by Commit bot

RenderText: Always invalidate layout on style changes and never on color changes

BUG=386749
R=msw

Review URL: https://codereview.chromium.org/522103002

Cr-Commit-Position: refs/heads/master@{#293072}
parent d9affcfb
...@@ -637,52 +637,24 @@ void RenderText::SetCompositionRange(const Range& composition_range) { ...@@ -637,52 +637,24 @@ void RenderText::SetCompositionRange(const Range& composition_range) {
void RenderText::SetColor(SkColor value) { void RenderText::SetColor(SkColor value) {
colors_.SetValue(value); colors_.SetValue(value);
#if defined(OS_WIN)
// TODO(msw): Windows applies colors and decorations in the layout process.
cached_bounds_and_offset_valid_ = false;
ResetLayout();
#endif
} }
void RenderText::ApplyColor(SkColor value, const Range& range) { void RenderText::ApplyColor(SkColor value, const Range& range) {
colors_.ApplyValue(value, range); colors_.ApplyValue(value, range);
#if defined(OS_WIN)
// TODO(msw): Windows applies colors and decorations in the layout process.
cached_bounds_and_offset_valid_ = false;
ResetLayout();
#endif
} }
void RenderText::SetStyle(TextStyle style, bool value) { void RenderText::SetStyle(TextStyle style, bool value) {
styles_[style].SetValue(value); styles_[style].SetValue(value);
// Only invalidate the layout on font changes; not for colors or decorations. cached_bounds_and_offset_valid_ = false;
bool invalidate = (style == BOLD) || (style == ITALIC); ResetLayout();
#if defined(OS_WIN)
// TODO(msw): Windows applies colors and decorations in the layout process.
invalidate = true;
#endif
if (invalidate) {
cached_bounds_and_offset_valid_ = false;
ResetLayout();
}
} }
void RenderText::ApplyStyle(TextStyle style, bool value, const Range& range) { void RenderText::ApplyStyle(TextStyle style, bool value, const Range& range) {
styles_[style].ApplyValue(value, range); styles_[style].ApplyValue(value, range);
// Only invalidate the layout on font changes; not for colors or decorations. cached_bounds_and_offset_valid_ = false;
bool invalidate = (style == BOLD) || (style == ITALIC); ResetLayout();
#if defined(OS_WIN)
// TODO(msw): Windows applies colors and decorations in the layout process.
invalidate = true;
#endif
if (invalidate) {
cached_bounds_and_offset_valid_ = false;
ResetLayout();
}
} }
bool RenderText::GetStyle(TextStyle style) const { bool RenderText::GetStyle(TextStyle style) const {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment