[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 14:17:06 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 12ae64d024d05baea8361631d60b1c9bf7c0a43a
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Oct 6 12:10:02 2010 +0000

    https://bugs.webkit.org/show_bug.cgi?id=47235
    
    Reviewed by Dan Bernstein.
    
    Make "lr" block-flow fieldsets work.
    
    (1) Patched html.css rules for legends and fieldsets to use logical margins and padding.
    (2) Converted just enough of computePreferredLogicalWidths to make basic examples work.
    (3) Removed the extra border drawing code from fieldsets so that the "clip out the legend" approach
    is now just always used.  It's silly to keep the old border drawing code in (which has already gotten out
    of sync with the base class) just to avoid a save/restore and some clipping.
    (4) Modified the layout/painting routines to place the legend properly and to be able to draw it in
    both the top and the left borders.
    
    Added fast/blockflow/fieldsets.html
    
    WebCore:
    
    * css/html.css:
    (legend):
    (fieldset):
    * rendering/RenderBlock.cpp:
    (WebCore::RenderBlock::determineLogicalLeftPositionForChild):
    (WebCore::RenderBlock::setLogicalLeftForChild):
    (WebCore::RenderBlock::setLogicalTopForChild):
    (WebCore::RenderBlock::layoutBlockChild):
    (WebCore::RenderBlock::computePreferredLogicalWidths):
    * rendering/RenderBlock.h:
    * rendering/RenderFieldset.cpp:
    (WebCore::RenderFieldset::layoutLegend):
    (WebCore::RenderFieldset::paintBoxDecorations):
    (WebCore::RenderFieldset::paintMask):
    * rendering/RenderFieldset.h:
    
    LayoutTests:
    
    * fast/blockflow/fieldsets.html: Added.
    * platform/mac/fast/blockflow/fieldsets-expected.checksum: Added.
    * platform/mac/fast/blockflow/fieldsets-expected.png: Added.
    * platform/mac/fast/blockflow/fieldsets-expected.txt: Added.
    * platform/mac/fast/forms/fieldset-align-expected.checksum:
    * platform/mac/fast/forms/fieldset-align-expected.png:
    * platform/mac/fast/forms/fieldset-align-expected.txt:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69184 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index fb80f27..aa68581 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,29 @@
+2010-10-06  David Hyatt  <hyatt at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=47235
+        
+        Make "lr" block-flow fieldsets work.
+        
+        (1) Patched html.css rules for legends and fieldsets to use logical margins and padding.
+        (2) Converted just enough of computePreferredLogicalWidths to make basic examples work.
+        (3) Removed the extra border drawing code from fieldsets so that the "clip out the legend" approach
+        is now just always used.  It's silly to keep the old border drawing code in (which has already gotten out
+        of sync with the base class) just to avoid a save/restore and some clipping.
+        (4) Modified the layout/painting routines to place the legend properly and to be able to draw it in
+        both the top and the left borders.
+
+        Added fast/blockflow/fieldsets.html
+
+        * fast/blockflow/fieldsets.html: Added.
+        * platform/mac/fast/blockflow/fieldsets-expected.checksum: Added.
+        * platform/mac/fast/blockflow/fieldsets-expected.png: Added.
+        * platform/mac/fast/blockflow/fieldsets-expected.txt: Added.
+        * platform/mac/fast/forms/fieldset-align-expected.checksum:
+        * platform/mac/fast/forms/fieldset-align-expected.png:
+        * platform/mac/fast/forms/fieldset-align-expected.txt:
+
 2010-10-06  Dirk Schulze  <krit at webkit.org>
 
         Unreviewed new baseline for Qt.
