Changeset 123988 in webkit


Ignore:
Timestamp:
Jul 29, 2012 3:55:51 PM (12 years ago)
Author:
mitz@apple.com
Message:

In flipped blocks, a point on the top edge of a text box is considered outside the box (and vice versa)
https://bugs.webkit.org/show_bug.cgi?id=92597

Reviewed by Ryosuke Niwa.

Source/WebCore:

This is similar to <http://webkit.org/b/92593> except for RenderText. Fixing this required
fixing some code that creates a point inside a box by setting its y coordinate to the
logical top of the box. In a flipped block, this would be just outside the box.

Enhanced fast/writing-mode/flipped-blocks-hit-test-line-edges.html to cover this.

  • editing/visible_units.cpp:

(WebCore::absoluteLineDirectionPointToLocalPointInBlock): Changed to use
RootInlineBox::blockDirectionPointInLine in the vertical case as well.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::positionForPointWithInlineChildren): Changed to use
RootInlineBox::blockDirectionPointInLine.

  • rendering/RenderText.cpp:

(WebCore::RenderText::positionForPoint): Changed the strictness of y inequalities based on
the flippedness of the block. This fixes the bug.

  • rendering/RootInlineBox.cpp:

(WebCore::RootInlineBox::blockDirectionPointInLine): Moved the implementation here from the
header, and made it return the bottom in the flipped block case, so that the returned point
is inside the line in that case as well.

  • rendering/RootInlineBox.h:

LayoutTests:

