Bug 213052 - [Line clamp] Do not apply the special anchor handling when the anchor content is visible after clamping
Summary: [Line clamp] Do not apply the special anchor handling when the anchor 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: 2020-06-10 15:10 PDT by zalan
Modified: 2020-06-11 11:09 PDT (History)
11 users (show)

See Also:


Attachments
Patch (5.12 KB, patch)
2020-06-10 15:34 PDT, zalan
no flags Details | Formatted Diff | Diff
Patch (5.91 KB, patch)
2020-06-10 19:25 PDT, 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 2020-06-10 15:10:45 PDT
<rdar://problem/59739131>
Comment 1 zalan 2020-06-10 15:34:02 PDT
Created attachment 401592 [details]
Patch
Comment 2 Darin Adler 2020-06-10 16:16:14 PDT
Comment on attachment 401592 [details]
Patch

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

> Source/WebCore/ChangeLog:9
> +        Line clamping tries to preserve the anchor text if it is at the bottom of the paragraph to support cases like "... Read mode", where the "read more" is an actual link.

mode/more?
Comment 3 zalan 2020-06-10 19:25:25 PDT
Created attachment 401615 [details]
Patch
Comment 4 EWS 2020-06-10 20:01:54 PDT
Committed r262892: <https://trac.webkit.org/changeset/262892>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 401615 [details].
Comment 5 David Kilzer (:ddkilzer) 2020-06-11 11:01:42 PDT
Comment on attachment 401615 [details]
Patch

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

> Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp:1004
> -        if (anchorBox && anchorBox->renderer().style().isLink())
> +        auto& anchorRenderer = anchorBox->renderer();
> +        auto& lastVisibleRenderer = lastVisibleLine->firstChild()->renderer();
> +        if (anchorBox && anchorBox->renderer().style().isLink() && &lastVisibleRenderer != &anchorRenderer)

Is Line 1002 (auto& anchorRenderer = anchorBox->renderer();) susceptible to a nullptr crash since you're no longer checking `anchorBox` before dereferencing it?
Comment 6 zalan 2020-06-11 11:05:55 PDT
(In reply to David Kilzer (:ddkilzer) from comment #5)
> Comment on attachment 401615 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=401615&action=review
> 
> > Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp:1004
> > -        if (anchorBox && anchorBox->renderer().style().isLink())
> > +        auto& anchorRenderer = anchorBox->renderer();
> > +        auto& lastVisibleRenderer = lastVisibleLine->firstChild()->renderer();
> > +        if (anchorBox && anchorBox->renderer().style().isLink() && &lastVisibleRenderer != &anchorRenderer)
> 
> Is Line 1002 (auto& anchorRenderer = anchorBox->renderer();) susceptible to
> a nullptr crash since you're no longer checking `anchorBox` before
> dereferencing it?
It should never really happen but I'll add a check. Thanks.
Comment 7 zalan 2020-06-11 11:09:02 PDT
(In reply to zalan from comment #6)
> (In reply to David Kilzer (:ddkilzer) from comment #5)
> > Comment on attachment 401615 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=401615&action=review
> > 
> > > Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp:1004
> > > -        if (anchorBox && anchorBox->renderer().style().isLink())
> > > +        auto& anchorRenderer = anchorBox->renderer();
> > > +        auto& lastVisibleRenderer = lastVisibleLine->firstChild()->renderer();
> > > +        if (anchorBox && anchorBox->renderer().style().isLink() && &lastVisibleRenderer != &anchorRenderer)
> > 
> > Is Line 1002 (auto& anchorRenderer = anchorBox->renderer();) susceptible to
> > a nullptr crash since you're no longer checking `anchorBox` before
> > dereferencing it?
> It should never really happen but I'll add a check. Thanks.
The InlineBox interface should probably be changed to return references.