Changeset 152122 in webkit


Ignore:
Timestamp:
Jun 27, 2013 1:33:07 PM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[CSS Shapes] New positioning model: basic support for rectangle shape-outside
https://bugs.webkit.org/show_bug.cgi?id=118080

Patch by Bem Jones-Bey <Bem Jones-Bey> on 2013-06-27
Reviewed by David Hyatt.

Source/WebCore:

With the latest Editor's Draft of the CSS Shapes specification,
shape-outside no longer affects the positioning of floats. This is the
first step in changing the implementation to reflect this
specification change. The bulk of this change is reverting the code
that was needed to position floats based on the bounding box of the
shape.

Tests: csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-000.html

csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-001.html
csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-002.html
csswg/submitted/shapes/shape-outside/shape-outside-floats-square-000.html
csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-000.html
csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-001.html
csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-002.html

  • rendering/LayoutState.cpp:

(WebCore::LayoutState::LayoutState): Revert changes to support float

positioning from shape-outside.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::blockSelectionGaps): Ditto.
(WebCore::RenderBlock::insertFloatingObject): Ditto.
(WebCore::RenderBlock::positionNewFloats): Ditto.
(WebCore::RenderBlock::logicalLeftOffsetForLine): Instead of

converting to shape bounding box coordinates, convert to the
float's margin box coordinates.

(WebCore::RenderBlock::logicalRightOffsetForLine): Ditto.
(WebCore::positionForPointRespectingEditingBoundaries): Revert changes

to support float positioning from shape-outside.

  • rendering/RenderBlock.h:

(WebCore::RenderBlock::xPositionForFloatIncludingMargin): Ditto.
(WebCore::RenderBlock::yPositionForFloatIncludingMargin): Ditto.

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::LineWidth::shrinkAvailableWidthForNewFloatIfNeeded): Instead

of converting to shape bounding box coordinates, convert to the
float's margin box coordinates.

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::mapLocalToContainer): Revert changes to support

float positioning from shape-outside.

(WebCore::RenderBox::offsetFromContainer): Ditto.
(WebCore::RenderBox::computeRectForRepaint): Ditto.
(WebCore::RenderBox::layoutOverflowRectForPropagation): Ditto.

  • rendering/RenderBoxModelObject.cpp: Ditto.
  • rendering/RenderBoxModelObject.h: Ditto.
  • rendering/RenderInline.cpp:

(WebCore::RenderInline::clippedOverflowRectForRepaint): Ditto.
(WebCore::RenderInline::computeRectForRepaint): Ditto.
(WebCore::RenderInline::mapLocalToContainer): Ditto.

  • rendering/RenderLayer.cpp:

(WebCore::RenderLayer::updateLayerPosition): Ditto.
(WebCore::RenderLayer::calculateClipRects): Ditto.
(WebCore::RenderLayer::shouldBeNormalFlowOnly): Ditto.

  • rendering/RenderLayer.h:

(WebCore::RenderLayer::offsetForInFlowPosition): Ditto.

  • rendering/RenderObject.h: Ditto.
  • rendering/shapes/ShapeInfo.h: Make m_renderer protected, since we

now need it in the subclass to compute the segments.

  • rendering/shapes/ShapeOutsideInfo.cpp:

(WebCore::ShapeOutsideInfo::computeSegmentsForLine): Update segment

computation to use the float's margin box instead of the shape's
bounding box for computing the deltas.

(WebCore::ShapeOutsideInfo::leftSegmentMarginBoxDelta): This used to

be leftSegmentShapeBoundingBoxDelta, which has been renamed in the
obvious way.

(WebCore::ShapeOutsideInfo::rightSegmentMarginBoxDelta): This used to

be rightSegmentShapeBoundingBoxDelta, which has been renamed in the
obvious way.

  • rendering/shapes/ShapeOutsideInfo.h: Revert changes to support float

positioning from shape-outside.

  • rendering/style/RenderStyle.h: Ditto.

LayoutTests:

Added new tests for the new model. These tests are also spec tests, so
their canonical location is now in the CSS WG's repository. They have
been imported to WebKit using the import-w3c-tests script, and that's
why they live under the csswg directory.

The new tests replace the shape-outside-floats-simple-rectangle.html
test, which was anything but simple.

Tests that have not been rewritten yet have been marked as skipped.
Tests for the old positioning behavior that are not applicable to the
new behavior have been deleted.

  • TestExpectations: Skip all the tests that need to be rewritten.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-000-expected.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-000.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-001-expected.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-001.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-002-expected.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-002.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-square-000-expected.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-square-000.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-000-expected.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-000.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-001-expected.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-001.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-002-expected.html: Added.
  • csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-002.html: Added.
  • csswg/submitted/shapes/shape-outside/w3c-import.log: Added.
  • fast/exclusions/shape-outside-floats/shape-outside-floats-margin-is-ignored-expected.html: Removed.
  • fast/exclusions/shape-outside-floats/shape-outside-floats-margin-is-ignored.html: Removed.
  • fast/exclusions/shape-outside-floats/shape-outside-floats-non-zero-y-expected.html: Removed.
  • fast/exclusions/shape-outside-floats/shape-outside-floats-non-zero-y.html: Removed.
  • fast/exclusions/shape-outside-floats/shape-outside-floats-overflow-hidden-expected.html: Removed.
  • fast/exclusions/shape-outside-floats/shape-outside-floats-overflow-hidden.html: Removed.
  • fast/exclusions/shape-outside-floats/shape-outside-floats-overhang-expected.html: Removed.
  • fast/exclusions/shape-outside-floats/shape-outside-floats-overhang.html: Removed.
  • fast/exclusions/shape-outside-floats/shape-outside-floats-positioning-expected.html: Removed.
  • fast/exclusions/shape-outside-floats/shape-outside-floats-positioning.html: Removed.
  • fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rectangle-expected.html: Removed.
  • fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rectangle.html: Removed.
