Changeset 115981 in webkit


Ignore:
Timestamp:
May 3, 2012 9:32:33 AM (12 years ago)
Author:
mitz@apple.com
Message:

highlight for Ruby text is mispositioned in the Web Inspector
https://bugs.webkit.org/show_bug.cgi?id=82684

Reviewed by Simon Fraser.

Source/WebCore:

Tests: fast/writing-mode/flipped-blocks-inline-map-local-to-container-expected.html

fast/writing-mode/flipped-blocks-inline-map-local-to-container.html

In flipped blocks writing modes, flipping was being applied twice to box descendants of
inline children of the flipped block, once during RenderBox::mapLocalToContainer, and then
again by RenderInline::mapLocalToContainer. The fix is to make the latter only apply the
flip to local coordinates originating in the inline or a descendant inline. This is done
by adding a parameter of type ApplyContainerFlipOrNot, which defaults to ApplyContainerFlip
but is reset to DoNotApplyContainerFlip in recursive calls into mapLocalToContainer().

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::mapLocalToContainer): Added ApplyContainerFlipOrNot parameter, passing
DoNotApplyContainerFlip when recursing into the container.

  • rendering/RenderBox.h:
  • rendering/RenderInline.cpp:

(WebCore::RenderInline::mapLocalToContainer): Added ApplyContainerFlipOrNot paramerer, and
made the flipping conditional on its value.

  • rendering/RenderInline.h:
  • rendering/RenderObject.cpp:

(WebCore::RenderObject::mapLocalToContainer): Added ApplyContainerFlipOrNot parameter,
passing DoNotApplyContainerFlip when recursing into the container.
(WebCore::RenderObject::localToContainerQuad): Pass ApplyContainerFlip.
(WebCore::RenderObject::localToContainerPoint): Ditto.

  • rendering/RenderObject.h:
  • rendering/RenderView.cpp:

(WebCore::RenderView::mapLocalToContainer): Added ApplyContainerFlipOrNot parameter.

  • rendering/RenderView.h:
  • rendering/svg/RenderSVGForeignObject.cpp:

(WebCore::RenderSVGForeignObject::mapLocalToContainer): Ditto.

  • rendering/svg/RenderSVGForeignObject.h:
  • rendering/svg/RenderSVGInline.cpp:

(WebCore::RenderSVGInline::mapLocalToContainer): Ditto.

  • rendering/svg/RenderSVGInline.h:
  • rendering/svg/RenderSVGModelObject.cpp:

(WebCore::RenderSVGModelObject::mapLocalToContainer): Ditto.

  • rendering/svg/RenderSVGModelObject.h:
  • rendering/svg/RenderSVGRoot.cpp:

(WebCore::RenderSVGRoot::mapLocalToContainer): Ditto.

  • rendering/svg/RenderSVGRoot.h:
  • rendering/svg/RenderSVGText.cpp:

(WebCore::RenderSVGText::mapLocalToContainer): Ditto.

  • rendering/svg/RenderSVGText.h:
  • rendering/svg/SVGRenderSupport.cpp:

(WebCore::SVGRenderSupport::mapLocalToContainer): Pass DoNotApplyContainerFlip when
recursing into the parent.

LayoutTests:

  • fast/writing-mode/flipped-blocks-inline-map-local-to-container-expected.html: Added.
  • fast/writing-mode/flipped-blocks-inline-map-local-to-container.html: Added.
