Ignore:
Timestamp:
Oct 3, 2013, 11:24:59 AM (12 years ago)
Author:
[email protected]
Message:

[CSS Shapes] Support block content with inline content around floats in shape-inside
https://bugs.webkit.org/show_bug.cgi?id=121616

Reviewed by David Hyatt.

In r156022 and r156364, I added support for floats inside shape-inside with inline content. This change extends
the existing implementation to support block content with inline content (paragraphs). I added an extra text for
positioning a float inside shape-inside without text content around it.

Source/WebCore:

Tests: fast/shapes/shape-inside/shape-inside-left-float-in-lower-left-triangle-block-content.html

fast/shapes/shape-inside/shape-inside-left-float-in-lower-right-triangle-block-content.html
fast/shapes/shape-inside/shape-inside-left-float-in-lower-right-triangle.html
fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-block-content.html
fast/shapes/shape-inside/shape-inside-left-float-in-upper-right-triangle-block-content.html

  • rendering/FloatingObjects.h:

(WebCore::FloatingObject::logicalSize): Add new function to return the FloatingObject logical size.

  • rendering/LineWidth.cpp:

(WebCore::LineWidth::fitBelowFloats): When the lineBreaker code pushes down the content below the floating object,
we need to update the segments if we are in a shape-inside.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::computeLogicalLocationForFloat): Do the positioning based on the float actual size, and use the
recent shapeInsideInfo. (Calling layoutShapeInsideInfo which deals with the layoutStates also instead of shapeInsideInfo.)

  • rendering/RenderBlock.h:
  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlock::adjustLogicalLineTopAndLogicalHeightIfNeeded): If we don't have inline content we still need to positionize
our float content in a shape-inside.
(WebCore::updateSegmentsForShapes): Use the right coordinates for block content with inline content.

LayoutTests:

  • fast/shapes/shape-inside/shape-inside-left-float-in-lower-left-triangle-block-content-expected.html: Added.
  • fast/shapes/shape-inside/shape-inside-left-float-in-lower-left-triangle-block-content.html: Added.
  • fast/shapes/shape-inside/shape-inside-left-float-in-lower-right-triangle-block-content-expected.html: Added.
  • fast/shapes/shape-inside/shape-inside-left-float-in-lower-right-triangle-block-content.html: Added.
  • fast/shapes/shape-inside/shape-inside-left-float-in-lower-right-triangle-expected.html: Added.
  • fast/shapes/shape-inside/shape-inside-left-float-in-lower-right-triangle.html: Added.
  • fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-block-content-expected.html: Added.
  • fast/shapes/shape-inside/shape-inside-left-float-in-upper-left-triangle-block-content.html: Added.
  • fast/shapes/shape-inside/shape-inside-left-float-in-upper-right-triangle-block-content-expected.html: Added.
  • fast/shapes/shape-inside/shape-inside-left-float-in-upper-right-triangle-block-content.html: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r156822 r156846  
    14791479{
    14801480    LayoutUnit adjustedLogicalLineTop = adjustLogicalLineTop(shapeInsideInfo, resolver.position(), end, wordMeasurements);
     1481
     1482    if (shapeInsideInfo && !wordMeasurements.size() && containsFloats()) {
     1483        lastFloatFromPreviousLine = m_floatingObjects->set().last().get();
     1484        LayoutUnit floatLogicalTopOffset = shapeInsideInfo->computeFirstFitPositionForFloat(lastFloatFromPreviousLine->logicalSize(isHorizontalWritingMode()));
     1485        if (logicalHeight() < floatLogicalTopOffset)
     1486            adjustedLogicalLineTop = floatLogicalTopOffset;
     1487    }
     1488
    14811489    if (!adjustedLogicalLineTop)
    14821490        return false;
     
    26502658
    26512659    ShapeInsideInfo* shapeInsideInfo = block->layoutShapeInsideInfo();
    2652     if (!shapeInsideInfo)
     2660    if (!lastFloatFromPreviousLine->isPlaced() || !shapeInsideInfo)
    26532661        return;
    26542662
    26552663    bool isHorizontalWritingMode = block->isHorizontalWritingMode();
    2656 
    2657     LayoutUnit lineLogicalTop = block->logicalHeight();
     2664    LayoutUnit logicalOffsetFromShapeContainer = block->logicalOffsetFromShapeAncestorContainer(shapeInsideInfo->owner()).height();
     2665
     2666    LayoutUnit lineLogicalTop = block->logicalHeight() + logicalOffsetFromShapeContainer;
    26582667    LayoutUnit lineLogicalHeight = block->lineHeight(isFirstLine, isHorizontalWritingMode ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes);
    26592668    LayoutUnit lineLogicalBottom = lineLogicalTop + lineLogicalHeight;
     
    26752684    if (block->logicalHeight() < floatLogicalTop) {
    26762685        shapeInsideInfo->adjustLogicalLineTop(minSegmentWidth + floatLogicalWidth);
    2677         block->setLogicalHeight(shapeInsideInfo->logicalLineTop());
    2678     }
    2679 
    2680     shapeInsideInfo->updateSegmentsForLine(block->logicalHeight(), lineLogicalHeight);
     2686        block->setLogicalHeight(shapeInsideInfo->logicalLineTop() - logicalOffsetFromShapeContainer);
     2687    }
     2688
     2689    lineLogicalTop = block->logicalHeight() + logicalOffsetFromShapeContainer;
     2690
     2691    shapeInsideInfo->updateSegmentsForLine(lineLogicalTop, lineLogicalHeight);
    26812692    width.updateCurrentShapeSegment();
    26822693    width.updateAvailableWidth();
Note: See TracChangeset for help on using the changeset viewer.