Location:
trunk
Files:
19 added
12 deleted
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r152105 r152122  
     12013-06-27  Bem Jones-Bey  <bjonesbe@adobe.com>
     2
     3        [CSS Shapes] New positioning model: basic support for rectangle shape-outside
     4        https://bugs.webkit.org/show_bug.cgi?id=118080
     5
     6        Reviewed by David Hyatt.
     7
     8        Added new tests for the new model. These tests are also spec tests, so
     9        their canonical location is now in the CSS WG's repository. They have
     10        been imported to WebKit using the import-w3c-tests script, and that's
     11        why they live under the csswg directory.
     12
     13        The new tests replace the shape-outside-floats-simple-rectangle.html
     14        test, which was anything but simple.
     15
     16        Tests that have not been rewritten yet have been marked as skipped.
     17        Tests for the old positioning behavior that are not applicable to the
     18        new behavior have been deleted.
     19
     20        * TestExpectations: Skip all the tests that need to be rewritten.
     21        * csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-000-expected.html: Added.
     22        * csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-000.html: Added.
     23        * csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-001-expected.html: Added.
     24        * csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-001.html: Added.
     25        * csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-002-expected.html: Added.
     26        * csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-002.html: Added.
     27        * csswg/submitted/shapes/shape-outside/shape-outside-floats-square-000-expected.html: Added.
     28        * csswg/submitted/shapes/shape-outside/shape-outside-floats-square-000.html: Added.
     29        * csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-000-expected.html: Added.
     30        * csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-000.html: Added.
     31        * csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-001-expected.html: Added.
     32        * csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-001.html: Added.
     33        * csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-002-expected.html: Added.
     34        * csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-002.html: Added.
     35        * csswg/submitted/shapes/shape-outside/w3c-import.log: Added.
     36        * fast/exclusions/shape-outside-floats/shape-outside-floats-margin-is-ignored-expected.html: Removed.
     37        * fast/exclusions/shape-outside-floats/shape-outside-floats-margin-is-ignored.html: Removed.
     38        * fast/exclusions/shape-outside-floats/shape-outside-floats-non-zero-y-expected.html: Removed.
     39        * fast/exclusions/shape-outside-floats/shape-outside-floats-non-zero-y.html: Removed.
     40        * fast/exclusions/shape-outside-floats/shape-outside-floats-overflow-hidden-expected.html: Removed.
     41        * fast/exclusions/shape-outside-floats/shape-outside-floats-overflow-hidden.html: Removed.
     42        * fast/exclusions/shape-outside-floats/shape-outside-floats-overhang-expected.html: Removed.
     43        * fast/exclusions/shape-outside-floats/shape-outside-floats-overhang.html: Removed.
     44        * fast/exclusions/shape-outside-floats/shape-outside-floats-positioning-expected.html: Removed.
     45        * fast/exclusions/shape-outside-floats/shape-outside-floats-positioning.html: Removed.
     46        * fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rectangle-expected.html: Removed.
     47        * fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rectangle.html: Removed.
     48
    1492013-06-27  Chris Fleizach  <cfleizach@apple.com>
    250
  • trunk/LayoutTests/TestExpectations

    r151000 r152122  
    1616# media/W3C/video/networkState/networkState_during_progress.html is flaky
    1717webkit.org/b/76280 media/W3C/video/networkState/networkState_during_progress.html [ Pass Failure ]
     18
     19# The CSS Shapes spec has changed the positioning model for floats with shape-outside.
     20# Thus all of the tests need to be rewitten to work as the implementation of
     21# the new model is completed.
     22webkit.org/b/118088 fast/exclusions/shape-outside-floats/shape-outside-floats-diamond-margin-polygon.html [ Skip ]
     23webkit.org/b/118088 fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-bottom.html [ Skip ]
     24webkit.org/b/118088 fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-left.html [ Skip ]
     25webkit.org/b/118088 fast/exclusions/shape-outside-floats/shape-outside-floats-ellipse-margin-right.html [ Skip ]
     26webkit.org/b/118088 fast/exclusions/shape-outside-floats/shape-outside-floats-left-margin-polygon.html [ Skip ]
     27webkit.org/b/118088 fast/exclusions/shape-outside-floats/shape-outside-floats-right-margin-polygon.html [ Skip ]
     28
     29webkit.org/b/118084 fast/exclusions/shape-outside-floats/shape-outside-floats-simple-circle.html [ Skip ]
     30webkit.org/b/118084 fast/exclusions/shape-outside-floats/shape-outside-floats-simple-ellipse.html [ Skip ]
     31
     32webkit.org/b/118085 fast/exclusions/shape-outside-floats/shape-outside-floats-simple-polygon.html [ Skip ]
     33
     34webkit.org/b/118086 fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rectangle-percentage.html [ Skip ]
     35webkit.org/b/118086 fast/exclusions/shape-outside-floats/shape-outside-floats-simple-inset-rectangle-percentage.html [ Skip ]
     36
     37webkit.org/b/118083 fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rounded-inset-rectangle.html [ Skip ]
     38webkit.org/b/118083 fast/exclusions/shape-outside-floats/shape-outside-floats-simple-inset-rectangle.html [ Skip ]
     39
     40webkit.org/b/118081 fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rounded-rectangle-001.html [ Skip ]
     41webkit.org/b/118081 fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rounded-rectangle-002.html [ Skip ]
     42webkit.org/b/118081 fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rounded-rectangle-003.html [ Skip ]
     43webkit.org/b/118081 fast/exclusions/shape-outside-floats/shape-outside-floats-rounded-rectangle-large-radius.html [ Skip ]
     44
     45webkit.org/b/118087 fast/exclusions/shape-outside-floats/shape-outside-floats-stacked.html [ Skip ]
     46webkit.org/b/118087 fast/exclusions/shape-outside-floats/shape-outside-floats-simple-rectangle-horizontal-multiple.html [ Skip ]
  • trunk/Source/WebCore/ChangeLog

    r152121 r152122  
     12013-06-27  Bem Jones-Bey  <bjonesbe@adobe.com>
     2
     3        [CSS Shapes] New positioning model: basic support for rectangle shape-outside
     4        https://bugs.webkit.org/show_bug.cgi?id=118080
     5
     6        Reviewed by David Hyatt.
     7
     8        With the latest Editor's Draft of the CSS Shapes specification,
     9        shape-outside no longer affects the positioning of floats. This is the
     10        first step in changing the implementation to reflect this
     11        specification change. The bulk of this change is reverting the code
     12        that was needed to position floats based on the bounding box of the
     13        shape.
     14
     15        Tests: csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-000.html
     16               csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-001.html
     17               csswg/submitted/shapes/shape-outside/shape-outside-floats-horizontal-rectangle-002.html
     18               csswg/submitted/shapes/shape-outside/shape-outside-floats-square-000.html
     19               csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-000.html
     20               csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-001.html
     21               csswg/submitted/shapes/shape-outside/shape-outside-floats-vertical-rectangle-002.html
     22
     23        * rendering/LayoutState.cpp:
     24        (WebCore::LayoutState::LayoutState): Revert changes to support float
     25            positioning from shape-outside.
     26        * rendering/RenderBlock.cpp:
     27        (WebCore::RenderBlock::blockSelectionGaps): Ditto.
     28        (WebCore::RenderBlock::insertFloatingObject): Ditto.
     29        (WebCore::RenderBlock::positionNewFloats): Ditto.
     30        (WebCore::RenderBlock::logicalLeftOffsetForLine): Instead of
     31            converting to shape bounding box coordinates, convert to the
     32            float's margin box coordinates.
     33        (WebCore::RenderBlock::logicalRightOffsetForLine): Ditto.
     34        (WebCore::positionForPointRespectingEditingBoundaries): Revert changes
     35            to support float positioning from shape-outside.
     36        * rendering/RenderBlock.h:
     37        (WebCore::RenderBlock::xPositionForFloatIncludingMargin): Ditto.
     38        (WebCore::RenderBlock::yPositionForFloatIncludingMargin): Ditto.
     39        * rendering/RenderBlockLineLayout.cpp:
     40        (WebCore::LineWidth::shrinkAvailableWidthForNewFloatIfNeeded): Instead
     41            of converting to shape bounding box coordinates, convert to the
     42            float's margin box coordinates.
     43        * rendering/RenderBox.cpp:
     44        (WebCore::RenderBox::mapLocalToContainer): Revert changes to support
     45            float positioning from shape-outside.
     46        (WebCore::RenderBox::offsetFromContainer): Ditto.
     47        (WebCore::RenderBox::computeRectForRepaint): Ditto.
     48        (WebCore::RenderBox::layoutOverflowRectForPropagation): Ditto.
     49        * rendering/RenderBoxModelObject.cpp: Ditto.
     50        * rendering/RenderBoxModelObject.h: Ditto.
     51        * rendering/RenderInline.cpp:
     52        (WebCore::RenderInline::clippedOverflowRectForRepaint): Ditto.
     53        (WebCore::RenderInline::computeRectForRepaint): Ditto.
     54        (WebCore::RenderInline::mapLocalToContainer): Ditto.
     55        * rendering/RenderLayer.cpp:
     56        (WebCore::RenderLayer::updateLayerPosition): Ditto.
     57        (WebCore::RenderLayer::calculateClipRects): Ditto.
     58        (WebCore::RenderLayer::shouldBeNormalFlowOnly): Ditto.
     59        * rendering/RenderLayer.h:
     60        (WebCore::RenderLayer::offsetForInFlowPosition): Ditto.
     61        * rendering/RenderObject.h: Ditto.
     62        * rendering/shapes/ShapeInfo.h: Make m_renderer protected, since we
     63            now need it in the subclass to compute the segments.
     64        * rendering/shapes/ShapeOutsideInfo.cpp:
     65        (WebCore::ShapeOutsideInfo::computeSegmentsForLine): Update segment
     66            computation to use the float's margin box instead of the shape's
     67            bounding box for computing the deltas.
     68        (WebCore::ShapeOutsideInfo::leftSegmentMarginBoxDelta): This used to
     69            be leftSegmentShapeBoundingBoxDelta, which has been renamed in the
     70            obvious way.
     71        (WebCore::ShapeOutsideInfo::rightSegmentMarginBoxDelta): This used to
     72            be rightSegmentShapeBoundingBoxDelta, which has been renamed in the
     73            obvious way.
     74        * rendering/shapes/ShapeOutsideInfo.h: Revert changes to support float
     75            positioning from shape-outside.
     76        * rendering/style/RenderStyle.h: Ditto.
     77
    1782013-06-27  Antti Koivisto  <antti@apple.com>
    279
  • trunk/Source/WebCore/rendering/LayoutState.cpp

    r151402 r152122  
    6666    m_layoutOffset = m_paintOffset;
    6767
    68     if (renderer->hasPaintOffset() && renderer->hasLayer())
    69         m_paintOffset += renderer->layer()->paintOffset();
     68    if (renderer->isInFlowPositioned() && renderer->hasLayer())
     69        m_paintOffset += renderer->layer()->offsetForInFlowPosition();
    7070
    7171    m_clipped = !fixed && prev->m_clipped;
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r151997 r152122  
    36913691            continue; // We must be a normal flow object in order to even be considered.
    36923692
    3693         if (curr->hasPaintOffset() && curr->hasLayer()) {
     3693        if (curr->isInFlowPositioned() && curr->hasLayer()) {
    36943694            // If the relposition offset is anything other than 0, then treat this just like an absolute positioned element.
    36953695            // Just disregard it completely.
    3696             LayoutSize relOffset = curr->layer()->paintOffset();
     3696            LayoutSize relOffset = curr->layer()->offsetForInFlowPosition();
    36973697            if (relOffset.width() || relOffset.height())
    36983698                continue;
     
    40364036    }
    40374037
     4038    setLogicalWidthForFloat(newObj, logicalWidthForChild(o) + marginStartForChild(o) + marginEndForChild(o));
     4039
    40384040#if ENABLE(CSS_SHAPES)
    4039     ShapeOutsideInfo* shapeOutside = o->shapeOutsideInfo();
    4040     if (shapeOutside) {
    4041         shapeOutside->setShapeSize(o->logicalWidth(), o->logicalHeight());
    4042         // The CSS Shapes specification says that the margins are ignored
    4043         // when a float has a shape outside.
    4044         setLogicalWidthForFloat(newObj, shapeOutside->shapeLogicalWidth());
    4045     } else
     4041    if (ShapeOutsideInfo* shapeOutside = o->shapeOutsideInfo())
     4042        shapeOutside->setShapeSize(logicalWidthForChild(o), logicalHeightForChild(o));
    40464043#endif
    4047         setLogicalWidthForFloat(newObj, logicalWidthForChild(o) + marginStartForChild(o) + marginEndForChild(o));
    40484044
    40494045    newObj->setShouldPaint(!o->hasSelfPaintingLayer()); // If a layer exists, the float will paint itself. Otherwise someone else will.
     
    41404136        LayoutUnit heightRemainingLeft = 1;
    41414137        LayoutUnit heightRemainingRight = 1;
    4142         floatLogicalLeft = logicalLeftOffsetForLine(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft, 0, ShapeOutsideFloatBoundingBoxOffset);
    4143         while (logicalRightOffsetForLine(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight, 0, ShapeOutsideFloatBoundingBoxOffset) - floatLogicalLeft < floatLogicalWidth) {
     4138        floatLogicalLeft = logicalLeftOffsetForLine(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft, 0, ShapeOutsideFloatMarginBoxOffset);
     4139        while (logicalRightOffsetForLine(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight, 0, ShapeOutsideFloatMarginBoxOffset) - floatLogicalLeft < floatLogicalWidth) {
    41444140            logicalTopOffset += min(heightRemainingLeft, heightRemainingRight);
    4145             floatLogicalLeft = logicalLeftOffsetForLine(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft, 0, ShapeOutsideFloatBoundingBoxOffset);
     4141            floatLogicalLeft = logicalLeftOffsetForLine(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft, 0, ShapeOutsideFloatMarginBoxOffset);
    41464142            if (insideFlowThread) {
    41474143                // Have to re-evaluate all of our offsets, since they may have changed.
     
    41554151        LayoutUnit heightRemainingLeft = 1;
    41564152        LayoutUnit heightRemainingRight = 1;
    4157         floatLogicalLeft = logicalRightOffsetForLine(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight, 0, ShapeOutsideFloatBoundingBoxOffset);
    4158         while (floatLogicalLeft - logicalLeftOffsetForLine(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft, 0, ShapeOutsideFloatBoundingBoxOffset) < floatLogicalWidth) {
     4153        floatLogicalLeft = logicalRightOffsetForLine(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight, 0, ShapeOutsideFloatMarginBoxOffset);
     4154        while (floatLogicalLeft - logicalLeftOffsetForLine(logicalTopOffset, logicalLeftOffset, false, &heightRemainingLeft, 0, ShapeOutsideFloatMarginBoxOffset) < floatLogicalWidth) {
    41594155            logicalTopOffset += min(heightRemainingLeft, heightRemainingRight);
    4160             floatLogicalLeft = logicalRightOffsetForLine(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight, 0, ShapeOutsideFloatBoundingBoxOffset);
     4156            floatLogicalLeft = logicalRightOffsetForLine(logicalTopOffset, logicalRightOffset, false, &heightRemainingRight, 0, ShapeOutsideFloatMarginBoxOffset);
    41614157            if (insideFlowThread) {
    41624158                // Have to re-evaluate all of our offsets, since they may have changed.
     
    42724268
    42734269        setLogicalTopForFloat(floatingObject, floatLogicalLocation.y());
    4274 #if ENABLE(CSS_SHAPES)
    4275         if (childBox->shapeOutsideInfo())
    4276             setLogicalHeightForFloat(floatingObject, childBox->shapeOutsideInfo()->shapeLogicalHeight());
    4277         else
    4278 #endif
    4279             setLogicalHeightForFloat(floatingObject, logicalHeightForChild(childBox) + marginBeforeForChild(childBox) + marginAfterForChild(childBox));
     4270
     4271        setLogicalHeightForFloat(floatingObject, logicalHeightForChild(childBox) + marginBeforeForChild(childBox) + marginAfterForChild(childBox));
    42804272
    42814273        m_floatingObjects->addPlacedObject(floatingObject);
     
    44644456        if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) {
    44654457            if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOutsideInfo()) {
    4466                 shapeOutside->computeSegmentsForLine(logicalTop - logicalTopForFloat(lastFloat) + shapeOutside->shapeLogicalTop(), logicalHeight);
    4467                 left += shapeOutside->rightSegmentShapeBoundingBoxDelta();
     4458                shapeOutside->computeSegmentsForLine(logicalTop - logicalTopForFloat(lastFloat), logicalHeight);
     4459                left += shapeOutside->rightSegmentMarginBoxDelta();
    44684460            }
    44694461        }
     
    45254517        if (offsetMode == ShapeOutsideFloatShapeOffset && lastFloat) {
    45264518            if (ShapeOutsideInfo* shapeOutside = lastFloat->renderer()->shapeOutsideInfo()) {
    4527                 shapeOutside->computeSegmentsForLine(logicalTop - logicalTopForFloat(lastFloat) + shapeOutside->shapeLogicalTop(), logicalHeight);
    4528                 rightFloatOffset += shapeOutside->leftSegmentShapeBoundingBoxDelta();
     4519                shapeOutside->computeSegmentsForLine(logicalTop - logicalTopForFloat(lastFloat), logicalHeight);
     4520                rightFloatOffset += shapeOutside->leftSegmentMarginBoxDelta();
    45294521            }
    45304522        }
     
    52735265{
    52745266    LayoutPoint childLocation = child->location();
    5275     if (child->hasPaintOffset())
    5276         childLocation += child->paintOffset();
     5267    if (child->isInFlowPositioned())
     5268        childLocation += child->offsetForInFlowPosition();
    52775269
    52785270    // FIXME: This is wrong if the child's writing-mode is different from the parent's.
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r151997 r152122  
    7373enum CaretType { CursorCaret, DragCaret };
    7474enum ContainingBlockState { NewContainingBlock, SameContainingBlock };
    75 enum ShapeOutsideFloatOffsetMode { ShapeOutsideFloatShapeOffset, ShapeOutsideFloatBoundingBoxOffset };
     75enum ShapeOutsideFloatOffsetMode { ShapeOutsideFloatShapeOffset, ShapeOutsideFloatMarginBoxOffset };
    7676
    7777enum TextRunFlag {
     
    790790    LayoutUnit xPositionForFloatIncludingMargin(const FloatingObject* child) const
    791791    {
    792 #if ENABLE(CSS_SHAPES)
    793         ShapeOutsideInfo *shapeOutside = child->renderer()->shapeOutsideInfo();
    794         if (shapeOutside)
    795             return child->x();
    796 #endif
    797 
    798792        if (isHorizontalWritingMode())
    799793            return child->x() + child->renderer()->marginLeft();
     
    804798    LayoutUnit yPositionForFloatIncludingMargin(const FloatingObject* child) const
    805799    {
    806 #if ENABLE(CSS_SHAPES)
    807         ShapeOutsideInfo *shapeOutside = child->renderer()->shapeOutsideInfo();
    808         if (shapeOutside)
    809             return child->y();
    810 #endif
    811 
    812800        if (isHorizontalWritingMode())
    813801            return child->y() + marginBeforeForChild(child->renderer());
     
    11981186        // the outermost float on that line has a shape-outside, the inline
    11991187        // content that butts up against that float must be positioned using
    1200         // the contours of the shape, not the shape's bounding box. We save the
    1201         // last float encountered so that the offset can be computed correctly
    1202         // by the code using this adapter.
     1188        // the contours of the shape, not the margin box of the float.
     1189        // We save the last float encountered so that the offset can be
     1190        // computed correctly by the code using this adapter.
    12031191        const FloatingObject* lastFloat() const { return m_last; }
    12041192#endif
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r151922 r152122  
    196196
    197197#if ENABLE(CSS_SHAPES)
    198     // When floats with shape outside are stacked, the floats are positioned based on the bounding box of the shape,
     198    // When floats with shape outside are stacked, the floats are positioned based on the margin box of the float,
    199199    // not the shape's contour. Since we computed the width based on the shape contour when we added the float,
    200200    // when we add a subsequent float on the same line, we need to undo the shape delta in order to position
    201     // based on the bounding box. In order to do this, we need to walk back through the floating object list to find
     201    // based on the margin box. In order to do this, we need to walk back through the floating object list to find
    202202    // the first previous float that is on the same side as our newFloat.
    203203    ShapeOutsideInfo* lastShapeOutsideInfo = 0;
     
    210210            lastShapeOutsideInfo = lastFloat->renderer()->shapeOutsideInfo();
    211211            if (lastShapeOutsideInfo)
    212                 lastShapeOutsideInfo->computeSegmentsForLine(m_block->logicalHeight() - m_block->logicalTopForFloat(lastFloat) + lastShapeOutsideInfo->shapeLogicalTop(), logicalHeightForLine(m_block, m_isFirstLine));
     212                lastShapeOutsideInfo->computeSegmentsForLine(m_block->logicalHeight() - m_block->logicalTopForFloat(lastFloat), logicalHeightForLine(m_block, m_isFirstLine));
    213213            break;
    214214        }
     
    217217    ShapeOutsideInfo* shapeOutsideInfo = newFloat->renderer()->shapeOutsideInfo();
    218218    if (shapeOutsideInfo)
    219         shapeOutsideInfo->computeSegmentsForLine(m_block->logicalHeight() - m_block->logicalTopForFloat(newFloat) + shapeOutsideInfo->shapeLogicalTop(), logicalHeightForLine(m_block, m_isFirstLine));
     219        shapeOutsideInfo->computeSegmentsForLine(m_block->logicalHeight() - m_block->logicalTopForFloat(newFloat), logicalHeightForLine(m_block, m_isFirstLine));
    220220#endif
    221221
     
    224224#if ENABLE(CSS_SHAPES)
    225225        if (lastShapeOutsideInfo)
    226             newLeft -= lastShapeOutsideInfo->rightSegmentShapeBoundingBoxDelta();
     226            newLeft -= lastShapeOutsideInfo->rightSegmentMarginBoxDelta();
    227227        if (shapeOutsideInfo)
    228             newLeft += shapeOutsideInfo->rightSegmentShapeBoundingBoxDelta();
     228            newLeft += shapeOutsideInfo->rightSegmentMarginBoxDelta();
    229229#endif
    230230
     
    236236#if ENABLE(CSS_SHAPES)
    237237        if (lastShapeOutsideInfo)
    238             newRight -= lastShapeOutsideInfo->leftSegmentShapeBoundingBoxDelta();
     238            newRight -= lastShapeOutsideInfo->leftSegmentMarginBoxDelta();
    239239        if (shapeOutsideInfo)
    240             newRight += shapeOutsideInfo->leftSegmentShapeBoundingBoxDelta();
     240            newRight += shapeOutsideInfo->leftSegmentMarginBoxDelta();
    241241#endif
    242242
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r151799 r152122  
    17341734            LayoutState* layoutState = v->layoutState();
    17351735            LayoutSize offset = layoutState->m_paintOffset + locationOffset();
    1736             if (style()->hasPaintOffset() && layer())
    1737                 offset += layer()->paintOffset();
     1736            if (style()->hasInFlowPosition() && layer())
     1737                offset += layer()->offsetForInFlowPosition();
    17381738            transformState.move(offset);
    17391739            return;
     
    18381838
    18391839    LayoutSize offset;   
    1840     if (hasPaintOffset())
    1841         offset += paintOffset();
     1840    if (isInFlowPositioned())
     1841        offset += offsetForInFlowPosition();
    18421842
    18431843    if (!isInline() || isReplaced()) {
     
    19791979
    19801980            // We can't trust the bits on RenderObject, because this might be called while re-resolving style.
    1981             if (styleToUse->hasPaintOffset() && layer())
    1982                 rect.move(layer()->paintOffset());
     1981            if (styleToUse->hasInFlowPosition() && layer())
     1982                rect.move(layer()->offsetForInFlowPosition());
    19831983
    19841984            rect.moveBy(location());
     
    20242024    if (position == AbsolutePosition && o->isInFlowPositioned() && o->isRenderInline())
    20252025        topLeft += toRenderInline(o)->offsetForInFlowPositionedInline(this);
    2026     else if (styleToUse->hasPaintOffset() && layer()) {
     2026    else if (styleToUse->hasInFlowPosition() && layer()) {
    20272027        // Apply the relative position offset when invalidating a rectangle.  The layer
    20282028        // is translated, but the render box isn't, so we need to do this to get the
    20292029        // right dirty rect.  Since this is called from RenderObject::setStyle, the relative position
    20302030        // flag on the RenderObject has been cleared, so use the one on the style().
    2031         topLeft += layer()->paintOffset();
     2031        topLeft += layer()->offsetForInFlowPosition();
    20322032    }
    20332033   
     
    43804380
    43814381    bool hasTransform = hasLayer() && layer()->transform();
    4382     if (hasPaintOffset() || hasTransform) {
     4382    if (isInFlowPositioned() || hasTransform) {
    43834383        // If we are relatively positioned or if we have a transform, then we have to convert
    43844384        // this rectangle into physical coordinates, apply relative positioning and transforms
     
    43894389            rect = layer()->currentTransform().mapRect(rect);
    43904390
    4391         if (hasPaintOffset())
    4392             rect.move(paintOffset());
     4391        if (isInFlowPositioned())
     4392            rect.move(offsetForInFlowPosition());
    43934393       
    43944394        // Now we need to flip back.
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r151623 r152122  
    621621}
    622622
    623 LayoutSize RenderBoxModelObject::paintOffset() const
    624 {
    625     LayoutSize offset = offsetForInFlowPosition();
    626 
    627 #if ENABLE(CSS_SHAPES)
    628     if (isBox() && isFloating())
    629         if (ShapeOutsideInfo* shapeOutside = toRenderBox(this)->shapeOutsideInfo())
    630             offset -= shapeOutside->shapeLogicalOffset();
    631 #endif
    632 
    633     return offset;
    634 }
    635 
    636623LayoutUnit RenderBoxModelObject::offsetLeft() const
    637624{
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.h

    r151623 r152122  
    7272
    7373    LayoutSize offsetForInFlowPosition() const;
    74     LayoutSize paintOffset() const;
    7574
    7675    // IE extensions. Used to calculate offsetWidth/Height.  Overridden by inlines (RenderFlow)
  • trunk/Source/WebCore/rendering/RenderInline.cpp

    r151946 r152122  
    10251025        }
    10261026        if (inlineFlow->style()->hasInFlowPosition() && inlineFlow->hasLayer())
    1027             repaintRect.move(toRenderInline(inlineFlow)->layer()->paintOffset());
     1027            repaintRect.move(toRenderInline(inlineFlow)->layer()->offsetForInFlowPosition());
    10281028    }
    10291029
     
    10721072            LayoutState* layoutState = v->layoutState();
    10731073            if (style()->hasInFlowPosition() && layer())
    1074                 rect.move(layer()->paintOffset());
     1074                rect.move(layer()->offsetForInFlowPosition());
    10751075            rect.move(layoutState->m_paintOffset);
    10761076            if (layoutState->m_clipped)
     
    11051105        // right dirty rect. Since this is called from RenderObject::setStyle, the relative or sticky position
    11061106        // flag on the RenderObject has been cleared, so use the one on the style().
    1107         topLeft += layer()->paintOffset();
     1107        topLeft += layer()->offsetForInFlowPosition();
    11081108    }
    11091109   
     
    11591159            LayoutSize offset = layoutState->m_paintOffset;
    11601160            if (style()->hasInFlowPosition() && layer())
    1161                 offset += layer()->paintOffset();
     1161                offset += layer()->offsetForInFlowPosition();
    11621162            transformState.move(offset);
    11631163            return;
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r151761 r152122  
    12911291   
    12921292    bool positionOrOffsetChanged = false;
    1293     if (renderer()->hasPaintOffset()) {
    1294         LayoutSize newOffset = toRenderBoxModelObject(renderer())->paintOffset();
    1295         positionOrOffsetChanged = newOffset != m_paintOffset;
    1296         m_paintOffset = newOffset;
    1297         localPoint.move(m_paintOffset);
     1293    if (renderer()->isInFlowPositioned()) {
     1294        LayoutSize newOffset = toRenderBoxModelObject(renderer())->offsetForInFlowPosition();
     1295        positionOrOffsetChanged = newOffset != m_offsetForInFlowPosition;
     1296        m_offsetForInFlowPosition = newOffset;
     1297        localPoint.move(m_offsetForInFlowPosition);
    12981298    } else {
    1299         m_paintOffset = LayoutSize();
     1299        m_offsetForInFlowPosition = LayoutSize();
    13001300    }
    13011301
     
    50845084        clipRects.setOverflowClipRect(clipRects.fixedClipRect());
    50855085        clipRects.setFixed(true);
    5086     } else if (renderer()->style()->hasPaintOffset())
     5086    } else if (renderer()->style()->hasInFlowPosition())
    50875087        clipRects.setPosClipRect(clipRects.overflowClipRect());
    50885088    else if (renderer()->style()->position() == AbsolutePosition)
     
    59775977            && !isTransparent()
    59785978            && !needsCompositedScrolling()
    5979 #if ENABLE(CSS_SHAPES)
    5980             && !renderer()->isFloatingWithShapeOutside()
    5981 #endif
    59825979            ;
    59835980}
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r151622 r152122  
    484484#endif
    485485
    486     const LayoutSize& paintOffset() const { return m_paintOffset; }
     486    const LayoutSize& offsetForInFlowPosition() const { return m_offsetForInFlowPosition; }
    487487
    488488    void clearClipRectsIncludingDescendants(ClipRectsType typeToClear = AllClipRectTypes);
     
    12211221    LayoutRect m_outlineBox;
    12221222
    1223     // Paint time offset only, it is used for properly paint relative / sticky positioned elements and exclusion boxes on floats.
    1224     LayoutSize m_paintOffset;
     1223    // Our current relative position offset.
     1224    LayoutSize m_offsetForInFlowPosition;
    12251225
    12261226    // Our (x,y) coordinates are in our parent layer's coordinate space.
  • trunk/Source/WebCore/rendering/RenderObject.h

    r152089 r152122  
    544544    bool isOutOfFlowPositioned() const { return m_bitfields.isOutOfFlowPositioned(); } // absolute or fixed positioning
    545545    bool isInFlowPositioned() const { return m_bitfields.isRelPositioned() || m_bitfields.isStickyPositioned(); } // relative or sticky positioning
    546     bool hasPaintOffset() const
    547     {
    548         bool positioned = isInFlowPositioned();
    549 #if ENABLE(CSS_SHAPES)
    550         // Shape outside on a float can reposition the float in much the
    551         // same way as relative positioning, so treat it as such.
    552         positioned = positioned || isFloatingWithShapeOutside();
    553 #endif
    554         return positioned;
    555     }
    556546    bool isRelPositioned() const { return m_bitfields.isRelPositioned(); } // relative positioning
    557547    bool isStickyPositioned() const { return m_bitfields.isStickyPositioned(); }
  • trunk/Source/WebCore/rendering/shapes/ShapeInfo.h

    r151402 r152122  
    120120    SegmentList m_segments;
    121121
     122    const RenderType* m_renderer;
     123
    122124private:
    123125    mutable OwnPtr<Shape> m_shape;
     
    125127    LayoutUnit m_shapeLogicalWidth;
    126128    LayoutUnit m_shapeLogicalHeight;
    127     const RenderType* m_renderer;
    128129};
    129130}
  • trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp

    r151402 r152122  
    4747    if (shapeSizeDirty() || m_lineTop != lineTop || m_lineHeight != lineHeight) {
    4848        if (ShapeInfo<RenderBox, &RenderStyle::shapeOutside, &Shape::getExcludedIntervals>::computeSegmentsForLine(lineTop, lineHeight)) {
    49             m_leftSegmentShapeBoundingBoxDelta = m_segments[0].logicalLeft - shapeLogicalLeft();
    50             m_rightSegmentShapeBoundingBoxDelta = m_segments[m_segments.size()-1].logicalRight - shapeLogicalRight();
     49            m_leftSegmentMarginBoxDelta = m_segments[0].logicalLeft + m_renderer->marginStart();
     50            m_rightSegmentMarginBoxDelta = m_segments[m_segments.size()-1].logicalRight - m_renderer->logicalWidth() - m_renderer->marginEnd();
    5151        } else {
    52             m_leftSegmentShapeBoundingBoxDelta = 0;
    53             m_rightSegmentShapeBoundingBoxDelta = 0;
     52            m_leftSegmentMarginBoxDelta = m_renderer->logicalWidth() + m_renderer->marginStart();
     53            m_rightSegmentMarginBoxDelta = -m_renderer->logicalWidth() - m_renderer->marginEnd();
    5454        }
    5555        m_lineTop = lineTop;
  • trunk/Source/WebCore/rendering/shapes/ShapeOutsideInfo.h

    r151402 r152122  
    4242class ShapeOutsideInfo : public ShapeInfo<RenderBox, &RenderStyle::shapeOutside, &Shape::getExcludedIntervals>, public MappedInfo<RenderBox, ShapeOutsideInfo> {
    4343public:
    44     LayoutSize shapeLogicalOffset() const { return LayoutSize(shapeLogicalLeft(), shapeLogicalTop()); }
    45 
    46     LayoutUnit leftSegmentShapeBoundingBoxDelta() const { return m_leftSegmentShapeBoundingBoxDelta; }
    47     LayoutUnit rightSegmentShapeBoundingBoxDelta() const { return m_rightSegmentShapeBoundingBoxDelta; }
     44    LayoutUnit leftSegmentMarginBoxDelta() const { return m_leftSegmentMarginBoxDelta; }
     45    LayoutUnit rightSegmentMarginBoxDelta() const { return m_rightSegmentMarginBoxDelta; }
    4846
    4947    virtual bool computeSegmentsForLine(LayoutUnit lineTop, LayoutUnit lineHeight) OVERRIDE;
     
    5856    ShapeOutsideInfo(const RenderBox* renderer) : ShapeInfo<RenderBox, &RenderStyle::shapeOutside, &Shape::getExcludedIntervals>(renderer) { }
    5957
    60     LayoutUnit m_leftSegmentShapeBoundingBoxDelta;
    61     LayoutUnit m_rightSegmentShapeBoundingBoxDelta;
     58    LayoutUnit m_leftSegmentMarginBoxDelta;
     59    LayoutUnit m_rightSegmentMarginBoxDelta;
    6260    LayoutUnit m_lineTop;
    6361};
  • trunk/Source/WebCore/rendering/style/RenderStyle.h

    r151622 r152122  
    461461    bool hasOutOfFlowPosition() const { return position() == AbsolutePosition || position() == FixedPosition; }
    462462    bool hasInFlowPosition() const { return position() == RelativePosition || position() == StickyPosition; }
    463     bool hasPaintOffset() const
    464     {
    465         bool paintOffset = hasInFlowPosition();
    466 #if ENABLE(CSS_SHAPES)
    467         paintOffset = paintOffset || (isFloating() && shapeOutside());
    468 #endif
    469         return paintOffset;
    470     }
    471463    bool hasViewportConstrainedPosition() const { return position() == FixedPosition || position() == StickyPosition; }
    472464    EFloat floating() const { return static_cast<EFloat>(noninherited_flags._floating); }
Note: See TracChangeset for help on using the changeset viewer.