Changeset 96159 in webkit


Ignore:
Timestamp:
Sep 27, 2011 2:45:54 PM (13 years ago)
Author:
ojan@chromium.org
Message:

take padding/border on flexbox into account with direction:rtl
https://bugs.webkit.org/show_bug.cgi?id=68846

Reviewed by David Hyatt.

Source/WebCore:

Use the logicalWidth of the flexbox instead of it's availableLogicalWidth
so that we include the flexbox's border and padding.

Also, change all uses of availableLogicalWidth to contentLogicalWidth.
The former takes multi-column into account. Multi-column flexboxes don't
make any sense, so there's no point in calling availableLogicalWidth.

  • rendering/RenderFlexibleBox.cpp:

(WebCore::RenderFlexibleBox::flowAwareLogicalWidth):
(WebCore::RenderFlexibleBox::flowAwareContentLogicalWidth):
(WebCore::RenderFlexibleBox::computePreferredLogicalWidth):
(WebCore::RenderFlexibleBox::runFreeSpaceAllocationAlgorithmInlineDirection):
(WebCore::RenderFlexibleBox::layoutAndPlaceChildrenInlineDirection):

  • rendering/RenderFlexibleBox.h:

LayoutTests:

  • css3/flexbox/writing-modes-expected.txt:
  • css3/flexbox/writing-modes.html:
Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r96158 r96159  
     12011-09-27  Ojan Vafai  <ojan@chromium.org>
     2
     3        take padding/border on flexbox into account with direction:rtl
     4        https://bugs.webkit.org/show_bug.cgi?id=68846
     5
     6        Reviewed by David Hyatt.
     7
     8        * css3/flexbox/writing-modes-expected.txt:
     9        * css3/flexbox/writing-modes.html:
     10
    1112011-09-27  Mihai Parparita  <mihaip@chromium.org>
    212
  • trunk/LayoutTests/css3/flexbox/writing-modes-expected.txt

    r96152 r96159  
     1PASS
     2PASS
    13PASS
    24PASS
  • trunk/LayoutTests/css3/flexbox/writing-modes.html

    r96152 r96159  
    88    width: 600px;
    99    display: -webkit-flexbox;
     10    background-color: grey;
    1011}
    1112.flexbox div {
     
    175176</div>
    176177
     178<div style="position: relative;">
     179    <div data-expected-width="600" style="direction: rtl; display: -webkit-flexbox; margin-left: 10px; margin-right:20px;" class="flexbox">
     180      <div data-expected-width="50" data-offset-x="510" style="width: -webkit-flex(1 0 0); margin: 0 auto;"></div>
     181      <div data-expected-width="300" data-offset-x="160" style="width: -webkit-flex(2 0 0); padding: 0 100px;"></div>
     182      <div data-expected-width="50" data-offset-x="10" style="width: -webkit-flex(1 0 0);margin-right: 100px;"></div>
     183    </div>
     184</div>
     185
     186<div style="position: relative;">
     187    <div data-expected-width="700" style="direction: rtl; display: -webkit-flexbox; padding-left: 10px; padding-right: 20px; border-style: solid; border-left: 30px solid; border-right: 40px solid;" class="flexbox ">
     188      <div data-expected-width="50" data-offset-x="540" style="width: -webkit-flex(1 0 0); margin: 0 auto;"></div>
     189      <div data-expected-width="300" data-offset-x="190" style="width: -webkit-flex(2 0 0); padding: 0 100px;"></div>
     190      <div data-expected-width="50" data-offset-x="40" style="width: -webkit-flex(1 0 0);margin-right: 100px;"></div>
     191    </div>
     192</div>
     193
    177194</body>
    178195</html>
  • trunk/Source/WebCore/ChangeLog

    r96157 r96159  
     12011-09-27  Ojan Vafai  <ojan@chromium.org>
     2
     3        take padding/border on flexbox into account with direction:rtl
     4        https://bugs.webkit.org/show_bug.cgi?id=68846
     5
     6        Reviewed by David Hyatt.
     7
     8        Use the logicalWidth of the flexbox instead of it's availableLogicalWidth
     9        so that we include the flexbox's border and padding.
     10       
     11        Also, change all uses of availableLogicalWidth to contentLogicalWidth.
     12        The former takes multi-column into account. Multi-column flexboxes don't
     13        make any sense, so there's no point in calling availableLogicalWidth.
     14
     15        * rendering/RenderFlexibleBox.cpp:
     16        (WebCore::RenderFlexibleBox::flowAwareLogicalWidth):
     17        (WebCore::RenderFlexibleBox::flowAwareContentLogicalWidth):
     18        (WebCore::RenderFlexibleBox::computePreferredLogicalWidth):
     19        (WebCore::RenderFlexibleBox::runFreeSpaceAllocationAlgorithmInlineDirection):
     20        (WebCore::RenderFlexibleBox::layoutAndPlaceChildrenInlineDirection):
     21        * rendering/RenderFlexibleBox.h:
     22
    1232011-09-27  Sheriff Bot  <webkit.review.bot@gmail.com>
    224
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp

    r95901 r96159  
    230230}
    231231
     232LayoutUnit RenderFlexibleBox::flowAwareLogicalWidth() const
     233{
     234    return logicalWidth();
     235}
     236
    232237LayoutUnit RenderFlexibleBox::flowAwareContentLogicalWidth() const
    233238{
    234239    return contentLogicalWidth();
    235 }
    236 
    237 LayoutUnit RenderFlexibleBox::flowAwareAvailableLogicalWidth() const
    238 {
    239     return availableLogicalWidth();
    240240}
    241241
     
    375375    totalPositiveFlexibility = totalNegativeFlexibility = 0;
    376376
    377     LayoutUnit flexboxAvailableLogicalWidth = flowAwareAvailableLogicalWidth();
     377    LayoutUnit flexboxAvailableLogicalWidth = flowAwareContentLogicalWidth();
    378378    for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
    379379        // We always have to lay out flexible objects again, since the flex distribution
     
    411411    childSizes.clear();
    412412
    413     LayoutUnit flexboxAvailableLogicalWidth = flowAwareAvailableLogicalWidth();
     413    LayoutUnit flexboxAvailableLogicalWidth = flowAwareContentLogicalWidth();
    414414    for (RenderBox* child = iterator.first(); child; child = iterator.next()) {
    415415        LayoutUnit childPreferredSize;
     
    475475
    476476    LayoutUnit logicalTop = flowAwareBorderBefore() + flowAwarePaddingBefore();
    477     LayoutUnit totalAvailableLogicalWidth = flowAwareAvailableLogicalWidth();
     477    LayoutUnit totalLogicalWidth = flowAwareLogicalWidth();
    478478    setFlowAwareLogicalHeight(0);
    479479    size_t i = 0;
     
    495495
    496496        LayoutUnit childLogicalWidth = flowAwareLogicalWidthForChild(child);
    497         LayoutUnit logicalLeft = isLeftToRightFlow() ? startEdge : totalAvailableLogicalWidth - startEdge - childLogicalWidth;
     497        LayoutUnit logicalLeft = isLeftToRightFlow() ? startEdge : totalLogicalWidth - startEdge - childLogicalWidth;
    498498        // FIXME: Do repaintDuringLayoutIfMoved.
    499499        // FIXME: Supporting layout deltas.
  • trunk/Source/WebCore/rendering/RenderFlexibleBox.h

    r95901 r96159  
    6161    LayoutUnit flowAwareLogicalWidthForChild(RenderBox* child);
    6262    LayoutUnit flowAwareLogicalHeight() const;
     63    LayoutUnit flowAwareLogicalWidth() const;
    6364    LayoutUnit flowAwareContentLogicalWidth() const;
    64     LayoutUnit flowAwareAvailableLogicalWidth() const;
    6565    LayoutUnit flowAwareBorderStart() const;
    6666    LayoutUnit flowAwareBorderBefore() const;
Note: See TracChangeset for help on using the changeset viewer.