Index: third_party/WebKit/Source/core/layout/LayoutReplaced.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp b/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp |
index 3e42a90b09d1e94d92945c587cc63ba4d5902a08..edd5d412b6903d11c1588b0462c6a6cbe349a89c 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp |
@@ -32,6 +32,7 @@ |
#include "core/paint/PaintInfo.h" |
#include "core/paint/PaintLayer.h" |
#include "core/paint/ReplacedPainter.h" |
+#include "core/svg/SVGSVGElement.h" |
#include "platform/LengthFunctions.h" |
namespace blink { |
@@ -266,6 +267,28 @@ void LayoutReplaced::computeIntrinsicRatioInformation(FloatSize& intrinsicSize, |
intrinsicRatio = intrinsicSize.width() / intrinsicSize.height(); |
} |
+static bool hasIntrinsicWidthForLayoutBox(LayoutBox* layoutObject) |
+{ |
+ if (layoutObject && layoutObject->isSVGRoot()) { |
+ SVGSVGElement* svg = toSVGSVGElement(layoutObject->node()); |
+ ASSERT(svg); |
+ return svg->hasIntrinsicWidth(); |
+ } |
+ |
+ return false; |
+} |
+ |
+static bool hasIntrinsicHeightForLayoutBox(LayoutBox* layoutObject) |
+{ |
+ if (layoutObject && layoutObject->isSVGRoot()) { |
+ SVGSVGElement* svg = toSVGSVGElement(layoutObject->node()); |
+ ASSERT(svg); |
+ return svg->hasIntrinsicHeight(); |
+ } |
+ |
+ return false; |
+} |
+ |
LayoutUnit LayoutReplaced::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const |
{ |
if (style()->logicalWidth().isSpecified() || style()->logicalWidth().isIntrinsic()) |
@@ -280,7 +303,7 @@ LayoutUnit LayoutReplaced::computeReplacedLogicalWidth(ShouldComputePreferred sh |
if (style()->logicalWidth().isAuto()) { |
bool computedHeightIsAuto = hasAutoHeightOrContainingBlockWithAutoHeight(); |
- bool hasIntrinsicWidth = constrainedSize.width() > 0; |
+ bool hasIntrinsicWidth = constrainedSize.width() > 0 || hasIntrinsicWidthForLayoutBox(contentLayoutObject); |
davve
2016/01/20 07:54:22
While I think this is safer than the previous fix,
|
// If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic width, then that intrinsic width is the used value of 'width'. |
if (computedHeightIsAuto && hasIntrinsicWidth) |
@@ -342,7 +365,7 @@ LayoutUnit LayoutReplaced::computeReplacedLogicalHeight() const |
computeAspectRatioInformationForLayoutBox(contentLayoutObject, constrainedSize, intrinsicRatio); |
bool widthIsAuto = style()->logicalWidth().isAuto(); |
- bool hasIntrinsicHeight = constrainedSize.height() > 0; |
+ bool hasIntrinsicHeight = constrainedSize.height() > 0 || hasIntrinsicHeightForLayoutBox(contentLayoutObject); |
// If 'height' and 'width' both have computed values of 'auto' and the element also has an intrinsic height, then that intrinsic height is the used value of 'height'. |
if (widthIsAuto && hasIntrinsicHeight) |