Changeset 126605 in webkit


Ignore:
Timestamp:
Aug 24, 2012 11:48:49 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[CSS Exclusions] Enable shape-inside for simple rectangles
https://bugs.webkit.org/show_bug.cgi?id=89259

Patch by Bear Travis <betravis@adobe.com> on 2012-08-24
Reviewed by Levi Weintraub.

Source/WebCore:

This patch is the first in a series enabling shape-inside. It adds
support for inline layout within a single render block with a
rectangular shape-inside.
Each RenderBlock with a valid shape-inside maintains a WrapShapeInfo,
which can calculate the areas, or LineSegments, where inline content
can flow on a line. The WrapShapeInfo class maintains a static map of
RenderBlocks to WrapShapeInfos. The basic algorithm involves three stages:

  1. Determine if the RenderBlock has a valid shape-inside, and store it

in a WrapShapeInfo if necessary.

  1. If the inline content is affected by a shape-inside, use the

corresponding WrapShapeInfo to break the content into line segments.

  1. Lay out the line segments.

Tests: fast/exclusions/shape-inside/shape-inside-floats-simple.html

fast/exclusions/shape-inside/shape-inside-inline-elements.html
fast/exclusions/shape-inside/shape-inside-overflow.html
fast/exclusions/shape-inside/shape-inside-percentage-auto.html
fast/exclusions/shape-inside/shape-inside-text.html

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • Target.pri:
  • WebCore.gypi:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::willBeDestroyed): Remove WrapShapeInfo when destroyed.
(WebCore::RenderBlock::styleDidChange): Detect modifications to style()->wrapShapeInside.
(WebCore):
(WebCore::RenderBlock::updateWrapShapeInfoAfterStyleChange): Update WrapShapeInfo
when style()->wrapShapeInside changes.
(WebCore::RenderBlock::layoutBlock): Notify WrapShapeInfo of changes in logicalWidth
and logicalHeight before laying out inline content.

  • rendering/RenderBlock.h:

(RenderBlock):
(WebCore::RenderBlock::wrapShapeInfo): Return the wrapShapeInfo associated with a
RenderBlock.

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::LineWidth::LineWidth): Determine the WrapShapeInfo::LineSegment this LineWidth
corresponds to, if any.
(LineWidth):
(WebCore::LineWidth::updateAvailableWidth): The width's LineSegment boundaries affect
the available width.
(WebCore::RenderBlock::computeInlineDirectionPositionsForLine): The current LineSegment
affects the left & right positioning of inline boxes.
(WebCore::RenderBlock::layoutRunsAndFloatsInRange): Move to the top of the inside wrap
shape before beginning inline layout, and update the line segments for each line.

  • rendering/WrapShapeInfo.cpp: Added.

(WebCore):
(WebCore::WrapShapeInfo::WrapShapeInfo): Create an empty WrapShapeInfo.
(WebCore::WrapShapeInfo::~WrapShapeInfo): No additional cleanup.
(WebCore::WrapShapeInfo::create): Create a WrapShapeInfo reference.
(WebCore::WrapShapeInfo::ensureWrapShapeInfoForRenderBlock): Create a WrapShapeInfo
for a RenderBlock with an inside WrapShape and place it in the WrapShapeInfo map.
(WebCore::WrapShapeInfo::wrapShapeInfoForRenderBlock): Lookup the WrapShapeInfo for
a RenderBlock in the WrapShapeInfo map.
(WebCore::WrapShapeInfo::isWrapShapeInfoEnabledForBlock): Determine if a RenderBlock
has an inside wrap shape that we can use for inline layout.
(WebCore::WrapShapeInfo::removeWrapShapeInfoForRenderBlock): Remove a RenderBlock's
WrapShapeInfo from the WrapShapeInfo map.
(WebCore::WrapShapeInfo::hasSegments): Returns true if there are any line segments
for the current line.
(WebCore::WrapShapeInfo::computeShapeSize): Compute the dimensions of the wrap shape
based on a block's logical width & height.
(WebCore::WrapShapeInfo::computeSegmentsForLine): Sets the current line and computes
its line segments.

  • rendering/WrapShapeInfo.h: Added.

