Bug 127082

Summary: Draw all underline segments in a particular run in the same call
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: New BugsAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: aestes, commit-queue, d-r, esprehn+autocc, glenn, jonlee, kondapallykalyan, simon.fraser
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch simon.fraser: review+

Description Myles C. Maxfield 2014-01-15 21:18:38 PST
Draw all underline segments in a particular run in the same call
Comment 1 Myles C. Maxfield 2014-01-15 21:24:55 PST
Created attachment 221330 [details]
Patch
Comment 2 Simon Fraser (smfr) 2014-01-15 22:18:56 PST
Comment on attachment 221330 [details]
Patch

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

> Source/WebCore/platform/graphics/GraphicsContext.h:374
> +        void drawLinesForText(const FloatPoint&, DashArray widths, bool printing);

Should DashArray be passed by value like this?
Comment 3 Myles C. Maxfield 2014-01-16 11:50:14 PST
Comment on attachment 221330 [details]
Patch

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

>> Source/WebCore/platform/graphics/GraphicsContext.h:374
>> +        void drawLinesForText(const FloatPoint&, DashArray widths, bool printing);
> 
> Should DashArray be passed by value like this?

Good point. Fixed.
Comment 4 Myles C. Maxfield 2014-01-16 12:15:22 PST
Created attachment 221399 [details]
Patch
Comment 5 Simon Fraser (smfr) 2014-01-16 12:20:33 PST
Comment on attachment 221399 [details]
Patch

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

> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:1496
> +    Vector<CGRect> dashBounds;

Inline capacity, and set capacity up front?

> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:1507
> +    if (fillColor() != strokeColor())

You could avoid doing this comparison twice.

> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:1518
> +    CGContextRef context = platformContext();
> +    CGContextSaveGState(context);

Odd that this is so different. Why save/restore here and not above?

> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:1525
> +    Vector<CGRect> dashBounds;

Ditto.

> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:1530
> +    if (m_state.shouldUseContextColors)

Is m_state.shouldUseContextColors iOS-specific? What does it mean?
Comment 6 Myles C. Maxfield 2014-01-16 12:47:43 PST
Comment on attachment 221399 [details]
Patch

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

>> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:1496
>> +    Vector<CGRect> dashBounds;
> 
> Inline capacity, and set capacity up front?

Done.

>> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:1507
>> +    if (fillColor() != strokeColor())
> 
> You could avoid doing this comparison twice.

Done.

>> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:1518
>> +    CGContextSaveGState(context);
> 
> Odd that this is so different. Why save/restore here and not above?

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

>> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:1525
>> +    Vector<CGRect> dashBounds;
> 
> Ditto.

Done.

>> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:1530
>> +    if (m_state.shouldUseContextColors)
> 
> Is m_state.shouldUseContextColors iOS-specific? What does it mean?

Yes, iOS-specific. It appears to be a flag that, when unset, fills the underline with the fillColor() instead of the strokeColor().
Comment 7 Andy Estes 2014-01-16 16:00:20 PST
Comment on attachment 221399 [details]
Patch

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

> Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:1523
> +    FloatRect rect = computeLineBoundsAndAntialiasingModeForText(*this, point, width, printing, shouldAntialiasLine, color);

This line breaks the iOS build. Should width be widths.last() instead?
Comment 8 Andy Estes 2014-01-16 16:10:03 PST
Assuming the answer to my question is yes, I fixed this in http://trac.webkit.org/changeset/162164
Comment 9 Myles C. Maxfield 2014-01-16 16:23:41 PST
Yes, it should be. Thanks for fixing this for me.