Changeset 129530 in webkit


Ignore:
Timestamp:
Sep 25, 2012 11:22:39 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[CSS Exclusions] Enable css exclusions for multiple blocks per element
https://bugs.webkit.org/show_bug.cgi?id=89993

Patch by Bear Travis <betravis@adobe.com> on 2012-09-25
Reviewed by Julien Chaffraix.

Source/WebCore:

Similar to multi-column layout, a parent RenderBlock's WrapShapeInfo may affect
the inline content of its children. This patch follows the example of ColumnInfo
and adds WrapShapeInfo to LayoutState, which tracks the current shape-inside that
inline content should respect.

Tests: fast/exclusions/shape-inside/shape-inside-multiple-blocks.html

fast/exclusions/shape-inside/shape-inside-multiple-blocks-vertical.html

  • rendering/LayoutState.cpp:

(WebCore::LayoutState::LayoutState): Initialize m_wrapShapeInfo.

  • rendering/LayoutState.h:

(WebCore):
(WebCore::LayoutState::LayoutState): Initialize m_wrapShapeInfo.
(LayoutState):
(WebCore::LayoutState::wrapShapeInfo): Getter for m_wrapShapeInfo.

  • rendering/RenderBlockLineLayout.cpp:

(WebCore::LineWidth::LineWidth): Use LayoutState to lookup WrapShapeInfo.
(WebCore::RenderBlock::computeInlineDirectionPositionsForLine): Ditto.
(WebCore::RenderBlock::layoutRunsAndFloatsInRange): Ditto.

  • rendering/RenderView.h:

(WebCore::RenderView::pushLayoutState): Push LayoutState if a WrapShapeInfo
is present.

LayoutTests:

Adding tests to cover the case where a shape-inside affects block children's
inline content.

  • fast/exclusions/shape-inside/shape-inside-multiple-blocks-expected.html: Added.
  • fast/exclusions/shape-inside/shape-inside-multiple-blocks-vertical-expected.html: Added.
  • fast/exclusions/shape-inside/shape-inside-multiple-blocks-vertical.html: Added.
  • fast/exclusions/shape-inside/shape-inside-multiple-blocks.html: Added.
