Bug 47237 - Make selection work with vertical text.
Summary: Make selection work with vertical text.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Dave Hyatt
URL:
Keywords: InRadar
Depends on: 48928 48945 49127
Blocks: 46123 65307
  Show dependency treegraph
 
Reported: 2010-10-05 17:58 PDT by Dave Hyatt
Modified: 2011-08-10 07:03 PDT (History)
7 users (show)

See Also:


Attachments
Patch (1.05 MB, patch)
2010-11-05 14:26 PDT, Dave Hyatt
mitz: review+
Details | Formatted Diff | Diff
Patch (1.06 MB, patch)
2010-11-05 22:04 PDT, Dave Hyatt
simon.fraser: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.