(WebCore):
(LineSegment):
(WrapShapeInfo):
(WebCore::WrapShapeInfo::shapeTop): The top of a wrap shape, where the inline content
area begins.
(WebCore::WrapShapeInfo::segments): The list of line segments for the current line.
(WebCore::WrapShapeInfo::wrapShapeSizeNeedsRecomputing): Mark a WrapShapeInfo as
needing to recompute its WrapShape dimensions.
(WebCore::WrapShapeInfo::lineState): The current line state: above, inside, or below
the wrap shape.

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::diff): Changes to shape inside require relayout.

LayoutTests:

Test that inline content correctly wraps for a simple rectangular
shape-inside. Text and inline content should wrap inside the
rectangular shape-inside, and overflow to its containing block.
Inline content inside a shape-inside should also avoid floats.

  • fast/exclusions/shape-inside/shape-inside-floats-simple-expected.html: Added.
  • fast/exclusions/shape-inside/shape-inside-floats-simple.html: Added.
  • fast/exclusions/shape-inside/shape-inside-inline-elements-expected.html: Added.
  • fast/exclusions/shape-inside/shape-inside-inline-elements.html: Added.
  • fast/exclusions/shape-inside/shape-inside-overflow-expected.html: Added.
  • fast/exclusions/shape-inside/shape-inside-overflow.html: Added.
  • fast/exclusions/shape-inside/shape-inside-percentage-auto-expected.html: Added.
  • fast/exclusions/shape-inside/shape-inside-percentage-auto.html: Added.
  • fast/exclusions/shape-inside/shape-inside-text-expected.html: Added.
  • fast/exclusions/shape-inside/shape-inside-text.html: Added.
