Changeset 167817 in webkit


Ignore:
Timestamp:
Apr 25, 2014 1:20:48 PM (10 years ago)
Author:
hyatt@apple.com
Message:

[New Multicolumn] fast/multicol/hit-test-* layout tests all fail
https://bugs.webkit.org/show_bug.cgi?id=132081

Reviewed by Dean Jackson.

Source/WebCore:
Added a bunch of tests in fast/multicol/newmulticol/compare-with-old-impl/hit-test-*.html

  • rendering/RenderBlock.h:

Make offsetForContents public, since I need to call it from RenderMultiColumnSet.

  • rendering/RenderMultiColumnFlowThread.cpp:

(WebCore::RenderMultiColumnFlowThread::populate):
Stop an ASSERT in the new columns code on the hit tests by making sure layout state is
disabled when moving children around.

  • rendering/RenderMultiColumnSet.cpp:

(WebCore::RenderMultiColumnSet::positionForPoint):
Refactor this function to call a helper function instead, translateRegionPointToFlowThread.

(WebCore::RenderMultiColumnSet::translateRegionPointToFlowThread):
This function is logical (unlike the mistaken physical function I first implemented in
positionForPoint).

(WebCore::RenderMultiColumnSet::updateHitTestResult):

  • rendering/RenderMultiColumnSet.h:

Overridden to fill in the correct local coordinate when the HTML document is inside a paginated
RenderView. Note that column spans don't actually work, but once we move over to a
non-column based pagination API, that will become irrelevant.

LayoutTests:

  • fast/multicol/newmulticol/compare-with-old-impl/hit-test-above-or-below-expected.txt: Added.
  • fast/multicol/newmulticol/compare-with-old-impl/hit-test-above-or-below.html: Added.
  • fast/multicol/newmulticol/compare-with-old-impl/hit-test-block-axis-flipped-expected.txt: Added.
  • fast/multicol/newmulticol/compare-with-old-impl/hit-test-block-axis-flipped.html: Added.
  • fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-expected.txt: Added.
  • fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height-expected.txt: Added.
  • fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height.html: Added.
  • fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column.html: Added.
  • fast/multicol/newmulticol/compare-with-old-impl/hit-test-float-expected.txt: Added.
  • fast/multicol/newmulticol/compare-with-old-impl/hit-test-float.html: Added.
  • fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-expected.txt: Added.
  • fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-flipped-expected.txt: Added.
  • fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-flipped.html: Added.
  • fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages.html: Added.
  • fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-block-axis-expected.txt: Added.
  • fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-block-axis.html: Added.
