Changeset 135851 in webkit


Ignore:
Timestamp:
Nov 27, 2012 5:23:10 AM (11 years ago)
Author:
mihnea@adobe.com
Message:

[CSS Regions] Absolutely positioned regions do not expand to fill their container
https://bugs.webkit.org/show_bug.cgi?id=102385

Reviewed by Julien Chaffraix.

Source/WebCore:

In the case of an absolutely positioned region with height auto, height computation should follow
the path of block elements instead of replaced elements.

Tests: fast/regions/autosize-abspos-anchoredregion-vertlr.html

fast/regions/autosize-abspos-anchoredregion.html

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::computePositionedLogicalHeight): Skip replaced element height computation when a region has height auto.

  • rendering/RenderRegion.h:

(WebCore::RenderRegion::shouldHaveAutoLogicalHeight): Make it private since it is not accessed from outside.

LayoutTests:

Added new tests for the case of an absolutely positioned region inside a container. The region is anchored and it should expand to the container limits
in the anchored direction.
Also modified expectations for another test that has absolutely positioned auto-height regions, which now have height computed properly.

  • fast/regions/autosize-abspos-anchoredregion-expected.txt: Added.
  • fast/regions/autosize-abspos-anchoredregion-vertlr-expected.txt: Added.
  • fast/regions/autosize-abspos-anchoredregion-vertlr.html: Added.
  • fast/regions/autosize-abspos-anchoredregion.html: Added.
  • platform/chromium/fast/regions/autoheight-regions-mark-expected.txt:
  • platform/efl/fast/regions/autoheight-regions-mark-expected.txt:
  • platform/gtk/fast/regions/autoheight-regions-mark-expected.txt:
  • platform/mac/fast/regions/autoheight-regions-mark-expected.txt:
  • platform/qt/fast/regions/autoheight-regions-mark-expected.txt:
