Reviewed by Hyatt
http://bugzilla.opendarwin.org/show_bug.cgi?id=9314
* fast/block/positioning/relative-overflow-block-expected.checksum: Added.
* fast/block/positioning/relative-overflow-block-expected.png: Added.
* fast/block/positioning/relative-overflow-block-expected.txt: Added.
* fast/block/positioning/relative-overflow-block.html: Added.
* fast/block/positioning/relative-overflow-replaced-expected.checksum: Added.
* fast/block/positioning/relative-overflow-replaced-expected.png: Added.
* fast/block/positioning/relative-overflow-replaced-expected.txt: Added.
* fast/block/positioning/relative-overflow-replaced-float-expected.checksum: Added.
* fast/block/positioning/relative-overflow-replaced-float-expected.png: Added.
* fast/block/positioning/relative-overflow-replaced-float-expected.txt: Added.
* fast/block/positioning/relative-overflow-replaced-float.html: Added.
* fast/block/positioning/relative-overflow-replaced.html: Added.
WebCore:
Reviewed by Hyatt.
http://bugzilla.opendarwin.org/show_bug.cgi?id=9314
Relative positioned block size doesnt update root layer size
- take relative positioning into account in leftmost/rightmost/lowestPosition()
- ignore zero width/height boxes in leftmost/rightmost/lowestPosition()
- split relativePositionOffset() to x and y functions
* rendering/RenderBox.cpp:
(WebCore::RenderBox::absolutePosition):
(WebCore::RenderBox::relativePositionOffsetX):
(WebCore::RenderBox::relativePositionOffsetY):
(WebCore::RenderBox::lowestPosition):
(WebCore::RenderBox::rightmostPosition):
(WebCore::RenderBox::leftmostPosition):
* rendering/RenderBox.h:
* rendering/RenderFlow.cpp:
(WebCore::RenderFlow::lowestPosition):
(WebCore::RenderFlow::rightmostPosition):
(WebCore::RenderFlow::leftmostPosition):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPosition):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::offsetLeft):
(WebCore::RenderObject::offsetTop):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14847
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-06-13 Antti Koivisto <koivisto@iki.fi>
+
+ Reviewed by Hyatt
+
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=9314
+
+ * fast/block/positioning/relative-overflow-block-expected.checksum: Added.
+ * fast/block/positioning/relative-overflow-block-expected.png: Added.
+ * fast/block/positioning/relative-overflow-block-expected.txt: Added.
+ * fast/block/positioning/relative-overflow-block.html: Added.
+ * fast/block/positioning/relative-overflow-replaced-expected.checksum: Added.
+ * fast/block/positioning/relative-overflow-replaced-expected.png: Added.
+ * fast/block/positioning/relative-overflow-replaced-expected.txt: Added.
+ * fast/block/positioning/relative-overflow-replaced-float-expected.checksum: Added.
+ * fast/block/positioning/relative-overflow-replaced-float-expected.png: Added.
+ * fast/block/positioning/relative-overflow-replaced-float-expected.txt: Added.
+ * fast/block/positioning/relative-overflow-replaced-float.html: Added.
+ * fast/block/positioning/relative-overflow-replaced.html: Added.
+
2006-06-13 Anders Carlsson <acarlsson@apple.com>
Reviewed by Dave Hyatt.
--- /dev/null
+c52303c7188babb248eb5c7293502200
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 814x850
+ RenderView at (0,0) size 785x585
+layer at (0,0) size 785x600
+ RenderBlock {HTML} at (0,0) size 785x600
+ RenderBody {BODY} at (8,8) size 769x584
+ RenderText {#text} at (0,0) size 762x36
+ text run at (0,0) width 762: "Document canvas should be big enough to fit both blue and red (relative positioned) rectangles (ie. have scrollbars if they"
+ text run at (0,18) width 131: "don't fit to the view) "
+layer at (8,44) size 506x506
+ RenderBlock (positioned) {DIV} at (8,44) size 504x504 [border: (2px solid #0000FF)]
+layer at (310,346) size 504x504
+ RenderBlock (relative positioned) {DIV} at (2,2) size 504x504 [border: (2px solid #FF0000)]
--- /dev/null
+<html>
+<body>
+Document canvas should be big enough to fit both blue and red (relative positioned) rectangles (ie. have scrollbars if they don't fit to the view)
+<div style="width: 500px; height: 500px; position: absolute; border: 2px solid blue;">
+<div style="width: 500px; height: 500px; left: 300px; top:300px; position: relative; border: 2px solid red;">
+</div>
+</div>
\ No newline at end of file
--- /dev/null
+2ff0091c8d44cd27d5c366745c066f07
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 1108x1108
+ RenderView at (0,0) size 785x585
+layer at (0,0) size 785x600
+ RenderBlock {HTML} at (0,0) size 785x600
+ RenderBody {BODY} at (8,8) size 769x584
+ RenderText {#text} at (100,86) size 743x36
+ text run at (100,86) width 643: " The image should be 1000px over to the right and bottom, which should cause horizontal and vertical"
+ text run at (0,104) width 126: "scrollbars to appear."
+ RenderText {#text} at (0,0) size 0x0
+layer at (1008,1008) size 100x100
+ RenderImage {IMG} at (0,0) size 100x100 [bgcolor=#00FF00]
--- /dev/null
+1f3a86bc9a6aebd0ac54c0d3a2e60fe2
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 1108x1108
+ RenderView at (0,0) size 785x585
+layer at (0,0) size 785x600
+ RenderBlock {HTML} at (0,0) size 785x600
+ RenderBody {BODY} at (8,8) size 769x584
+ RenderText {#text} at (100,0) size 639x36
+ text run at (100,0) width 639: "The image should be 1000px over to the right and bottom, which should cause horizontal and vertical"
+ text run at (100,18) width 126: "scrollbars to appear."
+ RenderText {#text} at (0,0) size 0x0
+layer at (1008,1008) size 100x100
+ RenderImage {IMG} at (0,0) size 100x100 [bgcolor=#00FF00]
--- /dev/null
+<html>
+<body>
+<img style="float:left;position:relative;left:1000px;top:1000px;height:100px;width:100px;background-color:lime">
+The image should be 1000px over to the right and bottom, which should cause horizontal and vertical scrollbars to appear.
+</body>
--- /dev/null
+<html>
+<body>
+<img style="position:relative;left:1000px;top:1000px;height:100px;width:100px;background-color:lime">
+The image should be 1000px over to the right and bottom, which should cause horizontal and vertical scrollbars to appear.
+</body>
+2006-06-13 Antti Koivisto <koivisto@iki.fi>
+
+ Reviewed by Hyatt.
+
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=9314
+ Relative positioned block size doesnt update root layer size
+
+ - take relative positioning into account in leftmost/rightmost/lowestPosition()
+ - ignore zero width/height boxes in leftmost/rightmost/lowestPosition()
+ - split relativePositionOffset() to x and y functions
+
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::absolutePosition):
+ (WebCore::RenderBox::relativePositionOffsetX):
+ (WebCore::RenderBox::relativePositionOffsetY):
+ (WebCore::RenderBox::lowestPosition):
+ (WebCore::RenderBox::rightmostPosition):
+ (WebCore::RenderBox::leftmostPosition):
+ * rendering/RenderBox.h:
+ * rendering/RenderFlow.cpp:
+ (WebCore::RenderFlow::lowestPosition):
+ (WebCore::RenderFlow::rightmostPosition):
+ (WebCore::RenderFlow::leftmostPosition):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::updateLayerPosition):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::offsetLeft):
+ (WebCore::RenderObject::offsetTop):
+
2006-06-13 Anders Carlsson <acarlsson@apple.com>
Reviewed by Dave Hyatt.
yPos += m_y;
}
- if (isRelPositioned())
- relativePositionOffset(xPos, yPos);
+ if (isRelPositioned()) {
+ xPos += relativePositionOffsetX();
+ yPos += relativePositionOffsetY();
+ }
return true;
}
}
}
-void RenderBox::relativePositionOffset(int &tx, int &ty)
+int RenderBox::relativePositionOffsetX() const
{
+ int tx = 0;
if(!style()->left().isAuto())
- tx += style()->left().calcValue(containingBlockWidth());
+ tx = style()->left().calcValue(containingBlockWidth());
else if(!style()->right().isAuto())
- tx -= style()->right().calcValue(containingBlockWidth());
+ tx = -style()->right().calcValue(containingBlockWidth());
+ return tx;
+}
+
+int RenderBox::relativePositionOffsetY() const
+{
+ int ty = 0;
if(!style()->top().isAuto())
{
if (!style()->top().isPercent()
|| containingBlock()->style()->height().isFixed())
- ty += style()->top().calcValue(containingBlockHeight());
+ ty = style()->top().calcValue(containingBlockHeight());
}
else if(!style()->bottom().isAuto())
{
if (!style()->bottom().isPercent()
|| containingBlock()->style()->height().isFixed())
- ty -= style()->bottom().calcValue(containingBlockHeight());
+ ty = -style()->bottom().calcValue(containingBlockHeight());
}
+ return ty;
}
void RenderBox::calcWidth()
int RenderBox::lowestPosition(bool includeOverflowInterior, bool includeSelf) const
{
- return includeSelf ? m_height : 0;
+ if (!includeSelf || !m_width)
+ return 0;
+ int bottom = m_height;
+ if (isRelPositioned())
+ bottom += relativePositionOffsetY();
+ return bottom;
}
int RenderBox::rightmostPosition(bool includeOverflowInterior, bool includeSelf) const
{
- return includeSelf ? m_width : 0;
+ if (!includeSelf || !m_height)
+ return 0;
+ int right = m_width;
+ if (isRelPositioned())
+ right += relativePositionOffsetX();
+ return right;
}
int RenderBox::leftmostPosition(bool includeOverflowInterior, bool includeSelf) const
{
- return includeSelf ? 0 : m_width;
+ if (!includeSelf || !m_height)
+ return m_width;
+ int left = 0;
+ if (isRelPositioned())
+ left += relativePositionOffsetX();
+ return left;
}
}
void calcVerticalMargins();
- void relativePositionOffset(int &tx, int &ty);
+ int relativePositionOffsetX() const;
+ int relativePositionOffsetY() const;
virtual RenderLayer* layer() const { return m_layer; }
RenderFlow::lowestPosition(bool includeOverflowInterior, bool includeSelf) const
{
assert(!isInlineFlow());
- int bottom = RenderContainer::lowestPosition(includeOverflowInterior, includeSelf);
+ int bottom = includeSelf && m_width > 0 ? m_height : 0;
if (!includeOverflowInterior && hasOverflowClip())
return bottom;
bottom = max(bottom, lp);
}
}
+
+ if (isRelPositioned())
+ bottom += relativePositionOffsetY();
return bottom;
}
int RenderFlow::rightmostPosition(bool includeOverflowInterior, bool includeSelf) const
{
assert(!isInlineFlow());
- int right = RenderContainer::rightmostPosition(includeOverflowInterior, includeSelf);
+ int right = includeSelf && m_height > 0 ? m_width : 0;
if (!includeOverflowInterior && hasOverflowClip())
return right;
}
}
+ if (isRelPositioned())
+ right += relativePositionOffsetX();
+
return right;
}
int RenderFlow::leftmostPosition(bool includeOverflowInterior, bool includeSelf) const
{
assert(!isInlineFlow());
- int left = RenderContainer::leftmostPosition(includeOverflowInterior, includeSelf);
+ int left = includeSelf && m_height > 0 ? 0 : m_width;
if (!includeOverflowInterior && hasOverflowClip())
return left;
}
}
+ if (isRelPositioned())
+ left += relativePositionOffsetX();
+
return left;
}
m_relX = m_relY = 0;
if (m_object->isRelPositioned()) {
- static_cast<RenderBox*>(m_object)->relativePositionOffset(m_relX, m_relY);
+ m_relX = static_cast<RenderBox*>(m_object)->relativePositionOffsetX();
+ m_relY = static_cast<RenderBox*>(m_object)->relativePositionOffsetY();
x += m_relX; y += m_relY;
}
{
int x = xPos();
if (!isPositioned()) {
- if (isRelPositioned()) {
- int y = 0;
- ((RenderBox*)this)->relativePositionOffset(x, y);
- }
+ if (isRelPositioned())
+ x += ((RenderBox*)this)->relativePositionOffsetX();
RenderObject* offsetPar = offsetParent();
RenderObject* curr = parent();
{
int y = yPos();
if (!isPositioned()) {
- if (isRelPositioned()) {
- int x = 0;
- ((RenderBox*)this)->relativePositionOffset(x, y);
- }
+ if (isRelPositioned())
+ y += ((RenderBox*)this)->relativePositionOffsetY();
RenderObject* offsetPar = offsetParent();
RenderObject* curr = parent();
while (curr && curr != offsetPar) {