<rdar://problem/10293929> REGRESSION (r97525): iChat transcript has horizontal scroll...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Oct 2011 18:20:38 +0000 (18:20 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Oct 2011 18:20:38 +0000 (18:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=70204

Reviewed by Darin Adler.

Source/WebCore:

Reverted r97525, which was supposed to fix <http://webkit.org/b/29447>.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeReplacedLogicalWidthUsing):
(WebCore::RenderBox::computeReplacedLogicalHeightUsing):
* rendering/RenderBox.h:

LayoutTests:

* fast/replaced/table-percent-width-expected.txt: Updated the results to
show that this test is failing after reverting r97525.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@97635 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/replaced/table-percent-width-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h

index aa2a62584378687d7e2c2fba5274567594faee90..f8848eaabe0ebb6cd4aec422d5549caf8d3a5f0f 100644 (file)
@@ -1,3 +1,13 @@
+2011-10-17  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/10293929> REGRESSION (r97525): iChat transcript has horizontal scroll bar when the conversation includes a wide image
+        https://bugs.webkit.org/show_bug.cgi?id=70204
+
+        Reviewed by Darin Adler.
+
+        * fast/replaced/table-percent-width-expected.txt: Updated the results to
+        show that this test is failing after reverting r97525.
+
 2011-10-17  Ryosuke Niwa  <rniwa@webkit.org>
 
         Moved V8-specific result to platform/chromium and added JSC result in cross-platform directory.
index e7f27fa4bd5c682b94eb163568dd09d4fa7b6858..73c0f10722d2e1e9a237f751502aa2af1f32f776 100644 (file)
@@ -15,10 +15,10 @@ PASS getWidth('img-2') is '98px'
 PASS getHeight('img-2') is '98px'
 PASS getWidth('img-3') is '40px'
 PASS getHeight('img-3') is '40px'
-PASS getWidth('img-4') is '36px'
-PASS getHeight('img-4') is '36px'
+FAIL getWidth('img-4') should be 36px. Was 98px.
+FAIL getHeight('img-4') should be 36px. Was 98px.
 PASS getWidth('img-5') is '40px'
-PASS getHeight('img-5') is '36px'
+FAIL getHeight('img-5') should be 36px. Was 98px.
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 5f9ab9dc635ddf10f9c9fa94e6aae90256b9ffb8..bafd4c94847cdff0faa660b414736b046c848364 100644 (file)
@@ -1,3 +1,17 @@
+2011-10-17  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/10293929> REGRESSION (r97525): iChat transcript has horizontal scroll bar when the conversation includes a wide image
+        https://bugs.webkit.org/show_bug.cgi?id=70204
+
+        Reviewed by Darin Adler.
+
+        Reverted r97525, which was supposed to fix <http://webkit.org/b/29447>.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeReplacedLogicalWidthUsing):
+        (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
+        * rendering/RenderBox.h:
+
 2011-10-17  Ada Chan  <adachan@apple.com>
 
         Export KURL::baseAsString() so it can be called in WebProcessProxy::assumeReadAccessToBaseURL() in WebKit2.
index f0baa9aa538013ba526dae2c0f75fc09635800d2..707e581dba3bf3967a88ddd8d05c4b4c00867171 100644 (file)
@@ -1271,39 +1271,6 @@ LayoutRect RenderBox::clipRect(const LayoutPoint& location)
     return clipRect;
 }
 
-enum IntrinsicDimension { LogicalHeightDimension, LogicalWidthDimension };
-
-static bool shouldExpandToIntrinsicDimension(RenderBlock* cb, IntrinsicDimension dimension)
-{
-    // This function allows images to size correctly to their intrinsic height/width when inside table cells 
-    // that only have percent or auto height/width.
-    // It's only interested in inspecting as far as the containing table, if there is one.
-    bool inTableCell = false;
-    while (cb && !cb->isRenderView()) {
-        if (cb->isTableCell())
-            inTableCell = true;
-
-        if (dimension == LogicalHeightDimension && !cb->style()->logicalHeight().isAuto() && !cb->style()->logicalHeight().isPercent())
-            return false;
-        if (dimension == LogicalWidthDimension && !cb->style()->logicalWidth().isAuto() && !cb->style()->logicalWidth().isPercent())
-            return false;
-
-        if (cb->isTable())
-            break;
-
-        cb = cb->containingBlock();
-    }
-    return inTableCell;
-}
-
-LayoutUnit RenderBox::containingBlockReplacedLogicalWidthForContent() const
-{
-    RenderBlock* cb = containingBlock();
-    if (shouldExpandToIntrinsicDimension(cb, LogicalWidthDimension))
-        return max(shrinkToAvoidFloats() ? cb->availableLogicalWidthForLine(logicalTop(), false) : cb->availableLogicalWidth(), intrinsicLogicalWidth());
-    return containingBlockLogicalWidthForContent();
-}
-
 LayoutUnit RenderBox::containingBlockLogicalWidthForContent() const
 {
     RenderBlock* cb = containingBlock();
@@ -2210,7 +2177,7 @@ LayoutUnit RenderBox::computeReplacedLogicalWidthUsing(Length logicalWidth) cons
             // FIXME: containingBlockLogicalWidthForContent() is wrong if the replaced element's block-flow is perpendicular to the
             // containing block's block-flow.
             // https://bugs.webkit.org/show_bug.cgi?id=46496
-            const LayoutUnit cw = isPositioned() ? containingBlockLogicalWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockReplacedLogicalWidthForContent();
+            const LayoutUnit cw = isPositioned() ? containingBlockLogicalWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockLogicalWidthForContent();
             if (cw > 0)
                 return computeContentBoxLogicalWidth(logicalWidth.calcMinValue(cw));
         }
@@ -2270,9 +2237,14 @@ LayoutUnit RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) co
                 // table cells using percentage heights.
                 // FIXME: This needs to be made block-flow-aware.  If the cell and image are perpendicular block-flows, this isn't right.
                 // https://bugs.webkit.org/show_bug.cgi?id=46997
-                if (shouldExpandToIntrinsicDimension(toRenderBlock(cb), LogicalHeightDimension)) {
-                    availableHeight = max(availableHeight, intrinsicLogicalHeight());
-                    return logicalHeight.calcValue(availableHeight - borderAndPaddingLogicalHeight());
+                while (cb && !cb->isRenderView() && (cb->style()->logicalHeight().isAuto() || cb->style()->logicalHeight().isPercent())) {
+                    if (cb->isTableCell()) {
+                        // Don't let table cells squeeze percent-height replaced elements
+                        // <http://bugs.webkit.org/show_bug.cgi?id=15359>
+                        availableHeight = max(availableHeight, intrinsicLogicalHeight());
+                        return logicalHeight.calcValue(availableHeight - borderAndPaddingLogicalHeight());
+                    }
+                    cb = cb->containingBlock();
                 }
             }
             return computeContentBoxLogicalHeight(logicalHeight.calcValue(availableHeight));
index 516a112509ecd077f9c11bc332f3dc29841df8f6..76a188ba131c28100a0d0922eac0e544ea7bc4f2 100644 (file)
@@ -297,7 +297,6 @@ public:
     virtual LayoutUnit containingBlockLogicalWidthForContent() const;
     LayoutUnit containingBlockLogicalWidthForContentInRegion(RenderRegion*, LayoutUnit offsetFromLogicalTopOfFirstPage) const;
     LayoutUnit perpendicularContainingBlockLogicalHeight() const;
-    LayoutUnit containingBlockReplacedLogicalWidthForContent() const;
     
     virtual void computeLogicalWidth();
     virtual void computeLogicalHeight();