Location:
trunk
Files:
2 added
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r115980 r115981  
     12012-05-03  Dan Bernstein  <mitz@apple.com>
     2
     3        highlight for Ruby text is mispositioned in the Web Inspector
     4        https://bugs.webkit.org/show_bug.cgi?id=82684
     5
     6        Reviewed by Simon Fraser.
     7
     8        * fast/writing-mode/flipped-blocks-inline-map-local-to-container-expected.html: Added.
     9        * fast/writing-mode/flipped-blocks-inline-map-local-to-container.html: Added.
     10
    1112012-05-03  Andrey Kosyakov  <caseq@chromium.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r115979 r115981  
     12012-05-03  Dan Bernstein  <mitz@apple.com>
     2
     3        highlight for Ruby text is mispositioned in the Web Inspector
     4        https://bugs.webkit.org/show_bug.cgi?id=82684
     5
     6        Reviewed by Simon Fraser.
     7
     8        Tests: fast/writing-mode/flipped-blocks-inline-map-local-to-container-expected.html
     9               fast/writing-mode/flipped-blocks-inline-map-local-to-container.html
     10
     11        In flipped blocks writing modes, flipping was being applied twice to box descendants of
     12        inline children of the flipped block, once during RenderBox::mapLocalToContainer, and then
     13        again by RenderInline::mapLocalToContainer. The fix is to make the latter only apply the
     14        flip to local coordinates originating in the inline or a descendant inline. This is done
     15        by adding a parameter of type ApplyContainerFlipOrNot, which defaults to ApplyContainerFlip
     16        but is reset to DoNotApplyContainerFlip in recursive calls into mapLocalToContainer().
     17
     18        * rendering/RenderBox.cpp:
     19        (WebCore::RenderBox::mapLocalToContainer): Added ApplyContainerFlipOrNot parameter, passing
     20        DoNotApplyContainerFlip when recursing into the container.
     21        * rendering/RenderBox.h:
     22
     23        * rendering/RenderInline.cpp:
     24        (WebCore::RenderInline::mapLocalToContainer): Added ApplyContainerFlipOrNot paramerer, and
     25        made the flipping conditional on its value.
     26
     27        * rendering/RenderInline.h:
     28
     29        * rendering/RenderObject.cpp:
     30        (WebCore::RenderObject::mapLocalToContainer): Added ApplyContainerFlipOrNot parameter,
     31        passing DoNotApplyContainerFlip when recursing into the container.
     32        (WebCore::RenderObject::localToContainerQuad): Pass ApplyContainerFlip.
     33        (WebCore::RenderObject::localToContainerPoint): Ditto.
     34        * rendering/RenderObject.h:
     35
     36        * rendering/RenderView.cpp:
     37        (WebCore::RenderView::mapLocalToContainer): Added ApplyContainerFlipOrNot parameter.
     38        * rendering/RenderView.h:
     39
     40        * rendering/svg/RenderSVGForeignObject.cpp:
     41        (WebCore::RenderSVGForeignObject::mapLocalToContainer): Ditto.
     42        * rendering/svg/RenderSVGForeignObject.h:
     43
     44        * rendering/svg/RenderSVGInline.cpp:
     45        (WebCore::RenderSVGInline::mapLocalToContainer): Ditto.
     46        * rendering/svg/RenderSVGInline.h:
     47
     48        * rendering/svg/RenderSVGModelObject.cpp:
     49        (WebCore::RenderSVGModelObject::mapLocalToContainer): Ditto.
     50        * rendering/svg/RenderSVGModelObject.h:
     51
     52        * rendering/svg/RenderSVGRoot.cpp:
     53        (WebCore::RenderSVGRoot::mapLocalToContainer): Ditto.
     54        * rendering/svg/RenderSVGRoot.h:
     55
     56        * rendering/svg/RenderSVGText.cpp:
     57        (WebCore::RenderSVGText::mapLocalToContainer): Ditto.
     58        * rendering/svg/RenderSVGText.h:
     59
     60        * rendering/svg/SVGRenderSupport.cpp:
     61        (WebCore::SVGRenderSupport::mapLocalToContainer): Pass DoNotApplyContainerFlip when
     62        recursing into the parent.
     63
    1642012-05-03  Pavel Feldman  <pfeldman@chromium.org>
    265
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r115846 r115981  
    13761376}
    13771377
    1378 void RenderBox::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, bool* wasFixed) const
     1378void RenderBox::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, ApplyContainerFlipOrNot, bool* wasFixed) const
    13791379{
    13801380    if (repaintContainer == this)
     
    14301430        RenderRegion* region = toRenderFlowThread(o)->mapFromFlowToRegion(transformState);
    14311431        if (region)
    1432             region->mapLocalToContainer(region->containerForRepaint(), fixed, useTransforms, transformState, wasFixed);
     1432            region->mapLocalToContainer(region->containerForRepaint(), fixed, useTransforms, transformState, DoNotApplyContainerFlip, wasFixed);
    14331433        return;
    14341434    }
    14351435
    1436     o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, wasFixed);
     1436    o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, DoNotApplyContainerFlip, wasFixed);
    14371437}
    14381438
  • trunk/Source/WebCore/rendering/RenderBox.h

    r115846 r115981  
    517517    virtual bool shouldComputeSizeAsReplaced() const { return isReplaced() && !isInlineBlockOrInlineTable(); }
    518518
    519     virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState&, bool* wasFixed = 0) const;
     519    virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const;
    520520    virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const;
    521521
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r115458 r115981  
    11651165}
    11661166
    1167 void RenderInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, bool* wasFixed) const
     1167void RenderInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, ApplyContainerFlipOrNot applyContainerFlip, bool* wasFixed) const
    11681168{
    11691169    if (repaintContainer == this)
     
    11861186        return;
    11871187
    1188     IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint());
    1189     if (o->isBox() && o->style()->isFlippedBlocksWritingMode())
    1190         transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(roundedIntPoint(transformState.mappedPoint())) - centerPoint);
     1188    if (applyContainerFlip && o->isBox() && o->style()->isFlippedBlocksWritingMode()) {
     1189        IntPoint centerPoint = roundedIntPoint(transformState.mappedPoint());
     1190        transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(centerPoint) - centerPoint);
     1191        applyContainerFlip = DoNotApplyContainerFlip;
     1192    }
    11911193
    11921194    LayoutSize containerOffset = offsetFromContainer(o, roundedLayoutPoint(transformState.mappedPoint()));
     
    12081210    }
    12091211
    1210     o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, wasFixed);
     1212    o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, applyContainerFlip, wasFixed);
    12111213}
    12121214
  • trunk/Source/WebCore/rendering/RenderInline.h

    r112756 r115981  
    131131    virtual void computeRectForRepaint(RenderBoxModelObject* repaintContainer, LayoutRect&, bool fixed) const;
    132132
    133     virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState&, bool* wasFixed = 0) const;
     133    virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const;
    134134
    135135    virtual VisiblePosition positionForPoint(const LayoutPoint&);
  • trunk/Source/WebCore/rendering/RenderObject.cpp

    r115701 r115981  
    20252025}
    20262026
    2027 void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, bool* wasFixed) const
     2027void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, ApplyContainerFlipOrNot, bool* wasFixed) const
    20282028{
    20292029    if (repaintContainer == this)
     
    20462046        transformState.move(-toRenderBox(o)->scrolledContentOffset());
    20472047
    2048     o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, wasFixed);
     2048    o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, DoNotApplyContainerFlip, wasFixed);
    20492049}
    20502050
     
    21022102    // it will use that point as the reference point to decide which column's transform to apply in multiple-column blocks.
    21032103    TransformState transformState(TransformState::ApplyTransformDirection, localQuad.boundingBox().center(), localQuad);
    2104     mapLocalToContainer(repaintContainer, fixed, true, transformState, wasFixed);
     2104    mapLocalToContainer(repaintContainer, fixed, true, transformState, ApplyContainerFlip, wasFixed);
    21052105    transformState.flatten();
    21062106   
     
    21112111{
    21122112    TransformState transformState(TransformState::ApplyTransformDirection, localPoint);
    2113     mapLocalToContainer(repaintContainer, fixed, true, transformState, wasFixed);
     2113    mapLocalToContainer(repaintContainer, fixed, true, transformState, ApplyContainerFlip, wasFixed);
    21142114    transformState.flatten();
    21152115
  • trunk/Source/WebCore/rendering/RenderObject.h

    r115908 r115981  
    866866    // Map points and quads through elements, potentially via 3d transforms. You should never need to call these directly; use
    867867    // localToAbsolute/absoluteToLocal methods instead.
    868     virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, bool* wasFixed = 0) const;
     868    enum ApplyContainerFlipOrNot { DoNotApplyContainerFlip, ApplyContainerFlip };
     869    virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const;
    869870    virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const;
    870871
  • trunk/Source/WebCore/rendering/RenderView.cpp

    r115779 r115981  
    151151}
    152152
    153 void RenderView::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, bool* wasFixed) const
     153void RenderView::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, ApplyContainerFlipOrNot, bool* wasFixed) const
    154154{
    155155    // If a container was specified, and was not 0 or the RenderView,
  • trunk/Source/WebCore/rendering/RenderView.h

    r115779 r115981  
    188188
    189189protected:
    190     virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, bool* wasFixed = 0) const;
     190    virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const;
    191191    virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const;
    192192    virtual bool requiresColumns(int desiredColumnCount) const OVERRIDE;
  • trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp

    r112438 r115981  
    189189}
    190190
    191 void RenderSVGForeignObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool /* fixed */, bool /* useTransforms */, TransformState& transformState, bool* wasFixed) const
     191void RenderSVGForeignObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool /* fixed */, bool /* useTransforms */, TransformState& transformState, ApplyContainerFlipOrNot, bool* wasFixed) const
    192192{
    193193    SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, wasFixed);
  • trunk/Source/WebCore/rendering/svg/RenderSVGForeignObject.h

    r103465 r115981  
    5555    virtual bool isSVGForeignObject() const { return true; }
    5656
    57     virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState&, bool* wasFixed = 0) const;
     57    virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const;
    5858    virtual void setNeedsTransformUpdate() { m_needsTransformUpdate = true; }
    5959
  • trunk/Source/WebCore/rendering/svg/RenderSVGInline.cpp

    r105549 r115981  
    8080}
    8181
    82 void RenderSVGInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool /* useTransforms */, bool /* fixed */, TransformState& transformState, bool* wasFixed) const
     82void RenderSVGInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool /* useTransforms */, bool /* fixed */, TransformState& transformState, ApplyContainerFlipOrNot, bool* wasFixed) const
    8383{
    8484    SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, wasFixed);
  • trunk/Source/WebCore/rendering/svg/RenderSVGInline.h

    r105549 r115981  
    4848    virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
    4949    virtual void computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect&, bool fixed = false) const;
    50     virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, bool* wasFixed = 0) const;
     50    virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const;
    5151    virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const;
    5252
  • trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp

    r110224 r115981  
    5656}
    5757
    58 void RenderSVGModelObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool /* fixed */, bool /* useTransforms */, TransformState& transformState, bool* wasFixed) const
     58void RenderSVGModelObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool /* fixed */, bool /* useTransforms */, TransformState& transformState, ApplyContainerFlipOrNot, bool* wasFixed) const
    5959{
    6060    SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, wasFixed);
  • trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h

    r110224 r115981  
    5959    virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const;
    6060
    61     virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, bool* wasFixed = 0) const;
     61    virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const;
    6262    virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
    6363    virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.cpp

    r114315 r115981  
    383383// Callers with local SVG viewport coordinates should first apply the localToBorderBoxTransform
    384384// to convert from SVG viewport coordinates to local CSS box coordinates.
    385 void RenderSVGRoot::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, bool* wasFixed) const
     385void RenderSVGRoot::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, ApplyContainerFlipOrNot, bool* wasFixed) const
    386386{
    387387    ASSERT(!fixed); // We should have no fixed content in the SVG rendering tree.
    388388    ASSERT(useTransforms); // mapping a point through SVG w/o respecting trasnforms is useless.
    389389
    390     RenderReplaced::mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, wasFixed);
     390    RenderReplaced::mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, ApplyContainerFlip, wasFixed);
    391391}
    392392
  • trunk/Source/WebCore/rendering/svg/RenderSVGRoot.h

    r112091 r115981  
    9595    virtual void computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const;
    9696
    97     virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, bool* wasFixed = 0) const;
     97    virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const;
    9898    virtual bool canBeSelectionLeaf() const { return false; }
    9999    virtual bool canHaveChildren() const { return true; }
  • trunk/Source/WebCore/rendering/svg/RenderSVGText.cpp

    r112284 r115981  
    106106}
    107107
    108 void RenderSVGText::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool /* fixed */, bool /* useTransforms */, TransformState& transformState, bool* wasFixed) const
     108void RenderSVGText::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool /* fixed */, bool /* useTransforms */, TransformState& transformState, ApplyContainerFlipOrNot, bool* wasFixed) const
    109109{
    110110    SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, wasFixed);
  • trunk/Source/WebCore/rendering/svg/RenderSVGText.h

    r112119 r115981  
    7979    virtual void computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect&, bool fixed = false) const;
    8080
    81     virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, bool* wasFixed = 0) const;
     81    virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const;
    8282    virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0);
    8383
  • trunk/Source/WebCore/rendering/svg/SVGRenderSupport.cpp

    r115097 r115981  
    8383        transformState.applyTransform(toRenderSVGRoot(parent)->localToBorderBoxTransform());
    8484   
    85     parent->mapLocalToContainer(repaintContainer, false, true, transformState, wasFixed);
     85    parent->mapLocalToContainer(repaintContainer, false, true, transformState, RenderObject::DoNotApplyContainerFlip, wasFixed);
    8686}
    8787
Note: See TracChangeset for help on using the changeset viewer.