Location:
trunk
Files:
16 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r167812 r167817  
     12014-04-25  David Hyatt  <hyatt@apple.com>
     2
     3        [New Multicolumn] fast/multicol/hit-test-* layout tests all fail
     4        https://bugs.webkit.org/show_bug.cgi?id=132081
     5
     6        Reviewed by Dean Jackson.
     7
     8        * fast/multicol/newmulticol/compare-with-old-impl/hit-test-above-or-below-expected.txt: Added.
     9        * fast/multicol/newmulticol/compare-with-old-impl/hit-test-above-or-below.html: Added.
     10        * fast/multicol/newmulticol/compare-with-old-impl/hit-test-block-axis-flipped-expected.txt: Added.
     11        * fast/multicol/newmulticol/compare-with-old-impl/hit-test-block-axis-flipped.html: Added.
     12        * fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-expected.txt: Added.
     13        * fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height-expected.txt: Added.
     14        * fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height.html: Added.
     15        * fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column.html: Added.
     16        * fast/multicol/newmulticol/compare-with-old-impl/hit-test-float-expected.txt: Added.
     17        * fast/multicol/newmulticol/compare-with-old-impl/hit-test-float.html: Added.
     18        * fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-expected.txt: Added.
     19        * fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-flipped-expected.txt: Added.
     20        * fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages-flipped.html: Added.
     21        * fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-between-pages.html: Added.
     22        * fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-block-axis-expected.txt: Added.
     23        * fast/multicol/newmulticol/compare-with-old-impl/hit-test-gap-block-axis.html: Added.
     24
    1252014-04-25  Tim Horton  <timothy_horton@apple.com>
    226
  • trunk/Source/WebCore/ChangeLog

    r167811 r167817  
     12014-04-25  David Hyatt  <hyatt@apple.com>
     2
     3        [New Multicolumn] fast/multicol/hit-test-* layout tests all fail
     4        https://bugs.webkit.org/show_bug.cgi?id=132081
     5
     6        Reviewed by Dean Jackson.
     7
     8        Added a bunch of tests in fast/multicol/newmulticol/compare-with-old-impl/hit-test-*.html
     9
     10        * rendering/RenderBlock.h:
     11        Make offsetForContents public, since I need to call it from RenderMultiColumnSet.
     12
     13        * rendering/RenderMultiColumnFlowThread.cpp:
     14        (WebCore::RenderMultiColumnFlowThread::populate):
     15        Stop an ASSERT in the new columns code on the hit tests by making sure layout state is
     16        disabled when moving children around.
     17
     18        * rendering/RenderMultiColumnSet.cpp:
     19        (WebCore::RenderMultiColumnSet::positionForPoint):
     20        Refactor this function to call a helper function instead, translateRegionPointToFlowThread.
     21
     22        (WebCore::RenderMultiColumnSet::translateRegionPointToFlowThread):
     23        This function is logical (unlike the mistaken physical function I first implemented in
     24        positionForPoint).
     25
     26        (WebCore::RenderMultiColumnSet::updateHitTestResult):
     27        * rendering/RenderMultiColumnSet.h:
     28        Overridden to fill in the correct local coordinate when the HTML document is inside a paginated
     29        RenderView. Note that column spans don't actually work, but once we move over to a
     30        non-column based pagination API, that will become irrelevant.
     31
    1322014-04-25  Andreas Kling  <akling@apple.com>
    233
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r167803 r167817  
    419419    // FIXME: Can devirtualize once old column code is gone.
    420420    virtual void computeLineGridPaginationOrigin(LayoutState&) const;
     421   
     422    // Adjust from painting offsets to the local coords of this renderer
     423    void offsetForContents(LayoutPoint&) const;
    421424
    422425protected:
     
    569572
    570573protected:
    571     // Adjust from painting offsets to the local coords of this renderer
    572     void offsetForContents(LayoutPoint&) const;
    573 
    574574    virtual bool requiresColumns(int computedColumnCount) const;
    575575
  • trunk/Source/WebCore/rendering/RenderMultiColumnFlowThread.cpp

    r167808 r167817  
    156156    // now. At this point there's obviously nothing after the flow thread, but renderers (column
    157157    // sets and spanners) will be inserted there as we insert elements into the flow thread.
     158    LayoutStateDisabler layoutStateDisabler(&view());
    158159    multicolContainer->moveChildrenTo(this, multicolContainer->firstChild(), this, true);
    159160}
  • trunk/Source/WebCore/rendering/RenderMultiColumnSet.cpp

    r167808 r167817  
    2828
    2929#include "FrameView.h"
     30#include "HitTestResult.h"
    3031#include "PaintInfo.h"
    3132#include "RenderLayer.h"
     
    870871}
    871872
    872 VisiblePosition RenderMultiColumnSet::positionForPoint(const LayoutPoint& physicalPoint, const RenderRegion*)
     873VisiblePosition RenderMultiColumnSet::positionForPoint(const LayoutPoint& logicalPoint, const RenderRegion*)
     874{
     875    return multiColumnFlowThread()->positionForPoint(translateRegionPointToFlowThread(logicalPoint, ClampHitTestTranslationToColumns), this);
     876}
     877
     878LayoutPoint RenderMultiColumnSet::translateRegionPointToFlowThread(const LayoutPoint & logicalPoint, ColumnHitTestTranslationMode clampMode) const
    873879{
    874880    // Determine which columns we intersect.
    875881    LayoutUnit colGap = columnGap();
    876882    LayoutUnit halfColGap = colGap / 2;
    877     LayoutPoint columnPoint(columnRectAt(0).location());
    878     LayoutUnit logicalOffset = 0;
    879    
     883
    880884    bool progressionIsInline = multiColumnFlowThread()->progressionIsInline();
    881885
    882     LayoutPoint point = physicalPoint;
     886    LayoutPoint point = logicalPoint;
    883887   
    884888    for (unsigned i = 0; i < columnCount(); i++) {
    885889        // Add in half the column gap to the left and right of the rect.
    886890        LayoutRect colRect = columnRectAt(i);
    887         flipForWritingMode(colRect);
    888891        if (isHorizontalWritingMode() == progressionIsInline) {
    889892            LayoutRect gapAndColumnRect(colRect.x() - halfColGap, colRect.y(), colRect.width() + colGap, colRect.height());
    890893            if (point.x() >= gapAndColumnRect.x() && point.x() < gapAndColumnRect.maxX()) {
    891                 if (progressionIsInline) {
    892                     // FIXME: The clamping that follows is not completely right for right-to-left
    893                     // content.
    894                     // Clamp everything above the column to its top left.
    895                     if (point.y() < gapAndColumnRect.y())
    896                         point = gapAndColumnRect.location();
    897                     // Clamp everything below the column to the next column's top left. If there is
    898                     // no next column, this still maps to just after this column.
    899                     else if (point.y() >= gapAndColumnRect.maxY()) {
    900                         point = gapAndColumnRect.location();
    901                         point.move(0, gapAndColumnRect.height());
     894                if (clampMode == ClampHitTestTranslationToColumns) {
     895                    if (progressionIsInline) {
     896                        // FIXME: The clamping that follows is not completely right for right-to-left
     897                        // content.
     898                        // Clamp everything above the column to its top left.
     899                        if (point.y() < gapAndColumnRect.y())
     900                            point = gapAndColumnRect.location();
     901                        // Clamp everything below the column to the next column's top left. If there is
     902                        // no next column, this still maps to just after this column.
     903                        else if (point.y() >= gapAndColumnRect.maxY()) {
     904                            point = gapAndColumnRect.location();
     905                            point.move(0, gapAndColumnRect.height());
     906                        }
     907                    } else {
     908                        if (point.x() < colRect.x())
     909                            point.setX(colRect.x());
     910                        else if (point.x() >= colRect.maxX())
     911                            point.setX(colRect.maxX() - 1);
    902912                    }
    903                 } else {
    904                     if (point.x() < colRect.x())
    905                         point.setX(colRect.x());
    906                     else if (point.x() >= colRect.maxX())
    907                         point.setX(colRect.maxX() - 1);
    908913                }
    909 
    910                 // We're inside the column. Translate the x and y into our column coordinate space.
    911                 if (progressionIsInline)
    912                     point.move(columnPoint.x() - colRect.x(), (!style().isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset));
    913                 else
    914                     point.move((!style().isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset) - colRect.x() + borderLeft() + paddingLeft(), 0);
    915914               
    916                 LayoutRect portion = flowThreadPortionRect();
    917                 flipForWritingMode(portion);
    918                 point.move(isHorizontalWritingMode() ? LayoutUnit() : portion.x(), isHorizontalWritingMode() ? portion.y() : LayoutUnit());
    919                 return multiColumnFlowThread()->positionForPoint(point, this);
     915                LayoutSize offsetInColumn = point - colRect.location();
     916                LayoutRect flowThreadPortion = flowThreadPortionRectAt(i);
     917               
     918                return flowThreadPortion.location() + offsetInColumn;
    920919            }
    921 
    922             // Move to the next position.
    923             logicalOffset += progressionIsInline ? colRect.height() : colRect.width();
    924920        } else {
    925921            LayoutRect gapAndColumnRect(colRect.x(), colRect.y() - halfColGap, colRect.width(), colRect.height() + colGap);
    926922            if (point.y() >= gapAndColumnRect.y() && point.y() < gapAndColumnRect.maxY()) {
    927                 if (progressionIsInline) {
    928                     // FIXME: The clamping that follows is not completely right for right-to-left
    929                     // content.
    930                     // Clamp everything above the column to its top left.
    931                     if (point.x() < gapAndColumnRect.x())
    932                         point = gapAndColumnRect.location();
    933                     // Clamp everything below the column to the next column's top left. If there is
    934                     // no next column, this still maps to just after this column.
    935                     else if (point.x() >= gapAndColumnRect.maxX()) {
    936                         point = gapAndColumnRect.location();
    937                         point.move(gapAndColumnRect.width(), 0);
     923                if (clampMode == ClampHitTestTranslationToColumns) {
     924                    if (progressionIsInline) {
     925                        // FIXME: The clamping that follows is not completely right for right-to-left
     926                        // content.
     927                        // Clamp everything above the column to its top left.
     928                        if (point.x() < gapAndColumnRect.x())
     929                            point = gapAndColumnRect.location();
     930                        // Clamp everything below the column to the next column's top left. If there is
     931                        // no next column, this still maps to just after this column.
     932                        else if (point.x() >= gapAndColumnRect.maxX()) {
     933                            point = gapAndColumnRect.location();
     934                            point.move(gapAndColumnRect.width(), 0);
     935                        }
     936                    } else {
     937                        if (point.y() < colRect.y())
     938                            point.setY(colRect.y());
     939                        else if (point.y() >= colRect.maxY())
     940                            point.setY(colRect.maxY() - 1);
    938941                    }
    939                 } else {
    940                     if (point.y() < colRect.y())
    941                         point.setY(colRect.y());
    942                     else if (point.y() >= colRect.maxY())
    943                         point.setY(colRect.maxY() - 1);
    944942                }
    945 
    946                 // We're inside the column. Translate the x and y into our column coordinate space.
    947                 if (progressionIsInline)
    948                     point.move((!style().isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset), columnPoint.y() - colRect.y());
    949                 else
    950                     point.move(0, (!style().isFlippedBlocksWritingMode() ? logicalOffset : -logicalOffset) - colRect.y() + borderTop() + paddingTop());
    951943               
    952                 LayoutRect portion = flowThreadPortionRect();
    953                 flipForWritingMode(portion);
    954                 point.move(isHorizontalWritingMode() ? LayoutUnit() : portion.x(), isHorizontalWritingMode() ? portion.y() : LayoutUnit());
    955                
    956                 return multiColumnFlowThread()->positionForPoint(point, this);
     944                LayoutSize offsetInColumn = point - colRect.location();
     945                LayoutRect flowThreadPortion = flowThreadPortionRectAt(i);
     946                return flowThreadPortion.location() + offsetInColumn;
    957947            }
    958 
    959             // Move to the next position.
    960             logicalOffset += progressionIsInline ? colRect.width() : colRect.height();
    961948        }
    962949    }
    963950
    964     return VisiblePosition();
     951    return logicalPoint;
     952}
     953
     954void RenderMultiColumnSet::updateHitTestResult(HitTestResult& result, const LayoutPoint& point)
     955{
     956    if (result.innerNode() || !parent()->isRenderView())
     957        return;
     958   
     959    // Note this does not work with column spans, but once we implement RenderPageSet, we can move this code
     960    // over there instead (and spans of course won't be allowed on pages).
     961    Node* node = document().documentElement();
     962    if (node) {
     963        result.setInnerNode(node);
     964        if (!result.innerNonSharedNode())
     965            result.setInnerNonSharedNode(node);
     966        LayoutPoint adjustedPoint = translateRegionPointToFlowThread(point);
     967        view().offsetForContents(adjustedPoint);
     968        result.setLocalPoint(adjustedPoint);
     969    }
    965970}
    966971
  • trunk/Source/WebCore/rendering/RenderMultiColumnSet.h

    r167803 r167817  
    120120    void paintColumnRules(PaintInfo&, const LayoutPoint& paintOffset);
    121121
     122    enum ColumnHitTestTranslationMode {
     123        ClampHitTestTranslationToColumns,
     124        DoNotClampHitTestTranslationToColumns
     125    };
     126    LayoutPoint translateRegionPointToFlowThread(const LayoutPoint & logicalPoint, ColumnHitTestTranslationMode = DoNotClampHitTestTranslationToColumns) const;
     127
     128    virtual void updateHitTestResult(HitTestResult&, const LayoutPoint&) override;
     129   
    122130protected:
    123131    void addOverflowFromChildren() override;
Note: See TracChangeset for help on using the changeset viewer.