Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Issue 219633002: Proper support for multiple text decorations. (Closed)

Created:
6 years, 8 months ago by andersr
Modified:
6 years, 7 months ago
CC:
blink-reviews, zoltan1, dsinclair, bemjb+rendering_chromium.org, eae+blinkwatch, ed+blinkwatch_opera.com, leviw+renderwatch, dglazkov+blink, apavlov+blink_chromium.org, jchaffraix+rendering, darktears, pdr., rune+blink, rwlbuis
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Proper support for multiple text decorations. This patch fixes two issues: * Incorrect style recalc for text-decoration-[style, color] for immediate child text nodes. (Issue 350840). * The ability of having multiple applied text decorations on the same line, for example a dashed underline over a wavy underline. (If that's your thing). Applied decorations (any number) are now stored as a vector of AppliedTextDecoration objects in StyleRareInheritedData. In the common case of a solid-underline-currentColor decoration, we don't store AppliedTextDecoration objects, but set a bit in inherited_flags instead. Some notes related to this: * If there are multiple solid-underline-currentColor decorations applied (i.e. if more than one parent generates such a decoration), it will not trigger the rare behavior. * The single-bit optimization will only be used if there are no other "rare" decorations applied already. Other changes: * Computing the color for the decoration has been moved to RenderStyle (visitedDependentDecoration[Style]Color). * I attempted to beautify the painting code in InlineTextBox.cpp a little bit. * The isRubyText check in the former RenderObject::getTextDecorations has been moved to StyleAdjuster:doesNotInheritTextDecoration. * The 'firstlineStyle'-case of RenderObject::getTextDecorations is now an implementation detail of RenderObject::resolvedDecorations, rather than something the caller must remember to do. Problems: * -webkit-text-decorations-in-effect (in its current form) is not compatible with CSS3 text decorations (in its current form). Behavior after this patch: if you set this property in a stylesheet, it will clear all decorations, and apply up to three solid-currentColor decorations as specified by the property. One solution to this would be to change the property to a comma- separated list of decorations (not recommended), or if at all possible *remove* the whole property (recommended). I attempted to remove the property, but it's used by core/editing in horrible ways I have yet to fully understand. Of course there are no issues if experimental features are not enabled. In this case the behavior should be indistinguishable from the current behavior. * text-decoration-line seems to accept multiple values (up to three), even though the spec does not allow it. (CSS2.1 does describe this for text-decoration, though, so it's possibly a problem with the spec rather than our implementation). BUG=350840, 315271 TEST=text-decoration-color-recalc.html text-decoration-style-recalc.html text-decoration-line-recalc.html text-decoration-style-multiple-overlap.html

Patch Set 1 #

Total comments: 24

Patch Set 2 : Rebase. #

Patch Set 3 : Fix most review issues. #

Patch Set 4 : Rebase #

Patch Set 5 : Resolve decoration colors dynamically. #

Total comments: 5

Patch Set 6 : Rebase. #

Patch Set 7 : Fix review issues. #

Total comments: 16

Patch Set 8 : Rebase. #

