Changeset 96452 in webkit


Ignore:
Timestamp:
Sep 30, 2011 8:07:46 PM (13 years ago)
Author:
hyatt@apple.com
Message:

https://bugs.webkit.org/show_bug.cgi?id=69202

[CSS3 Regions] Make positioned objects use the first region as the ICB when it
is their containing block. Make sure static distance computations take into
account the current region as well.

Reviewed by Sam Weinig.

Source/WebCore:

Added new tests in fast/regions.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::adjustPositionedBlock):

  • rendering/RenderBlock.h:

(WebCore::RenderBlock::startOffsetForContent):

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::containingBlockLogicalWidthForPositioned):
(WebCore::RenderBox::containingBlockLogicalHeightForPositioned):
(WebCore::computeInlineStaticDistance):
(WebCore::computeLogicalLeftPositionedOffset):
(WebCore::computeLogicalTopPositionedOffset):

  • rendering/RenderFlowThread.cpp:

(WebCore::RenderFlowThread::contentLogicalWidthOfFirstRegion):
(WebCore::RenderFlowThread::contentLogicalHeightOfFirstRegion):
(WebCore::RenderFlowThread::contentLogicalLeftOfFirstRegion):

  • rendering/RenderFlowThread.h:

LayoutTests:

  • fast/regions/positioned-objects-block-static-in-regions.html: Added.
  • fast/regions/positioned-objects-block-static-in-rtl-regions.html: Added.
  • fast/regions/positioned-objects-in-regions.html: Added.
  • fast/regions/positioned-objects-in-rtl-regions.html: Added.
  • fast/regions/positioned-objects-inline-static-in-regions.html: Added.
  • fast/regions/positioned-objects-inline-static-in-rtl-regions.html: Added.
  • fast/regions/positioned-objects-perpendicular-flows-in-regions.html: Added.
  • platform/mac/fast/regions/positioned-objects-block-static-in-regions-expected.png: Added.
  • platform/mac/fast/regions/positioned-objects-block-static-in-regions-expected.txt: Added.
  • platform/mac/fast/regions/positioned-objects-block-static-in-rtl-regions-expected.png: Added.
  • platform/mac/fast/regions/positioned-objects-block-static-in-rtl-regions-expected.txt: Added.
  • platform/mac/fast/regions/positioned-objects-in-regions-expected.png: Added.
  • platform/mac/fast/regions/positioned-objects-in-regions-expected.txt: Added.
  • platform/mac/fast/regions/positioned-objects-in-rtl-regions-expected.png: Added.
  • platform/mac/fast/regions/positioned-objects-in-rtl-regions-expected.txt: Added.
  • platform/mac/fast/regions/positioned-objects-inline-static-in-regions-expected.png: Added.
  • platform/mac/fast/regions/positioned-objects-inline-static-in-regions-expected.txt: Added.
  • platform/mac/fast/regions/positioned-objects-inline-static-in-rtl-regions-expected.png: Added.
  • platform/mac/fast/regions/positioned-objects-inline-static-in-rtl-regions-expected.txt: Added.
  • platform/mac/fast/regions/positioned-objects-perpendicular-flows-in-regions-expected.png: Added.
  • platform/mac/fast/regions/positioned-objects-perpendicular-flows-in-regions-expected.txt: Added.
