[Webkit-unassigned] [Bug 39863] innerText does not include a letter with :first-letter applied

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon May 31 21:19:55 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=39863





--- Comment #16 from Yoshiki Hayashi <yhayashi at google.com>  2010-05-31 21:19:54 PST ---
Thank you for review!

(In reply to comment #15)
> (From update of attachment 57453 [details])
> Does this work with "white-space: pre" text?

Good point.  No, it doesn't work.  I'm going to attach a new patch to fix it which just adds if (renderer->style()->collapseWhiteSpace()) in front of while loop.

> WebCore/editing/TextIterator.cpp:593
>  +                  while (runStart < runEnd && str[runStart] == ' ')
>  +                      ++runStart;
> 
> What about other kinds of whitespace and newline? The logic in <http://trac.webkit.org/browser/trunk/WebCore/rendering/RenderBlock.cpp?rev=60408#L4914> is different. Could you instead use the InlineTextBox’s start and end, like handleTextBox() does?

There are two cases when handling leading whitespaces.  One is whitespaces are collapsed and another is not collapsed.  When whitespace is not collapsed, all leading whitespaces should be preserved as you pointed out above.   So this whil e loop shouldn't be run.  When whitespaces should be collapsed, those should be already replaced to one ' ' so the above loop should correctly skip that.  The RenderBlock code you mentioned also skips punctuations when finding the first letter that could get :first-letter to be applied but here, we want to output them as text so we don't need special handling for those.  So unless I'm missing something (which is quite possible as I just did in the previous patch), I think the new code should work.

As to the latter point, if I understand the code correctly, RenderTextFragment doesn't have InlineTextBox and it holds text directly.  RenderTextFragment itself has start and end but those are offset into original text which will produce the text fragment (text_fragment = original_text.substring(start, end)) so those can't be used, either.  So looking at the RenderTextFragment.cpp, I don't know if there's a better way to do it.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list