Bug 136484

Summary: Add support for the initial-letter CSS property to first-letter
Product: WebKit Reporter: Dave Hyatt <hyatt>
Component: CSSAssignee: Dave Hyatt <hyatt>
Status: RESOLVED FIXED    
Severity: Normal CC: bjonesbe, commit-queue, jonlee, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=164150
Bug Depends on:    
Bug Blocks: 136841    
Attachments:
Description Flags
Patch dino: review+

Description Dave Hyatt 2014-09-03 09:40:26 PDT
Bug for adding initial-letter support to WebKit.
Comment 1 Dave Hyatt 2014-09-03 10:49:25 PDT
Created attachment 237561 [details]
Patch
Comment 2 WebKit Commit Bot 2014-09-03 10:50:32 PDT
Attachment 237561 [details] did not pass style-queue:


ERROR: Source/WebCore/rendering/RenderBlockFlow.cpp:2350:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
ERROR: Source/WebCore/css/CSSLineBoxContainValue.h:38:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 2 in 33 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Dean Jackson 2014-09-03 11:11:03 PDT
Comment on attachment 237561 [details]
Patch

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

> Source/WebCore/css/CSSValueKeywords.in:974
> +initial-letter

Do you actually ever use this?

> Source/WebCore/platform/graphics/FontMetrics.h:102
> -
> +    

whoopsy

> Source/WebCore/rendering/RenderBlock.cpp:3484
> +        while (actualCapHeight > desiredCapHeight) {

Would this ever be slow?

> Source/WebCore/rendering/RenderBlock.cpp:3487
> +            newFontDescription.setComputedSize(newFontDescription.computedSize() -1);

Nit: missing space between - and 1

> Source/WebCore/rendering/style/RenderStyle.h:1087
> +    const IntSize& initialLetter() const { return rareNonInheritedData->m_initialLetter; }
> +    int initialLetterDrop() const { return initialLetter().width(); }
> +    int initialLetterHeight() const { return initialLetter().height(); }

This is a bit weird - maybe initialLetter() should be private, so that people won't ever think that the IntSize.width() is an actual width.

> Source/WebCore/rendering/style/RenderStyle.h:1620
> +    void setInitialLetter(const IntSize& size) { SET_VAR(rareNonInheritedData, m_initialLetter, size); }

Again, a bit weird that you need to know what is width and what is height.
Comment 4 Dave Hyatt 2014-09-03 12:27:01 PDT
Landed in r173217.
Comment 5 Tim Horton 2014-09-03 13:27:41 PDT
Build fix that I'm not 100% sure about in http://trac.webkit.org/changeset/173221; Dave, if you could check it that would be great.
Comment 6 Bem Jones-Bey 2014-09-03 16:56:32 PDT
Comment on attachment 237561 [details]
Patch

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

> Source/WebCore/css/CSSParser.cpp:2436
> +            addProperty(propId, createPrimitiveValuePair(parsedValue1.release(), parsedValue2.release()), important);

This looks dangerous to me: in the case of only 1 value, you're release()ing it twice. Why is this ok here?
Comment 7 Tim Horton 2014-09-03 17:01:28 PDT
Comment on attachment 237561 [details]
Patch

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

>> Source/WebCore/css/CSSParser.cpp:2436
>> +            addProperty(propId, createPrimitiveValuePair(parsedValue1.release(), parsedValue2.release()), important);
> 
> This looks dangerous to me: in the case of only 1 value, you're release()ing it twice. Why is this ok here?

There are two RefPtrs; even if they point at the same thing they'll both own one reference apiece, and each release will move said reference into a PassRefPtr.
Comment 8 Radar WebKit Bug Importer 2014-11-11 09:53:25 PST
<rdar://problem/18941449>