Bug 47237

Summary: Make selection work with vertical text.
Product: WebKit Reporter: Dave Hyatt <hyatt>
Component: Layout and RenderingAssignee: Dave Hyatt <hyatt>
Status: RESOLVED FIXED    
Severity: Normal CC: k.blank, mifenton, mitz, ossy, rniwa, tonikitoo, webkit-ews
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Bug Depends on: 48928, 48945, 49127    
Bug Blocks: 46123, 65307    
Attachments:
Description Flags
Patch
mitz: review+
Patch simon.fraser: review+

Description Dave Hyatt 2010-10-05 17:58:17 PDT
Make selection work with vertical text.
Comment 1 Adele Peterson 2010-10-29 15:13:02 PDT
<rdar://problem/8612041>
Comment 2 Dave Hyatt 2010-11-05 14:26:00 PDT
Created attachment 73118 [details]
Patch
Comment 3 Early Warning System Bot 2010-11-05 15:00:50 PDT
Attachment 73118 [details] did not build on qt:
Build output: http://queues.webkit.org/results/5331023
Comment 4 mitz 2010-11-05 15:09:56 PDT
Comment on attachment 73118 [details]
Patch

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

Found one mistake.

> WebCore/rendering/RenderBlock.cpp:2709
> +        if (!paintInfo || (style()->isHorizontalWritingMode() && physicalRect.y() < paintInfo->rect.bottom() && physicalRect.bottom() > paintInfo->rect.y()
> +            || (!style()->isHorizontalWritingMode() && physicalRect.x() < paintInfo->rect.right() && physicalRect.right() > paintInfo->rect.x())))

Redundant parentheses there.

> WebCore/rendering/RenderBlock.h:121
> +    IntRect logicalLeftSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,
> +                                    RenderObject* selObj, int logicalLeft, int logicalTop, int logicalHeight, const PaintInfo* paintInfo);
> +    IntRect logicalRightSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,
> +                                     RenderObject* selObj, int logicalRight, int logicalTop, int logicalHeight, const PaintInfo* paintInfo);

Don’t add the argument name “paintInfo”.

> WebCore/rendering/RenderBlock.h:541
> +    GapRects selectionGaps(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,
> +                           int& lastLogicalTop, int& lastLogicalLeft, int& lastLogicalRight, const PaintInfo* paintInfo = 0);
> +    GapRects inlineSelectionGaps(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,
> +                           int& lastLogicalTop, int& lastLogicalLeft, int& lastLogicalRight, const PaintInfo* paintInfo);
> +    GapRects blockSelectionGaps(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,
> +                           int& lastLogicalTop, int& lastLogicalLeft, int& lastLogicalRight, const PaintInfo* paintInfo);
> +    IntRect blockSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,
> +                              int lastLogicalTop, int lastLogicalLeft, int lastLogicalRight, int logicalBottom, const PaintInfo* paintInfo);
>      int logicalLeftSelectionOffset(RenderBlock* rootBlock, int position);

Ditto.

> WebCore/rendering/RenderBlock.h:543
> +    

whitespace!

> WebCore/rendering/RenderBox.cpp:3245
> +    return style()->isHorizontalWritingMode() ? IntSize(offset.width(), logicalHeight() - offset.height()) : IntSize(logicalHeight() - offset.width(), offset.height());

Should be logicalWidth() - offset.width() in the second branch.

> WebCore/rendering/RootInlineBox.cpp:254
> +GapRects RootInlineBox::lineSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock, 
> +                                         int selTop, int selHeight, const PaintInfo* paintInfo)

Can omit “paintInfo”.
Comment 5 mitz 2010-11-05 15:12:00 PDT
(In reply to comment #4)
> > WebCore/rendering/RootInlineBox.cpp:254
> > +GapRects RootInlineBox::lineSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock, 
> > +                                         int selTop, int selHeight, const PaintInfo* paintInfo)
> 
> Can omit “paintInfo”.

Ignore this :)
Comment 6 Dave Hyatt 2010-11-05 22:04:25 PDT
Created attachment 73164 [details]
Patch
Comment 7 Dave Hyatt 2010-11-05 22:06:25 PDT
This new patch addresses Dan's comments, but more importantly it fixes one failing layout test from the previous patch.  See the second paragraph of the WebCore ChangeLog for the explanation.  The only change is to RootInlineBox::selectionTop() (to now extend selection up to the top content edge of the block now that lineTop no longer always starts there) and changing RenderBlock::positionForPoint to just exactly match selection as far as what line it chooses when you're in between lines.
Comment 8 Dave Hyatt 2010-11-05 22:50:18 PDT
Fixed in r71465.
Comment 9 Csaba Osztrogonác 2010-11-06 01:41:23 PDT
(In reply to comment #8)
> Fixed in r71465.

It made editing/selection/after-line-break.html fail on Qt bot, 
I filed a new bug on it: https://bugs.webkit.org/show_bug.cgi?id=49127
Comment 11 Kamil Blank 2011-08-09 07:38:41 PDT
Hi,

After this patch and changes made inside RootInlineBox::selectionTop(), I've noticed some problem on BBC site which I reported here:
https://bugs.webkit.org/show_bug.cgi?id=65307
Could you please take a look on it?

(In reply to comment #7)
> This new patch addresses Dan's comments, but more importantly it fixes one failing layout test from the previous patch.  See the second paragraph of the WebCore ChangeLog for the explanation.  The only change is to RootInlineBox::selectionTop() (to now extend selection up to the top content edge of the block now that lineTop no longer always starts there) and changing RenderBlock::positionForPoint to just exactly match selection as far as what line it chooses when you're in between lines.