Location:
trunk
Files:
13 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r126604 r126605  
     12012-08-24  Bear Travis  <betravis@adobe.com>
     2
     3        [CSS Exclusions] Enable shape-inside for simple rectangles
     4        https://bugs.webkit.org/show_bug.cgi?id=89259
     5
     6        Reviewed by Levi Weintraub.
     7
     8        Test that inline content correctly wraps for a simple rectangular
     9        shape-inside. Text and inline content should wrap inside the
     10        rectangular shape-inside, and overflow to its containing block.
     11        Inline content inside a shape-inside should also avoid floats.
     12
     13        * fast/exclusions/shape-inside/shape-inside-floats-simple-expected.html: Added.
     14        * fast/exclusions/shape-inside/shape-inside-floats-simple.html: Added.
     15        * fast/exclusions/shape-inside/shape-inside-inline-elements-expected.html: Added.
     16        * fast/exclusions/shape-inside/shape-inside-inline-elements.html: Added.
     17        * fast/exclusions/shape-inside/shape-inside-overflow-expected.html: Added.
     18        * fast/exclusions/shape-inside/shape-inside-overflow.html: Added.
     19        * fast/exclusions/shape-inside/shape-inside-percentage-auto-expected.html: Added.
     20        * fast/exclusions/shape-inside/shape-inside-percentage-auto.html: Added.
     21        * fast/exclusions/shape-inside/shape-inside-text-expected.html: Added.
     22        * fast/exclusions/shape-inside/shape-inside-text.html: Added.
     23
    1242012-08-24  Julien Chaffraix  <jchaffraix@webkit.org>
    225
  • trunk/Source/WebCore/CMakeLists.txt

    r126372 r126605  
    21002100    rendering/RootInlineBox.cpp
    21012101    rendering/ScrollBehavior.cpp
     2102    rendering/WrapShapeInfo.cpp
    21022103    rendering/break_lines.cpp
    21032104
  • trunk/Source/WebCore/ChangeLog

    r126602 r126605  
     12012-08-24  Bear Travis  <betravis@adobe.com>
     2
     3        [CSS Exclusions] Enable shape-inside for simple rectangles
     4        https://bugs.webkit.org/show_bug.cgi?id=89259
     5
     6        Reviewed by Levi Weintraub.
     7
     8        This patch is the first in a series enabling shape-inside. It adds
     9        support for inline layout within a single render block with a
     10        rectangular shape-inside.
     11        Each RenderBlock with a valid shape-inside maintains a WrapShapeInfo,
     12        which can calculate the areas, or LineSegments, where inline content
     13        can flow on a line. The WrapShapeInfo class maintains a static map of
     14        RenderBlocks to WrapShapeInfos. The basic algorithm involves three stages:
     15        1. Determine if the RenderBlock has a valid shape-inside, and store it
     16        in a WrapShapeInfo if necessary.
     17        2. If the inline content is affected by a shape-inside, use the
     18        corresponding WrapShapeInfo to break the content into line segments.
     19        3. Lay out the line segments.
     20
     21        Tests: fast/exclusions/shape-inside/shape-inside-floats-simple.html
     22               fast/exclusions/shape-inside/shape-inside-inline-elements.html
     23               fast/exclusions/shape-inside/shape-inside-overflow.html
     24               fast/exclusions/shape-inside/shape-inside-percentage-auto.html
     25               fast/exclusions/shape-inside/shape-inside-text.html
     26
     27        * CMakeLists.txt:
     28        * GNUmakefile.list.am:
     29        * Target.pri:
     30        * WebCore.gypi:
     31        * WebCore.vcproj/WebCore.vcproj:
     32        * WebCore.xcodeproj/project.pbxproj:
     33        * rendering/RenderBlock.cpp:
     34        (WebCore::RenderBlock::willBeDestroyed): Remove WrapShapeInfo when destroyed.
     35        (WebCore::RenderBlock::styleDidChange): Detect modifications to style()->wrapShapeInside.
     36        (WebCore):
     37        (WebCore::RenderBlock::updateWrapShapeInfoAfterStyleChange): Update WrapShapeInfo
     38        when style()->wrapShapeInside changes.
     39        (WebCore::RenderBlock::layoutBlock): Notify WrapShapeInfo of changes in logicalWidth
     40        and logicalHeight before laying out inline content.
     41        * rendering/RenderBlock.h:
     42        (RenderBlock):
     43        (WebCore::RenderBlock::wrapShapeInfo): Return the wrapShapeInfo associated with a
     44        RenderBlock.
     45        * rendering/RenderBlockLineLayout.cpp:
     46        (WebCore::LineWidth::LineWidth): Determine the WrapShapeInfo::LineSegment this LineWidth
     47        corresponds to, if any.
     48        (LineWidth):
     49        (WebCore::LineWidth::updateAvailableWidth): The width's LineSegment boundaries affect
     50        the available width.
     51        (WebCore::RenderBlock::computeInlineDirectionPositionsForLine): The current LineSegment
     52        affects the left & right positioning of inline boxes.
     53        (WebCore::RenderBlock::layoutRunsAndFloatsInRange): Move to the top of the inside wrap
     54        shape before beginning inline layout, and update the line segments for each line.
     55        * rendering/WrapShapeInfo.cpp: Added.
     56        (WebCore):
     57        (WebCore::WrapShapeInfo::WrapShapeInfo): Create an empty WrapShapeInfo.
     58        (WebCore::WrapShapeInfo::~WrapShapeInfo): No additional cleanup.
     59        (WebCore::WrapShapeInfo::create): Create a WrapShapeInfo reference.
     60        (WebCore::WrapShapeInfo::ensureWrapShapeInfoForRenderBlock): Create a WrapShapeInfo
     61        for a RenderBlock with an inside WrapShape and place it in the WrapShapeInfo map.
     62        (WebCore::WrapShapeInfo::wrapShapeInfoForRenderBlock): Lookup the WrapShapeInfo for
     63        a RenderBlock in the WrapShapeInfo map.
     64        (WebCore::WrapShapeInfo::isWrapShapeInfoEnabledForBlock): Determine if a RenderBlock
     65        has an inside wrap shape that we can use for inline layout.
     66        (WebCore::WrapShapeInfo::removeWrapShapeInfoForRenderBlock): Remove a RenderBlock's
     67        WrapShapeInfo from the WrapShapeInfo map.
     68        (WebCore::WrapShapeInfo::hasSegments): Returns true if there are any line segments
     69        for the current line.
     70        (WebCore::WrapShapeInfo::computeShapeSize): Compute the dimensions of the wrap shape
     71        based on a block's logical width & height.
     72        (WebCore::WrapShapeInfo::computeSegmentsForLine): Sets the current line and computes
     73        its line segments.
     74        * rendering/WrapShapeInfo.h: Added.
     75        (WebCore):
     76        (LineSegment):
     77        (WrapShapeInfo):
     78        (WebCore::WrapShapeInfo::shapeTop): The top of a wrap shape, where the inline content
     79        area begins.
     80        (WebCore::WrapShapeInfo::segments): The list of line segments for the current line.
     81        (WebCore::WrapShapeInfo::wrapShapeSizeNeedsRecomputing): Mark a WrapShapeInfo as
     82        needing to recompute its WrapShape dimensions.
     83        (WebCore::WrapShapeInfo::lineState): The current line state: above, inside, or below
     84        the wrap shape.
     85        * rendering/style/RenderStyle.cpp:
     86        (WebCore::RenderStyle::diff): Changes to shape inside require relayout.
     87
    1882012-08-24  David Hyatt  <hyatt@apple.com>
    289
  • trunk/Source/WebCore/GNUmakefile.list.am

    r126583 r126605  
    50335033        Source/WebCore/rendering/ScrollBehavior.h \
    50345034        Source/WebCore/rendering/VerticalPositionCache.h \
     5035        Source/WebCore/rendering/WrapShapeInfo.cpp \
     5036        Source/WebCore/rendering/WrapShapeInfo.h \
    50355037        Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp \
    50365038        Source/WebCore/rendering/mathml/RenderMathMLBlock.h \
  • trunk/Source/WebCore/Target.pri

    r126372 r126605  
    11831183    rendering/RootInlineBox.cpp \
    11841184    rendering/ScrollBehavior.cpp \
     1185    rendering/WrapShapeInfo.cpp \
    11851186    rendering/style/ContentData.cpp \
    11861187    rendering/style/CounterDirectives.cpp \
     
    23652366    rendering/RootInlineBox.h \
    23662367    rendering/ScrollBehavior.h \
     2368    rendering/WrapShapeInfo.h \
    23672369    rendering/style/ContentData.h \
    23682370    rendering/style/CounterDirectives.h \
  • trunk/Source/WebCore/WebCore.gypi

    r126566 r126605  
    584584            'rendering/RootInlineBox.h',
    585585            'rendering/ScrollBehavior.h',
     586            'rendering/WrapShapeInfo.h',
    586587            'rendering/style/BorderData.h',
    587588            'rendering/style/BorderValue.h',
     
    48714872            'rendering/TrailingFloatsRootInlineBox.h',
    48724873            'rendering/VerticalPositionCache.h',
     4874            'rendering/WrapShapeInfo.cpp',
    48734875            'rendering/break_lines.cpp',
    48744876            'rendering/break_lines.h',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r126437 r126605  
    4203642036                        </File>
    4203742037                        <File
     42038                                RelativePath="..\rendering\WrapShapeInfo.cpp"
     42039                                >
     42040                        </File>
     42041                        <File
     42042                                RelativePath="..\rendering\WrapShapeInfo.h"
     42043                                >
     42044                        </File>
     42045                        <File
    4203842046                                RelativePath="..\rendering\svg\RenderSVGAllInOne.cpp"
    4203942047                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r126486 r126605  
    64416441                FD6F252C13F5EF0E0065165F /* MediaElementAudioSourceNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD6F252913F5EF0E0065165F /* MediaElementAudioSourceNode.cpp */; };
    64426442                FD6F252D13F5EF0E0065165F /* MediaElementAudioSourceNode.h in Headers */ = {isa = PBXBuildFile; fileRef = FD6F252A13F5EF0E0065165F /* MediaElementAudioSourceNode.h */; };
     6443                FD748ABF15BF74ED0059CF0D /* WrapShapeInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD748ABD15BF74ED0059CF0D /* WrapShapeInfo.cpp */; };
     6444                FD748AC015BF74ED0059CF0D /* WrapShapeInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = FD748ABE15BF74ED0059CF0D /* WrapShapeInfo.h */; settings = {ATTRIBUTES = (Private, ); }; };
    64436445                FD7868B9136B999200D403DF /* JSDynamicsCompressorNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD7868B7136B999200D403DF /* JSDynamicsCompressorNode.cpp */; };
    64446446                FD7868BA136B999200D403DF /* JSDynamicsCompressorNode.h in Headers */ = {isa = PBXBuildFile; fileRef = FD7868B8136B999200D403DF /* JSDynamicsCompressorNode.h */; };
     
    1384713849                FD6F252A13F5EF0E0065165F /* MediaElementAudioSourceNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaElementAudioSourceNode.h; sourceTree = "<group>"; };
    1384813850                FD6F252B13F5EF0E0065165F /* MediaElementAudioSourceNode.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaElementAudioSourceNode.idl; sourceTree = "<group>"; };
     13851                FD748ABD15BF74ED0059CF0D /* WrapShapeInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WrapShapeInfo.cpp; sourceTree = "<group>"; };
     13852                FD748ABE15BF74ED0059CF0D /* WrapShapeInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WrapShapeInfo.h; sourceTree = "<group>"; };
    1384913853                FD7868B7136B999200D403DF /* JSDynamicsCompressorNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDynamicsCompressorNode.cpp; sourceTree = "<group>"; };
    1385013854                FD7868B8136B999200D403DF /* JSDynamicsCompressorNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDynamicsCompressorNode.h; sourceTree = "<group>"; };
     
    2146221466                                37FC96DA1104ED71003E1FAD /* TrailingFloatsRootInlineBox.h */,
    2146321467                                BCA257141293C010007A263D /* VerticalPositionCache.h */,
     21468                                FD748ABD15BF74ED0059CF0D /* WrapShapeInfo.cpp */,
     21469                                FD748ABE15BF74ED0059CF0D /* WrapShapeInfo.h */,
    2146421470                        );
    2146521471                        path = rendering;
     
    2540625412                                93309E24099E64920056E581 /* WrapContentsInDummySpanCommand.h in Headers */,
    2540725413                                FDE6860315B0A96100BB480C /* WrapShapeFunctions.h in Headers */,
     25414                                FD748AC015BF74ED0059CF0D /* WrapShapeInfo.h in Headers */,
    2540825415                                FDE6860415B0A96100BB480C /* WrapShapes.h in Headers */,
    2540925416                                9BAF3B2412C1A39800014BF1 /* WritingDirection.h in Headers */,
     
    2849328500                                93309E23099E64920056E581 /* WrapContentsInDummySpanCommand.cpp in Sources */,
    2849428501                                FDE6860215B0A93B00BB480C /* WrapShapeFunctions.cpp in Sources */,
     28502                                FD748ABF15BF74ED0059CF0D /* WrapShapeInfo.cpp in Sources */,
    2849528503                                F553B89315BE26C000B134C9 /* WrapShapes.cpp in Sources */,
    2849628504                                A833C7CC0A2CF07400D57664 /* XLinkNames.cpp in Sources */,
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r126520 r126605  
    6262#include "TransformState.h"
    6363#include <wtf/StdLibExtras.h>
     64#if ENABLE(CSS_EXCLUSIONS)
     65#include "WrapShapeInfo.h"
     66#endif
    6467
    6568using namespace std;
     
    275278    if (lineGridBox())
    276279        lineGridBox()->destroy(renderArena());
     280
     281#if ENABLE(CSS_EXCLUSIONS)
     282    WrapShapeInfo::removeWrapShapeInfoForRenderBlock(this);
     283#endif
    277284
    278285    if (UNLIKELY(gDelayedUpdateScrollInfoSet != 0))
     
    320327{
    321328    RenderBox::styleDidChange(diff, oldStyle);
     329
     330#if ENABLE(CSS_EXCLUSIONS)
     331    // FIXME: Bug 89993: Style changes should affect the WrapShapeInfos for other render blocks that
     332    // share the same WrapShapeInfo
     333    updateWrapShapeInfoAfterStyleChange(style()->wrapShapeInside(), oldStyle ? oldStyle->wrapShapeInside() : 0);
     334#endif
    322335
    323336    if (!isAnonymousBlock()) {
     
    13671380}
    13681381
     1382#if ENABLE(CSS_EXCLUSIONS)
     1383void RenderBlock::updateWrapShapeInfoAfterStyleChange(const WrapShape* wrapShape, const WrapShape* oldWrapShape)
     1384{
     1385    // FIXME: A future optimization would do a deep comparison for equality.
     1386    if (wrapShape == oldWrapShape)
     1387        return;
     1388
     1389    if (wrapShape) {
     1390        WrapShapeInfo* wrapShapeInfo = WrapShapeInfo::ensureWrapShapeInfoForRenderBlock(this);
     1391        wrapShapeInfo->dirtyWrapShapeSize();
     1392    } else
     1393        WrapShapeInfo::removeWrapShapeInfoForRenderBlock(this);
     1394}
     1395#endif
     1396
    13691397void RenderBlock::computeInitialRegionRangeForBlock()
    13701398{
     
    14621490    }
    14631491    computeInitialRegionRangeForBlock();
     1492#if ENABLE(CSS_EXCLUSIONS)
     1493    // FIXME: Bug 93547: Resolve logical height for percentage based vertical lengths
     1494    if (WrapShapeInfo* wrapShapeInfo = this->wrapShapeInfo())
     1495        wrapShapeInfo->computeShapeSize(logicalWidth(), 0);
     1496#endif
    14641497
    14651498    // We use four values, maxTopPos, maxTopNeg, maxBottomPos, and maxBottomNeg, to track
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r126343 r126605  
    3434#include <wtf/ListHashSet.h>
    3535
     36#if ENABLE(CSS_EXCLUSIONS)
     37#include "WrapShapeInfo.h"
     38#endif
     39
    3640namespace WebCore {
    3741
     
    397401#endif
    398402
     403#if ENABLE(CSS_EXCLUSIONS)
     404    WrapShapeInfo* wrapShapeInfo() const
     405    {
     406        return style()->wrapShapeInside() && WrapShapeInfo::isWrapShapeInfoEnabledForRenderBlock(this) ? WrapShapeInfo::wrapShapeInfoForRenderBlock(this) : 0;
     407    }
     408#endif
     409
    399410protected:
    400411    virtual void willBeDestroyed();
     
    486497
    487498private:
     499#if ENABLE(CSS_EXCLUSIONS)
     500    void updateWrapShapeInfoAfterStyleChange(const WrapShape*, const WrapShape* oldWrapShape);
     501#endif
    488502    virtual RenderObjectChildList* virtualChildren() { return children(); }
    489503    virtual const RenderObjectChildList* virtualChildren() const { return children(); }
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r126100 r126605  
    4747#include <wtf/unicode/CharacterNames.h>
    4848
     49#if ENABLE(CSS_EXCLUSIONS)
     50#include "WrapShapeInfo.h"
     51#endif
     52
    4953#if ENABLE(SVG)
    5054#include "RenderSVGInlineText.h"
     
    7175        , m_right(0)
    7276        , m_availableWidth(0)
     77#if ENABLE(CSS_EXCLUSIONS)
     78        , m_segment(0)
     79#endif
    7380        , m_isFirstLine(isFirstLine)
    7481    {
    7582        ASSERT(block);
     83#if ENABLE(CSS_EXCLUSIONS)
     84        WrapShapeInfo* wrapShapeInfo = m_block->wrapShapeInfo();
     85        // FIXME: Bug 91878: Add support for multiple segments, currently we only support one
     86        if (wrapShapeInfo && wrapShapeInfo->lineState() == WrapShapeInfo::LINE_INSIDE_SHAPE) {
     87            // All interior shape positions should have at least one segment
     88            ASSERT(wrapShapeInfo->hasSegments());
     89            m_segment = &wrapShapeInfo->segments()[0];
     90        }
     91#endif
    7692        updateAvailableWidth();
    7793    }
     
    115131    float m_right;
    116132    float m_availableWidth;
     133#if ENABLE(CSS_EXCLUSIONS)
     134    const LineSegment* m_segment;
     135#endif
    117136    bool m_isFirstLine;
    118137};
     
    138157    m_left = m_block->logicalLeftOffsetForLine(height, m_isFirstLine, logicalHeight);
    139158    m_right = m_block->logicalRightOffsetForLine(height, m_isFirstLine, logicalHeight);
     159
     160#if ENABLE(CSS_EXCLUSIONS)
     161    if (m_segment) {
     162        m_left = max<float>(m_segment->logicalLeft, m_left);
     163        m_right = min<float>(m_segment->logicalRight, m_right);
     164    }
     165#endif
    140166
    141167    computeAvailableWidthFromLeftAndRight();
     
    778804    bool firstLine = lineInfo.isFirstLine() && !(isAnonymousBlock() && parent()->firstChild() != this);
    779805    float logicalLeft = pixelSnappedLogicalLeftOffsetForLine(logicalHeight(), firstLine, lineLogicalHeight);
    780     float availableLogicalWidth = pixelSnappedLogicalRightOffsetForLine(logicalHeight(), firstLine, lineLogicalHeight) - logicalLeft;
     806    float logicalRight = pixelSnappedLogicalRightOffsetForLine(logicalHeight(), firstLine, lineLogicalHeight);
     807#if ENABLE(CSS_EXCLUSIONS)
     808    WrapShapeInfo* wrapShapeInfo = this->wrapShapeInfo();
     809    if (wrapShapeInfo && wrapShapeInfo->lineState() == WrapShapeInfo::LINE_INSIDE_SHAPE) {
     810        logicalLeft = max<float>(roundToInt(wrapShapeInfo->segments()[0].logicalLeft), logicalLeft);
     811        logicalRight = min<float>(floorToInt(wrapShapeInfo->segments()[0].logicalRight), logicalRight);
     812    }
     813#endif
     814    float availableLogicalWidth = logicalRight - logicalLeft;
    781815
    782816    bool needsWordSpacing = false;
     
    12531287    LineBreaker lineBreaker(this);
    12541288
     1289#if ENABLE(CSS_EXCLUSIONS)
     1290    WrapShapeInfo* wrapShapeInfo = this->wrapShapeInfo();
     1291    // Move to the top of the shape inside to begin layout
     1292    if (wrapShapeInfo && logicalHeight() < wrapShapeInfo->shapeTop())
     1293        setLogicalHeight(wrapShapeInfo->shapeTop());
     1294#endif
     1295
    12551296    while (!end.atEnd()) {
    12561297        // FIXME: Is this check necessary before the first iteration or can it be moved to the end?
     
    12711312        bool isNewUBAParagraph = layoutState.lineInfo().previousLineBrokeCleanly();
    12721313        FloatingObject* lastFloatFromPreviousLine = (m_floatingObjects && !m_floatingObjects->set().isEmpty()) ? m_floatingObjects->set().last() : 0;
     1314#if ENABLE(CSS_EXCLUSIONS)
     1315        // FIXME: Bug 89993: If the wrap shape comes from a parent, we will need to adjust
     1316        // the height coordinate
     1317        if (wrapShapeInfo)
     1318            wrapShapeInfo->computeSegmentsForLine(logicalHeight());
     1319#endif
    12731320        end = lineBreaker.nextLineBreak(resolver, layoutState.lineInfo(), lineBreakIteratorInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines);
    12741321        if (resolver.position().atEnd()) {
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r126438 r126605  
    454454        // If regions change, trigger a relayout to re-calc regions.
    455455        if (rareNonInheritedData->m_dashboardRegions != other->rareNonInheritedData->m_dashboardRegions)
     456            return StyleDifferenceLayout;
     457#endif
     458
     459#if ENABLE(CSS_EXCLUSIONS)
     460        if (rareNonInheritedData->m_wrapShapeInside != other->rareNonInheritedData->m_wrapShapeInside)
    456461            return StyleDifferenceLayout;
    457462#endif
     
    674679        // to avoid having diff() == StyleDifferenceEqual where wrap-shapes actually differ.
    675680        // Tracking bug: https://bugs.webkit.org/show_bug.cgi?id=62991
    676         if (rareNonInheritedData->m_wrapShapeInside != other->rareNonInheritedData->m_wrapShapeInside
    677             || rareNonInheritedData->m_wrapShapeOutside != other->rareNonInheritedData->m_wrapShapeOutside)
     681        if (rareNonInheritedData->m_wrapShapeOutside != other->rareNonInheritedData->m_wrapShapeOutside)
    678682            return StyleDifferenceRepaint;
    679683
Note: See TracChangeset for help on using the changeset viewer.