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

Issue 207553007: Apply the correct style to first-letter pseudo elements composed of different renderers (Closed)

Created:
6 years, 9 months ago by mario.prada
Modified:
6 years, 8 months ago
CC:
blink-reviews, bemjb+rendering_chromium.org, dsinclair, zoltan1, eae+blinkwatch, leviw+renderwatch, jchaffraix+rendering, pdr., rune+blink, esprehn
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Apply the correct style to first-letter pseudo elements composed of different renderers Traverse (in preorder) the whole subtree under a render block with a first-letter selector when looking for the text renderers which would need to get the apropriate style applied, instead of only considering the first renderer only, which might not contain all the text that should be considered as a "first letter" (leading and trailing punctuation should be included too). The present patch also considers leading spaces, if any, as part of the first-letter element, to match the behaviour of other renderers such as IE and Opera (Firefox does not do that). R=eae@chromium.org, leviw@chromium.org BUG=354403 TEST=Add new test to check first-letter elements composed of different renderers. Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=170677

Patch Set 1 #

Total comments: 2

Patch Set 2 : Addressed comments from Eric: refactored code + more testing #

Total comments: 14

Patch Set 3 : Added early return for empty strings + fixed comments #

Total comments: 4

Patch Set 4 : Use a helper struct FirstLetterSearchState to have a cleaner implementation #

Total comments: 16

Patch Set 5 : Use a class FirstLetterFinder and a state machine to process the text renderers #

Total comments: 8

Patch Set 6 : Address comments from the latest review #

Unified diffs Side-by-side diffs Delta from patch set Stats (+351 lines, -103 lines) Patch
M LayoutTests/editing/selection/extend-by-word-002.html View 1 chunk +1 line, -1 line 0 comments Download
M LayoutTests/editing/selection/extend-by-word-002-expected.txt View 1 chunk +1 line, -1 line 0 comments Download
M LayoutTests/fast/css-generated-content/quote-first-letter-expected.html View 1 chunk +2 lines, -2 lines 0 comments Download
A LayoutTests/fast/css/first-letter-different-renderers.html View 1 1 chunk +54 lines, -0 lines 0 comments Download
A LayoutTests/fast/css/first-letter-different-renderers-expected.html View 1 1 chunk +54 lines, -0 lines 0 comments Download
M LayoutTests/fast/css/first-letter-punctuation.html View 1 2 chunks +7 lines, -1 line 0 comments Download
M LayoutTests/fast/css/first-letter-punctuation-expected.html View 1 2 chunks +7 lines, -1 line 0 comments Download
M Source/core/rendering/RenderBlock.cpp View 1 2 3 4 5 5 chunks +225 lines, -97 lines 0 comments Download

Messages

