RESOLVED FIXED 48539
Support the text-emphasis CSS property
https://bugs.webkit.org/show_bug.cgi?id=48539
Summary Support the text-emphasis CSS property
Dave Hyatt
Reported 2010-10-28 11:47:53 PDT
This is a master bug for text-emphasis support (both back end and front end).
Attachments
Part 1: CSS support (36.89 KB, patch)
2010-12-02 12:58 PST, mitz
no flags
Part 2: Platform, layout and rendering (WIP, do not review) (49.51 KB, patch)
2010-12-12 13:30 PST, mitz
no flags
Part 2: Platform, layout and rendering (WIP, do not review) (52.06 KB, patch)
2010-12-12 14:04 PST, mitz
no flags
Part 2: Platform, layout and rendering (WIP, do not review) (68.64 KB, patch)
2010-12-12 15:06 PST, mitz
no flags
Part 2: Platform, layout and rendering (WIP, do not review) (68.97 KB, patch)
2010-12-12 15:08 PST, mitz
no flags
Part 2: Platform, layout and rendering (WIP, do not review) (81.55 KB, patch)
2010-12-12 18:56 PST, mitz
no flags
Part 2: Platform, layout and rendering (WIP, do not review) (82.66 KB, patch)
2010-12-13 14:25 PST, mitz
no flags
Part 2: Platform, layout and rendering (WIP, do not review) (83.50 KB, patch)
2010-12-13 18:09 PST, mitz
no flags
Platform, layout and rendering (WIP, do not review) (83.52 KB, patch)
2010-12-13 18:38 PST, mitz
no flags
Part 2: Additional RenderStyle support (3.93 KB, patch)
2010-12-14 19:21 PST, mitz
no flags
Part 2: Additional RenderStyle support (5.65 KB, patch)
2010-12-14 19:28 PST, mitz
no flags
Part 3: Platform support (82.43 KB, patch)
2010-12-15 16:57 PST, mitz
no flags
Part 4: Layout and rendering (294.00 KB, patch)
2010-12-16 13:50 PST, mitz
no flags
Part 4: Layout and rendering (306.56 KB, patch)
2010-12-17 00:11 PST, mitz
hyatt: review+
mitz
Comment 1 2010-12-02 12:58:53 PST
Created attachment 75408 [details] Part 1: CSS support
Dave Hyatt
Comment 2 2010-12-02 13:08:54 PST
Comment on attachment 75408 [details] Part 1: CSS support r=me, but can you go ahead and add a RenderStyle::diff hint as well? I think it's going to end up being a layout hint (because of possible changes to overflow propagation, e.g., since emphasis marks can go above Rubies).
Dave Hyatt
Comment 3 2010-12-02 13:09:22 PST
Actually only changing the color is just a repaint hint I suppose, so just do the right thing with each property. :)
Darin Adler
Comment 4 2010-12-02 13:14:45 PST
Comment on attachment 75408 [details] Part 1: CSS support View in context: https://bugs.webkit.org/attachment.cgi?id=75408&action=review > WebCore/css/CSSComputedStyleDeclaration.cpp:1237 > + } > + } I think it would be slightly better to explicitly list all the cases so we get a warning if we ever add a new case. If you want to put the default code outside the switch and use "break" we’d get everything except for the runtime check for a bad enum value, which I think is a good tradeoff. > WebCore/css/CSSParser.cpp:5147 > + if (fill && shape) { > + RefPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSeparated(); > + parsedValues->append(fill.release()); > + parsedValues->append(shape.release()); > + addProperty(CSSPropertyWebkitTextEmphasisStyle, parsedValues.release(), important); > + } else if (fill) > + addProperty(CSSPropertyWebkitTextEmphasisStyle, fill.release(), important); > + else if (shape) > + addProperty(CSSPropertyWebkitTextEmphasisStyle, shape.release(), important); > + else > + return false; > + > + return true; I think this would read better if the return true was inside each if and we thus did not need all those elses.
mitz
Comment 5 2010-12-02 16:37:58 PST
mitz
Comment 6 2010-12-12 13:30:12 PST
Created attachment 76333 [details] Part 2: Platform, layout and rendering (WIP, do not review) Uploading this primarily for the EWS to look at.
Early Warning System Bot
Comment 7 2010-12-12 13:48:10 PST
WebKit Review Bot
Comment 8 2010-12-12 13:49:35 PST
mitz
Comment 9 2010-12-12 14:04:28 PST
Created attachment 76334 [details] Part 2: Platform, layout and rendering (WIP, do not review)
Build Bot
Comment 10 2010-12-12 14:23:43 PST
Early Warning System Bot
Comment 11 2010-12-12 14:29:41 PST
WebKit Review Bot
Comment 12 2010-12-12 14:34:38 PST
Build Bot
Comment 13 2010-12-12 14:42:45 PST
mitz
Comment 14 2010-12-12 15:06:07 PST
Created attachment 76336 [details] Part 2: Platform, layout and rendering (WIP, do not review)
mitz
Comment 15 2010-12-12 15:08:22 PST
Created attachment 76337 [details] Part 2: Platform, layout and rendering (WIP, do not review)
mitz
Comment 16 2010-12-12 15:10:06 PST
I can probably move the implementation of smallCapsFontData() and emphasisMarkFontData() to cross-platform code.
WebKit Review Bot
Comment 17 2010-12-12 15:28:57 PST
Early Warning System Bot
Comment 18 2010-12-12 15:29:19 PST
WebKit Review Bot
Comment 19 2010-12-12 15:44:21 PST
Build Bot
Comment 20 2010-12-12 15:48:56 PST
Early Warning System Bot
Comment 21 2010-12-12 15:50:40 PST
Build Bot
Comment 22 2010-12-12 16:17:32 PST
Build Bot
Comment 23 2010-12-12 16:56:16 PST
mitz
Comment 24 2010-12-12 18:56:45 PST
Created attachment 76345 [details] Part 2: Platform, layout and rendering (WIP, do not review)
Early Warning System Bot
Comment 25 2010-12-12 19:23:23 PST
mitz
Comment 26 2010-12-13 14:25:10 PST
Created attachment 76439 [details] Part 2: Platform, layout and rendering (WIP, do not review) Trying to appease Qt, correcting emphasis mark positioning in vertical fonts.
Early Warning System Bot
Comment 27 2010-12-13 17:53:10 PST
mitz
Comment 28 2010-12-13 18:09:19 PST
Created attachment 76477 [details] Part 2: Platform, layout and rendering (WIP, do not review)
mitz
Comment 29 2010-12-13 18:38:03 PST
Created attachment 76481 [details] Platform, layout and rendering (WIP, do not review)
mitz
Comment 30 2010-12-14 19:21:14 PST
Created attachment 76617 [details] Part 2: Additional RenderStyle support Another small piece, ready for review.
mitz
Comment 31 2010-12-14 19:28:18 PST
Created attachment 76619 [details] Part 2: Additional RenderStyle support
mitz
Comment 32 2010-12-14 19:33:52 PST
mitz
Comment 33 2010-12-14 19:40:42 PST
Comment on attachment 76619 [details] Part 2: Additional RenderStyle support <http://trac.webkit.org/changeset/74095>
mitz
Comment 34 2010-12-15 16:57:24 PST
Created attachment 76712 [details] Part 3: Platform support
Darin Adler
Comment 35 2010-12-15 17:59:24 PST
Comment on attachment 76712 [details] Part 3: Platform support View in context: https://bugs.webkit.org/attachment.cgi?id=76712&action=review > WebCore/platform/graphics/FontFastPath.cpp:200 > +// FIXME: This method is not complex-text aware. Anthropomorphizing the function and saying it’s not aware of complex text doesn’t make clear to me what the problem is here. Is it incorrect in some way? For what cases? I think you can probably write a slightly different comment that will be less ambiguous. Also, I’d prefer you use the C++ term function rather than the term method. > WebCore/platform/graphics/SimpleFontData.cpp:200 > + m_derivedFontData = new DerivedFontData(isCustomFont()); Can I talk you into future-proofing this code by calling adoptPtr in all the call sites like this one? In a related question, should we use the create function idiom for this struct? > WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp:85 > + return new SimpleFontData( > + FontPlatformData(cairo_scaled_font_get_font_face(m_platformData.scaledFont()), I would have made that first argument be on the first line because of my distaste for breaking right after an open paren. I think the line length ends up being not too horrible. > WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp:96 > + m_derivedFontData->smallCaps = scaledFontData(fontDescription, .7); We should really name that 0.7 constant at some point. I know it wasn’t named before. > WebCore/platform/graphics/freetype/SimpleFontDataFreeType.cpp:106 > + m_derivedFontData->emphasisMark = scaledFontData(fontDescription, .5); And this 0.5 constant.
mitz
Comment 36 2010-12-15 18:24:29 PST
mitz
Comment 37 2010-12-16 13:50:51 PST
Created attachment 76813 [details] Part 4: Layout and rendering I am going to file a follow-up bug for the interaction with ruby
mitz
Comment 38 2010-12-16 14:25:53 PST
Comment on attachment 76813 [details] Part 4: Layout and rendering Hyatt suggested that I try do this the right way instead :)
WebKit Review Bot
Comment 39 2010-12-16 15:37:42 PST
http://trac.webkit.org/changeset/74169 might have broken Leopard Intel Debug (Tests)
mitz
Comment 40 2010-12-17 00:11:30 PST
Created attachment 76852 [details] Part 4: Layout and rendering
Dave Hyatt
Comment 41 2010-12-17 11:29:05 PST
Comment on attachment 76852 [details] Part 4: Layout and rendering View in context: https://bugs.webkit.org/attachment.cgi?id=76852&action=review r=me! > WebCore/rendering/InlineFlowBox.cpp:754 > + if (style->textEmphasisMark() != TextEmphasisMarkNone) { > + int emphasisMarkHeight = style->font().emphasisMarkHeight(style->textEmphasisMarkString()); > + if (style->textEmphasisPosition() == TextEmphasisPositionOver) > + topGlyphOverflow = min(topGlyphOverflow, -emphasisMarkHeight); > + else > + bottomGlyphOverflow = max(bottomGlyphOverflow, emphasisMarkHeight); > + } It would be great to have a repaint test that tests the overflow repainting.
mitz
Comment 42 2010-12-17 11:33:20 PST
Jessie Berlin
Comment 43 2010-12-17 12:53:12 PST
mitz
Comment 44 2010-12-17 12:55:10 PST
(In reply to comment #43) > Are platform-specific tests required on Windows? > > http://build.webkit.org/results/Windows%207%20Release%20(Tests)/r74283%20(7526)/results.html Yes
Jessie Berlin
Comment 45 2010-12-17 12:57:40 PST
(In reply to comment #44) > (In reply to comment #43) > > Are platform-specific tests required on Windows? > > > > http://build.webkit.org/results/Windows%207%20Release%20(Tests)/r74283%20(7526)/results.html > > Yes Are you adding them or should I?
Jessie Berlin
Comment 46 2010-12-17 13:38:29 PST
Landed Windows-specific results in http://trac.webkit.org/changeset/74290
Note You need to log in before you can comment on or make changes to this bug.