[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

hyatt at apple.com hyatt at apple.com
Wed Dec 22 13:46:55 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit c41de223fae9e7a5dbfa210e2856ed872a00f137
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Sep 27 02:09:36 2010 +0000

    https://bugs.webkit.org/show_bug.cgi?id=46519
    
    Reviewed by Sam Weinig.
    
    Convert the implementation of computeLogicalWidth to work with block-flow.
    
    WebCore:
    
    * rendering/RenderBlock.cpp:
    (WebCore::RenderBlock::determineHorizontalPosition):
    Patched to call the new computeMarginsInContainingBlockInlineDirection.  Eventually determineHorizontalPosition will
    be placing children along the inline direction of the containing block, and those children may have mismatched
    block flows.  The new computeMarginsInContainingBlockInlineDirection function is designed to handle that.
    
    * rendering/RenderBox.cpp:
    (WebCore::RenderBox::marginStart):
    (WebCore::RenderBox::marginStartUsing):
    (WebCore::RenderBox::marginEnd):
    (WebCore::RenderBox::marginEndUsing):
    (WebCore::RenderBox::setMarginStart):
    (WebCore::RenderBox::setMarginEnd):
    (WebCore::RenderBox::setMarginStartUsing):
    (WebCore::RenderBox::setMarginEndUsing):
    Helpers that allow for marginStart/End access and that also allow for marginStart/End to be computed based off another
    element's block-flow and direction (typically the containing block).
    
    (WebCore::RenderBox::computeBorderBoxLogicalWidth):
    (WebCore::RenderBox::computeBorderBoxLogicalHeight):
    (WebCore::RenderBox::computeContentBoxLogicalWidth):
    (WebCore::RenderBox::computeContentBoxLogicalHeight):
    Patched to use logical border/padding widths and heights.
    
    (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight):
    A function for returning the available logical height of a perpendicular containing block.  If a child has vertical
    text for example and its block-flow is "lr", its available logical width is determined by the logical
    height of the containing block when that containing block is perpendicular, e.g. "tb".
    
    (WebCore::RenderBox::computeLogicalWidth):
    (WebCore::RenderBox::computeLogicalWidthUsing):
    Patched to be block-flow-aware and to use logical width values everywhere.
    
    (WebCore::RenderBox::sizesToIntrinsicLogicalWidth):
    Patched to use logical widths.
    
    (WebCore::RenderBox::computeMarginsInContainingBlockInlineDirection):
    A new function that is directionally abstract and that can handle the computation of margins in the containing
    block's inline direction.  This function is written such that a perpendicular child block flow can still be
    pushed to the center, left or right in the containing block's inline direction.
    
    (WebCore::RenderBox::computePositionedLogicalWidth):
    This function is still largely unpatched.  A future patch will address positioend elements.
    
    * rendering/RenderBox.h:
    (WebCore::RenderBox::stretchesToMinIntrinsicLogicalWidth):
    * rendering/RenderFieldset.h:
    (WebCore::RenderFieldset::stretchesToMinIntrinsicLogicalWidth):
    Renames.
    
    * rendering/RenderTable.cpp:
    (WebCore::RenderTable::computeLogicalWidth):
    Renames, but not converted yet. Tables will happen in a future patch.
    
    * rendering/style/RenderStyle.cpp:
    (WebCore::RenderStyle::marginStartUsing):
    (WebCore::RenderStyle::marginEndUsing):
    * rendering/style/RenderStyle.h:
    Added helpers for accessing marginStart and End using another style's direction and block flow (typically will
    be the containing block's).
    
    fast/block/basic/016.html changed, since centering now always awards the extra pixel for odd widths to the end margin
    instead of the right margin.  This is a progression.
    
    fast/css/logical-property-values.html is now reporting garbage results, which is expected now that some of the core layout
    functions have been patched.
    
    Horizontal block flows are untestable still, since the normal layout process incorrectly blows away any computed height values.
    
    LayoutTests:
    
    * fast/css/logical-property-resolution-expected.txt:
    * platform/mac/fast/block/basic/016-expected.checksum:
    * platform/mac/fast/block/basic/016-expected.png:
    * platform/mac/fast/block/basic/016-expected.txt:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68362 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index d74097d..b90982c 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-09-24  David Hyatt  <hyatt at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=46519
+
+        Convert the implementation of computeLogicalWidth to work with block-flow.
+
+        * fast/css/logical-property-resolution-expected.txt:
+        * platform/mac/fast/block/basic/016-expected.checksum:
+        * platform/mac/fast/block/basic/016-expected.png:
+        * platform/mac/fast/block/basic/016-expected.txt:
+
 2010-09-26  Antonio Gomes  <agomes at rim.com>
 
         Reviewed by Kenneth Rohde Christiansen.
diff --git a/LayoutTests/fast/css/logical-property-resolution-expected.txt b/LayoutTests/fast/css/logical-property-resolution-expected.txt
index e2623a7..06995bc 100644
--- a/LayoutTests/fast/css/logical-property-resolution-expected.txt
+++ b/LayoutTests/fast/css/logical-property-resolution-expected.txt
@@ -12,16 +12,16 @@ Borders: 3px dashed rgb(255, 255, 0), 2px dotted rgb(0, 128, 0), 1px solid rgb(0
 Width: 100px
 Height: 50px
 Block #3:
-Margins: 4px 3px 2px 1px
+Margins: 4px 0px 2px 0px
 Padding: 1px 2px 3px 4px
 Borders: 4px double rgb(128, 0, 128), 3px dashed rgb(255, 255, 0), 2px dotted rgb(0, 128, 0), 1px solid rgb(0, 0, 0)
-Width: 100px
+Width: -10px
 Height: 100px
 Block #4:
-Margins: 4px 1px 2px 3px
+Margins: 4px 0px 2px 0px
 Padding: 1px 4px 3px 2px
 Borders: 4px double rgb(128, 0, 128), 1px solid rgb(0, 0, 0), 2px dotted rgb(0, 128, 0), 3px dashed rgb(255, 255, 0)
-Width: 100px
+Width: -10px
 Height: 100px
 Block #5:
 Margins: 1px 4px 3px 2px
@@ -36,15 +36,15 @@ Borders: 3px dashed rgb(255, 255, 0), 4px double rgb(128, 0, 128), 1px solid rgb
 Width: 100px
 Height: 50px
 Block #7:
-Margins: 2px 3px 4px 1px
+Margins: 2px 0px 4px 0px
 Padding: 3px 2px 1px 4px
 Borders: 2px dotted rgb(0, 128, 0), 3px dashed rgb(255, 255, 0), 4px double rgb(128, 0, 128), 1px solid rgb(0, 0, 0)
-Width: 100px
+Width: -10px
 Height: 100px
 Block #8:
-Margins: 2px 1px 4px 3px
+Margins: 2px 0px 4px 0px
 Padding: 3px 4px 1px 2px
 Borders: 2px dotted rgb(0, 128, 0), 1px solid rgb(0, 0, 0), 4px double rgb(128, 0, 128), 3px dashed rgb(255, 255, 0)
-Width: 100px
+Width: -10px
 Height: 100px
 
diff --git a/LayoutTests/platform/mac/fast/block/basic/016-expected.checksum b/LayoutTests/platform/mac/fast/block/basic/016-expected.checksum
index 4d799ad..120c04d 100644
--- a/LayoutTests/platform/mac/fast/block/basic/016-expected.checksum
+++ b/LayoutTests/platform/mac/fast/block/basic/016-expected.checksum
@@ -1 +1 @@
-a994da722c74db37d5da1275ced8ba84
\ No newline at end of file
+753abc3309493eb5fc05e2089ef01b34
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/block/basic/016-expected.png b/LayoutTests/platform/mac/fast/block/basic/016-expected.png
index 6ed3a5e..9ea6f05 100644
Binary files a/LayoutTests/platform/mac/fast/block/basic/016-expected.png and b/LayoutTests/platform/mac/fast/block/basic/016-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/block/basic/016-expected.txt b/LayoutTests/platform/mac/fast/block/basic/016-expected.txt
index efee50c..15f6fc4 100644
--- a/LayoutTests/platform/mac/fast/block/basic/016-expected.txt
+++ b/LayoutTests/platform/mac/fast/block/basic/016-expected.txt
@@ -613,7 +613,7 @@ layer at (0,0) size 785x7588
                   RenderText {#text} at (1,1) size 86x18
                     text run at (1,1) width 4 RTL: "."
                     text run at (5,1) width 82: "Normal table"
-          RenderTable {TABLE} at (312,164) size 140x28 [border: (2px solid #0000FF)]
+          RenderTable {TABLE} at (313,164) size 140x28 [border: (2px solid #0000FF)]
             RenderTableSection {TBODY} at (2,2) size 136x24
               RenderTableRow {TR} at (0,2) size 136x20
                 RenderTableCell {TD} at (2,2) size 132x20 [r=0 c=0 rs=1 cs=1]
@@ -650,7 +650,7 @@ layer at (0,0) size 785x7588
                   RenderText {#text} at (305,1) size 86x18
                     text run at (305,1) width 4 RTL: "."
                     text run at (309,1) width 82: "Normal table"
-          RenderTable {TABLE} at (182,164) size 400x28 [border: (2px solid #0000FF)]
+          RenderTable {TABLE} at (183,164) size 400x28 [border: (2px solid #0000FF)]
             RenderTableSection {TBODY} at (2,2) size 396x24
               RenderTableRow {TR} at (0,2) size 396x20
                 RenderTableCell {TD} at (2,2) size 392x20 [r=0 c=0 rs=1 cs=1]
@@ -687,7 +687,7 @@ layer at (0,0) size 785x7588
                   RenderText {#text} at (1,1) size 86x18
                     text run at (1,1) width 4 RTL: "."
                     text run at (5,1) width 82: "Normal table"
-          RenderTable {TABLE} at (312,164) size 140x28 [border: (2px solid #0000FF)]
+          RenderTable {TABLE} at (313,164) size 140x28 [border: (2px solid #0000FF)]
             RenderTableSection {TBODY} at (2,2) size 136x24
               RenderTableRow {TR} at (0,2) size 136x20
                 RenderTableCell {TD} at (2,2) size 132x20 [r=0 c=0 rs=1 cs=1]
@@ -724,7 +724,7 @@ layer at (0,0) size 785x7588
                   RenderText {#text} at (305,1) size 86x18
                     text run at (305,1) width 4 RTL: "."
                     text run at (309,1) width 82: "Normal table"
-          RenderTable {TABLE} at (182,164) size 400x28 [border: (2px solid #0000FF)]
+          RenderTable {TABLE} at (183,164) size 400x28 [border: (2px solid #0000FF)]
             RenderTableSection {TBODY} at (2,2) size 396x24
               RenderTableRow {TR} at (0,2) size 396x20
                 RenderTableCell {TD} at (2,2) size 392x20 [r=0 c=0 rs=1 cs=1]
@@ -754,21 +754,21 @@ layer at (0,0) size 785x7588
           RenderBlock {CENTER} at (6,110) size 753x26 [border: (2px solid #0000FF)]
             RenderText {#text} at (270,4) size 212x18
               text run at (270,4) width 212: "Center tag inside align=center div"
-          RenderTable {TABLE} at (334,136) size 96x28 [border: (2px solid #0000FF)]
+          RenderTable {TABLE} at (335,136) size 96x28 [border: (2px solid #0000FF)]
             RenderTableSection {TBODY} at (2,2) size 92x24
               RenderTableRow {TR} at (0,2) size 92x20
                 RenderTableCell {TD} at (2,2) size 88x20 [r=0 c=0 rs=1 cs=1]
                   RenderText {#text} at (1,1) size 86x18
                     text run at (1,1) width 4 RTL: "."
                     text run at (5,1) width 82: "Normal table"
-          RenderTable {TABLE} at (312,164) size 140x28 [border: (2px solid #0000FF)]
+          RenderTable {TABLE} at (313,164) size 140x28 [border: (2px solid #0000FF)]
             RenderTableSection {TBODY} at (2,2) size 136x24
               RenderTableRow {TR} at (0,2) size 136x20
                 RenderTableCell {TD} at (2,2) size 132x20 [r=0 c=0 rs=1 cs=1]
                   RenderText {#text} at (1,1) size 130x18
                     text run at (1,1) width 4 RTL: "."
                     text run at (5,1) width 126: "Center aligned table"
-          RenderTable {TABLE} at (287,192) size 190x28 [border: (2px solid #0000FF)]
+          RenderTable {TABLE} at (288,192) size 190x28 [border: (2px solid #0000FF)]
             RenderTableSection {TBODY} at (2,2) size 186x24
               RenderTableRow {TR} at (0,2) size 186x20
                 RenderTableCell {TD} at (2,2) size 182x20 [r=0 c=0 rs=1 cs=1]
@@ -776,36 +776,36 @@ layer at (0,0) size 785x7588
                     text run at (1,1) width 9 RTL: ")."
                     text run at (10,1) width 171: "Center table (fixed margins"
         RenderBlock {DIV} at (2,1150) size 765x226 [border: (4px solid #800080)]
-          RenderBlock {DIV} at (178,6) size 408x26 [border: (2px solid #0000FF)]
+          RenderBlock {DIV} at (179,6) size 408x26 [border: (2px solid #0000FF)]
             RenderText {#text} at (56,4) size 295x18
               text run at (56,4) width 295: "Normal fixed width div inside align=center div"
-          RenderBlock {DIV} at (178,32) size 408x26 [border: (2px solid #0000FF)]
+          RenderBlock {DIV} at (179,32) size 408x26 [border: (2px solid #0000FF)]
             RenderText {#text} at (4,4) size 273x18
               text run at (4,4) width 273: "Left fixed width div inside align=center div"
-          RenderBlock {DIV} at (178,58) size 408x26 [border: (2px solid #0000FF)]
+          RenderBlock {DIV} at (179,58) size 408x26 [border: (2px solid #0000FF)]
             RenderText {#text} at (59,4) size 289x18
               text run at (59,4) width 289: "Center fixed width div inside align=center div"
-          RenderBlock {DIV} at (178,84) size 408x26 [border: (2px solid #0000FF)]
+          RenderBlock {DIV} at (179,84) size 408x26 [border: (2px solid #0000FF)]
             RenderText {#text} at (122,4) size 282x18
               text run at (122,4) width 282: "Right fixed width div inside align=center div"
-          RenderBlock {CENTER} at (178,110) size 408x26 [border: (2px solid #0000FF)]
+          RenderBlock {CENTER} at (179,110) size 408x26 [border: (2px solid #0000FF)]
             RenderText {#text} at (55,4) size 298x18
               text run at (55,4) width 298: "Center tag (fixed width) inside align=center div"
-          RenderTable {TABLE} at (182,136) size 400x28 [border: (2px solid #0000FF)]
+          RenderTable {TABLE} at (183,136) size 400x28 [border: (2px solid #0000FF)]
             RenderTableSection {TBODY} at (2,2) size 396x24
               RenderTableRow {TR} at (0,2) size 396x20
                 RenderTableCell {TD} at (2,2) size 392x20 [r=0 c=0 rs=1 cs=1]
                   RenderText {#text} at (305,1) size 86x18
                     text run at (305,1) width 4 RTL: "."
                     text run at (309,1) width 82: "Normal table"
-          RenderTable {TABLE} at (182,164) size 400x28 [border: (2px solid #0000FF)]
+          RenderTable {TABLE} at (183,164) size 400x28 [border: (2px solid #0000FF)]
             RenderTableSection {TBODY} at (2,2) size 396x24
               RenderTableRow {TR} at (0,2) size 396x20
                 RenderTableCell {TD} at (2,2) size 392x20 [r=0 c=0 rs=1 cs=1]
                   RenderText {#text} at (261,1) size 130x18
                     text run at (261,1) width 4 RTL: "."
                     text run at (265,1) width 126: "Center aligned table"
-          RenderTable {TABLE} at (182,192) size 400x28 [border: (2px solid #0000FF)]
+          RenderTable {TABLE} at (183,192) size 400x28 [border: (2px solid #0000FF)]
             RenderTableSection {TBODY} at (2,2) size 396x24
               RenderTableRow {TR} at (0,2) size 396x20
                 RenderTableCell {TD} at (2,2) size 392x20 [r=0 c=0 rs=1 cs=1]
@@ -835,7 +835,7 @@ layer at (0,0) size 785x7588
                   RenderText {#text} at (1,1) size 86x18
                     text run at (1,1) width 4 RTL: "."
                     text run at (5,1) width 82: "Normal table"
-          RenderTable {TABLE} at (312,164) size 140x28 [border: (2px solid #0000FF)]
+          RenderTable {TABLE} at (313,164) size 140x28 [border: (2px solid #0000FF)]
             RenderTableSection {TBODY} at (2,2) size 136x24
               RenderTableRow {TR} at (0,2) size 136x20
                 RenderTableCell {TD} at (2,2) size 132x20 [r=0 c=0 rs=1 cs=1]
@@ -872,7 +872,7 @@ layer at (0,0) size 785x7588
                   RenderText {#text} at (305,1) size 86x18
                     text run at (305,1) width 4 RTL: "."
                     text run at (309,1) width 82: "Normal table"
-          RenderTable {TABLE} at (182,164) size 400x28 [border: (2px solid #0000FF)]
+          RenderTable {TABLE} at (183,164) size 400x28 [border: (2px solid #0000FF)]
             RenderTableSection {TBODY} at (2,2) size 396x24
               RenderTableRow {TR} at (0,2) size 396x20
                 RenderTableCell {TD} at (2,2) size 392x20 [r=0 c=0 rs=1 cs=1]
@@ -916,7 +916,7 @@ layer at (0,0) size 785x7588
                         RenderText {#text} at (1,1) size 86x18
                           text run at (1,1) width 4 RTL: "."
                           text run at (5,1) width 82: "Normal table"
-                RenderTable {TABLE} at (308,163) size 140x28 [border: (2px solid #0000FF)]
+                RenderTable {TABLE} at (309,163) size 140x28 [border: (2px solid #0000FF)]
                   RenderTableSection {TBODY} at (2,2) size 136x24
                     RenderTableRow {TR} at (0,2) size 136x20
                       RenderTableCell {TD} at (2,2) size 132x20 [r=0 c=0 rs=1 cs=1]
@@ -956,7 +956,7 @@ layer at (0,0) size 785x7588
                         RenderText {#text} at (305,1) size 86x18
                           text run at (305,1) width 4 RTL: "."
                           text run at (309,1) width 82: "Normal table"
-                RenderTable {TABLE} at (178,163) size 400x28 [border: (2px solid #0000FF)]
+                RenderTable {TABLE} at (179,163) size 400x28 [border: (2px solid #0000FF)]
                   RenderTableSection {TBODY} at (2,2) size 396x24
                     RenderTableRow {TR} at (0,2) size 396x20
                       RenderTableCell {TD} at (2,2) size 392x20 [r=0 c=0 rs=1 cs=1]
@@ -996,7 +996,7 @@ layer at (0,0) size 785x7588
                         RenderText {#text} at (1,1) size 86x18
                           text run at (1,1) width 4 RTL: "."
                           text run at (5,1) width 82: "Normal table"
-                RenderTable {TABLE} at (308,163) size 140x28 [border: (2px solid #0000FF)]
+                RenderTable {TABLE} at (309,163) size 140x28 [border: (2px solid #0000FF)]
                   RenderTableSection {TBODY} at (2,2) size 136x24
                     RenderTableRow {TR} at (0,2) size 136x20
                       RenderTableCell {TD} at (2,2) size 132x20 [r=0 c=0 rs=1 cs=1]
@@ -1036,7 +1036,7 @@ layer at (0,0) size 785x7588
                         RenderText {#text} at (305,1) size 86x18
                           text run at (305,1) width 4 RTL: "."
                           text run at (309,1) width 82: "Normal table"
-                RenderTable {TABLE} at (178,163) size 400x28 [border: (2px solid #0000FF)]
+                RenderTable {TABLE} at (179,163) size 400x28 [border: (2px solid #0000FF)]
                   RenderTableSection {TBODY} at (2,2) size 396x24
                     RenderTableRow {TR} at (0,2) size 396x20
                       RenderTableCell {TD} at (2,2) size 392x20 [r=0 c=0 rs=1 cs=1]
@@ -1069,21 +1069,21 @@ layer at (0,0) size 785x7588
                 RenderBlock {CENTER} at (5,109) size 747x26 [border: (2px solid #0000FF)]
                   RenderText {#text} at (271,4) size 204x18
                     text run at (271,4) width 204: "Center tag inside align=center td"
-                RenderTable {TABLE} at (330,135) size 96x28 [border: (2px solid #0000FF)]
+                RenderTable {TABLE} at (331,135) size 96x28 [border: (2px solid #0000FF)]
                   RenderTableSection {TBODY} at (2,2) size 92x24
                     RenderTableRow {TR} at (0,2) size 92x20
                       RenderTableCell {TD} at (2,2) size 88x20 [r=0 c=0 rs=1 cs=1]
                         RenderText {#text} at (1,1) size 86x18
                           text run at (1,1) width 4 RTL: "."
                           text run at (5,1) width 82: "Normal table"
-                RenderTable {TABLE} at (308,163) size 140x28 [border: (2px solid #0000FF)]
+                RenderTable {TABLE} at (309,163) size 140x28 [border: (2px solid #0000FF)]
                   RenderTableSection {TBODY} at (2,2) size 136x24
                     RenderTableRow {TR} at (0,2) size 136x20
                       RenderTableCell {TD} at (2,2) size 132x20 [r=0 c=0 rs=1 cs=1]
                         RenderText {#text} at (1,1) size 130x18
                           text run at (1,1) width 4 RTL: "."
                           text run at (5,1) width 126: "Center aligned table"
-                RenderTable {TABLE} at (283,191) size 190x28 [border: (2px solid #0000FF)]
+                RenderTable {TABLE} at (284,191) size 190x28 [border: (2px solid #0000FF)]
                   RenderTableSection {TBODY} at (2,2) size 186x24
                     RenderTableRow {TR} at (0,2) size 186x20
                       RenderTableCell {TD} at (2,2) size 182x20 [r=0 c=0 rs=1 cs=1]
@@ -1094,36 +1094,36 @@ layer at (0,0) size 785x7588
           RenderTableSection {TBODY} at (2,2) size 761x228
             RenderTableRow {TR} at (0,2) size 761x224
               RenderTableCell {TD} at (2,2) size 757x224 [border: (4px solid #800080)] [r=0 c=0 rs=1 cs=1]
-                RenderBlock {DIV} at (174,5) size 408x26 [border: (2px solid #0000FF)]
+                RenderBlock {DIV} at (175,5) size 408x26 [border: (2px solid #0000FF)]
                   RenderText {#text} at (60,4) size 287x18
                     text run at (60,4) width 287: "Normal fixed width div inside align=center td"
-                RenderBlock {DIV} at (174,31) size 408x26 [border: (2px solid #0000FF)]
+                RenderBlock {DIV} at (175,31) size 408x26 [border: (2px solid #0000FF)]
                   RenderText {#text} at (4,4) size 265x18
                     text run at (4,4) width 265: "Left fixed width div inside align=center td"
-                RenderBlock {DIV} at (174,57) size 408x26 [border: (2px solid #0000FF)]
+                RenderBlock {DIV} at (175,57) size 408x26 [border: (2px solid #0000FF)]
                   RenderText {#text} at (63,4) size 281x18
                     text run at (63,4) width 281: "Center fixed width div inside align=center td"
-                RenderBlock {DIV} at (174,83) size 408x26 [border: (2px solid #0000FF)]
+                RenderBlock {DIV} at (175,83) size 408x26 [border: (2px solid #0000FF)]
                   RenderText {#text} at (130,4) size 274x18
                     text run at (130,4) width 274: "Right fixed width div inside align=center td"
-                RenderBlock {CENTER} at (174,109) size 408x26 [border: (2px solid #0000FF)]
+                RenderBlock {CENTER} at (175,109) size 408x26 [border: (2px solid #0000FF)]
                   RenderText {#text} at (59,4) size 290x18
                     text run at (59,4) width 290: "Center tag (fixed width) inside align=center td"
-                RenderTable {TABLE} at (178,135) size 400x28 [border: (2px solid #0000FF)]
+                RenderTable {TABLE} at (179,135) size 400x28 [border: (2px solid #0000FF)]
                   RenderTableSection {TBODY} at (2,2) size 396x24
                     RenderTableRow {TR} at (0,2) size 396x20
                       RenderTableCell {TD} at (2,2) size 392x20 [r=0 c=0 rs=1 cs=1]
                         RenderText {#text} at (305,1) size 86x18
                           text run at (305,1) width 4 RTL: "."
                           text run at (309,1) width 82: "Normal table"
-                RenderTable {TABLE} at (178,163) size 400x28 [border: (2px solid #0000FF)]
+                RenderTable {TABLE} at (179,163) size 400x28 [border: (2px solid #0000FF)]
                   RenderTableSection {TBODY} at (2,2) size 396x24
                     RenderTableRow {TR} at (0,2) size 396x20
                       RenderTableCell {TD} at (2,2) size 392x20 [r=0 c=0 rs=1 cs=1]
                         RenderText {#text} at (261,1) size 130x18
                           text run at (261,1) width 4 RTL: "."
                           text run at (265,1) width 126: "Center aligned table"
-                RenderTable {TABLE} at (178,191) size 400x28 [border: (2px solid #0000FF)]
+                RenderTable {TABLE} at (179,191) size 400x28 [border: (2px solid #0000FF)]
                   RenderTableSection {TBODY} at (2,2) size 396x24
                     RenderTableRow {TR} at (0,2) size 396x20
                       RenderTableCell {TD} at (2,2) size 392x20 [r=0 c=0 rs=1 cs=1]
@@ -1156,7 +1156,7 @@ layer at (0,0) size 785x7588
                         RenderText {#text} at (1,1) size 86x18
                           text run at (1,1) width 4 RTL: "."
                           text run at (5,1) width 82: "Normal table"
-                RenderTable {TABLE} at (308,163) size 140x28 [border: (2px solid #0000FF)]
+                RenderTable {TABLE} at (309,163) size 140x28 [border: (2px solid #0000FF)]
                   RenderTableSection {TBODY} at (2,2) size 136x24
                     RenderTableRow {TR} at (0,2) size 136x20
                       RenderTableCell {TD} at (2,2) size 132x20 [r=0 c=0 rs=1 cs=1]
@@ -1196,7 +1196,7 @@ layer at (0,0) size 785x7588
                         RenderText {#text} at (305,1) size 86x18
                           text run at (305,1) width 4 RTL: "."
                           text run at (309,1) width 82: "Normal table"
-                RenderTable {TABLE} at (178,163) size 400x28 [border: (2px solid #0000FF)]
+                RenderTable {TABLE} at (179,163) size 400x28 [border: (2px solid #0000FF)]
                   RenderTableSection {TBODY} at (2,2) size 396x24
                     RenderTableRow {TR} at (0,2) size 396x20
                       RenderTableCell {TD} at (2,2) size 392x20 [r=0 c=0 rs=1 cs=1]
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9a691ed..901a80a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,80 @@
+2010-09-26  David Hyatt  <hyatt at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        https://bugs.webkit.org/show_bug.cgi?id=46519
+
+        Convert the implementation of computeLogicalWidth to work with block-flow.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::determineHorizontalPosition):
+        Patched to call the new computeMarginsInContainingBlockInlineDirection.  Eventually determineHorizontalPosition will
+        be placing children along the inline direction of the containing block, and those children may have mismatched
+        block flows.  The new computeMarginsInContainingBlockInlineDirection function is designed to handle that.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::marginStart):
+        (WebCore::RenderBox::marginStartUsing):
+        (WebCore::RenderBox::marginEnd):
+        (WebCore::RenderBox::marginEndUsing):
+        (WebCore::RenderBox::setMarginStart):
+        (WebCore::RenderBox::setMarginEnd):
+        (WebCore::RenderBox::setMarginStartUsing):
+        (WebCore::RenderBox::setMarginEndUsing):
+        Helpers that allow for marginStart/End access and that also allow for marginStart/End to be computed based off another
+        element's block-flow and direction (typically the containing block).
+        
+        (WebCore::RenderBox::computeBorderBoxLogicalWidth):
+        (WebCore::RenderBox::computeBorderBoxLogicalHeight):
+        (WebCore::RenderBox::computeContentBoxLogicalWidth):
+        (WebCore::RenderBox::computeContentBoxLogicalHeight):
+        Patched to use logical border/padding widths and heights.
+
+        (WebCore::RenderBox::perpendicularContainingBlockLogicalHeight):
+        A function for returning the available logical height of a perpendicular containing block.  If a child has vertical
+        text for example and its block-flow is "lr", its available logical width is determined by the logical
+        height of the containing block when that containing block is perpendicular, e.g. "tb".
+        
+        (WebCore::RenderBox::computeLogicalWidth):
+        (WebCore::RenderBox::computeLogicalWidthUsing):
+        Patched to be block-flow-aware and to use logical width values everywhere.
+    
+        (WebCore::RenderBox::sizesToIntrinsicLogicalWidth):
+        Patched to use logical widths.
+        
+        (WebCore::RenderBox::computeMarginsInContainingBlockInlineDirection):
+        A new function that is directionally abstract and that can handle the computation of margins in the containing
+        block's inline direction.  This function is written such that a perpendicular child block flow can still be 
+        pushed to the center, left or right in the containing block's inline direction.
+        
+        (WebCore::RenderBox::computePositionedLogicalWidth):
+        This function is still largely unpatched.  A future patch will address positioend elements.
+        
+        * rendering/RenderBox.h:
+        (WebCore::RenderBox::stretchesToMinIntrinsicLogicalWidth):
+        * rendering/RenderFieldset.h:
+        (WebCore::RenderFieldset::stretchesToMinIntrinsicLogicalWidth):
+        Renames.
+        
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::computeLogicalWidth):
+        Renames, but not converted yet. Tables will happen in a future patch.
+        
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::marginStartUsing):
+        (WebCore::RenderStyle::marginEndUsing):
+        * rendering/style/RenderStyle.h:
+        Added helpers for accessing marginStart and End using another style's direction and block flow (typically will
+        be the containing block's).
+
+        fast/block/basic/016.html changed, since centering now always awards the extra pixel for odd widths to the end margin
+        instead of the right margin.  This is a progression.
+        
+        fast/css/logical-property-values.html is now reporting garbage results, which is expected now that some of the core layout
+        functions have been patched.
+
+        Horizontal block flows are untestable still, since the normal layout process incorrectly blows away any computed height values.
+
 2010-09-26  Antonio Gomes  <agomes at rim.comg>
 
         Reviewed by Kenneth Rohde Christiansen.
@@ -384,7 +461,7 @@
         (WebCore::Document::setInPageCache):
         * dom/Document.h:
         (WebCore::Document::viewportArguments):
-
+        
 2010-09-24  David Hyatt  <hyatt at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index a0b2605..1ca881b 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -1659,9 +1659,9 @@ void RenderBlock::determineHorizontalPosition(RenderBox* child)
                 // The object is shifting right. The object might be centered, so we need to
                 // recalculate our horizontal margins. Note that the containing block content
                 // width computation will take into account the delta between |leftOff| and |xPos|
-                // so that we can just pass the content width in directly to the |computeInlineDirectionMargins|
+                // so that we can just pass the content width in directly to the |computeMarginsInContainingBlockInlineDirection|
                 // function.
-                child->computeInlineDirectionMargins(child->style()->marginLeft(), child->style()->marginRight(), availableLogicalWidthForLine(child->y(), false));
+                child->computeMarginsInContainingBlockInlineDirection(this, availableLogicalWidthForLine(child->y(), false), child->width());
                 chPos = leftOff + child->marginLeft();
             }
         }
@@ -1682,7 +1682,7 @@ void RenderBlock::determineHorizontalPosition(RenderBox* child)
                 // width computation will take into account the delta between |rightOff| and |xPos|
                 // so that we can just pass the content width in directly to the |computeInlineDirectionMargins|
                 // function.
-                child->computeInlineDirectionMargins(child->style()->marginLeft(), child->style()->marginRight(), availableLogicalWidthForLine(child->y(), false));
+                child->computeMarginsInContainingBlockInlineDirection(this, availableLogicalWidthForLine(child->y(), false), child->width());
                 chPos = rightOff - child->marginRight() - child->width();
             }
         }
diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp
index 892c821..00398f7 100644
--- a/WebCore/rendering/RenderBox.cpp
+++ b/WebCore/rendering/RenderBox.cpp
@@ -143,16 +143,66 @@ int RenderBox::marginAfter() const
 
 int RenderBox::marginStart() const
 {
-    if (style()->isVerticalBlockFlow())
-        return style()->direction() == LTR ? m_marginLeft : m_marginRight;
-    return style()->direction() == LTR ? m_marginTop : m_marginBottom;
+    return marginStartUsing(style());
+}
+
+int RenderBox::marginStartUsing(const RenderStyle* s) const
+{
+    if (s->isVerticalBlockFlow())
+        return s->direction() == LTR ? m_marginLeft : m_marginRight;
+    return s->direction() == LTR ? m_marginTop : m_marginBottom;
 }
 
 int RenderBox::marginEnd() const
 {
-    if (style()->isVerticalBlockFlow())
-        return style()->direction() == LTR ? m_marginRight : m_marginLeft;
-    return style()->direction() == LTR ? m_marginBottom : m_marginTop;
+    return marginEndUsing(style());
+}
+
+int RenderBox::marginEndUsing(const RenderStyle* s) const
+{
+    if (s->isVerticalBlockFlow())
+        return s->direction() == LTR ? m_marginRight : m_marginLeft;
+    return s->direction() == LTR ? m_marginBottom : m_marginTop;
+}
+
+void RenderBox::setMarginStart(int margin)
+{
+    setMarginStartUsing(style(), margin);
+}
+
+void RenderBox::setMarginEnd(int margin)
+{
+    setMarginEndUsing(style(), margin);
+}
+
+void RenderBox::setMarginStartUsing(const RenderStyle* s, int margin)
+{
+    if (s->isVerticalBlockFlow()) {
+        if (s->direction() == LTR)
+            m_marginLeft = margin;
+        else
+            m_marginRight = margin;
+    } else {
+        if (s->direction() == LTR)
+            m_marginTop = margin;
+        else
+            m_marginBottom = margin;
+    }
+}
+
+void RenderBox::setMarginEndUsing(const RenderStyle* s, int margin)
+{
+    if (s->isVerticalBlockFlow()) {
+        if (s->direction() == LTR)
+            m_marginRight = margin;
+        else
+            m_marginLeft = margin;
+    } else {
+        if (s->direction() == LTR)
+            m_marginBottom = margin;
+        else
+            m_marginTop = margin;
+    }
 }
 
 void RenderBox::destroy()
@@ -589,7 +639,7 @@ int RenderBox::overrideHeight() const
 
 int RenderBox::computeBorderBoxLogicalWidth(int width) const
 {
-    int bordersPlusPadding = borderAndPaddingWidth();
+    int bordersPlusPadding = borderAndPaddingLogicalWidth();
     if (style()->boxSizing() == CONTENT_BOX)
         return width + bordersPlusPadding;
     return max(width, bordersPlusPadding);
@@ -597,7 +647,7 @@ int RenderBox::computeBorderBoxLogicalWidth(int width) const
 
 int RenderBox::computeBorderBoxLogicalHeight(int height) const
 {
-    int bordersPlusPadding = borderAndPaddingHeight();
+    int bordersPlusPadding = borderAndPaddingLogicalHeight();
     if (style()->boxSizing() == CONTENT_BOX)
         return height + bordersPlusPadding;
     return max(height, bordersPlusPadding);
@@ -606,14 +656,14 @@ int RenderBox::computeBorderBoxLogicalHeight(int height) const
 int RenderBox::computeContentBoxLogicalWidth(int width) const
 {
     if (style()->boxSizing() == BORDER_BOX)
-        width -= borderAndPaddingWidth();
+        width -= borderAndPaddingLogicalWidth();
     return max(0, width);
 }
 
 int RenderBox::computeContentBoxLogicalHeight(int height) const
 {
     if (style()->boxSizing() == BORDER_BOX)
-        height -= borderAndPaddingHeight();
+        height -= borderAndPaddingLogicalHeight();
     return max(0, height);
 }
 
@@ -1043,6 +1093,24 @@ int RenderBox::containingBlockLogicalWidthForContent() const
     return cb->availableLogicalWidth();
 }
 
+int RenderBox::perpendicularContainingBlockLogicalHeight() const
+{
+    RenderBlock* cb = containingBlock();
+    RenderStyle* containingBlockStyle = cb->style();
+    Length logicalHeightLength = containingBlockStyle->logicalHeight();
+    
+    // FIXME: For now just support fixed heights.  Eventually should support percentage heights as well.
+    if (!logicalHeightLength.isFixed()) {
+        // Rather than making the child be completely unconstrained, WinIE uses the viewport width and height
+        // as a constraint.  We do that for now as well even though it's likely being unconstrained is what the spec
+        // will decide.
+        return containingBlockStyle->isVerticalBlockFlow() ? view()->frameView()->visibleHeight() : view()->frameView()->visibleWidth();
+    }
+    
+    // Use the content box logical height as specified by the style.
+    return cb->computeContentBoxLogicalHeight(logicalHeightLength.value());
+}
+
 void RenderBox::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState) const
 {
     if (repaintContainer == this)
@@ -1350,11 +1418,13 @@ void RenderBox::repaintDuringLayoutIfMoved(const IntRect& rect)
 void RenderBox::computeLogicalWidth()
 {
     if (isPositioned()) {
+        // FIXME: This calculation is not patched for block-flow yet.
+        // https://bugs.webkit.org/show_bug.cgi?id=46500
         computePositionedLogicalWidth();
         return;
     }
 
-    // If layout is limited to a subtree, the subtree root's width does not change.
+    // If layout is limited to a subtree, the subtree root's logical width does not change.
     if (node() && view()->frameView() && view()->frameView()->layoutRoot(true) == this)
         return;
 
@@ -1364,7 +1434,7 @@ void RenderBox::computeLogicalWidth()
     // https://bugs.webkit.org/show_bug.cgi?id=46418
     if (hasOverrideSize() &&  parent()->style()->boxOrient() == HORIZONTAL
             && parent()->isFlexibleBox() && parent()->isFlexingChildren()) {
-        setWidth(overrideSize());
+        setLogicalWidth(overrideSize());
         return;
     }
 
@@ -1374,70 +1444,64 @@ void RenderBox::computeLogicalWidth()
     bool stretching = (parent()->style()->boxAlign() == BSTRETCH);
     bool treatAsReplaced = shouldComputeSizeAsReplaced() && (!inVerticalBox || !stretching);
 
-    Length w = (treatAsReplaced) ? Length(computeReplacedWidth(), Fixed) : style()->width();
+    Length logicalWidthLength = (treatAsReplaced) ? Length(computeReplacedWidth(), Fixed) : style()->logicalWidth();
 
     RenderBlock* cb = containingBlock();
-    int containerWidth = max(0, containingBlockLogicalWidthForContent());
-
-    Length marginLeft = style()->marginLeft();
-    Length marginRight = style()->marginRight();
-
+    int containerLogicalWidth = max(0, containingBlockLogicalWidthForContent());
+    bool hasPerpendicularContainingBlock = cb->style()->isVerticalBlockFlow() != style()->isVerticalBlockFlow();
+    int containerWidthInInlineDirection = containerLogicalWidth;
+    if (hasPerpendicularContainingBlock)
+        containerWidthInInlineDirection = perpendicularContainingBlockLogicalHeight();
+    
     if (isInline() && !isInlineBlockOrInlineTable()) {
         // just calculate margins
-        m_marginLeft = marginLeft.calcMinValue(containerWidth);
-        m_marginRight = marginRight.calcMinValue(containerWidth);
+        setMarginStart(style()->marginStart().calcMinValue(containerLogicalWidth));
+        setMarginEnd(style()->marginEnd().calcMinValue(containerLogicalWidth));
         if (treatAsReplaced)
-            setWidth(max(w.value() + borderAndPaddingWidth(), minPreferredLogicalWidth()));
-
+            setLogicalWidth(max(logicalWidthLength.value() + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth()));
         return;
     }
 
     // Width calculations
     if (treatAsReplaced)
-        setWidth(w.value() + borderAndPaddingWidth());
+        setLogicalWidth(logicalWidthLength.value() + borderAndPaddingLogicalWidth());
     else {
-        // Calculate Width
-        setWidth(computeLogicalWidthUsing(LogicalWidth, containerWidth));
-
-        // Calculate MaxWidth
-        if (!style()->maxWidth().isUndefined()) {
-            int maxW = computeLogicalWidthUsing(MaxLogicalWidth, containerWidth);
-            if (width() > maxW) {
-                setWidth(maxW);
-                w = style()->maxWidth();
+        // Calculate LogicalWidth
+        setLogicalWidth(computeLogicalWidthUsing(LogicalWidth, containerWidthInInlineDirection));
+
+        // Calculate MaxLogicalWidth
+        if (!style()->logicalMaxWidth().isUndefined()) {
+            int maxLogicalWidth = computeLogicalWidthUsing(MaxLogicalWidth, containerWidthInInlineDirection);
+            if (logicalWidth() > maxLogicalWidth) {
+                setLogicalWidth(maxLogicalWidth);
+                logicalWidthLength = style()->logicalMaxWidth();
             }
         }
 
-        // Calculate MinWidth
-        int minW = computeLogicalWidthUsing(MinLogicalWidth, containerWidth);
-        if (width() < minW) {
-            setWidth(minW);
-            w = style()->minWidth();
+        // Calculate MinLogicalWidth
+        int minLogicalWidth = computeLogicalWidthUsing(MinLogicalWidth, containerWidthInInlineDirection);
+        if (logicalWidth() < minLogicalWidth) {
+            setLogicalWidth(minLogicalWidth);
+            logicalWidthLength = style()->logicalMinWidth();
         }
     }
 
-    if (stretchesToMinIntrinsicWidth()) {
-        setWidth(max(width(), minPreferredLogicalWidth()));
-        w = Length(width(), Fixed);
+    // Fieldsets are currently the only objects that stretch to their minimum width.
+    if (stretchesToMinIntrinsicLogicalWidth()) {
+        setLogicalWidth(max(logicalWidth(), minPreferredLogicalWidth()));
+        logicalWidthLength = Length(logicalWidth(), Fixed);
     }
 
-    // Margin calculations
-    if (w.isAuto()) {
-        m_marginLeft = marginLeft.calcMinValue(containerWidth);
-        m_marginRight = marginRight.calcMinValue(containerWidth);
-    } else {
-        m_marginLeft = 0;
-        m_marginRight = 0;
-        computeInlineDirectionMargins(marginLeft, marginRight, containerWidth);
-    }
+    // Margin calculations.
+    if (logicalWidthLength.isAuto() || hasPerpendicularContainingBlock || isFloating() || isInline()) {
+        setMarginStart(style()->marginStart().calcMinValue(containerLogicalWidth));
+        setMarginEnd(style()->marginEnd().calcMinValue(containerLogicalWidth));
+    } else
+        computeMarginsInContainingBlockInlineDirection(cb, containerLogicalWidth, logicalWidth());
 
-    if (containerWidth && containerWidth != (width() + m_marginLeft + m_marginRight)
-            && !isFloating() && !isInline() && !cb->isFlexibleBox()) {
-        if (cb->style()->direction() == LTR)
-            m_marginRight = containerWidth - width() - m_marginLeft;
-        else
-            m_marginLeft = containerWidth - width() - m_marginRight;
-    }
+    if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLogicalWidth != (logicalWidth() + marginStart() + marginEnd())
+            && !isFloating() && !isInline() && !cb->isFlexibleBox())
+        setMarginEndUsing(cb->style(), containerLogicalWidth - logicalWidth() - marginStartUsing(cb->style()));
 }
 
 int RenderBox::computeLogicalWidthUsing(LogicalWidthType widthType, int availableLogicalWidth)
@@ -1457,7 +1521,7 @@ int RenderBox::computeLogicalWidthUsing(LogicalWidthType widthType, int availabl
         if (availableLogicalWidth)
             logicalWidthResult = availableLogicalWidth - marginStart - marginEnd;
 
-        if (sizesToIntrinsicWidth(widthType)) {
+        if (sizesToIntrinsicLogicalWidth(widthType)) {
             logicalWidthResult = max(logicalWidthResult, minPreferredLogicalWidth());
             logicalWidthResult = min(logicalWidthResult, maxPreferredLogicalWidth());
         }
@@ -1467,7 +1531,7 @@ int RenderBox::computeLogicalWidthUsing(LogicalWidthType widthType, int availabl
     return logicalWidthResult;
 }
 
-bool RenderBox::sizesToIntrinsicWidth(LogicalWidthType widthType) const
+bool RenderBox::sizesToIntrinsicLogicalWidth(LogicalWidthType widthType) const
 {
     // Marquees in WinIE are like a mixture of blocks and inline-blocks.  They size as though they're blocks,
     // but they allow text to sit on the same line as the marquee.
@@ -1510,32 +1574,40 @@ bool RenderBox::sizesToIntrinsicWidth(LogicalWidthType widthType) const
     return false;
 }
 
-void RenderBox::computeInlineDirectionMargins(const Length& marginLeft, const Length& marginRight, int containerWidth)
+void RenderBox::computeMarginsInContainingBlockInlineDirection(RenderBlock* containingBlock, int containerWidth, int childWidth)
 {
-    if (isFloating() || isInline()) {
-        // Inline blocks/tables and floats don't have their margins increased.
-        m_marginLeft = marginLeft.calcMinValue(containerWidth);
-        m_marginRight = marginRight.calcMinValue(containerWidth);
-        return;
-    }
+    Length marginStartLength = style()->marginStartUsing(containingBlock->style());
+    Length marginEndLength = style()->marginEndUsing(containingBlock->style());
+    const RenderStyle* containingBlockStyle = containingBlock->style();
 
-    if ((marginLeft.isAuto() && marginRight.isAuto() && width() < containerWidth)
-            || (!marginLeft.isAuto() && !marginRight.isAuto() && containingBlock()->style()->textAlign() == WEBKIT_CENTER)) {
-        m_marginLeft = max(0, (containerWidth - width()) / 2);
-        m_marginRight = containerWidth - width() - m_marginLeft;
-    } else if ((marginRight.isAuto() && width() < containerWidth)
-            || (!marginLeft.isAuto() && containingBlock()->style()->direction() == RTL && containingBlock()->style()->textAlign() == WEBKIT_LEFT)) {
-        m_marginLeft = marginLeft.calcValue(containerWidth);
-        m_marginRight = containerWidth - width() - m_marginLeft;
-    } else if ((marginLeft.isAuto() && width() < containerWidth)
-            || (!marginRight.isAuto() && containingBlock()->style()->direction() == LTR && containingBlock()->style()->textAlign() == WEBKIT_RIGHT)) {
-        m_marginRight = marginRight.calcValue(containerWidth);
-        m_marginLeft = containerWidth - width() - m_marginRight;
-    } else {
-        // This makes auto margins 0 if we failed a width() < containerWidth test above (css2.1, 10.3.3).
-        m_marginLeft = marginLeft.calcMinValue(containerWidth);
-        m_marginRight = marginRight.calcMinValue(containerWidth);
-    }
+    // Case One: The object is being centered in the containing block's available logical width.
+    if ((marginStartLength.isAuto() && marginEndLength.isAuto() && childWidth < containerWidth)
+        || (!marginStartLength.isAuto() && !marginEndLength.isAuto() && containingBlock->style()->textAlign() == WEBKIT_CENTER)) {
+        setMarginStartUsing(containingBlockStyle, max(0, (containerWidth - childWidth) / 2));
+        setMarginEndUsing(containingBlockStyle, containerWidth - childWidth - marginStartUsing(containingBlockStyle));
+        return;
+    } 
+    
+    // Case Two: The object is being pushed to the start of the containing block's available logical width.
+    if (marginEndLength.isAuto() && childWidth < containerWidth) {
+        setMarginStartUsing(containingBlockStyle, marginStartLength.calcValue(containerWidth));
+        setMarginEndUsing(containingBlockStyle, containerWidth - childWidth - marginStartUsing(containingBlockStyle));
+        return;
+    } 
+    
+    // Case Three: The object is being pushed to the end of the containing block's available logical width.
+    bool pushToEndFromTextAlign = !marginEndLength.isAuto() && ((containingBlockStyle->direction() == RTL && containingBlockStyle->textAlign() == WEBKIT_LEFT)
+        || (containingBlockStyle->direction() == LTR && containingBlockStyle->textAlign() == WEBKIT_RIGHT));
+    if ((marginStartLength.isAuto() && childWidth < containerWidth) || pushToEndFromTextAlign) {
+        setMarginEndUsing(containingBlockStyle, marginEndLength.calcValue(containerWidth));
+        setMarginStartUsing(containingBlockStyle, containerWidth - childWidth - marginEndUsing(containingBlockStyle));
+        return;
+    } 
+    
+    // Case Four: Either no auto margins, or our width is >= the container width (css2.1, 10.3.3).  In that case
+    // auto margins will just turn into 0.
+    setMarginStartUsing(containingBlockStyle, marginStartLength.calcMinValue(containerWidth));
+    setMarginEndUsing(containingBlockStyle, marginEndLength.calcMinValue(containerWidth));
 }
 
 void RenderBox::computeLogicalHeight()
@@ -1905,7 +1977,7 @@ void RenderBox::computePositionedLogicalWidth()
     // was also previously done for deciding what to override when you had
     // over-constrained margins?  Also note that the container block is used
     // in similar situations in other parts of the RenderBox class (see computeLogicalWidth()
-    // and computeInlineDirectionMargins()). For now we are using the parent for quirks
+    // and computeMarginsInContainingBlockInlineDirection()). For now we are using the parent for quirks
     // mode and the containing block for strict mode.
 
     // FIXME 2: Should we still deal with these the cases of 'left' or 'right' having
@@ -2038,7 +2110,7 @@ void RenderBox::computePositionedLogicalWidth()
         }
     }
 
-    if (stretchesToMinIntrinsicWidth() && width() < minPreferredLogicalWidth() - bordersPlusPadding) {
+    if (stretchesToMinIntrinsicLogicalWidth() && width() < minPreferredLogicalWidth() - bordersPlusPadding) {
         computePositionedLogicalWidthUsing(Length(minPreferredLogicalWidth() - bordersPlusPadding, Fixed), containerBlock, containerDirection,
                                      containerWidth, bordersPlusPadding,
                                      left, right, marginLeft, marginRight,
diff --git a/WebCore/rendering/RenderBox.h b/WebCore/rendering/RenderBox.h
index c849b3a..91fbab9 100644
--- a/WebCore/rendering/RenderBox.h
+++ b/WebCore/rendering/RenderBox.h
@@ -148,6 +148,8 @@ public:
     virtual int marginAfter() const;
     virtual int marginStart() const;
     virtual int marginEnd() const;
+    void setMarginStart(int);
+    void setMarginEnd(int);
 
     // The following five functions are used to implement collapsing margins.
     // All objects know their maximal positive and negative margins.  The
@@ -192,11 +194,9 @@ public:
 
     virtual void borderFitAdjust(int& /*x*/, int& /*w*/) const { } // Shrink the box in which the border paints if border-fit is set.
 
-    // This method is now public so that centered objects like tables that are
-    // shifted right by left-aligned floats can recompute their left and
-    // right margins (so that they can remain centered after being
-    // shifted. -dwh
-    void computeInlineDirectionMargins(const Length& marginLeft, const Length& marginRight, int containerWidth);
+    // Resolve auto margins in the inline direction of the containing block so that objects can be pushed to the start, middle or end
+    // of the containing block.
+    void computeMarginsInContainingBlockInlineDirection(RenderBlock* containingBlock, int containerWidth, int childWidth);
 
     void positionLineBox(InlineBox*);
 
@@ -220,7 +220,8 @@ public:
     virtual void repaintDuringLayoutIfMoved(const IntRect&);
 
     virtual int containingBlockLogicalWidthForContent() const;
-
+    int perpendicularContainingBlockLogicalHeight() const;
+    
     virtual void computeLogicalWidth();
     virtual void computeLogicalHeight();
 
@@ -233,8 +234,8 @@ public:
 
     // Whether or not the element shrinks to its intrinsic width (rather than filling the width
     // of a containing block).  HTML4 buttons, <select>s, <input>s, legends, and floating/compact elements do this.
-    bool sizesToIntrinsicWidth(LogicalWidthType) const;
-    virtual bool stretchesToMinIntrinsicWidth() const { return false; }
+    bool sizesToIntrinsicLogicalWidth(LogicalWidthType) const;
+    virtual bool stretchesToMinIntrinsicLogicalWidth() const { return false; }
 
     int computeLogicalWidthUsing(LogicalWidthType, int availableLogicalWidth);
     int computeLogicalHeightUsing(const Length& height);
@@ -360,6 +361,11 @@ private:
     // These include tables, positioned objects, floats and flexible boxes.
     virtual void computePreferredLogicalWidths() { setPreferredLogicalWidthsDirty(false); }
 
+    void setMarginStartUsing(const RenderStyle*, int);
+    void setMarginEndUsing(const RenderStyle*, int);
+    int marginStartUsing(const RenderStyle*) const;
+    int marginEndUsing(const RenderStyle*) const;
+
 private:
     // The width/height of the contents + borders + padding.  The x/y location is relative to our container (which is not always our parent).
     IntRect m_frameRect;
diff --git a/WebCore/rendering/RenderFieldset.h b/WebCore/rendering/RenderFieldset.h
index e999f23..bc8e8ae 100644
--- a/WebCore/rendering/RenderFieldset.h
+++ b/WebCore/rendering/RenderFieldset.h
@@ -42,7 +42,7 @@ private:
 
     virtual void computePreferredLogicalWidths();
     virtual bool avoidsFloats() const { return true; }
-    virtual bool stretchesToMinIntrinsicWidth() const { return true; }
+    virtual bool stretchesToMinIntrinsicLogicalWidth() const { return true; }
 
     virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
 
diff --git a/WebCore/rendering/RenderTable.cpp b/WebCore/rendering/RenderTable.cpp
index 51a02de..5962f59 100644
--- a/WebCore/rendering/RenderTable.cpp
+++ b/WebCore/rendering/RenderTable.cpp
@@ -231,7 +231,7 @@ void RenderTable::computeLogicalWidth()
     // Finally, with our true width determined, compute our margins for real.
     m_marginRight = 0;
     m_marginLeft = 0;
-    computeInlineDirectionMargins(style()->marginLeft(), style()->marginRight(), availableWidth);
+    computeMarginsInContainingBlockInlineDirection(cb, availableWidth, width());
 }
 
 void RenderTable::layout()
diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp
index 4b77d6b..77984f4 100644
--- a/WebCore/rendering/style/RenderStyle.cpp
+++ b/WebCore/rendering/style/RenderStyle.cpp
@@ -1198,6 +1198,20 @@ Length RenderStyle::marginEnd() const
     return direction() == LTR ? marginBottom() : marginTop();
 }
     
+Length RenderStyle::marginStartUsing(const RenderStyle* otherStyle) const
+{
+    if (otherStyle->isVerticalBlockFlow())
+        return otherStyle->direction() == LTR ? marginLeft() : marginRight();
+    return otherStyle->direction() == LTR ? marginTop() : marginBottom();
+}
+
+Length RenderStyle::marginEndUsing(const RenderStyle* otherStyle) const
+{
+    if (otherStyle->isVerticalBlockFlow())
+        return otherStyle->direction() == LTR ? marginRight() : marginLeft();
+    return otherStyle->direction() == LTR ? marginBottom() : marginTop();
+}
+
 Length RenderStyle::paddingBefore() const
 {
     switch (blockFlow()) {
diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h
index 9616454..4095346 100644
--- a/WebCore/rendering/style/RenderStyle.h
+++ b/WebCore/rendering/style/RenderStyle.h
@@ -598,6 +598,8 @@ public:
     Length marginAfter() const;
     Length marginStart() const;
     Length marginEnd() const;
+    Length marginStartUsing(const RenderStyle* otherStyle) const;
+    Length marginEndUsing(const RenderStyle* otherStyle) const;
 
     LengthBox paddingBox() const { return surround->padding; }
     Length paddingTop() const { return surround->padding.top(); }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list