diff --git a/LayoutTests/fast/blockflow/fieldsets.html b/LayoutTests/fast/blockflow/fieldsets.html
new file mode 100644
index 0000000..678644a
--- /dev/null
+++ b/LayoutTests/fast/blockflow/fieldsets.html
@@ -0,0 +1,83 @@
+<html>
+<head>
+<style>
+fieldset
+{
+    -webkit-logical-width:200px;
+    -webkit-logical-height:100px;
+    margin:1em;
+    display:inline-block;
+}
+
+div
+{
+    -webkit-logical-width:100px;
+    -webkit-logical-height:25px;
+    background-color:orange;
+}
+
+</style>
+</head>
+
+LTR fieldset with left/center/right text-align: <br>
+
+<fieldset>
+<legend style="text-align:left; margin-left:20px"><div></div></legend>
+</fieldset>
+
+<fieldset>
+<legend style="text-align:right; margin-right:20px"><div></div></legend>
+</fieldset>
+
+<fieldset>
+<legend style="text-align:center;"><div></div></legend>
+</fieldset>
+
+<br>
+
+RTL fieldset with left/center/right text-align: <br>
+
+<fieldset dir=rtl>
+<legend style="text-align:left; margin-left:20px"><div></div></legend>
+</fieldset>
+
+<fieldset dir=rtl>
+<legend style="text-align:right; margin-right:20px"><div></div></legend>
+</fieldset>
+
+<fieldset dir=rtl>
+<legend style="text-align:center;"><div></div></legend>
+</fieldset>
+
+<br>
+
+Vertical LTR fieldset with left/center/right text-align: <br>
+
+<fieldset style="-webkit-block-flow:lr;">
+<legend style="text-align:left; margin-top:20px"><div></div></legend>
+</fieldset>
+
+<fieldset style="-webkit-block-flow:lr;">
+<legend style="text-align:right; margin-bottom:20px"><div></div></legend>
+</fieldset>
+
+<fieldset style="-webkit-block-flow:lr;">
+<legend style="text-align:center"><div></div></legend>
+</fieldset>
+
+
+<br>
+
+Vertical RTL fieldset with left/center/right text-align: <br>
+
+<fieldset dir=rtl style="-webkit-block-flow:lr;">
+<legend style="text-align:left; margin-top:20px"><div></div></legend>
+</fieldset>
+
+<fieldset dir=rtl style="-webkit-block-flow:lr;">
+<legend style="text-align:right; margin-bottom:20px"><div></div></legend>
+</fieldset>
+
+<fieldset dir=rtl style="-webkit-block-flow:lr;">
+<legend style="text-align:center"><div></div></legend>
+</fieldset>
diff --git a/LayoutTests/platform/mac/fast/blockflow/fieldsets-expected.checksum b/LayoutTests/platform/mac/fast/blockflow/fieldsets-expected.checksum
new file mode 100644
index 0000000..701cd10
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/blockflow/fieldsets-expected.checksum
@@ -0,0 +1 @@
+1296d144f4991c9a3c70324124150c8c
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/blockflow/fieldsets-expected.png b/LayoutTests/platform/mac/fast/blockflow/fieldsets-expected.png
new file mode 100644
index 0000000..32a1af1
Binary files /dev/null and b/LayoutTests/platform/mac/fast/blockflow/fieldsets-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/blockflow/fieldsets-expected.txt b/LayoutTests/platform/mac/fast/blockflow/fieldsets-expected.txt
new file mode 100644
index 0000000..dae0f78
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/blockflow/fieldsets-expected.txt
@@ -0,0 +1,77 @@
+layer at (0,0) size 785x1236
+  RenderView at (0,0) size 785x600
+layer at (0,0) size 785x1236
+  RenderBlock {HTML} at (0,0) size 785x1236
+    RenderBody {BODY} at (8,8) size 769x1220
+      RenderText {#text} at (0,0) size 282x18
+        text run at (0,0) width 282: "LTR fieldset with left/center/right text-align: "
+      RenderBR {BR} at (282,14) size 0x0
+      RenderFieldSet {FIELDSET} at (16,34) size 228x119 [border: (2px groove #C0C0C0)]
+        RenderBlock {LEGEND} at (34,0) size 104x25
+          RenderBlock {DIV} at (2,0) size 100x25 [bgcolor=#FFA500]
+      RenderText {#text} at (260,155) size 4x18
+        text run at (260,155) width 4: " "
+      RenderFieldSet {FIELDSET} at (280,34) size 228x119 [border: (2px groove #C0C0C0)]
+        RenderBlock {LEGEND} at (110,0) size 104x25
+          RenderBlock {DIV} at (2,0) size 100x25 [bgcolor=#FFA500]
+      RenderText {#text} at (0,0) size 0x0
+      RenderFieldSet {FIELDSET} at (16,189) size 228x119 [border: (2px groove #C0C0C0)]
+        RenderBlock {LEGEND} at (62,0) size 104x25
+          RenderBlock {DIV} at (2,0) size 100x25 [bgcolor=#FFA500]
+      RenderText {#text} at (260,310) size 4x18
+        text run at (260,310) width 4: " "
+      RenderBR {BR} at (0,0) size 0x0
+      RenderText {#text} at (0,328) size 282x18
+        text run at (0,328) width 282: "RTL fieldset with left/center/right text-align: "
+      RenderBR {BR} at (282,342) size 0x0
+      RenderFieldSet {FIELDSET} at (16,362) size 228x119 [border: (2px groove #C0C0C0)]
+        RenderBlock {LEGEND} at (14,0) size 104x25
+          RenderBlock {DIV} at (2,0) size 100x25 [bgcolor=#FFA500]
+      RenderText {#text} at (260,483) size 4x18
+        text run at (260,483) width 4: " "
+      RenderFieldSet {FIELDSET} at (280,362) size 228x119 [border: (2px groove #C0C0C0)]
+        RenderBlock {LEGEND} at (90,0) size 104x25
+          RenderBlock {DIV} at (2,0) size 100x25 [bgcolor=#FFA500]
+      RenderText {#text} at (0,0) size 0x0
+      RenderFieldSet {FIELDSET} at (16,517) size 228x119 [border: (2px groove #C0C0C0)]
+        RenderBlock {LEGEND} at (62,0) size 104x25
+          RenderBlock {DIV} at (2,0) size 100x25 [bgcolor=#FFA500]
+      RenderText {#text} at (260,638) size 4x18
+        text run at (260,638) width 4: " "
+      RenderBR {BR} at (0,0) size 0x0
+      RenderText {#text} at (0,656) size 336x18
+        text run at (0,656) width 336: "Vertical LTR fieldset with left/center/right text-align: "
+      RenderBR {BR} at (336,670) size 0x0
+      RenderFieldSet {FIELDSET} at (16,690) size 119x228 [border: (2px groove #C0C0C0)]
+        RenderBlock {LEGEND} at (0,34) size 25x104
+          RenderBlock {DIV} at (0,2) size 25x100 [bgcolor=#FFA500]
+      RenderText {#text} at (151,920) size 4x18
+        text run at (151,920) width 4: " "
+      RenderFieldSet {FIELDSET} at (171,690) size 119x228 [border: (2px groove #C0C0C0)]
+        RenderBlock {LEGEND} at (0,110) size 25x104
+          RenderBlock {DIV} at (0,2) size 25x100 [bgcolor=#FFA500]
+      RenderText {#text} at (306,920) size 4x18
+        text run at (306,920) width 4: " "
+      RenderFieldSet {FIELDSET} at (326,690) size 119x228 [border: (2px groove #C0C0C0)]
+        RenderBlock {LEGEND} at (0,62) size 25x104
+          RenderBlock {DIV} at (0,2) size 25x100 [bgcolor=#FFA500]
+      RenderText {#text} at (461,920) size 4x18
+        text run at (461,920) width 4: " "
+      RenderBR {BR} at (0,0) size 0x0
+      RenderText {#text} at (0,938) size 336x18
+        text run at (0,938) width 336: "Vertical RTL fieldset with left/center/right text-align: "
+      RenderBR {BR} at (336,952) size 0x0
+      RenderFieldSet {FIELDSET} at (16,972) size 119x228 [border: (2px groove #C0C0C0)]
+        RenderBlock {LEGEND} at (0,14) size 25x104
+          RenderBlock {DIV} at (0,2) size 25x100 [bgcolor=#FFA500]
+      RenderText {#text} at (151,1202) size 4x18
+        text run at (151,1202) width 4: " "
+      RenderFieldSet {FIELDSET} at (171,972) size 119x228 [border: (2px groove #C0C0C0)]
+        RenderBlock {LEGEND} at (0,90) size 25x104
+          RenderBlock {DIV} at (0,2) size 25x100 [bgcolor=#FFA500]
+      RenderText {#text} at (306,1202) size 4x18
+        text run at (306,1202) width 4: " "
+      RenderFieldSet {FIELDSET} at (326,972) size 119x228 [border: (2px groove #C0C0C0)]
+        RenderBlock {LEGEND} at (0,62) size 25x104
+          RenderBlock {DIV} at (0,2) size 25x100 [bgcolor=#FFA500]
+      RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/forms/fieldset-align-expected.checksum b/LayoutTests/platform/mac/fast/forms/fieldset-align-expected.checksum
index 1aeb1e5..112d336 100644
--- a/LayoutTests/platform/mac/fast/forms/fieldset-align-expected.checksum
+++ b/LayoutTests/platform/mac/fast/forms/fieldset-align-expected.checksum
@@ -1 +1 @@
-f4e0c868becb4422c55882b46e275638
\ No newline at end of file
+6fff1f1b414f1ee0c8fa8650c4d1b395
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/forms/fieldset-align-expected.png b/LayoutTests/platform/mac/fast/forms/fieldset-align-expected.png
index 303789c..1cc7f91 100644
Binary files a/LayoutTests/platform/mac/fast/forms/fieldset-align-expected.png and b/LayoutTests/platform/mac/fast/forms/fieldset-align-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/forms/fieldset-align-expected.txt b/LayoutTests/platform/mac/fast/forms/fieldset-align-expected.txt
index 002885f..7377e10 100644
--- a/LayoutTests/platform/mac/fast/forms/fieldset-align-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/fieldset-align-expected.txt
@@ -50,7 +50,7 @@ layer at (0,0) size 785x1382
             RenderTextControl {INPUT} at (610,2) size 125x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
             RenderText {#text} at (0,0) size 0x0
         RenderFieldSet {FIELDSET} at (2,58) size 765x58 [border: (2px groove #C0C0C0)]
-          RenderBlock {LEGEND} at (322,0) size 120x18
+          RenderBlock {LEGEND} at (323,0) size 120x18
             RenderText {#text} at (2,0) size 116x18
               text run at (2,0) width 116: "My Legend center"
           RenderBlock (anonymous) at (14,23) size 737x23
@@ -121,7 +121,7 @@ layer at (0,0) size 785x1382
             RenderTextControl {INPUT} at (578,2) size 125x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
             RenderText {#text} at (0,0) size 0x0
         RenderFieldSet {FIELDSET} at (15,88) size 739x73 [border: (2px groove #C0C0C0)]
-          RenderBlock {LEGEND} at (309,0) size 120x18
+          RenderBlock {LEGEND} at (310,0) size 120x18
             RenderText {#text} at (2,0) size 116x18
               text run at (2,0) width 116: "My Legend center"
           RenderBlock (anonymous) at (17,33) size 705x23
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b0e81b6..2178ec2 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,37 @@
+2010-10-06  David Hyatt  <hyatt at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=47235
+        
+        Make "lr" block-flow fieldsets work.
+        
+        (1) Patched html.css rules for legends and fieldsets to use logical margins and padding.
+        (2) Converted just enough of computePreferredLogicalWidths to make basic examples work.
+        (3) Removed the extra border drawing code from fieldsets so that the "clip out the legend" approach
+        is now just always used.  It's silly to keep the old border drawing code in (which has already gotten out
+        of sync with the base class) just to avoid a save/restore and some clipping.
+        (4) Modified the layout/painting routines to place the legend properly and to be able to draw it in
+        both the top and the left borders.
+
+        Added fast/blockflow/fieldsets.html
+
+        * css/html.css:
+        (legend):
+        (fieldset):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::determineLogicalLeftPositionForChild):
+        (WebCore::RenderBlock::setLogicalLeftForChild):
+        (WebCore::RenderBlock::setLogicalTopForChild):
+        (WebCore::RenderBlock::layoutBlockChild):
+        (WebCore::RenderBlock::computePreferredLogicalWidths):
+        * rendering/RenderBlock.h:
+        * rendering/RenderFieldset.cpp:
+        (WebCore::RenderFieldset::layoutLegend):
+        (WebCore::RenderFieldset::paintBoxDecorations):
+        (WebCore::RenderFieldset::paintMask):
+        * rendering/RenderFieldset.h:
+
 2010-10-06  Patrick Gansterer  <paroga at webkit.org>
 
         Reviewed by Darin Adler.
diff --git a/WebCore/css/html.css b/WebCore/css/html.css
index 5399c1c..02fa620 100644
--- a/WebCore/css/html.css
+++ b/WebCore/css/html.css
@@ -284,16 +284,19 @@ label {
 
 legend {
     display: block;
-    padding-left: 2px;
-    padding-right: 2px;
+    -webkit-padding-start: 2px;
+    -webkit-padding-end: 2px;
     border: none
 }
 
 fieldset {
     display: block;
-    margin-left: 2px;
-    margin-right: 2px;
-    padding: 0.35em 0.75em 0.625em;
+    -webkit-margin-start: 2px;
+    -webkit-margin-end: 2px;
+    -webkit-padding-before: 0.35em;
+    -webkit-padding-start: 0.75em;
+    -webkit-padding-end: 0.75em;
+    -webkit-padding-after: 0.625em;
     border: 2px groove ThreeDFace
 }
 
diff --git a/WebCore/rendering/RenderBlock.cpp b/WebCore/rendering/RenderBlock.cpp
index ac1b513..beae8f3 100644
--- a/WebCore/rendering/RenderBlock.cpp
+++ b/WebCore/rendering/RenderBlock.cpp
@@ -1677,7 +1677,7 @@ void RenderBlock::determineLogicalLeftPositionForChild(RenderBox* child)
         }
     }
 
-    setLogicalLeftForChild(child, style()->isLeftToRightDirection() ? newPosition : totalAvailableLogicalWidth - newPosition - logicalWidthForChild(child));
+    setLogicalLeftForChild(child, style()->isLeftToRightDirection() ? newPosition : totalAvailableLogicalWidth - newPosition - logicalWidthForChild(child), ApplyLayoutDelta);
 }
 
 void RenderBlock::setCollapsedBottomMargin(const MarginInfo& marginInfo)
@@ -1718,27 +1718,27 @@ void RenderBlock::handleAfterSideOfBlock(int beforeSide, int afterSide, MarginIn
     setCollapsedBottomMargin(marginInfo);
 }
 
-void RenderBlock::setLogicalLeftForChild(RenderBox* child, int logicalLeft)
+void RenderBlock::setLogicalLeftForChild(RenderBox* child, int logicalLeft, ApplyLayoutDeltaMode applyDelta)
 {
     if (style()->isVerticalBlockFlow()) {
-        if (!child->isFloatingOrPositioned())
+        if (applyDelta == ApplyLayoutDelta)
             view()->addLayoutDelta(IntSize(child->x() - logicalLeft, 0));
         child->setX(logicalLeft);
     } else {
-        if (!child->isFloatingOrPositioned())
+        if (applyDelta == ApplyLayoutDelta)
             view()->addLayoutDelta(IntSize(0, child->y() - logicalLeft));
         child->setY(logicalLeft);
     }
 }
 
-void RenderBlock::setLogicalTopForChild(RenderBox* child, int logicalTop)
+void RenderBlock::setLogicalTopForChild(RenderBox* child, int logicalTop, ApplyLayoutDeltaMode applyDelta)
 {
     if (style()->isVerticalBlockFlow()) {
-        if (!child->isFloatingOrPositioned())
+        if (applyDelta == ApplyLayoutDelta)
             view()->addLayoutDelta(IntSize(0, child->y() - logicalTop));
         child->setY(logicalTop);
     } else {
-        if (!child->isFloatingOrPositioned())
+        if (applyDelta == ApplyLayoutDelta)
             view()->addLayoutDelta(IntSize(child->x() - logicalTop, 0));
         child->setX(logicalTop);
     }
@@ -1841,7 +1841,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int
     IntSize oldLayoutDelta = view()->layoutDelta();
 #endif
     // Go ahead and position the child as though it didn't collapse with the top.
-    setLogicalTopForChild(child, logicalTopEstimate);
+    setLogicalTopForChild(child, logicalTopEstimate, ApplyLayoutDelta);
 
     RenderBlock* childRenderBlock = child->isRenderBlock() ? toRenderBlock(child) : 0;
     bool markDescendantsWithFloats = false;
@@ -1916,7 +1916,7 @@ void RenderBlock::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, int
         setLogicalHeight(logicalHeight() + (logicalTopAfterClear - oldTop));
     }
 
-    setLogicalTopForChild(child, logicalTopAfterClear);
+    setLogicalTopForChild(child, logicalTopAfterClear, ApplyLayoutDelta);
 
     // Now we have a final top position.  See if it really does end up being different from our estimate.
     if (logicalTopAfterClear != logicalTopEstimate) {
@@ -4579,8 +4579,8 @@ void RenderBlock::computePreferredLogicalWidths()
 
     updateFirstLetter();
 
-    if (!isTableCell() && style()->width().isFixed() && style()->width().value() > 0)
-        m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value());
+    if (!isTableCell() && style()->logicalWidth().isFixed() && style()->logicalWidth().value() > 0)
+        m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->logicalWidth().value());
     else {
         m_minPreferredLogicalWidth = 0;
         m_maxPreferredLogicalWidth = 0;
@@ -4607,18 +4607,18 @@ void RenderBlock::computePreferredLogicalWidths()
         }
     }
     
-    if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
-        m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
-        m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->minWidth().value()));
+    if (style()->logicalMinWidth().isFixed() && style()->logicalMinWidth().value() > 0) {
+        m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->logicalMinWidth().value()));
+        m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->logicalMinWidth().value()));
     }
     
-    if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength) {
-        m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
-        m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->maxWidth().value()));
+    if (style()->logicalMaxWidth().isFixed() && style()->logicalMaxWidth().value() != undefinedLength) {
+        m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->logicalMaxWidth().value()));
+        m_minPreferredLogicalWidth = min(m_minPreferredLogicalWidth, computeContentBoxLogicalWidth(style()->logicalMaxWidth().value()));
     }
 
     int toAdd = 0;
-    toAdd = borderAndPaddingWidth();
+    toAdd = borderAndPaddingLogicalWidth();
 
     if (hasOverflowClip() && style()->overflowY() == OSCROLL)
         toAdd += verticalScrollbarWidth();
diff --git a/WebCore/rendering/RenderBlock.h b/WebCore/rendering/RenderBlock.h
index 864fc89..aad5ff8 100644
--- a/WebCore/rendering/RenderBlock.h
+++ b/WebCore/rendering/RenderBlock.h
@@ -170,11 +170,12 @@ public:
     void setPageY(int y);
 
     // Accessors for logical width/height and margins in the containing block's block-flow direction.
+    enum ApplyLayoutDeltaMode { ApplyLayoutDelta, DoNotApplyLayoutDelta };
     int logicalWidthForChild(RenderBox* child) { return style()->isVerticalBlockFlow() ? child->width() : child->height(); }
     int logicalHeightForChild(RenderBox* child) { return style()->isVerticalBlockFlow() ? child->height() : child->width(); }
     int logicalTopForChild(RenderBox* child) { return style()->isVerticalBlockFlow() ? child->y() : child->x(); }
-    void setLogicalLeftForChild(RenderBox* child, int logicalLeft);
-    void setLogicalTopForChild(RenderBox* child, int logicalTop);
+    void setLogicalLeftForChild(RenderBox* child, int logicalLeft, ApplyLayoutDeltaMode = DoNotApplyLayoutDelta);
+    void setLogicalTopForChild(RenderBox* child, int logicalTop, ApplyLayoutDeltaMode = DoNotApplyLayoutDelta);
     int marginBeforeForChild(RenderBoxModelObject* child) const;
     int marginAfterForChild(RenderBoxModelObject* child) const;
     int marginStartForChild(RenderBoxModelObject* child) const;
diff --git a/WebCore/rendering/RenderFieldset.cpp b/WebCore/rendering/RenderFieldset.cpp
index 074f2d5..4a40049 100644
--- a/WebCore/rendering/RenderFieldset.cpp
+++ b/WebCore/rendering/RenderFieldset.cpp
@@ -71,34 +71,43 @@ RenderObject* RenderFieldset::layoutLegend(bool relayoutChildren)
             legend->setNeedsLayout(true);
         legend->layoutIfNeeded();
 
-        int xPos;
-        if (!style()->isLeftToRightDirection()) {
+        int logicalLeft;
+        if (style()->isLeftToRightDirection()) {
             switch (legend->style()->textAlign()) {
-                case LEFT:
-                    xPos = borderLeft() + paddingLeft();
-                    break;
-                case CENTER:
-                    xPos = (width() - legend->width()) / 2;
-                    break;
-                default:
-                    xPos = width() - paddingRight() - borderRight() - legend->width() - legend->marginRight();
+            case CENTER:
+                logicalLeft = (logicalWidth() - logicalWidthForChild(legend)) / 2;
+                break;
+            case RIGHT:
+                logicalLeft = logicalWidth() - borderEnd() - paddingEnd() - logicalWidthForChild(legend);
+                break;
+            default:
+                logicalLeft = borderStart() + paddingStart() + marginStartForChild(legend);
+                break;
             }
         } else {
             switch (legend->style()->textAlign()) {
-                case RIGHT:
-                    xPos = width() - paddingRight() - borderRight() - legend->width();
-                    break;
-                case CENTER:
-                    xPos = (width() - legend->width()) / 2;
-                    break;
-                default:
-                    xPos = borderLeft() + paddingLeft() + legend->marginLeft();
+            case LEFT:
+                logicalLeft = borderStart() + paddingStart();
+                break;
+            case CENTER: {
+                // Make sure that the extra pixel goes to the end side in RTL (since it went to the end side
+                // in LTR).
+                int centeredWidth = logicalWidth() - logicalWidthForChild(legend);
+                logicalLeft = centeredWidth - centeredWidth / 2;
+                break;
+            }
+            default:
+                logicalLeft = logicalWidth() - borderStart() - paddingStart() - marginStartForChild(legend) - logicalWidthForChild(legend);
+                break;
             }
         }
-        int b = borderTop();
-        int h = legend->height();
-        legend->setLocation(xPos, max((b-h)/2, 0));
-        setHeight(max(b, h) + paddingTop());
+
+        setLogicalLeftForChild(legend, logicalLeft);
+
+        int b = borderBefore();
+        int h = logicalHeightForChild(legend);
+        setLogicalTopForChild(legend, max((b - h) / 2, 0));
+        setLogicalHeight(max(b, h) + paddingBefore());
     }
     return legend;
 }
@@ -129,10 +138,18 @@ void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
     if (!legend)
         return RenderBlock::paintBoxDecorations(paintInfo, tx, ty);
 
-    int yOff = (legend->y() > 0) ? 0 : (legend->height() - borderTop()) / 2;
-    int legendBottom = ty + legend->y() + legend->height();
-    h -= yOff;
-    ty += yOff;
+    // FIXME: We need to work with "rl" and "bt" block flow directions.  In those
+    // cases the legend is embedded in the right and bottom borders respectively.
+    // https://bugs.webkit.org/show_bug.cgi?id=47236
+    if (style()->isVerticalBlockFlow()) {
+        int yOff = (legend->y() > 0) ? 0 : (legend->height() - borderTop()) / 2;
+        h -= yOff;
+        ty += yOff;
+    } else {
+        int xOff = (legend->x() > 0) ? 0 : (legend->width() - borderLeft()) / 2;
+        w -= xOff;
+        tx += xOff;
+    }
 
     paintBoxShadow(paintInfo.context, tx, ty, w, h, style(), Normal);
 
@@ -141,21 +158,24 @@ void RenderFieldset::paintBoxDecorations(PaintInfo& paintInfo, int tx, int ty)
 
     if (!style()->hasBorder())
         return;
-
-    // Save time by not saving and restoring the GraphicsContext in the straight border case
-    if (!style()->hasBorderRadius())
-        return paintBorderMinusLegend(paintInfo.context, tx, ty, w, h, style(), legend->x(), legend->width(), legendBottom);
     
-    // We have rounded borders, create a clipping region 
-    // around the legend and paint the border as normal
+    // Create a clipping region around the legend and paint the border as normal
     GraphicsContext* graphicsContext = paintInfo.context;
     graphicsContext->save();
 
-    int clipTop = ty;
-    int clipHeight = max(static_cast<int>(style()->borderTopWidth()), legend->height());
+    // FIXME: We need to work with "rl" and "bt" block flow directions.  In those
+    // cases the legend is embedded in the right and bottom borders respectively.
+    // https://bugs.webkit.org/show_bug.cgi?id=47236
+    if (style()->isVerticalBlockFlow()) {
+        int clipTop = ty;
+        int clipHeight = max(static_cast<int>(style()->borderTopWidth()), legend->height());
+        graphicsContext->clipOut(IntRect(tx + legend->x(), clipTop, legend->width(), clipHeight));
+    } else {
+        int clipLeft = tx;
+        int clipWidth = max(static_cast<int>(style()->borderLeftWidth()), legend->width());
+        graphicsContext->clipOut(IntRect(clipLeft, ty + legend->y(), clipWidth, legend->height()));
+    }
 
-    graphicsContext->clipOut(IntRect(tx + legend->x(), clipTop,
-                                       legend->width(), clipHeight));
     paintBorder(paintInfo.context, tx, ty, w, h, style(), true, true);
 
     graphicsContext->restore();
@@ -172,95 +192,20 @@ void RenderFieldset::paintMask(PaintInfo& paintInfo, int tx, int ty)
     if (!legend)
         return RenderBlock::paintMask(paintInfo, tx, ty);
 
-    int yOff = (legend->y() > 0) ? 0 : (legend->height() - borderTop()) / 2;
-    h -= yOff;
-    ty += yOff;
-
-    paintMaskImages(paintInfo, tx, ty, w, h);
-}
-        
-void RenderFieldset::paintBorderMinusLegend(GraphicsContext* graphicsContext, int tx, int ty, int w, int h,
-                                            const RenderStyle* style, int lx, int lw, int lb)
-{
-    const Color& tc = style->visitedDependentColor(CSSPropertyBorderTopColor);
-    const Color& bc = style->visitedDependentColor(CSSPropertyBorderBottomColor);
-
-    EBorderStyle ts = style->borderTopStyle();
-    EBorderStyle bs = style->borderBottomStyle();
-    EBorderStyle ls = style->borderLeftStyle();
-    EBorderStyle rs = style->borderRightStyle();
-
-    bool render_t = ts > BHIDDEN;
-    bool render_l = ls > BHIDDEN;
-    bool render_r = rs > BHIDDEN;
-    bool render_b = bs > BHIDDEN;
-
-    int borderLeftWidth = style->borderLeftWidth();
-    int borderRightWidth = style->borderRightWidth();
-
-    if (render_t) {
-        if (lx >= borderLeftWidth)
-            drawLineForBoxSide(graphicsContext, tx, ty, tx + min(lx, w), ty + style->borderTopWidth(), BSTop, tc, ts,
-                       (render_l && (ls == DOTTED || ls == DASHED || ls == DOUBLE) ? borderLeftWidth : 0),
-                       (lx >= w && render_r && (rs == DOTTED || rs == DASHED || rs == DOUBLE) ? borderRightWidth : 0));
-        if (lx + lw <=  w - borderRightWidth)
-            drawLineForBoxSide(graphicsContext, tx + max(0, lx + lw), ty, tx + w, ty + style->borderTopWidth(), BSTop, tc, ts,
-                       (lx + lw <= 0 && render_l && (ls == DOTTED || ls == DASHED || ls == DOUBLE) ? borderLeftWidth : 0),
-                       (render_r && (rs == DOTTED || rs == DASHED || rs == DOUBLE) ? borderRightWidth : 0));
+    // FIXME: We need to work with "rl" and "bt" block flow directions.  In those
+    // cases the legend is embedded in the right and bottom borders respectively.
+    // https://bugs.webkit.org/show_bug.cgi?id=47236
+    if (style()->isVerticalBlockFlow()) {
+        int yOff = (legend->y() > 0) ? 0 : (legend->height() - borderTop()) / 2;
+        h -= yOff;
+        ty += yOff;
+    } else {
+        int xOff = (legend->x() > 0) ? 0 : (legend->width() - borderLeft()) / 2;
+        w -= xOff;
+        tx += xOff;
     }
 
-    if (render_b)
-        drawLineForBoxSide(graphicsContext, tx, ty + h - style->borderBottomWidth(), tx + w, ty + h, BSBottom, bc, bs,
-                   (render_l && (ls == DOTTED || ls == DASHED || ls == DOUBLE) ? style->borderLeftWidth() : 0),
-                   (render_r && (rs == DOTTED || rs == DASHED || rs == DOUBLE) ? style->borderRightWidth() : 0));
-
-    if (render_l) {
-        const Color& lc = style->visitedDependentColor(CSSPropertyBorderLeftColor);
-        int startY = ty;
-
-        bool ignore_top =
-            (tc == lc) &&
-            (ls >= OUTSET) &&
-            (ts == DOTTED || ts == DASHED || ts == SOLID || ts == OUTSET);
-
-        bool ignore_bottom =
-            (bc == lc) &&
-            (ls >= OUTSET) &&
-            (bs == DOTTED || bs == DASHED || bs == SOLID || bs == INSET);
-
-        if (lx < borderLeftWidth && lx + lw > 0) {
-            // The legend intersects the border.
-            ignore_top = true;
-            startY = lb;
-        }
-
-        drawLineForBoxSide(graphicsContext, tx, startY, tx + borderLeftWidth, ty + h, BSLeft, lc, ls,
-                           ignore_top ? 0 : style->borderTopWidth(), ignore_bottom ? 0 : style->borderBottomWidth());
-    }
-
-    if (render_r) {
-        const Color& rc = style->visitedDependentColor(CSSPropertyBorderRightColor);
-        int startY = ty;
-
-        bool ignore_top =
-            (tc == rc) &&
-            (rs >= DOTTED || rs == INSET) &&
-            (ts == DOTTED || ts == DASHED || ts == SOLID || ts == OUTSET);
-
-        bool ignore_bottom =
-            (bc == rc) &&
-            (rs >= DOTTED || rs == INSET) &&
-            (bs == DOTTED || bs == DASHED || bs == SOLID || bs == INSET);
-
-        if (lx < w && lx + lw > w - borderRightWidth) {
-            // The legend intersects the border.
-            ignore_top = true;
-            startY = lb;
-        }
-
-        drawLineForBoxSide(graphicsContext, tx + w - borderRightWidth, startY, tx + w, ty + h, BSRight, rc, rs,
-                   ignore_top ? 0 : style->borderTopWidth(), ignore_bottom ? 0 : style->borderBottomWidth());
-    }
+    paintMaskImages(paintInfo, tx, ty, w, h);
 }
 
 void RenderFieldset::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
diff --git a/WebCore/rendering/RenderFieldset.h b/WebCore/rendering/RenderFieldset.h
index bc8e8ae..ea4e587 100644
--- a/WebCore/rendering/RenderFieldset.h
+++ b/WebCore/rendering/RenderFieldset.h
@@ -48,8 +48,6 @@ private:
 
     virtual void paintBoxDecorations(PaintInfo&, int tx, int ty);
     virtual void paintMask(PaintInfo&, int tx, int ty);
-
-    void paintBorderMinusLegend(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, int lx, int lw, int lb);
 };
 
 inline RenderFieldset* toRenderFieldset(RenderObject* object)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list