Changeset 123973 in webkit


Ignore:
Timestamp:
Jul 28, 2012 2:40:48 PM (12 years ago)
Author:
mitz@apple.com
Message:

In flipped lines writing modes, hit testing at the beginning of a column may return a result from the previous column
https://bugs.webkit.org/show_bug.cgi?id=92566

Reviewed by Simon Fraser.

Source/WebCore:

Enhanced the fix for <http://webkit.org/b/92524> to work with flipped lines.

Extended fast/multicol/hit-test-end-of-column-with-line-height.html.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::positionForPointWithInlineChildren): For flipped lines, check if the
hit line is the last one before a page break, and in that case, check if the hit point was
after the break.

LayoutTests:

  • fast/multicol/hit-test-end-of-column-with-line-height-expected.txt: Updated.
  • fast/multicol/hit-test-end-of-column-with-line-height.html: Extended with tests for

horizontal-bt.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r123972 r123973  
     12012-07-28  Dan Bernstein  <mitz@apple.com>
     2
     3        In flipped lines writing modes, hit testing at the beginning of a column may return a result from the previous column
     4        https://bugs.webkit.org/show_bug.cgi?id=92566
     5
     6        Reviewed by Simon Fraser.
     7
     8        * fast/multicol/hit-test-end-of-column-with-line-height-expected.txt: Updated.
     9        * fast/multicol/hit-test-end-of-column-with-line-height.html: Extended with tests for
     10        horizontal-bt.
     11
    1122012-07-28  Simon Fraser  <simon.fraser@apple.com>
    213
  • trunk/LayoutTests/fast/multicol/hit-test-end-of-column-with-line-height-expected.txt

    r123904 r123973  
    22PASS
    33PASS
     4PASS
     5PASS
    46
  • trunk/LayoutTests/fast/multicol/hit-test-end-of-column-with-line-height.html

    r123904 r123973  
    2828    hitOffset = document.caretRangeFromPoint(target.offsetLeft + 250, target.offsetTop + 2).startOffset;
    2929    log(hitOffset === 14 ? "PASS" : "FAIL: hit offset " + hitOffset + ".");
     30
     31    // Now test with a flipped lines writing mode.
     32    target.style.webkitWritingMode = "horizontal-bt";
     33
     34    // Clicking above the last line in the first column should not select anything from the first
     35    // line on the second column.
     36    hitOffset = document.caretRangeFromPoint(target.offsetLeft + 190, target.offsetTop + 3).startOffset;
     37    log(hitOffset === 11 ? "PASS" : "FAIL: hit offset " + hitOffset + ".");
     38
     39    // Clicking below the first line in the second column should not snap to the beginning of the line.
     40    hitOffset = document.caretRangeFromPoint(target.offsetLeft + 250, target.offsetTop + 78).startOffset;
     41    log(hitOffset === 14 ? "PASS" : "FAIL: hit offset " + hitOffset + ".");
    3042</script>
  • trunk/Source/WebCore/ChangeLog

    r123972 r123973  
     12012-07-28  Dan Bernstein  <mitz@apple.com>
     2
     3        In flipped lines writing modes, hit testing at the beginning of a column may return a result from the previous column
     4        https://bugs.webkit.org/show_bug.cgi?id=92566
     5
     6        Reviewed by Simon Fraser.
     7
     8        Enhanced the fix for <http://webkit.org/b/92524> to work with flipped lines.
     9
     10        Extended fast/multicol/hit-test-end-of-column-with-line-height.html.
     11
     12        * rendering/RenderBlock.cpp:
     13        (WebCore::RenderBlock::positionForPointWithInlineChildren): For flipped lines, check if the
     14        hit line is the last one before a page break, and in that case, check if the hit point was
     15        after the break.
     16
    1172012-07-28  Simon Fraser  <simon.fraser@apple.com>
    218
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r123904 r123973  
    49174917        return createVisiblePosition(0, DOWNSTREAM);
    49184918
     4919    bool linesAreFlipped = style()->isFlippedLinesWritingMode();
     4920
    49194921    // look for the closest line box in the root box which is at the passed-in y coordinate
    49204922    InlineBox* closestBox = 0;
     
    49274929            firstRootBoxWithChildren = root;
    49284930
    4929         if (root->isFirstAfterPageBreak() && pointInLogicalContents.y() < root->lineTopWithLeading())
     4931        if (!linesAreFlipped && root->isFirstAfterPageBreak() && pointInLogicalContents.y() < root->lineTopWithLeading())
    49304932            break;
    49314933
     
    49344936        // check if this root line box is located at this y coordinate
    49354937        if (pointInLogicalContents.y() < root->selectionBottom()) {
     4938            if (linesAreFlipped) {
     4939                RootInlineBox* nextRootBoxWithChildren = root->nextRootBox();
     4940                while (nextRootBoxWithChildren && !nextRootBoxWithChildren->firstLeafChild())
     4941                    nextRootBoxWithChildren = nextRootBoxWithChildren->nextRootBox();
     4942
     4943                if (nextRootBoxWithChildren && nextRootBoxWithChildren->isFirstAfterPageBreak() && pointInLogicalContents.y() >= nextRootBoxWithChildren->lineTopWithLeading())
     4944                    continue;
     4945            }
    49364946            closestBox = root->closestLeafChildForLogicalLeftPosition(pointInLogicalContents.x());
    49374947            if (closestBox)
Note: See TracChangeset for help on using the changeset viewer.