Bug 167831 - Simple line layout: Skip 16bit specific checks on 8bit content.
Summary: Simple line layout: Skip 16bit specific checks on 8bit content.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-02-03 21:08 PST by zalan
Modified: 2017-02-04 08:36 PST (History)
10 users (show)

See Also:


Attachments
Patch (6.52 KB, patch)
2017-02-03 21:13 PST, zalan
no flags Details | Formatted Diff | Diff
Patch (7.38 KB, patch)
2017-02-04 07:24 PST, zalan
koivisto: review+
Details | Formatted Diff | Diff
Patch (7.61 KB, patch)
2017-02-04 07:59 PST, zalan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zalan 2017-02-03 21:08:49 PST
They are redundant.
Comment 1 Radar WebKit Bug Importer 2017-02-03 21:09:15 PST
<rdar://problem/30361948>
Comment 2 zalan 2017-02-03 21:13:22 PST
Created attachment 300601 [details]
Patch
Comment 3 Myles C. Maxfield 2017-02-03 21:25:13 PST
Comment on attachment 300601 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=300601&action=review

> Source/WebCore/rendering/SimpleLineLayout.cpp:-139
> -template <typename CharacterType>

Historically, we've gotten some speedups by using the template to generate a completely new loop for 8-bit code rather than doing it at runtime. We might not want to lose this benefit.

> Source/WebCore/rendering/SimpleLineLayout.cpp:160
> +        // 16bit checks start here.

Redundant with the line above. Should remove.

> Source/WebCore/rendering/SimpleLineLayout.cpp:163
>              bool isLatinIncludingExtendedB = character <= 0x01FF;

What does this have to do with justification?

> Source/WebCore/rendering/SimpleLineLayout.cpp:169
> +        if (lineHeightConstraint && primaryFont.boundsForGlyph(glyphData.glyph).height() > *lineHeightConstraint)

Why doesn't this need to be done in the 8-bit case? Any glyph can have giant bounds (see Zapfino)

> Source/WebCore/rendering/SimpleLineLayout.cpp:195
> +        // FIXME: Do not return until after checking all children.

Why?

> Source/WebCore/rendering/SimpleLineLayout.cpp:196
> +        if (!textRenderer.textLength())

Why don't you just detect this case early and ASSERT() here? It's really easy to measure 0 length runs.
Comment 4 zalan 2017-02-03 21:54:30 PST
> > Source/WebCore/rendering/SimpleLineLayout.cpp:160
> > +        // 16bit checks start here.
> 
> Redundant with the line above. Should remove.
Ok. I just wanted to emphasize that this is for 16bit only.

> 
> > Source/WebCore/rendering/SimpleLineLayout.cpp:163
> >              bool isLatinIncludingExtendedB = character <= 0x01FF;
> 
> What does this have to do with justification?
This is a hack for iBooks content (extend justified text support to Latin-B + punctuation. see r210948 -we talked about this a week ago.) 
> 
> > Source/WebCore/rendering/SimpleLineLayout.cpp:169
> > +        if (lineHeightConstraint && primaryFont.boundsForGlyph(glyphData.glyph).height() > *lineHeightConstraint)
> 
> Why doesn't this need to be done in the 8-bit case? Any glyph can have giant
> bounds (see Zapfino)
Yes, I missed this. Thanks.

> 
> > Source/WebCore/rendering/SimpleLineLayout.cpp:195
> > +        // FIXME: Do not return until after checking all children.
> 
> Why?
Because we could still do SLL on a block that has multiple text children even when one of them is empty.

> 
> > Source/WebCore/rendering/SimpleLineLayout.cpp:196
> > +        if (!textRenderer.textLength())
> 
> Why don't you just detect this case early and ASSERT() here? It's really
> easy to measure 0 length runs.
This is the part where we start looking into the content (as opposed to css properties). We can move checks around, but the current grouping is as follows:
basic tree structure checks, css properties, content.
Comment 5 zalan 2017-02-04 07:24:52 PST
Created attachment 300623 [details]
Patch
Comment 6 Antti Koivisto 2017-02-04 07:32:34 PST
Comment on attachment 300623 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=300623&action=review

> Source/WebCore/rendering/SimpleLineLayout.cpp:141
> +template <typename CharacterType>
> +static AvoidanceReasonFlags canUseForCharacter(CharacterType character, bool textIsJustified, IncludeReasons includeReasons)

It might be nicer to to first declare the template and then provide both specializations separately:

template <typename CharacterType> AvoidanceReasonFlags canUseForCharacter(CharacterType, bool textIsJustified, IncludeReasons);

template<> AvoidanceReasonFlags canUseForCharacter(UChar character, bool textIsJustified, IncludeReasons includeReasons) 
{
   ...

I don't think 'static' is needed.
Comment 7 Antti Koivisto 2017-02-04 07:39:29 PST
Comment on attachment 300623 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=300623&action=review

> Source/WebCore/rendering/SimpleLineLayout.cpp:189
> +        canUseForCharacter(character, textIsJustified, includeReasons);

Should we do something with the return value?
Comment 8 zalan 2017-02-04 07:59:09 PST
Created attachment 300624 [details]
Patch
Comment 9 WebKit Commit Bot 2017-02-04 08:36:26 PST
Comment on attachment 300624 [details]
Patch

Clearing flags on attachment: 300624

Committed r211671: <http://trac.webkit.org/changeset/211671>
Comment 10 WebKit Commit Bot 2017-02-04 08:36:31 PST
All reviewed patches have been landed.  Closing bug.