Location:
trunk
Files:
4 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r135850 r135851  
     12012-11-27  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        [CSS Regions] Absolutely positioned regions do not expand to fill their container
     4        https://bugs.webkit.org/show_bug.cgi?id=102385
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        Added new tests for the case of an absolutely positioned region inside a container. The region is anchored and it should expand to the container limits
     9        in the anchored direction.
     10        Also modified expectations for another test that has absolutely positioned auto-height regions, which now have height computed properly.
     11
     12        * fast/regions/autosize-abspos-anchoredregion-expected.txt: Added.
     13        * fast/regions/autosize-abspos-anchoredregion-vertlr-expected.txt: Added.
     14        * fast/regions/autosize-abspos-anchoredregion-vertlr.html: Added.
     15        * fast/regions/autosize-abspos-anchoredregion.html: Added.
     16        * platform/chromium/fast/regions/autoheight-regions-mark-expected.txt:
     17        * platform/efl/fast/regions/autoheight-regions-mark-expected.txt:
     18        * platform/gtk/fast/regions/autoheight-regions-mark-expected.txt:
     19        * platform/mac/fast/regions/autoheight-regions-mark-expected.txt:
     20        * platform/qt/fast/regions/autoheight-regions-mark-expected.txt:
     21
    1222012-11-27  János Badics  <jbadics@inf.u-szeged.hu>
    223
  • trunk/LayoutTests/platform/chromium/fast/regions/autoheight-regions-mark-expected.txt

    r131694 r135851  
    88      RenderRegion {DIV} at (0,50) size 50x0
    99      RenderRegion {DIV} at (0,50) size 50x50
     10layer at (8,50) size 50x450
     11  RenderRegion {DIV} at (8,50) size 50x450
     12layer at (50,8) size 650x50
     13  RenderRegion {DIV} at (50,8) size 650x50
    1014Flow Threads
    1115  Thread with flow-name 'flow'
     
    1822    RenderRegion {DIV} #region2 hasAutoLogicalHeight
    1923  Thread with flow-name 'flow3'
     24    layer at (0,0) size 50x450
     25      RenderNamedFlowThread at (0,0) size 50x450
    2026  Regions for flow 'flow3'
    2127    RenderRegion {DIV} #region3
    2228  Thread with flow-name 'flow4'
     29    layer at (0,0) size 650x50
     30      RenderNamedFlowThread at (0,0) size 650x50
    2331  Regions for flow 'flow4'
    2432    RenderRegion {DIV} #region4
  • trunk/LayoutTests/platform/efl/fast/regions/autoheight-regions-mark-expected.txt

    r129395 r135851  
    88      RenderRegion {DIV} at (0,50) size 50x0
    99      RenderRegion {DIV} at (0,50) size 50x50
     10layer at (8,50) size 50x450
     11  RenderRegion {DIV} at (8,50) size 50x450
     12layer at (50,8) size 650x50
     13  RenderRegion {DIV} at (50,8) size 650x50
    1014Flow Threads
    1115  Thread with flow-name 'flow'
     
    1822    RenderRegion {DIV} #region2 hasAutoLogicalHeight
    1923  Thread with flow-name 'flow3'
     24    layer at (0,0) size 50x450
     25      RenderNamedFlowThread at (0,0) size 50x450
    2026  Regions for flow 'flow3'
    2127    RenderRegion {DIV} #region3
    2228  Thread with flow-name 'flow4'
     29    layer at (0,0) size 650x50
     30      RenderNamedFlowThread at (0,0) size 650x50
    2331  Regions for flow 'flow4'
    2432    RenderRegion {DIV} #region4
  • trunk/LayoutTests/platform/gtk/fast/regions/autoheight-regions-mark-expected.txt

    r129008 r135851  
    88      RenderRegion {DIV} at (0,50) size 50x0
    99      RenderRegion {DIV} at (0,50) size 50x50
     10layer at (8,50) size 50x450
     11  RenderRegion {DIV} at (8,50) size 50x450
     12layer at (50,8) size 650x50
     13  RenderRegion {DIV} at (50,8) size 650x50
    1014Flow Threads
    1115  Thread with flow-name 'flow'
     
    1822    RenderRegion {DIV} #region2 hasAutoLogicalHeight
    1923  Thread with flow-name 'flow3'
     24    layer at (0,0) size 50x450
     25      RenderNamedFlowThread at (0,0) size 50x450
    2026  Regions for flow 'flow3'
    2127    RenderRegion {DIV} #region3
    2228  Thread with flow-name 'flow4'
     29    layer at (0,0) size 650x50
     30      RenderNamedFlowThread at (0,0) size 650x50
    2331  Regions for flow 'flow4'
    2432    RenderRegion {DIV} #region4
  • trunk/LayoutTests/platform/mac/fast/regions/autoheight-regions-mark-expected.txt

    r128861 r135851  
    88      RenderRegion {DIV} at (0,50) size 50x0
    99      RenderRegion {DIV} at (0,50) size 50x50
     10layer at (8,50) size 50x450
     11  RenderRegion {DIV} at (8,50) size 50x450
     12layer at (50,8) size 650x50
     13  RenderRegion {DIV} at (50,8) size 650x50
    1014Flow Threads
    1115  Thread with flow-name 'flow'
     
    1822    RenderRegion {DIV} #region2 hasAutoLogicalHeight
    1923  Thread with flow-name 'flow3'
     24    layer at (0,0) size 50x450
     25      RenderNamedFlowThread at (0,0) size 50x450
    2026  Regions for flow 'flow3'
    2127    RenderRegion {DIV} #region3
    2228  Thread with flow-name 'flow4'
     29    layer at (0,0) size 650x50
     30      RenderNamedFlowThread at (0,0) size 650x50
    2331  Regions for flow 'flow4'
    2432    RenderRegion {DIV} #region4
  • trunk/LayoutTests/platform/qt/fast/regions/autoheight-regions-mark-expected.txt

    r129126 r135851  
    88      RenderRegion {DIV} at (0,50) size 50x0
    99      RenderRegion {DIV} at (0,50) size 50x50
     10layer at (8,50) size 50x450
     11  RenderRegion {DIV} at (8,50) size 50x450
     12layer at (50,8) size 650x50
     13  RenderRegion {DIV} at (50,8) size 650x50
    1014Flow Threads
    1115  Thread with flow-name 'flow'
     
    1822    RenderRegion {DIV} #region2 hasAutoLogicalHeight
    1923  Thread with flow-name 'flow3'
     24    layer at (0,0) size 50x450
     25      RenderNamedFlowThread at (0,0) size 50x450
    2026  Regions for flow 'flow3'
    2127    RenderRegion {DIV} #region3
    2228  Thread with flow-name 'flow4'
     29    layer at (0,0) size 650x50
     30      RenderNamedFlowThread at (0,0) size 650x50
    2331  Regions for flow 'flow4'
    2432    RenderRegion {DIV} #region4
  • trunk/Source/WebCore/ChangeLog

    r135848 r135851  
     12012-11-27  Mihnea Ovidenie  <mihnea@adobe.com>
     2
     3        [CSS Regions] Absolutely positioned regions do not expand to fill their container
     4        https://bugs.webkit.org/show_bug.cgi?id=102385
     5
     6        Reviewed by Julien Chaffraix.
     7
     8        In the case of an absolutely positioned region with height auto, height computation should follow
     9        the path of block elements instead of replaced elements.
     10
     11        Tests: fast/regions/autosize-abspos-anchoredregion-vertlr.html
     12               fast/regions/autosize-abspos-anchoredregion.html
     13
     14        * rendering/RenderBox.cpp:
     15        (WebCore::RenderBox::computePositionedLogicalHeight): Skip replaced element height computation when a region has height auto.
     16        * rendering/RenderRegion.h:
     17        (WebCore::RenderRegion::shouldHaveAutoLogicalHeight): Make it private since it is not accessed from outside.
     18
    1192012-11-27  Alexander Pavlov  <apavlov@chromium.org>
    220
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r135741 r135851  
    29622962{
    29632963    if (isReplaced()) {
    2964         computePositionedLogicalHeightReplaced(computedValues);
    2965         return;
     2964        // FIXME: For regions with height auto, we want to compute width using the normal block sizing code.
     2965        // For now, regions are replaced elements and this code can be removed once the RenderRegion
     2966        // will inherit from RenderBlock instead of RenderReplaced.
     2967        // (see https://bugs.webkit.org/show_bug.cgi?id=74132 )
     2968        if (!isRenderRegion() || (isRenderRegion() && shouldComputeSizeAsReplaced())) {
     2969            computePositionedLogicalHeightReplaced(computedValues);
     2970            return;
     2971        }
    29662972    }
    29672973
  • trunk/Source/WebCore/rendering/RenderRegion.h

    r134425 r135851  
    115115    virtual LayoutUnit logicalHeightOfAllFlowThreadContent() const;
    116116
     117    bool hasAutoLogicalHeight() const { return m_hasAutoLogicalHeight; }
     118
     119    bool needsOverrideLogicalContentHeightComputation() const;
     120
     121    virtual void updateLogicalHeight() OVERRIDE;
     122
     123    // The top of the nearest page inside the region. For RenderRegions, this is just the logical top of the
     124    // flow thread portion we contain. For sets, we have to figure out the top of the nearest column or
     125    // page.
     126    virtual LayoutUnit pageLogicalTopForOffset(LayoutUnit offset) const;
     127   
     128    virtual void expandToEncompassFlowThreadContentsIfNeeded() { };
     129
     130    // Whether or not this region is a set.
     131    virtual bool isRenderRegionSet() const { return false; }
     132   
     133    virtual void repaintFlowThreadContent(const LayoutRect& repaintRect, bool immediate) const;
     134
     135protected:
     136    void setRegionObjectsRegionStyle();
     137    void restoreRegionObjectsOriginalStyle();
     138
     139    LayoutRect overflowRectForFlowThreadPortion(LayoutRect flowThreadPortionRect, bool isFirstPortion, bool isLastPortion) const;
     140    void repaintFlowThreadContentRectangle(const LayoutRect& repaintRect, bool immediate, const LayoutRect& flowThreadPortionRect,
     141        const LayoutRect& flowThreadPortionOverflowRect, const LayoutPoint& regionLocation) const;
     142
     143private:
     144    virtual const char* renderName() const { return "RenderRegion"; }
     145
     146    // FIXME: these functions should be revisited once RenderRegion inherits from RenderBlock
     147    // instead of RenderReplaced (see https://bugs.webkit.org/show_bug.cgi?id=74132 )
     148    // When width is auto, use normal block/box sizing code except when inline.
     149    virtual bool isInlineBlockOrInlineTable() const OVERRIDE { return isInline() && !shouldComputeSizeAsReplaced(); }
     150    virtual bool shouldComputeSizeAsReplaced() const OVERRIDE { return !style()->logicalWidth().isAuto() && !style()->logicalHeight().isAuto(); }
     151
    117152    bool shouldHaveAutoLogicalHeight() const
    118153    {
     
    121156        return style()->logicalHeight().isAuto() && !hasAnchoredEndpointsForHeight;
    122157    }
    123     bool hasAutoLogicalHeight() const { return m_hasAutoLogicalHeight; }
    124 
    125     bool needsOverrideLogicalContentHeightComputation() const;
    126 
    127     virtual void updateLogicalHeight() OVERRIDE;
    128 
    129     // The top of the nearest page inside the region. For RenderRegions, this is just the logical top of the
    130     // flow thread portion we contain. For sets, we have to figure out the top of the nearest column or
    131     // page.
    132     virtual LayoutUnit pageLogicalTopForOffset(LayoutUnit offset) const;
    133    
    134     virtual void expandToEncompassFlowThreadContentsIfNeeded() { };
    135 
    136     // Whether or not this region is a set.
    137     virtual bool isRenderRegionSet() const { return false; }
    138    
    139     virtual void repaintFlowThreadContent(const LayoutRect& repaintRect, bool immediate) const;
    140 
    141 protected:
    142     void setRegionObjectsRegionStyle();
    143     void restoreRegionObjectsOriginalStyle();
    144 
    145     LayoutRect overflowRectForFlowThreadPortion(LayoutRect flowThreadPortionRect, bool isFirstPortion, bool isLastPortion) const;
    146     void repaintFlowThreadContentRectangle(const LayoutRect& repaintRect, bool immediate, const LayoutRect& flowThreadPortionRect,
    147         const LayoutRect& flowThreadPortionOverflowRect, const LayoutPoint& regionLocation) const;
    148 
    149 private:
    150     virtual const char* renderName() const { return "RenderRegion"; }
    151 
    152     // FIXME: these functions should be revisited once RenderRegion inherits from RenderBlock
    153     // instead of RenderReplaced (see https://bugs.webkit.org/show_bug.cgi?id=74132 )
    154     // When width is auto, use normal block/box sizing code except when inline.
    155     virtual bool isInlineBlockOrInlineTable() const OVERRIDE { return isInline() && style()->logicalWidth().isAuto(); }
    156     virtual bool shouldComputeSizeAsReplaced() const OVERRIDE { return !style()->logicalWidth().isAuto(); }
    157158
    158159    virtual void insertedIntoTree() OVERRIDE;
Note: See TracChangeset for help on using the changeset viewer.