Total messages: 24 (0 generated)
mario.prada
Finally, I managed to attach a patch that seems to fix the issue while not ...
6 years, 9 months ago (2014-03-25 17:20:04 UTC) #1
mario.prada
See an screenshot of blink rendering the newly added test here: https://code.google.com/p/chromium/issues/detail?id=354403#c3
6 years, 9 months ago (2014-03-25 17:27:28 UTC) #2
eae
On 2014/03/25 17:27:28, mario.prada wrote: > See an screenshot of blink rendering the newly added ...
6 years, 9 months ago (2014-03-25 19:15:28 UTC) #3
mario.prada
On 2014/03/25 19:15:28, eae wrote: > On 2014/03/25 17:27:28, mario.prada wrote: > > See an ...
6 years, 9 months ago (2014-03-25 22:57:05 UTC) #4
eseidel
I think we need more testing of first-letter. we've found several bugs in this code.
6 years, 9 months ago (2014-03-26 15:29:27 UTC) #5
eseidel
I'm OK with the idea of being spec-compliant here, but I don't believe we have ...
6 years, 9 months ago (2014-03-26 15:31:22 UTC) #6
eseidel
https://codereview.chromium.org/207553007/diff/1/Source/core/rendering/RenderBlock.cpp File Source/core/rendering/RenderBlock.cpp (right): https://codereview.chromium.org/207553007/diff/1/Source/core/rendering/RenderBlock.cpp#newcode4154 Source/core/rendering/RenderBlock.cpp:4154: static String getRendererTextForFirstLetter(RenderObject* renderer) We don't normally use "get" ...
6 years, 9 months ago (2014-03-26 15:31:52 UTC) #7
mario.prada
Uploaded a new patch set trying to address Eric's comments. See some notes about this ...
6 years, 9 months ago (2014-03-27 14:12:38 UTC) #8
eseidel
It feels very odd to me that "first-letter" doesn't actually just mean one letter, but ...
6 years, 9 months ago (2014-03-27 21:45:29 UTC) #9
eseidel
https://codereview.chromium.org/207553007/diff/130001/Source/core/rendering/RenderBlock.cpp File Source/core/rendering/RenderBlock.cpp (right): https://codereview.chromium.org/207553007/diff/130001/Source/core/rendering/RenderBlock.cpp#newcode4163 Source/core/rendering/RenderBlock.cpp:4163: if (!result && !textRenderer->isBR() && !textRenderer->isWordBreak()) Are you sure ...
6 years, 9 months ago (2014-03-27 21:48:11 UTC) #10
mario.prada
https://codereview.chromium.org/207553007/diff/130001/Source/core/rendering/RenderBlock.cpp File Source/core/rendering/RenderBlock.cpp (right): https://codereview.chromium.org/207553007/diff/130001/Source/core/rendering/RenderBlock.cpp#newcode4163 Source/core/rendering/RenderBlock.cpp:4163: if (!result && !textRenderer->isBR() && !textRenderer->isWordBreak()) On 2014/03/27 21:48:11, ...
6 years, 9 months ago (2014-03-28 01:08:48 UTC) #11
eseidel
https://codereview.chromium.org/207553007/diff/150001/Source/core/rendering/RenderBlock.cpp File Source/core/rendering/RenderBlock.cpp (right): https://codereview.chromium.org/207553007/diff/150001/Source/core/rendering/RenderBlock.cpp#newcode4169 Source/core/rendering/RenderBlock.cpp:4169: static bool shouldConsiderTextForFirstLetter(const String& text, unsigned& length, bool& leadingSpacesChecked, ...
6 years, 8 months ago (2014-03-31 16:12:51 UTC) #12
mario.prada
Thank you very much for the review. I will upload a new patch soon addressing ...
6 years, 8 months ago (2014-03-31 16:49:34 UTC) #13
eseidel
If its truly a state machine, an enum would be better than bools. :)
6 years, 8 months ago (2014-03-31 16:54:59 UTC) #14
eseidel
We're going to need to go another round here. You don't have to do the ...
6 years, 8 months ago (2014-04-01 06:05:43 UTC) #15
mario.prada
Thanks a lot for the careful review. I will try to address all your comments ...
6 years, 8 months ago (2014-04-01 12:56:08 UTC) #16
mario.prada
I'll be uploading a new patch in a couple of minutes, but let me first ...
6 years, 8 months ago (2014-04-01 17:23:33 UTC) #17
eseidel
lgtm I think this is OK. I'm sure we could iterate more here. https://codereview.chromium.org/207553007/diff/190001/Source/core/rendering/RenderBlock.cpp File ...
6 years, 8 months ago (2014-04-01 17:50:37 UTC) #18
mario.prada
On 2014/04/01 17:50:37, eseidel wrote: > lgtm > > I think this is OK. I'm ...
6 years, 8 months ago (2014-04-02 10:05:08 UTC) #19
eseidel
I think we should try this and iterate from here. lgtm.
6 years, 8 months ago (2014-04-02 17:17:40 UTC) #20
mario.prada
On 2014/04/02 17:17:40, eseidel wrote: > I think we should try this and iterate from ...
6 years, 8 months ago (2014-04-02 17:19:24 UTC) #21
mario.prada
The CQ bit was checked by mario.prada@samsung.com
6 years, 8 months ago (2014-04-02 17:19:31 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/mario.prada@samsung.com/207553007/200001
6 years, 8 months ago (2014-04-02 17:19:41 UTC) #23
commit-bot: I haz the power
6 years, 8 months ago (2014-04-02 17:58:32 UTC) #24
Message was sent while issue was closed.
Change committed as 170677

Powered by Google App Engine
This is Rietveld 408576698