[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:02:39 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit bee66d9313e9c702498109ac54a7dc425d0cdc9d
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Oct 1 19:59:48 2010 +0000
https://bugs.webkit.org/show_bug.cgi?id=46642, make replaced elements work with block-flow. This patch changes
all of the computeReplacedLogicalWidth and comuteReplacedLogicalHeight functions (and their helpers) to use logical width
and logical height instead.
Reviewed by Darin Adler.
Added fast/blockflow/block-level-images.html
WebCore:
* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeLogicalWidth):
(WebCore::RenderBox::computeLogicalHeight):
(WebCore::RenderBox::computeReplacedLogicalWidth):
(WebCore::RenderBox::computeReplacedLogicalWidthUsing):
(WebCore::RenderBox::computeReplacedLogicalHeight):
(WebCore::RenderBox::computeReplacedLogicalHeightUsing):
(WebCore::RenderBox::computePositionedLogicalWidthReplaced):
(WebCore::RenderBox::computePositionedLogicalHeightReplaced):
* rendering/RenderBox.h:
(WebCore::RenderBox::intrinsicLogicalWidth):
(WebCore::RenderBox::intrinsicLogicalHeight):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::isLogicalWidthSpecified):
(WebCore::RenderImage::isLogicalHeightSpecified):
(WebCore::RenderImage::computeReplacedLogicalWidth):
(WebCore::RenderImage::computeReplacedLogicalHeight):
(WebCore::RenderImage::calcAspectRatioLogicalWidth):
(WebCore::RenderImage::calcAspectRatioLogicalHeight):
* rendering/RenderImage.h:
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::layout):
(WebCore::RenderReplaced::computeReplacedLogicalWidth):
(WebCore::RenderReplaced::computeReplacedLogicalHeight):
(WebCore::RenderReplaced::calcAspectRatioLogicalWidth):
(WebCore::RenderReplaced::calcAspectRatioLogicalHeight):
(WebCore::RenderReplaced::computePreferredLogicalWidths):
* rendering/RenderReplaced.h:
* rendering/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::computePreferredLogicalWidths):
(WebCore::RenderSVGRoot::computeReplacedLogicalWidth):
(WebCore::RenderSVGRoot::computeReplacedLogicalHeight):
* rendering/RenderSVGRoot.h:
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::computeReplacedLogicalWidth):
(WebCore::RenderVideo::computeReplacedLogicalHeight):
* rendering/RenderVideo.h:
LayoutTests:
* fast/blockflow/block-level-images.html: Added.
* fast/blockflow/resources: Added.
* fast/blockflow/resources/circle.svg: Added.
* fast/blockflow/resources/oval.png: Added.
* platform/mac/fast/blockflow/block-level-images-expected.checksum: Added.
* platform/mac/fast/blockflow/block-level-images-expected.png: Added.
* platform/mac/fast/blockflow/block-level-images-expected.txt: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68917 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 25cf30f..d30aad1 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2010-10-01 David Hyatt <hyatt at apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=46642, make replaced elements work with block-flow. This patch changes
+ all of the computeReplacedLogicalWidth and comuteReplacedLogicalHeight functions (and their helpers) to use logical width
+ and logical height instead.
+
+ Added fast/blockflow/block-level-images.html
+
+ * fast/blockflow/block-level-images.html: Added.
+ * fast/blockflow/resources: Added.
+ * fast/blockflow/resources/circle.svg: Added.
+ * fast/blockflow/resources/oval.png: Added.
+ * platform/mac/fast/blockflow/block-level-images-expected.checksum: Added.
+ * platform/mac/fast/blockflow/block-level-images-expected.png: Added.
+ * platform/mac/fast/blockflow/block-level-images-expected.txt: Added.
+
2010-09-30 Adam Barth <abarth at webkit.org>
Reviewed by Eric Seidel.
diff --git a/LayoutTests/fast/blockflow/block-level-images.html b/LayoutTests/fast/blockflow/block-level-images.html
new file mode 100644
index 0000000..ff8efb0
--- /dev/null
+++ b/LayoutTests/fast/blockflow/block-level-images.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<div style="margin:2px; float:left; height:300px;border:2px solid black;-webkit-writing-mode:tb-lr; writing-mode:tb-lr">
+<div style="width:25px;background-color:green"></div>
+<img style="display:block;height:50%; -webkit-border-before:2px solid maroon; -webkit-border-after:2px solid maroon; -webkit-border-start: 1px solid purple; -webkit-border-end:5px dashed grey" src="resources/circle.svg">
+<img style="-webkit-margin-start: 40px; display:block;height:50px" src="resources/oval.png">
+<div style="width:25px;background-color:green"></div>
+</div>
+
+<div style="margin:2px; float:left; height:300px;border:2px solid black;-webkit-writing-mode:bt-lr; writing-mode:bt-lr">
+<div style="width:25px;background-color:green"></div>
+<img style="display:block;height:50%; -webkit-border-before:2px solid maroon; -webkit-border-after:2px solid maroon; -webkit-border-start: 1px solid purple; -webkit-border-end:5px dashed grey" src="resources/circle.svg">
+<img style="-webkit-margin-start: 40px; display:block;height:50px" src="resources/oval.png">
+<div style="width:25px;background-color:green"></div>
+</div>
\ No newline at end of file
diff --git a/LayoutTests/fast/images/resources/circle.svg b/LayoutTests/fast/blockflow/resources/circle.svg
similarity index 100%
copy from LayoutTests/fast/images/resources/circle.svg
copy to LayoutTests/fast/blockflow/resources/circle.svg
diff --git a/LayoutTests/platform/mac/fast/blockflow/block-level-images-expected.checksum b/LayoutTests/platform/mac/fast/blockflow/block-level-images-expected.checksum
new file mode 100644
index 0000000..8659e55
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/blockflow/block-level-images-expected.checksum
@@ -0,0 +1 @@
+615aa0547a22f31cb00f1d0caa37cd02
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/blockflow/block-level-images-expected.png b/LayoutTests/platform/mac/fast/blockflow/block-level-images-expected.png
new file mode 100644
index 0000000..45ad4be
Binary files /dev/null and b/LayoutTests/platform/mac/fast/blockflow/block-level-images-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/blockflow/block-level-images-expected.txt b/LayoutTests/platform/mac/fast/blockflow/block-level-images-expected.txt
new file mode 100644
index 0000000..41fcfc7
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/blockflow/block-level-images-expected.txt
@@ -0,0 +1,15 @@
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x314
+ RenderBlock {HTML} at (0,0) size 800x8
+ RenderBody {BODY} at (8,8) size 784x0
+ RenderBlock (floating) {DIV} at (2,2) size 264x304 [border: (2px solid #000000)]
+ RenderBlock {DIV} at (2,2) size 25x300 [bgcolor=#008000]
+ RenderImage {IMG} at (27,2) size 154x156 [border: (1px solid #800080) (2px solid #800000) (5px dashed #808080) (2px solid #800000)]
+ RenderImage {IMG} at (181,42) size 56x50
+ RenderBlock {DIV} at (237,2) size 25x300 [bgcolor=#008000]
+ RenderBlock (floating) {DIV} at (270,2) size 264x304 [border: (2px solid #000000)]
+ RenderBlock {DIV} at (2,2) size 25x300 [bgcolor=#008000]
+ RenderImage {IMG} at (27,146) size 154x156 [border: (5px dashed #808080) (2px solid #800000) (1px solid #800080) (2px solid #800000)]
+ RenderImage {IMG} at (181,212) size 56x50
+ RenderBlock {DIV} at (237,2) size 25x300 [bgcolor=#008000]
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e62e504..190f971 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,51 @@
+2010-10-01 David Hyatt <hyatt at apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=46642, make replaced elements work with block-flow. This patch changes
+ all of the computeReplacedLogicalWidth and comuteReplacedLogicalHeight functions (and their helpers) to use logical width
+ and logical height instead.
+
+ Added fast/blockflow/block-level-images.html
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::computeLogicalWidth):
+ (WebCore::RenderBox::computeLogicalHeight):
+ (WebCore::RenderBox::computeReplacedLogicalWidth):
+ (WebCore::RenderBox::computeReplacedLogicalWidthUsing):
+ (WebCore::RenderBox::computeReplacedLogicalHeight):
+ (WebCore::RenderBox::computeReplacedLogicalHeightUsing):
+ (WebCore::RenderBox::computePositionedLogicalWidthReplaced):
+ (WebCore::RenderBox::computePositionedLogicalHeightReplaced):
+ * rendering/RenderBox.h:
+ (WebCore::RenderBox::intrinsicLogicalWidth):
+ (WebCore::RenderBox::intrinsicLogicalHeight):
+ * rendering/RenderImage.cpp:
+ (WebCore::RenderImage::isLogicalWidthSpecified):
+ (WebCore::RenderImage::isLogicalHeightSpecified):
+ (WebCore::RenderImage::computeReplacedLogicalWidth):
+ (WebCore::RenderImage::computeReplacedLogicalHeight):
+ (WebCore::RenderImage::calcAspectRatioLogicalWidth):
+ (WebCore::RenderImage::calcAspectRatioLogicalHeight):
+ * rendering/RenderImage.h:
+ * rendering/RenderReplaced.cpp:
+ (WebCore::RenderReplaced::layout):
+ (WebCore::RenderReplaced::computeReplacedLogicalWidth):
+ (WebCore::RenderReplaced::computeReplacedLogicalHeight):
+ (WebCore::RenderReplaced::calcAspectRatioLogicalWidth):
+ (WebCore::RenderReplaced::calcAspectRatioLogicalHeight):
+ (WebCore::RenderReplaced::computePreferredLogicalWidths):
+ * rendering/RenderReplaced.h:
+ * rendering/RenderSVGRoot.cpp:
+ (WebCore::RenderSVGRoot::computePreferredLogicalWidths):
+ (WebCore::RenderSVGRoot::computeReplacedLogicalWidth):
+ (WebCore::RenderSVGRoot::computeReplacedLogicalHeight):
+ * rendering/RenderSVGRoot.h:
+ * rendering/RenderVideo.cpp:
+ (WebCore::RenderVideo::computeReplacedLogicalWidth):
+ (WebCore::RenderVideo::computeReplacedLogicalHeight):
+ * rendering/RenderVideo.h:
+
2010-10-01 Nate Chapin <japhet at chromium.org>
Reviewed by Darin Adler.
diff --git a/WebCore/rendering/RenderBox.cpp b/WebCore/rendering/RenderBox.cpp
index 4b52920..487a2bb 100644
--- a/WebCore/rendering/RenderBox.cpp
+++ b/WebCore/rendering/RenderBox.cpp
@@ -1439,7 +1439,7 @@ void RenderBox::computeLogicalWidth()
bool stretching = (parent()->style()->boxAlign() == BSTRETCH);
bool treatAsReplaced = shouldComputeSizeAsReplaced() && (!inVerticalBox || !stretching);
- Length logicalWidthLength = (treatAsReplaced) ? Length(computeReplacedWidth(), Fixed) : style()->logicalWidth();
+ Length logicalWidthLength = (treatAsReplaced) ? Length(computeReplacedLogicalWidth(), Fixed) : style()->logicalWidth();
RenderBlock* cb = containingBlock();
int containerLogicalWidth = max(0, containingBlockLogicalWidthForContent());
@@ -1645,7 +1645,7 @@ void RenderBox::computeLogicalHeight()
&& parent()->isFlexingChildren())
h = Length(overrideSize() - borderAndPaddingLogicalHeight(), Fixed);
else if (treatAsReplaced)
- h = Length(computeReplacedHeight(), Fixed);
+ h = Length(computeReplacedLogicalHeight(), Fixed);
else {
h = style()->logicalHeight();
checkMinMaxHeight = true;
@@ -1810,48 +1810,48 @@ int RenderBox::computePercentageLogicalHeight(const Length& height)
return result;
}
-int RenderBox::computeReplacedWidth(bool includeMaxWidth) const
+int RenderBox::computeReplacedLogicalWidth(bool includeMaxWidth) const
{
- int width = computeReplacedWidthUsing(style()->width());
- int minW = computeReplacedWidthUsing(style()->minWidth());
- int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : computeReplacedWidthUsing(style()->maxWidth());
+ int logicalWidth = computeReplacedLogicalWidthUsing(style()->logicalWidth());
+ int minLogicalWidth = computeReplacedLogicalWidthUsing(style()->logicalMinWidth());
+ int maxLogicalWidth = !includeMaxWidth || style()->logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMaxWidth());
- return max(minW, min(width, maxW));
+ return max(minLogicalWidth, min(logicalWidth, maxLogicalWidth));
}
-int RenderBox::computeReplacedWidthUsing(Length width) const
+int RenderBox::computeReplacedLogicalWidthUsing(Length logicalWidth) const
{
- switch (width.type()) {
+ switch (logicalWidth.type()) {
case Fixed:
- return computeContentBoxLogicalWidth(width.value());
+ return computeContentBoxLogicalWidth(logicalWidth.value());
case Percent: {
// 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 int cw = isPositioned() ? containingBlockWidthForPositioned(toRenderBoxModelObject(container())) : containingBlockLogicalWidthForContent();
if (cw > 0)
- return computeContentBoxLogicalWidth(width.calcMinValue(cw));
+ return computeContentBoxLogicalWidth(logicalWidth.calcMinValue(cw));
}
// fall through
default:
- return intrinsicSize().width();
+ return intrinsicLogicalWidth();
}
}
-int RenderBox::computeReplacedHeight() const
+int RenderBox::computeReplacedLogicalHeight() const
{
- int height = computeReplacedHeightUsing(style()->height());
- int minH = computeReplacedHeightUsing(style()->minHeight());
- int maxH = style()->maxHeight().isUndefined() ? height : computeReplacedHeightUsing(style()->maxHeight());
+ int logicalHeight = computeReplacedLogicalHeightUsing(style()->logicalHeight());
+ int minLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMinHeight());
+ int maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight());
- return max(minH, min(height, maxH));
+ return max(minLogicalHeight, min(logicalHeight, maxLogicalHeight));
}
-int RenderBox::computeReplacedHeightUsing(Length height) const
+int RenderBox::computeReplacedLogicalHeightUsing(Length logicalHeight) const
{
- switch (height.type()) {
+ switch (logicalHeight.type()) {
case Fixed:
- return computeContentBoxLogicalHeight(height.value());
+ return computeContentBoxLogicalHeight(logicalHeight.value());
case Percent:
{
RenderObject* cb = isPositioned() ? container() : containingBlock();
@@ -1860,6 +1860,8 @@ int RenderBox::computeReplacedHeightUsing(Length height) const
toRenderBlock(cb)->addPercentHeightDescendant(const_cast<RenderBox*>(this));
}
+ // FIXME: This calculation is not patched for block-flow yet.
+ // https://bugs.webkit.org/show_bug.cgi?id=46500
if (cb->isPositioned() && cb->style()->height().isAuto() && !(cb->style()->top().isAuto() || cb->style()->bottom().isAuto())) {
ASSERT(cb->isRenderBlock());
RenderBlock* block = toRenderBlock(cb);
@@ -1867,25 +1869,30 @@ int RenderBox::computeReplacedHeightUsing(Length height) const
block->computeLogicalHeight();
int newHeight = block->computeContentBoxLogicalHeight(block->contentHeight());
block->setHeight(oldHeight);
- return computeContentBoxLogicalHeight(height.calcValue(newHeight));
+ return computeContentBoxLogicalHeight(logicalHeight.calcValue(newHeight));
}
+ // FIXME: availableLogicalHeight() 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
int availableHeight = isPositioned() ? containingBlockHeightForPositioned(toRenderBoxModelObject(cb)) : toRenderBox(cb)->availableLogicalHeight();
// It is necessary to use the border-box to match WinIE's broken
// box model. This is essential for sizing inside
// table cells using percentage heights.
- if (cb->isTableCell() && (cb->style()->height().isAuto() || cb->style()->height().isPercent())) {
+ // 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 (cb->isTableCell() && (cb->style()->logicalHeight().isAuto() || cb->style()->logicalHeight().isPercent())) {
// Don't let table cells squeeze percent-height replaced elements
// <http://bugs.webkit.org/show_bug.cgi?id=15359>
- availableHeight = max(availableHeight, intrinsicSize().height());
- return height.calcValue(availableHeight - borderAndPaddingHeight());
+ availableHeight = max(availableHeight, intrinsicLogicalHeight());
+ return logicalHeight.calcValue(availableHeight - borderAndPaddingLogicalHeight());
}
- return computeContentBoxLogicalHeight(height.calcValue(availableHeight));
+ return computeContentBoxLogicalHeight(logicalHeight.calcValue(availableHeight));
}
default:
- return intrinsicSize().height();
+ return intrinsicLogicalHeight();
}
}
@@ -2578,7 +2585,7 @@ void RenderBox::computePositionedLogicalWidthReplaced()
// NOTE: This value of width is FINAL in that the min/max width calculations
// are dealt with in computeReplacedWidth(). This means that the steps to produce
// correct max/min in the non-replaced version, are not necessary.
- setWidth(computeReplacedWidth() + borderAndPaddingWidth());
+ setWidth(computeReplacedLogicalWidth() + borderAndPaddingWidth());
const int availableSpace = containerWidth - width();
/*-----------------------------------------------------------------------*\
@@ -2751,7 +2758,7 @@ void RenderBox::computePositionedLogicalHeightReplaced()
// NOTE: This value of height is FINAL in that the min/max height calculations
// are dealt with in computeReplacedHeight(). This means that the steps to produce
// correct max/min in the non-replaced version, are not necessary.
- setHeight(computeReplacedHeight() + borderAndPaddingHeight());
+ setHeight(computeReplacedLogicalHeight() + borderAndPaddingHeight());
const int availableSpace = containerHeight - height();
/*-----------------------------------------------------------------------*\
diff --git a/WebCore/rendering/RenderBox.h b/WebCore/rendering/RenderBox.h
index f964bc3..29ffdb6 100644
--- a/WebCore/rendering/RenderBox.h
+++ b/WebCore/rendering/RenderBox.h
@@ -276,6 +276,8 @@ public:
}
virtual IntSize intrinsicSize() const { return IntSize(); }
+ int intrinsicLogicalWidth() const { return style()->isVerticalBlockFlow() ? intrinsicSize().width() : intrinsicSize().height(); }
+ int intrinsicLogicalHeight() const { return style()->isVerticalBlockFlow() ? intrinsicSize().height() : intrinsicSize().width(); }
// 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.
@@ -284,11 +286,11 @@ public:
int computeLogicalWidthUsing(LogicalWidthType, int availableLogicalWidth);
int computeLogicalHeightUsing(const Length& height);
- int computeReplacedWidthUsing(Length width) const;
- int computeReplacedHeightUsing(Length height) const;
+ int computeReplacedLogicalWidthUsing(Length width) const;
+ int computeReplacedLogicalHeightUsing(Length height) const;
- virtual int computeReplacedWidth(bool includeMaxWidth = true) const;
- virtual int computeReplacedHeight() const;
+ virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
+ virtual int computeReplacedLogicalHeight() const;
int computePercentageLogicalHeight(const Length& height);
diff --git a/WebCore/rendering/RenderImage.cpp b/WebCore/rendering/RenderImage.cpp
index a220ca2..e7624de 100644
--- a/WebCore/rendering/RenderImage.cpp
+++ b/WebCore/rendering/RenderImage.cpp
@@ -395,9 +395,9 @@ void RenderImage::updateAltText()
#endif
}
-bool RenderImage::isWidthSpecified() const
+bool RenderImage::isLogicalWidthSpecified() const
{
- switch (style()->width().type()) {
+ switch (style()->logicalWidth().type()) {
case Fixed:
case Percent:
return true;
@@ -412,9 +412,9 @@ bool RenderImage::isWidthSpecified() const
return false;
}
-bool RenderImage::isHeightSpecified() const
+bool RenderImage::isLogicalHeightSpecified() const
{
- switch (style()->height().type()) {
+ switch (style()->logicalHeight().type()) {
case Fixed:
case Percent:
return true;
@@ -429,7 +429,7 @@ bool RenderImage::isHeightSpecified() const
return false;
}
-int RenderImage::computeReplacedWidth(bool includeMaxWidth) const
+int RenderImage::computeReplacedLogicalWidth(bool includeMaxWidth) const
{
if (m_imageResource->imageHasRelativeWidth())
if (RenderObject* cb = isPositioned() ? container() : containingBlock()) {
@@ -437,58 +437,62 @@ int RenderImage::computeReplacedWidth(bool includeMaxWidth) const
m_imageResource->setImageContainerSize(IntSize(toRenderBox(cb)->availableWidth(), toRenderBox(cb)->availableHeight()));
}
- int width;
- if (isWidthSpecified())
- width = computeReplacedWidthUsing(style()->width());
- else if (m_imageResource->usesImageContainerSize())
- width = m_imageResource->imageSize(style()->effectiveZoom()).width();
- else if (m_imageResource->imageHasRelativeWidth())
- width = 0; // If the image is relatively-sized, set the width to 0 until there is a set container size.
+ int logicalWidth;
+ if (isLogicalWidthSpecified())
+ logicalWidth = computeReplacedLogicalWidthUsing(style()->logicalWidth());
+ else if (m_imageResource->usesImageContainerSize()) {
+ IntSize size = m_imageResource->imageSize(style()->effectiveZoom());
+ logicalWidth = style()->isVerticalBlockFlow() ? size.width() : size.height();
+ } else if (m_imageResource->imageHasRelativeWidth())
+ logicalWidth = 0; // If the image is relatively-sized, set the width to 0 until there is a set container size.
else
- width = calcAspectRatioWidth();
+ logicalWidth = calcAspectRatioLogicalWidth();
- int minW = computeReplacedWidthUsing(style()->minWidth());
- int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : computeReplacedWidthUsing(style()->maxWidth());
+ int minLogicalWidth = computeReplacedLogicalWidthUsing(style()->logicalMinWidth());
+ int maxLogicalWidth = !includeMaxWidth || style()->logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMaxWidth());
- return max(minW, min(width, maxW));
+ return max(minLogicalWidth, min(logicalWidth, maxLogicalWidth));
}
-int RenderImage::computeReplacedHeight() const
+int RenderImage::computeReplacedLogicalHeight() const
{
- int height;
- if (isHeightSpecified())
- height = computeReplacedHeightUsing(style()->height());
- else if (m_imageResource->usesImageContainerSize())
- height = m_imageResource->imageSize(style()->effectiveZoom()).height();
- else if (m_imageResource->imageHasRelativeHeight())
- height = 0; // If the image is relatively-sized, set the height to 0 until there is a set container size.
+ int logicalHeight;
+ if (isLogicalHeightSpecified())
+ logicalHeight = computeReplacedLogicalHeightUsing(style()->logicalHeight());
+ else if (m_imageResource->usesImageContainerSize()) {
+ IntSize size = m_imageResource->imageSize(style()->effectiveZoom());
+ logicalHeight = style()->isVerticalBlockFlow() ? size.height() : size.width();
+ } else if (m_imageResource->imageHasRelativeHeight())
+ logicalHeight = 0; // If the image is relatively-sized, set the height to 0 until there is a set container size.
else
- height = calcAspectRatioHeight();
+ logicalHeight = calcAspectRatioLogicalHeight();
- int minH = computeReplacedHeightUsing(style()->minHeight());
- int maxH = style()->maxHeight().isUndefined() ? height : computeReplacedHeightUsing(style()->maxHeight());
+ int minLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMinHeight());
+ int maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight());
- return max(minH, min(height, maxH));
+ return max(minLogicalHeight, min(logicalHeight, maxLogicalHeight));
}
-int RenderImage::calcAspectRatioWidth() const
+int RenderImage::calcAspectRatioLogicalWidth() const
{
- IntSize size = intrinsicSize();
- if (!size.height())
+ int intrinsicWidth = intrinsicLogicalWidth();
+ int intrinsicHeight = intrinsicLogicalHeight();
+ if (!intrinsicHeight)
return 0;
if (!m_imageResource->hasImage() || m_imageResource->errorOccurred())
- return size.width(); // Don't bother scaling.
- return RenderBox::computeReplacedHeight() * size.width() / size.height();
+ return intrinsicWidth; // Don't bother scaling.
+ return RenderBox::computeReplacedLogicalHeight() * intrinsicWidth / intrinsicHeight;
}
-int RenderImage::calcAspectRatioHeight() const
+int RenderImage::calcAspectRatioLogicalHeight() const
{
- IntSize size = intrinsicSize();
- if (!size.width())
+ int intrinsicWidth = intrinsicLogicalWidth();
+ int intrinsicHeight = intrinsicLogicalHeight();
+ if (!intrinsicWidth)
return 0;
if (!m_imageResource->hasImage() || m_imageResource->errorOccurred())
- return size.height(); // Don't bother scaling.
- return RenderBox::computeReplacedWidth() * size.height() / size.width();
+ return intrinsicHeight; // Don't bother scaling.
+ return RenderBox::computeReplacedLogicalWidth() * intrinsicHeight / intrinsicWidth;
}
} // namespace WebCore
diff --git a/WebCore/rendering/RenderImage.h b/WebCore/rendering/RenderImage.h
index 022d792..308c863 100644
--- a/WebCore/rendering/RenderImage.h
+++ b/WebCore/rendering/RenderImage.h
@@ -58,8 +58,8 @@ protected:
void paintFocusRings(PaintInfo&, const RenderStyle*);
virtual void paint(PaintInfo&, int tx, int ty);
- bool isWidthSpecified() const;
- bool isHeightSpecified() const;
+ bool isLogicalWidthSpecified() const;
+ bool isLogicalHeightSpecified() const;
virtual void intrinsicSizeChanged()
{
@@ -80,11 +80,11 @@ private:
virtual void notifyFinished(CachedResource*);
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, int x, int y, int tx, int ty, HitTestAction);
- virtual int computeReplacedWidth(bool includeMaxWidth = true) const;
- virtual int computeReplacedHeight() const;
+ virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
+ virtual int computeReplacedLogicalHeight() const;
- int calcAspectRatioWidth() const;
- int calcAspectRatioHeight() const;
+ int calcAspectRatioLogicalWidth() const;
+ int calcAspectRatioLogicalHeight() const;
private:
// Text to display as long as the image isn't available.
diff --git a/WebCore/rendering/RenderReplaced.cpp b/WebCore/rendering/RenderReplaced.cpp
index d3b449c..7690ac9 100644
--- a/WebCore/rendering/RenderReplaced.cpp
+++ b/WebCore/rendering/RenderReplaced.cpp
@@ -57,13 +57,6 @@ RenderReplaced::~RenderReplaced()
{
}
-void RenderReplaced::setStyle(PassRefPtr<RenderStyle> newStyle)
-{
- if (newStyle->blockFlow() != TopToBottomBlockFlow)
- newStyle->setBlockFlow(TopToBottomBlockFlow);
- RenderBox::setStyle(newStyle);
-}
-
void RenderReplaced::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
{
RenderBox::styleDidChange(diff, oldStyle);
@@ -88,8 +81,7 @@ void RenderReplaced::layout()
m_overflow.clear();
addShadowOverflow();
- repainter.repaintAfterLayout();
-
+ repainter.repaintAfterLayout();
setNeedsLayout(false);
}
@@ -207,54 +199,54 @@ static inline bool lengthIsSpecified(Length length)
return lengthType == Fixed || lengthType == Percent;
}
-int RenderReplaced::computeReplacedWidth(bool includeMaxWidth) const
+int RenderReplaced::computeReplacedLogicalWidth(bool includeMaxWidth) const
{
- int width;
+ int logicalWidth;
if (lengthIsSpecified(style()->width()))
- width = computeReplacedWidthUsing(style()->width());
+ logicalWidth = computeReplacedLogicalWidthUsing(style()->logicalWidth());
else if (m_hasIntrinsicSize)
- width = calcAspectRatioWidth();
+ logicalWidth = calcAspectRatioLogicalWidth();
else
- width = intrinsicSize().width();
+ logicalWidth = intrinsicLogicalWidth();
- int minW = computeReplacedWidthUsing(style()->minWidth());
- int maxW = !includeMaxWidth || style()->maxWidth().isUndefined() ? width : computeReplacedWidthUsing(style()->maxWidth());
+ int minLogicalWidth = computeReplacedLogicalWidthUsing(style()->logicalMinWidth());
+ int maxLogicalWidth = !includeMaxWidth || style()->logicalMaxWidth().isUndefined() ? logicalWidth : computeReplacedLogicalWidthUsing(style()->logicalMaxWidth());
- return max(minW, min(width, maxW));
+ return max(minLogicalWidth, min(logicalWidth, maxLogicalWidth));
}
-int RenderReplaced::computeReplacedHeight() const
+int RenderReplaced::computeReplacedLogicalHeight() const
{
- int height;
- if (lengthIsSpecified(style()->height()))
- height = computeReplacedHeightUsing(style()->height());
+ int logicalHeight;
+ if (lengthIsSpecified(style()->logicalHeight()))
+ logicalHeight = computeReplacedLogicalHeightUsing(style()->logicalHeight());
else if (m_hasIntrinsicSize)
- height = calcAspectRatioHeight();
+ logicalHeight = calcAspectRatioLogicalHeight();
else
- height = intrinsicSize().height();
+ logicalHeight = intrinsicLogicalHeight();
- int minH = computeReplacedHeightUsing(style()->minHeight());
- int maxH = style()->maxHeight().isUndefined() ? height : computeReplacedHeightUsing(style()->maxHeight());
+ int minLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMinHeight());
+ int maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight());
- return max(minH, min(height, maxH));
+ return max(minLogicalHeight, min(logicalHeight, maxLogicalHeight));
}
-int RenderReplaced::calcAspectRatioWidth() const
+int RenderReplaced::calcAspectRatioLogicalWidth() const
{
- int intrinsicWidth = intrinsicSize().width();
- int intrinsicHeight = intrinsicSize().height();
+ int intrinsicWidth = intrinsicLogicalWidth();
+ int intrinsicHeight = intrinsicLogicalHeight();
if (!intrinsicHeight)
return 0;
- return RenderBox::computeReplacedHeight() * intrinsicWidth / intrinsicHeight;
+ return RenderBox::computeReplacedLogicalHeight() * intrinsicWidth / intrinsicHeight;
}
-int RenderReplaced::calcAspectRatioHeight() const
+int RenderReplaced::calcAspectRatioLogicalHeight() const
{
- int intrinsicWidth = intrinsicSize().width();
- int intrinsicHeight = intrinsicSize().height();
+ int intrinsicWidth = intrinsicLogicalWidth();
+ int intrinsicHeight = intrinsicLogicalHeight();
if (!intrinsicWidth)
return 0;
- return RenderBox::computeReplacedWidth() * intrinsicHeight / intrinsicWidth;
+ return RenderBox::computeReplacedLogicalWidth() * intrinsicHeight / intrinsicWidth;
}
void RenderReplaced::computePreferredLogicalWidths()
@@ -262,7 +254,7 @@ void RenderReplaced::computePreferredLogicalWidths()
ASSERT(preferredLogicalWidthsDirty());
int borderAndPadding = borderAndPaddingWidth();
- m_maxPreferredLogicalWidth = computeReplacedWidth(false) + borderAndPadding;
+ m_maxPreferredLogicalWidth = computeReplacedLogicalWidth(false) + borderAndPadding;
if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength)
m_maxPreferredLogicalWidth = min(m_maxPreferredLogicalWidth, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : 0));
diff --git a/WebCore/rendering/RenderReplaced.h b/WebCore/rendering/RenderReplaced.h
index 872f6d0..044ee81 100644
--- a/WebCore/rendering/RenderReplaced.h
+++ b/WebCore/rendering/RenderReplaced.h
@@ -32,15 +32,13 @@ public:
RenderReplaced(Node*, const IntSize& intrinsicSize);
virtual ~RenderReplaced();
- virtual void setStyle(PassRefPtr<RenderStyle>);
-
protected:
virtual void layout();
virtual IntSize intrinsicSize() const;
- virtual int computeReplacedWidth(bool includeMaxWidth = true) const;
- virtual int computeReplacedHeight() const;
+ virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
+ virtual int computeReplacedLogicalHeight() const;
virtual int minimumReplacedHeight() const { return 0; }
virtual void setSelectionState(SelectionState);
@@ -67,8 +65,8 @@ private:
virtual void computePreferredLogicalWidths();
- int calcAspectRatioWidth() const;
- int calcAspectRatioHeight() const;
+ int calcAspectRatioLogicalWidth() const;
+ int calcAspectRatioLogicalHeight() const;
virtual void paintReplaced(PaintInfo&, int /*tx*/, int /*ty*/) { }
diff --git a/WebCore/rendering/RenderSVGRoot.cpp b/WebCore/rendering/RenderSVGRoot.cpp
index 82b10d5..31b62cf 100644
--- a/WebCore/rendering/RenderSVGRoot.cpp
+++ b/WebCore/rendering/RenderSVGRoot.cpp
@@ -68,7 +68,7 @@ void RenderSVGRoot::computePreferredLogicalWidths()
ASSERT(preferredLogicalWidthsDirty());
int borderAndPadding = borderAndPaddingWidth();
- int width = computeReplacedWidth(false) + borderAndPadding;
+ int width = computeReplacedLogicalWidth(false) + borderAndPadding;
if (style()->maxWidth().isFixed() && style()->maxWidth().value() != undefinedLength)
width = min(width, style()->maxWidth().value() + (style()->boxSizing() == CONTENT_BOX ? borderAndPadding : 0));
@@ -82,10 +82,10 @@ void RenderSVGRoot::computePreferredLogicalWidths()
setPreferredLogicalWidthsDirty(false);
}
-int RenderSVGRoot::computeReplacedWidth(bool includeMaxWidth) const
+int RenderSVGRoot::computeReplacedLogicalWidth(bool includeMaxWidth) const
{
- int replacedWidth = RenderBox::computeReplacedWidth(includeMaxWidth);
- if (!style()->width().isPercent())
+ int replacedWidth = RenderBox::computeReplacedLogicalWidth(includeMaxWidth);
+ if (!style()->logicalWidth().isPercent())
return replacedWidth;
// FIXME: Investigate in size rounding issues
@@ -93,10 +93,10 @@ int RenderSVGRoot::computeReplacedWidth(bool includeMaxWidth) const
return static_cast<int>(roundf(replacedWidth * svg->currentScale()));
}
-int RenderSVGRoot::computeReplacedHeight() const
+int RenderSVGRoot::computeReplacedLogicalHeight() const
{
- int replacedHeight = RenderBox::computeReplacedHeight();
- if (!style()->height().isPercent())
+ int replacedHeight = RenderBox::computeReplacedLogicalHeight();
+ if (!style()->logicalHeight().isPercent())
return replacedHeight;
// FIXME: Investigate in size rounding issues
diff --git a/WebCore/rendering/RenderSVGRoot.h b/WebCore/rendering/RenderSVGRoot.h
index 3c29b87..9964393 100644
--- a/WebCore/rendering/RenderSVGRoot.h
+++ b/WebCore/rendering/RenderSVGRoot.h
@@ -54,8 +54,8 @@ private:
virtual int lineHeight(bool b, bool isRootLineBox = false) const;
virtual int baselinePosition(bool b, bool isRootLineBox = false) const;
virtual void computePreferredLogicalWidths();
- virtual int computeReplacedWidth(bool includeMaxWidth = true) const;
- virtual int computeReplacedHeight() const;
+ virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
+ virtual int computeReplacedLogicalHeight() const;
virtual void layout();
virtual void paint(PaintInfo&, int parentX, int parentY);
diff --git a/WebCore/rendering/RenderVideo.cpp b/WebCore/rendering/RenderVideo.cpp
index 470499a..32ba91b 100644
--- a/WebCore/rendering/RenderVideo.cpp
+++ b/WebCore/rendering/RenderVideo.cpp
@@ -246,14 +246,14 @@ void RenderVideo::updatePlayer()
mediaPlayer->setVisible(true);
}
-int RenderVideo::computeReplacedWidth(bool includeMaxWidth) const
+int RenderVideo::computeReplacedLogicalWidth(bool includeMaxWidth) const
{
- return RenderReplaced::computeReplacedWidth(includeMaxWidth);
+ return RenderReplaced::computeReplacedLogicalWidth(includeMaxWidth);
}
-int RenderVideo::computeReplacedHeight() const
+int RenderVideo::computeReplacedLogicalHeight() const
{
- return RenderReplaced::computeReplacedHeight();
+ return RenderReplaced::computeReplacedLogicalHeight();
}
int RenderVideo::minimumReplacedHeight() const
diff --git a/WebCore/rendering/RenderVideo.h b/WebCore/rendering/RenderVideo.h
index 24f473d..9091490 100644
--- a/WebCore/rendering/RenderVideo.h
+++ b/WebCore/rendering/RenderVideo.h
@@ -70,8 +70,8 @@ private:
virtual void layout();
- virtual int computeReplacedWidth(bool includeMaxWidth = true) const;
- virtual int computeReplacedHeight() const;
+ virtual int computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
+ virtual int computeReplacedLogicalHeight() const;
virtual int minimumReplacedHeight() const;
void updatePlayer();
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list