Patch Set 9 : Fix jchaffraix' issues. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+539 lines, -110 lines) Patch
M LayoutTests/TestExpectations View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
A LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-color-recalc.html View 1 2 3 4 1 chunk +15 lines, -0 lines 0 comments Download
A LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-color-recalc-expected.html View 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-recalc.html View 1 2 1 chunk +15 lines, -0 lines 0 comments Download
A LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-recalc-expected.html View 1 chunk +10 lines, -0 lines 0 comments Download
A LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-style-multiple-overlap.html View 1 2 1 chunk +30 lines, -0 lines 0 comments Download
A LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-style-multiple-overlap-expected.html View 1 2 1 chunk +30 lines, -0 lines 0 comments Download
A LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-style-recalc.html View 1 2 3 4 1 chunk +15 lines, -0 lines 0 comments Download
A LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-style-recalc-expected.html View 1 chunk +10 lines, -0 lines 0 comments Download
M Source/core/core.gypi View 1 2 3 4 5 6 7 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/css/resolver/StyleAdjuster.cpp View 1 2 3 4 5 6 7 2 chunks +4 lines, -4 lines 0 comments Download
M Source/core/rendering/InlineTextBox.h View 1 2 3 4 2 chunks +5 lines, -1 line 0 comments Download
M Source/core/rendering/InlineTextBox.cpp View 1 2 3 4 8 chunks +98 lines, -40 lines 0 comments Download
M Source/core/rendering/RenderObject.h View 1 2 3 4 5 6 7 1 chunk +9 lines, -4 lines 0 comments Download
M Source/core/rendering/RenderObject.cpp View 1 2 3 4 5 6 7 2 chunks +44 lines, -44 lines 0 comments Download
A Source/core/rendering/style/AppliedTextDecoration.h View 1 2 3 4 5 6 1 chunk +35 lines, -0 lines 0 comments Download
A Source/core/rendering/style/AppliedTextDecoration.cpp View 1 2 3 4 5 6 1 chunk +36 lines, -0 lines 0 comments Download
M Source/core/rendering/style/RenderStyle.h View 1 2 3 4 5 6 7 8 7 chunks +15 lines, -10 lines 0 comments Download
M Source/core/rendering/style/RenderStyle.cpp View 1 2 3 4 5 6 7 8 6 chunks +106 lines, -5 lines 0 comments Download
M Source/core/rendering/style/StyleRareInheritedData.h View 1 2 3 4 5 6 2 chunks +6 lines, -0 lines 0 comments Download
M Source/core/rendering/style/StyleRareInheritedData.cpp View 1 2 3 4 5 6 7 8 4 chunks +5 lines, -2 lines 0 comments Download
A Source/wtf/RefVector.h View 1 2 3 4 5 6 7 8 1 chunk +38 lines, -0 lines 0 comments Download

Messages