Location:
trunk
Files:
21 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r96449 r96452  
     12011-09-30  David Hyatt  <hyatt@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=69202
     4       
     5        [CSS3 Regions] Make positioned objects use the first region as the ICB when it
     6        is their containing block. Make sure static distance computations take into
     7        account the current region as well.
     8
     9        Reviewed by Sam Weinig.
     10
     11        * fast/regions/positioned-objects-block-static-in-regions.html: Added.
     12        * fast/regions/positioned-objects-block-static-in-rtl-regions.html: Added.
     13        * fast/regions/positioned-objects-in-regions.html: Added.
     14        * fast/regions/positioned-objects-in-rtl-regions.html: Added.
     15        * fast/regions/positioned-objects-inline-static-in-regions.html: Added.
     16        * fast/regions/positioned-objects-inline-static-in-rtl-regions.html: Added.
     17        * fast/regions/positioned-objects-perpendicular-flows-in-regions.html: Added.
     18        * platform/mac/fast/regions/positioned-objects-block-static-in-regions-expected.png: Added.
     19        * platform/mac/fast/regions/positioned-objects-block-static-in-regions-expected.txt: Added.
     20        * platform/mac/fast/regions/positioned-objects-block-static-in-rtl-regions-expected.png: Added.
     21        * platform/mac/fast/regions/positioned-objects-block-static-in-rtl-regions-expected.txt: Added.
     22        * platform/mac/fast/regions/positioned-objects-in-regions-expected.png: Added.
     23        * platform/mac/fast/regions/positioned-objects-in-regions-expected.txt: Added.
     24        * platform/mac/fast/regions/positioned-objects-in-rtl-regions-expected.png: Added.
     25        * platform/mac/fast/regions/positioned-objects-in-rtl-regions-expected.txt: Added.
     26        * platform/mac/fast/regions/positioned-objects-inline-static-in-regions-expected.png: Added.
     27        * platform/mac/fast/regions/positioned-objects-inline-static-in-regions-expected.txt: Added.
     28        * platform/mac/fast/regions/positioned-objects-inline-static-in-rtl-regions-expected.png: Added.
     29        * platform/mac/fast/regions/positioned-objects-inline-static-in-rtl-regions-expected.txt: Added.
     30        * platform/mac/fast/regions/positioned-objects-perpendicular-flows-in-regions-expected.png: Added.
     31        * platform/mac/fast/regions/positioned-objects-perpendicular-flows-in-regions-expected.txt: Added.
     32
    1332011-09-30  David Barr  <davidbarr@chromium.org>
    234
  • trunk/Source/WebCore/ChangeLog

    r96449 r96452  
     12011-09-30  David Hyatt  <hyatt@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=69202
     4       
     5        [CSS3 Regions] Make positioned objects use the first region as the ICB when it
     6        is their containing block. Make sure static distance computations take into
     7        account the current region as well.
     8
     9        Reviewed by Sam Weinig.
     10
     11        Added new tests in fast/regions.
     12
     13        * rendering/RenderBlock.cpp:
     14        (WebCore::RenderBlock::adjustPositionedBlock):
     15        * rendering/RenderBlock.h:
     16        (WebCore::RenderBlock::startOffsetForContent):
     17        * rendering/RenderBox.cpp:
     18        (WebCore::RenderBox::containingBlockLogicalWidthForPositioned):
     19        (WebCore::RenderBox::containingBlockLogicalHeightForPositioned):
     20        (WebCore::computeInlineStaticDistance):
     21        (WebCore::computeLogicalLeftPositionedOffset):
     22        (WebCore::computeLogicalTopPositionedOffset):
     23        * rendering/RenderFlowThread.cpp:
     24        (WebCore::RenderFlowThread::contentLogicalWidthOfFirstRegion):
     25        (WebCore::RenderFlowThread::contentLogicalHeightOfFirstRegion):
     26        (WebCore::RenderFlowThread::contentLogicalLeftOfFirstRegion):
     27        * rendering/RenderFlowThread.h:
     28
    1292011-09-30  David Barr  <davidbarr@chromium.org>
    230
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r96423 r96452  
    14741474    RenderLayer* childLayer = child->layer();
    14751475       
    1476     childLayer->setStaticInlinePosition(borderAndPaddingStart());
     1476    childLayer->setStaticInlinePosition(startOffsetForContent(logicalHeight()));
    14771477
    14781478    LayoutUnit logicalTop = logicalHeight();
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r96408 r96452  
    129129    LayoutUnit logicalRightOffsetForLine(LayoutUnit position, bool firstLine) const { return logicalRightOffsetForLine(position, logicalRightOffsetForContent(position), firstLine); }
    130130    LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, bool firstLine) const { return logicalLeftOffsetForLine(position, logicalLeftOffsetForContent(position), firstLine); }
    131     LayoutUnit startOffsetForLine(LayoutUnit position, bool firstLine) const { return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine) : width() - logicalRightOffsetForLine(position, firstLine); }
     131    LayoutUnit startOffsetForLine(LayoutUnit position, bool firstLine) const { return style()->isLeftToRightDirection() ? logicalLeftOffsetForLine(position, firstLine) : logicalWidth() - logicalRightOffsetForLine(position, firstLine); }
    132132    LayoutUnit startAlignedOffsetForLine(RenderBox* child, LayoutUnit position, bool firstLine);
    133133    LayoutUnit textIndentOffset() const;
     
    264264    LayoutUnit logicalRightOffsetForContent(LayoutUnit position) const;
    265265    LayoutUnit availableLogicalWidthForContent(LayoutUnit position) const { return max(0, logicalRightOffsetForContent(position) - logicalLeftOffsetForContent(position)); }
     266    LayoutUnit startOffsetForContent(LayoutUnit position) const { return style()->isLeftToRightDirection() ? logicalLeftOffsetForContent(position) : logicalWidth() - logicalRightOffsetForContent(position); }
    266267
    267268#ifndef NDEBUG
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r96162 r96452  
    870870        child->layer()->setStaticInlinePosition(block->startAlignedOffsetForLine(child, blockHeight, false));
    871871    else
    872         child->layer()->setStaticInlinePosition(block->borderAndPaddingStart());
     872        child->layer()->setStaticInlinePosition(block->startOffsetForContent(blockHeight));
    873873    child->layer()->setStaticBlockPosition(blockHeight);
    874874}
     
    21532153            bool isInlineType = box->style()->isOriginalDisplayInlineType();
    21542154            if (!isInlineType)
    2155                 box->layer()->setStaticInlinePosition(m_block->borderAndPaddingStart());
     2155                box->layer()->setStaticInlinePosition(m_block->startOffsetForContent(m_block->logicalHeight()));
    21562156            else  {
    21572157                // If our original display was an INLINE type, then we can go ahead
     
    27152715
    27162716    if (!style()->isLeftToRightDirection())
    2717         return width() - (logicalLeft + totalLogicalWidth);
     2717        return logicalWidth() - (logicalLeft + totalLogicalWidth);
    27182718    return logicalLeft;
    27192719}
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r96431 r96452  
    22692269        return containingBlockLogicalHeightForPositioned(containingBlock, false);
    22702270
    2271     if (containingBlock->isBox())
     2271    if (containingBlock->isBox()) {
     2272        if (inRenderFlowThread() && containingBlock->isRenderFlowThread())
     2273            return toRenderFlowThread(containingBlock)->contentLogicalWidthOfFirstRegion();
    22722274        return toRenderBox(containingBlock)->clientLogicalWidth();
     2275    }
    22732276
    22742277    ASSERT(containingBlock->isRenderInline() && containingBlock->isRelPositioned());
     
    23002303        return containingBlockLogicalWidthForPositioned(containingBlock, false);
    23012304
    2302     if (containingBlock->isBox())
     2305    if (containingBlock->isBox()) {
     2306        if (inRenderFlowThread() && containingBlock->isRenderFlowThread())
     2307            return toRenderFlowThread(containingBlock)->contentLogicalHeightOfFirstRegion();
    23032308        return toRenderBox(containingBlock)->clientLogicalHeight();
     2309    }
    23042310       
    23052311    ASSERT(containingBlock->isRenderInline() && containingBlock->isRelPositioned());
     
    23352341                staticPosition += toRenderBox(curr)->logicalLeft();
    23362342        }
     2343       
     2344        // If our container block is an RTL RenderFlowThread, then we also have to subtract out the region offset.
     2345        if (child->inRenderFlowThread() && containerBlock->isRenderFlowThread()
     2346            && (child->isHorizontalWritingMode() == containerBlock->isHorizontalWritingMode())
     2347            && containerBlock->style()->direction() == RTL)
     2348            staticPosition -= toRenderFlowThread(containerBlock)->contentLogicalLeftOfFirstRegion();
     2349       
    23372350        logicalLeft.setValue(Fixed, staticPosition);
    23382351    } else {
     
    23442357                staticPosition -= toRenderBox(curr)->logicalLeft();
    23452358        }
     2359       
     2360        // If our container block is an RTL RenderFlowThread, then we also have to subtract out the region offset.
     2361        if (child->inRenderFlowThread() && containerBlock->isRenderFlowThread()
     2362            && (child->isHorizontalWritingMode() == containerBlock->isHorizontalWritingMode())
     2363            && containerBlock->style()->direction() == RTL)
     2364            staticPosition += toRenderFlowThread(containerBlock)->contentLogicalLeftOfFirstRegion();
     2365
    23462366        logicalRight.setValue(Fixed, staticPosition);
    23472367    }
     
    24902510        logicalLeftPos = containerLogicalWidth - logicalWidthValue - logicalLeftPos;
    24912511        logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->borderRight() : containerBlock->borderBottom());
    2492     } else
     2512    } else {
    24932513        logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->borderLeft() : containerBlock->borderTop());
     2514       
     2515        // If our container block is an RTL RenderFlowThread, then we also have to add in the region offset.
     2516        if (child->inRenderFlowThread() && containerBlock->isRenderFlowThread()
     2517            && (child->isHorizontalWritingMode() == containerBlock->isHorizontalWritingMode())
     2518            && containerBlock->style()->direction() == RTL)
     2519            logicalLeftPos += toRenderFlowThread(containerBlock)->contentLogicalLeftOfFirstRegion();
     2520    }
    24942521}
    24952522
     
    28082835            logicalTopPos += containerBlock->borderLeft();
    28092836    }
     2837   
     2838    // If our container block is an RTL RenderFlowThread, then we also have to add in the region offset.
     2839    if (child->inRenderFlowThread() && containerBlock->isRenderFlowThread()
     2840        && (child->isHorizontalWritingMode() != containerBlock->isHorizontalWritingMode())
     2841        && containerBlock->style()->direction() == RTL)
     2842        logicalTopPos += toRenderFlowThread(containerBlock)->contentLogicalLeftOfFirstRegion();
    28102843}
    28112844
  • trunk/Source/WebCore/rendering/RenderFlowThread.cpp

    r96423 r96452  
    637637}
    638638
     639LayoutUnit RenderFlowThread::contentLogicalWidthOfFirstRegion() const
     640{
     641    if (!hasValidRegions())
     642        return 0;
     643    for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
     644        RenderRegion* region = *iter;
     645        if (!region->isValid())
     646            continue;
     647        return isHorizontalWritingMode() ? region->contentWidth() : region->contentHeight();
     648    }
     649    ASSERT_NOT_REACHED();
     650    return 0;
     651}
     652
     653LayoutUnit RenderFlowThread::contentLogicalHeightOfFirstRegion() const
     654{
     655    if (!hasValidRegions())
     656        return 0;
     657    for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
     658        RenderRegion* region = *iter;
     659        if (!region->isValid())
     660            continue;
     661        return isHorizontalWritingMode() ? region->contentHeight() : region->contentWidth();
     662    }
     663    ASSERT_NOT_REACHED();
     664    return 0;
     665}
     666 
     667LayoutUnit RenderFlowThread::contentLogicalLeftOfFirstRegion() const
     668{
     669    if (!hasValidRegions())
     670        return 0;
     671    for (RenderRegionList::const_iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) {
     672        RenderRegion* region = *iter;
     673        if (!region->isValid())
     674            continue;
     675        return isHorizontalWritingMode() ? region->regionRect().x() : region->regionRect().y();
     676    }
     677    ASSERT_NOT_REACHED();
     678    return 0;
     679}
     680
    639681} // namespace WebCore
  • trunk/Source/WebCore/rendering/RenderFlowThread.h

    r96408 r96452  
    110110    void removeRenderBoxRegionInfo(RenderBox*);
    111111
     112    LayoutUnit contentLogicalWidthOfFirstRegion() const;
     113    LayoutUnit contentLogicalHeightOfFirstRegion() const;
     114    LayoutUnit contentLogicalLeftOfFirstRegion() const;
     115   
    112116private:
    113117    virtual const char* renderName() const { return "RenderFlowThread"; }
Note: See TracChangeset for help on using the changeset viewer.