Added hits inside the text to this test.

  • fast/writing-mode/flipped-blocks-hit-test-line-edges-expected.txt:
  • fast/writing-mode/flipped-blocks-hit-test-line-edges.html:
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r123980 r123988  
     12012-07-29  Dan Bernstein  <mitz@apple.com>
     2
     3        In flipped blocks, a point on the top edge of a text box is considered outside the box (and vice versa)
     4        https://bugs.webkit.org/show_bug.cgi?id=92597
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Added hits inside the text to this test.
     9
     10        * fast/writing-mode/flipped-blocks-hit-test-line-edges-expected.txt:
     11        * fast/writing-mode/flipped-blocks-hit-test-line-edges.html:
     12
    1132012-07-29  Dan Bernstein  <mitz@apple.com>
    214
  • trunk/LayoutTests/fast/writing-mode/flipped-blocks-hit-test-line-edges-expected.txt

    r123980 r123988  
    11Lorem ipsum dolor sit amet
     2PASS: offset at (100,105) was 4.
    23PASS: offset at (160,105) was 5.
     4PASS: offset at (100,104) was 10.
    35PASS: offset at (160,104) was 11.
     6PASS: offset at (60,26) was 24.
    47PASS: offset at (160,26) was 26.
     8PASS: offset at (60,25) was 24.
    59PASS: offset at (160,25) was 26.
     10PASS: offset at (60,24) was 26.
    611PASS: offset at (160,24) was 26.
    712
  • trunk/LayoutTests/fast/writing-mode/flipped-blocks-hit-test-line-edges.html

    r123980 r123988  
    2626    }
    2727
     28    test(100, 105, 4);
    2829    test(160, 105, 5);
     30    test(100, 104, 10);
    2931    test(160, 104, 11);
     32    test(60, 26, 24);
    3033    test(160, 26, 26);
     34    test(60, 25, 24);
    3135    test(160, 25, 26);
     36    test(60, 24, 26);
    3237    test(160, 24, 26);
    3338</script>
  • trunk/Source/WebCore/ChangeLog

    r123984 r123988  
     12012-07-29  Dan Bernstein  <mitz@apple.com>
     2
     3        In flipped blocks, a point on the top edge of a text box is considered outside the box (and vice versa)
     4        https://bugs.webkit.org/show_bug.cgi?id=92597
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        This is similar to <http://webkit.org/b/92593> except for RenderText. Fixing this required
     9        fixing some code that creates a point inside a box by setting its y coordinate to the
     10        logical top of the box. In a flipped block, this would be just outside the box.
     11
     12        Enhanced fast/writing-mode/flipped-blocks-hit-test-line-edges.html to cover this.
     13
     14        * editing/visible_units.cpp:
     15        (WebCore::absoluteLineDirectionPointToLocalPointInBlock): Changed to use
     16        RootInlineBox::blockDirectionPointInLine in the vertical case as well.
     17        * rendering/RenderBlock.cpp:
     18        (WebCore::RenderBlock::positionForPointWithInlineChildren): Changed to use
     19        RootInlineBox::blockDirectionPointInLine.
     20        * rendering/RenderText.cpp:
     21        (WebCore::RenderText::positionForPoint): Changed the strictness of y inequalities based on
     22        the flippedness of the block. This fixes the bug.
     23        * rendering/RootInlineBox.cpp:
     24        (WebCore::RootInlineBox::blockDirectionPointInLine): Moved the implementation here from the
     25        header, and made it return the bottom in the flipped block case, so that the returned point
     26        is inside the line in that case as well.
     27        * rendering/RootInlineBox.h:
     28
    1292012-07-29  Rik Cabanier  <cabanier@adobe.com>
    230
  • trunk/Source/WebCore/editing/visible_units.cpp

    r117813 r123988  
    920920        return IntPoint(lineDirectionPoint - absoluteBlockPoint.x(), root->blockDirectionPointInLine());
    921921
    922     return IntPoint(root->selectionTop(), lineDirectionPoint - absoluteBlockPoint.y());
     922    return IntPoint(root->blockDirectionPointInLine(), lineDirectionPoint - absoluteBlockPoint.y());
    923923}
    924924
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r123980 r123988  
    49764976
    49774977        // pass the box a top position that is inside it
    4978         LayoutPoint point(pointInLogicalContents.x(), max(closestBox->root()->lineTop(), closestBox->root()->selectionTop()));
     4978        LayoutPoint point(pointInLogicalContents.x(), closestBox->root()->blockDirectionPointInLine());
    49794979        if (!isHorizontalWritingMode())
    49804980            point = point.transposedPoint();
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r121102 r123988  
    614614    LayoutUnit pointLineDirection = firstTextBox()->isHorizontal() ? point.x() : point.y();
    615615    LayoutUnit pointBlockDirection = firstTextBox()->isHorizontal() ? point.y() : point.x();
     616    bool blocksAreFlipped = style()->isFlippedBlocksWritingMode();
    616617
    617618    InlineTextBox* lastBox = 0;
     
    621622
    622623        RootInlineBox* rootBox = box->root();
    623         if (pointBlockDirection >= rootBox->selectionTop() || pointBlockDirection >= rootBox->lineTop()) {
     624        LayoutUnit top = min(rootBox->selectionTop(), rootBox->lineTop());
     625        if (pointBlockDirection > top || (!blocksAreFlipped && pointBlockDirection == top)) {
    624626            LayoutUnit bottom = rootBox->selectionBottom();
    625627            if (rootBox->nextRootBox())
    626628                bottom = min(bottom, rootBox->nextRootBox()->lineTop());
    627629
    628             if (pointBlockDirection < bottom) {
     630            if (pointBlockDirection < bottom || (blocksAreFlipped && pointBlockDirection == bottom)) {
    629631                ShouldAffinityBeDownstream shouldAffinityBeDownstream;
    630632                if (lineDirectionPointFitsInBox(pointLineDirection, box, shouldAffinityBeDownstream))
  • trunk/Source/WebCore/rendering/RootInlineBox.cpp

    r122883 r123988  
    602602}
    603603
     604int RootInlineBox::blockDirectionPointInLine() const
     605{
     606    return !block()->style()->isFlippedBlocksWritingMode() ? max(lineTop(), selectionTop()) : min(lineBottom(), selectionBottom());
     607}
     608
    604609RenderBlock* RootInlineBox::block() const
    605610{
  • trunk/Source/WebCore/rendering/RootInlineBox.h

    r123904 r123988  
    7070    LayoutUnit selectionHeightAdjustedForPrecedingBlock() const { return max<LayoutUnit>(0, selectionBottom() - selectionTopAdjustedForPrecedingBlock()); }
    7171
    72     int blockDirectionPointInLine() const { return max(lineTop(), selectionTop()); }
     72    int blockDirectionPointInLine() const;
    7373
    7474    LayoutUnit alignBoxesInBlockDirection(LayoutUnit heightOfBlock, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&);
Note: See TracChangeset for help on using the changeset viewer.