Total messages: 14 (0 generated)
andersr
Note: this is a new attempt at fixing the style recalc for text-decoration-[style,color]. Previous attempt: ...
6 years, 8 months ago (2014-03-31 17:05:17 UTC) #1
esprehn
https://codereview.chromium.org/219633002/diff/1/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-color-recalc.html File LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-color-recalc.html (right): https://codereview.chromium.org/219633002/diff/1/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-color-recalc.html#newcode9 LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-color-recalc.html:9: window.addEventListener("load", function() { onload = function() { https://codereview.chromium.org/219633002/diff/1/LayoutTests/fast/css3-text/css3-text-decoration/text-decoration-line-recalc.html File ...
6 years, 8 months ago (2014-03-31 17:41:24 UTC) #2
andersr
https://codereview.chromium.org/219633002/diff/1/Source/core/rendering/style/RenderStyle.h File Source/core/rendering/style/RenderStyle.h (right): https://codereview.chromium.org/219633002/diff/1/Source/core/rendering/style/RenderStyle.h#newcode585 Source/core/rendering/style/RenderStyle.h:585: TextDecoration appliedTextUnderline() const { return static_cast<TextDecoration>(inherited_flags.m_textUnderline); } On 2014/03/31 ...
6 years, 8 months ago (2014-04-01 17:07:54 UTC) #3
esprehn
Any luck based on our discussion?
6 years, 8 months ago (2014-04-12 06:14:57 UTC) #4
andersr
On 2014/04/12 06:14:57, esprehn wrote: > Any luck based on our discussion? I've let this ...
6 years, 8 months ago (2014-04-14 09:24:09 UTC) #5
andersr
Patch Set 5: The colors for *all* decorations are now resolved dynamically, rather than just ...
6 years, 7 months ago (2014-04-30 10:55:20 UTC) #6
esprehn
lgtm, this seems reasonable. fix nits before landing https://codereview.chromium.org/219633002/diff/80001/Source/core/rendering/style/AppliedTextDecoration.h File Source/core/rendering/style/AppliedTextDecoration.h (right): https://codereview.chromium.org/219633002/diff/80001/Source/core/rendering/style/AppliedTextDecoration.h#newcode17 Source/core/rendering/style/AppliedTextDecoration.h:17: AppliedTextDecoration(TextDecoration); ...
6 years, 7 months ago (2014-05-01 17:17:54 UTC) #7
Peter Beverloo
https://codereview.chromium.org/219633002/diff/80001/Source/core/rendering/style/AppliedTextDecoration.cpp File Source/core/rendering/style/AppliedTextDecoration.cpp (right): https://codereview.chromium.org/219633002/diff/80001/Source/core/rendering/style/AppliedTextDecoration.cpp#newcode33 Source/core/rendering/style/AppliedTextDecoration.cpp:33: return m_color == o.m_color && m_line == o.m_line && ...
6 years, 7 months ago (2014-05-01 17:24:51 UTC) #8
andersr
https://codereview.chromium.org/219633002/diff/80001/Source/core/rendering/style/AppliedTextDecoration.cpp File Source/core/rendering/style/AppliedTextDecoration.cpp (right): https://codereview.chromium.org/219633002/diff/80001/Source/core/rendering/style/AppliedTextDecoration.cpp#newcode33 Source/core/rendering/style/AppliedTextDecoration.cpp:33: return m_color == o.m_color && m_line == o.m_line && ...
6 years, 7 months ago (2014-05-02 11:10:34 UTC) #9
Julien - ping for review
I don't think I have a good understanding of this change as it is changing ...
6 years, 7 months ago (2014-05-05 17:45:07 UTC) #10
andersr
On 2014/05/05 17:45:07, Julien Chaffraix - PST wrote: > I don't think I have a ...
6 years, 7 months ago (2014-05-06 13:15:12 UTC) #11
andersr
https://codereview.chromium.org/219633002/diff/120001/Source/core/css/resolver/StyleAdjuster.cpp File Source/core/css/resolver/StyleAdjuster.cpp (left): https://codereview.chromium.org/219633002/diff/120001/Source/core/css/resolver/StyleAdjuster.cpp#oldcode248 Source/core/css/resolver/StyleAdjuster.cpp:248: style->setTextDecorationsInEffect(style->textDecoration()); On 2014/05/05 17:45:08, Julien Chaffraix - PST wrote: ...
6 years, 7 months ago (2014-05-06 13:15:28 UTC) #12
andersr
I've split out the RenderStyle changes in a separate patch here: https://codereview.chromium.org/272443002/
6 years, 7 months ago (2014-05-06 16:40:26 UTC) #13
Julien - ping for review
6 years, 7 months ago (2014-05-06 17:26:52 UTC) #14
On 2014/05/06 13:15:12, andersr wrote:
> On 2014/05/05 17:45:07, Julien Chaffraix - PST wrote:
> > I don't think I have a good understanding of this change as it is changing
> > *everything* at once. You should really split this change into smaller more
> > focused patches. In the meantime, I don't think we should land this so not
> lgtm.
> 
> Hardly "everything", but it *is* possible to split this into two patches (at
> least), I agree.
> 
> Patch 1: Fix just the style recalculation issue. This patch would contain the
> AppliedTextDecoration objects + the m_textUnderline optimization, but the
> painting code would not be changed.
> 
> Patch 2: Fix multiple decoration issue. The painting code would be changed to
> paint based on the AppliedTextDecoration vector rather than
> textDecorationsInEffect.

That's a first step to splitting the change. I usually advise people to always
split CSS and rendering into different patches as it's not the same subset of
people that can review them.

Now, Patch 1 is actually 2 changes:
- One refactoring: changing the internal representation of decoration to use
AppliedTextDecoration objects (depending on the granularity you want, this could
be several patches).
- Fixing the style recalculation issue.

I will continue my review on the new change you put up for review.

Powered by Google App Engine
This is Rietveld 408576698