Bug 46972

Summary: Add two new helper files for the new SVGTextLayoutEngine
Product: WebKit Reporter: Nikolas Zimmermann <zimmermann>
Component: SVGAssignee: Nikolas Zimmermann <zimmermann>
Status: RESOLVED FIXED    
Severity: Normal CC: mdelaney7, webkit.review.bot, zimmermann
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Bug Depends on:    
Bug Blocks: 45532    
Attachments:
Description Flags
Patch
none
Patch v2
krit: review-
Patch v3 krit: review+

Description Nikolas Zimmermann 2010-10-01 03:51:46 PDT
Add SVGTextLayoutEngineBaseline & SVGTextLayoutEngineSpacing, which will be used & owned by the new SVGTextLayoutEngine.
Comment 1 Nikolas Zimmermann 2010-10-01 03:55:06 PDT
Created attachment 69446 [details]
Patch
Comment 2 WebKit Review Bot 2010-10-01 03:58:27 PDT
Attachment 69446 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
WebCore/rendering/svg/SVGTextLayoutEngineBaseline.cpp:158:  Non-label code inside switch statements should be indented.  [whitespace/indent] [4]
WebCore/rendering/svg/SVGTextLayoutEngineBaseline.cpp:181:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
WebCore/rendering/svg/SVGTextLayoutEngineBaseline.cpp:199:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
WebCore/rendering/svg/SVGTextLayoutEngineBaseline.cpp:210:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
WebCore/rendering/svg/SVGTextLayoutEngineBaseline.cpp:226:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
WebCore/rendering/svg/SVGTextLayoutEngineSpacing.cpp:82:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Total errors found: 6 in 12 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Nikolas Zimmermann 2010-10-01 04:07:26 PDT
Created attachment 69447 [details]
Patch v2

Fix style issues.
Comment 4 Dirk Schulze 2010-10-01 04:17:19 PDT
Comment on attachment 69447 [details]
Patch v2

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

> WebCore/rendering/svg/SVGTextLayoutEngineBaseline.cpp:146
> +        return m_font.ascent() * 8.0f / 10.0f;
> +    case AB_MATHEMATICAL:
> +        return m_font.ascent() / 2;
> +    default:

On one line you use / 2, on the other line / 10.0f. Please use a common style here. I think it's more save to use / 2.f instead of / 2, but it's your decision.

> WebCore/rendering/svg/SVGTextLayoutEngineBaseline.cpp:166
> +    case GO_AUTO:
> +        {
> +            // Spec: Fullwidth ideographic and fullwidth Latin text will be set with a glyph-orientation of 0-degrees.
> +            // Text which is not fullwidth will be set with a glyph-orientation of 90-degrees.
> +            unsigned int unicodeRange = findCharUnicodeRange(character);
> +            if (unicodeRange == cRangeSetLatin || unicodeRange == cRangeArabic)
> +                return 90;
> +
> +            return 0;
> +        }

The indention looks wrong here.
Comment 5 Nikolas Zimmermann 2010-10-01 04:20:32 PDT
(In reply to comment #4)
> (From update of attachment 69447 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=69447&action=review
> 
> > WebCore/rendering/svg/SVGTextLayoutEngineBaseline.cpp:146
> > +        return m_font.ascent() * 8.0f / 10.0f;
> > +    case AB_MATHEMATICAL:
> > +        return m_font.ascent() / 2;
> > +    default:
> 
> On one line you use / 2, on the other line / 10.0f. Please use a common style here. I think it's more save to use / 2.f instead of / 2, but it's your decision.
Well the common style is to avoid .f where possible. But as 8 / 10 gives me an integer, I need to use these postfixes.

> 
> > WebCore/rendering/svg/SVGTextLayoutEngineBaseline.cpp:166
> > +    case GO_AUTO:
> > +        {
> > +            // Spec: Fullwidth ideographic and fullwidth Latin text will be set with a glyph-orientation of 0-degrees.
> > +            // Text which is not fullwidth will be set with a glyph-orientation of 90-degrees.
> > +            unsigned int unicodeRange = findCharUnicodeRange(character);
> > +            if (unicodeRange == cRangeSetLatin || unicodeRange == cRangeArabic)
> > +                return 90;
> > +
> > +            return 0;
> > +        }
> 
> The indention looks wrong here.
If you check the last patch, I did that on purpose, otherwhise the style bot moans.
Comment 6 Nikolas Zimmermann 2010-10-01 04:36:07 PDT
Created attachment 69448 [details]
Patch v3

We agreed to ignore the style warning regarding indentation in a switch, it looks awkward, and the coding style guidelines don't say a word about it.
Comment 7 Dirk Schulze 2010-10-01 04:37:48 PDT
Comment on attachment 69448 [details]
Patch v3

LGTM. r=me
Comment 8 Nikolas Zimmermann 2010-10-01 04:38:24 PDT
Landed in r68878.