Location:
trunk
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r129529 r129530  
     12012-09-25  Bear Travis  <betravis@adobe.com>
     2
     3        [CSS Exclusions] Enable css exclusions for multiple blocks per element
     4        https://bugs.webkit.org/show_bug.cgi?id=89993
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        Adding tests to cover the case where a shape-inside affects block children's
     9        inline content.
     10
     11        * fast/exclusions/shape-inside/shape-inside-multiple-blocks-expected.html: Added.
     12        * fast/exclusions/shape-inside/shape-inside-multiple-blocks-vertical-expected.html: Added.
     13        * fast/exclusions/shape-inside/shape-inside-multiple-blocks-vertical.html: Added.
     14        * fast/exclusions/shape-inside/shape-inside-multiple-blocks.html: Added.
     15
    1162012-09-24  Emil A Eklund  <eae@chromium.org>
    217
  • trunk/Source/WebCore/ChangeLog

    r129529 r129530  
     12012-09-25  Bear Travis  <betravis@adobe.com>
     2
     3        [CSS Exclusions] Enable css exclusions for multiple blocks per element
     4        https://bugs.webkit.org/show_bug.cgi?id=89993
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        Similar to multi-column layout, a parent RenderBlock's WrapShapeInfo may affect
     9        the inline content of its children. This patch follows the example of ColumnInfo
     10        and adds WrapShapeInfo to LayoutState, which tracks the current shape-inside that
     11        inline content should respect.
     12
     13        Tests: fast/exclusions/shape-inside/shape-inside-multiple-blocks.html
     14               fast/exclusions/shape-inside/shape-inside-multiple-blocks-vertical.html
     15
     16        * rendering/LayoutState.cpp:
     17        (WebCore::LayoutState::LayoutState): Initialize m_wrapShapeInfo.
     18        * rendering/LayoutState.h:
     19        (WebCore):
     20        (WebCore::LayoutState::LayoutState): Initialize m_wrapShapeInfo.
     21        (LayoutState):
     22        (WebCore::LayoutState::wrapShapeInfo): Getter for m_wrapShapeInfo.
     23        * rendering/RenderBlockLineLayout.cpp:
     24        (WebCore::LineWidth::LineWidth): Use LayoutState to lookup WrapShapeInfo.
     25        (WebCore::RenderBlock::computeInlineDirectionPositionsForLine): Ditto.
     26        (WebCore::RenderBlock::layoutRunsAndFloatsInRange): Ditto.
     27        * rendering/RenderView.h:
     28        (WebCore::RenderView::pushLayoutState): Push LayoutState if a WrapShapeInfo
     29        is present.
     30
    1312012-09-24  Emil A Eklund  <eae@chromium.org>
    232
  • trunk/Source/WebCore/rendering/LayoutState.cpp

    r127267 r129530  
    4343    , m_renderer(renderer)
    4444#endif
     45#if ENABLE(CSS_EXCLUSIONS)
     46    , m_wrapShapeInfo(0)
     47#endif
    4548{
    4649    ASSERT(m_next);
     
    108111        m_columnInfo = m_next->m_columnInfo;
    109112
     113#if ENABLE(CSS_EXCLUSIONS)
     114    if (renderer->isRenderBlock()) {
     115        m_wrapShapeInfo = toRenderBlock(renderer)->wrapShapeInfo();
     116        if (!m_wrapShapeInfo)
     117            m_wrapShapeInfo = m_next->m_wrapShapeInfo;
     118    }
     119#endif
     120
    110121    m_layoutDelta = m_next->m_layoutDelta;
    111122   
     
    132143#ifndef NDEBUG
    133144    , m_renderer(root)
     145#endif
     146#if ENABLE(CSS_EXCLUSIONS)
     147    , m_wrapShapeInfo(0)
    134148#endif
    135149{
  • trunk/Source/WebCore/rendering/LayoutState.h

    r127267 r129530  
    3939class RenderObject;
    4040class RenderFlowThread;
     41#if ENABLE(CSS_EXCLUSIONS)
     42class WrapShapeInfo;
     43#endif
    4144
    4245class LayoutState {
     
    5356#ifndef NDEBUG
    5457        , m_renderer(0)
     58#endif
     59#if ENABLE(CSS_EXCLUSIONS)
     60        , m_wrapShapeInfo(0)
    5561#endif
    5662    {
     
    8995    bool needsBlockDirectionLocationSetBeforeLayout() const { return m_lineGrid || (m_isPaginated && m_pageLogicalHeight); }
    9096
     97#if ENABLE(CSS_EXCLUSIONS)
     98    WrapShapeInfo* wrapShapeInfo() const { return m_wrapShapeInfo; }
     99#endif
    91100private:
    92101    // The normal operator new is disallowed.
     
    130139    RenderObject* m_renderer;
    131140#endif
     141#if ENABLE(CSS_EXCLUSIONS)
     142    WrapShapeInfo* m_wrapShapeInfo;
     143#endif
    132144};
    133145
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r129284 r129530  
    6464const unsigned cMaxLineDepth = 200;
    6565
     66#if ENABLE(CSS_EXCLUSIONS)
     67static inline WrapShapeInfo* layoutWrapShapeInfo(const RenderBlock* block)
     68{
     69    return block->view()->layoutState()->wrapShapeInfo();
     70}
     71#endif
     72
    6673class LineWidth {
    6774public:
     
    8188        ASSERT(block);
    8289#if ENABLE(CSS_EXCLUSIONS)
    83         WrapShapeInfo* wrapShapeInfo = m_block->wrapShapeInfo();
     90        WrapShapeInfo* wrapShapeInfo = layoutWrapShapeInfo(m_block);
    8491        // FIXME: Bug 91878: Add support for multiple segments, currently we only support one
    8592        if (wrapShapeInfo && wrapShapeInfo->lineState() == WrapShapeInfo::LINE_INSIDE_SHAPE) {
     
    805812    float logicalRight = pixelSnappedLogicalRightOffsetForLine(logicalHeight(), firstLine, lineLogicalHeight);
    806813#if ENABLE(CSS_EXCLUSIONS)
    807     WrapShapeInfo* wrapShapeInfo = this->wrapShapeInfo();
     814    WrapShapeInfo* wrapShapeInfo = layoutWrapShapeInfo(this);
    808815    if (wrapShapeInfo && wrapShapeInfo->lineState() == WrapShapeInfo::LINE_INSIDE_SHAPE) {
    809816        logicalLeft = max<float>(roundToInt(wrapShapeInfo->segments()[0].logicalLeft), logicalLeft);
     
    12971304
    12981305#if ENABLE(CSS_EXCLUSIONS)
    1299     WrapShapeInfo* wrapShapeInfo = this->wrapShapeInfo();
    1300     // Move to the top of the shape inside to begin layout
    1301     if (wrapShapeInfo && logicalHeight() < wrapShapeInfo->shapeLogicalTop())
    1302         setLogicalHeight(wrapShapeInfo->shapeLogicalTop());
     1306    LayoutUnit absoluteLogicalTop;
     1307    WrapShapeInfo* wrapShapeInfo = layoutWrapShapeInfo(this);
     1308    if (wrapShapeInfo) {
     1309        if (wrapShapeInfo != this->wrapShapeInfo()) {
     1310            // FIXME: If layout state is disabled, the offset will be incorrect.
     1311            LayoutSize layoutOffset = view()->layoutState()->layoutOffset();
     1312            absoluteLogicalTop = logicalTop() + (isHorizontalWritingMode() ? layoutOffset.height() : layoutOffset.width());
     1313        }
     1314        // Begin layout at the logical top of our shape inside.
     1315        if (logicalHeight() + absoluteLogicalTop < wrapShapeInfo->shapeLogicalTop())
     1316            setLogicalHeight(wrapShapeInfo->shapeLogicalTop() - absoluteLogicalTop);
     1317    }
    13031318#endif
    13041319
     
    13221337        FloatingObject* lastFloatFromPreviousLine = (m_floatingObjects && !m_floatingObjects->set().isEmpty()) ? m_floatingObjects->set().last() : 0;
    13231338#if ENABLE(CSS_EXCLUSIONS)
    1324         // FIXME: Bug 89993: If the wrap shape comes from a parent, we will need to adjust
    1325         // the height coordinate
    13261339        if (wrapShapeInfo)
    1327             wrapShapeInfo->computeSegmentsForLine(logicalHeight());
     1340            wrapShapeInfo->computeSegmentsForLine(logicalHeight() + absoluteLogicalTop);
    13281341#endif
    13291342        end = lineBreaker.nextLineBreak(resolver, layoutState.lineInfo(), renderTextInfo, lastFloatFromPreviousLine, consecutiveHyphenatedLines);
  • trunk/Source/WebCore/rendering/RenderView.h

    r128468 r129530  
    224224        // We push LayoutState even if layoutState is disabled because it stores layoutDelta too.
    225225        if (!doingFullRepaint() || m_layoutState->isPaginated() || renderer->hasColumns() || renderer->inRenderFlowThread()
    226             || m_layoutState->lineGrid() || (renderer->style()->lineGrid() != RenderStyle::initialLineGrid() && renderer->isBlockFlow())) {
     226            || m_layoutState->lineGrid() || (renderer->style()->lineGrid() != RenderStyle::initialLineGrid() && renderer->isBlockFlow())
     227#if ENABLE(CSS_EXCLUSIONS)
     228            || (renderer->isRenderBlock() && toRenderBlock(renderer)->wrapShapeInfo())
     229#endif
     230            ) {
    227231            m_layoutState = new (renderArena()) LayoutState(m_layoutState, renderer, offset, pageHeight, pageHeightChanged, colInfo);
    228232            return true;
Note: See TracChangeset for help on using the changeset viewer.