[webkit-changes] cvs commit: LayoutTests/fast/overflow
overflow-rtl-expected.checksum overflow-rtl-expected.png
overflow-rtl-expected.txt overflow-rtl.html
Darin
darin at opensource.apple.com
Sat Dec 10 12:22:00 PST 2005
darin 05/12/10 12:21:59
Modified: . ChangeLog
khtml/rendering render_block.cpp render_layer.cpp
render_layer.h
. ChangeLog
Added: fast/overflow overflow-rtl-expected.checksum
overflow-rtl-expected.png overflow-rtl-expected.txt
overflow-rtl.html
Log:
LayoutTests:
New layout test for http://bugzilla.opendarwin.org/show_bug.cgi?id=5826
* fast/overflow/overflow-rtl-expected.checksum: Added.
* fast/overflow/overflow-rtl-expected.png: Added.
* fast/overflow/overflow-rtl-expected.txt: Added.
* fast/overflow/overflow-rtl.html: Added.
WebCore:
Reviewed by Hyatt, landed by Darin.
- fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5826
Blocks with direction:rtl and overflow:auto or scroll have incorrect scrollbars
* khtml/rendering/render_block.cpp: (khtml::RenderBlock::leftmostPosition):
* khtml/rendering/render_layer.cpp:
(khtml::RenderLayer::RenderLayer): Initialize
(khtml::RenderLayer::scrollOffset):
(khtml::RenderLayer::subtractScrollOffset):
(khtml::RenderLayer::scrollToOffset):
(khtml::RenderLayer::scrollRectToVisible):
(khtml::RenderLayer::updateScrollPositionFromScrollbars):
(khtml::RenderLayer::computeScrollDimensions):
(khtml::RenderLayer::updateScrollInfoAfterLayout):
* khtml/rendering/render_layer.h:
(khtml::RenderLayer::scrollXOffset):
(khtml::RenderLayer::scrollToYOffset):
Revision Changes Path
1.501 +21 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.500
retrieving revision 1.501
diff -u -r1.500 -r1.501
--- ChangeLog 10 Dec 2005 19:56:05 -0000 1.500
+++ ChangeLog 10 Dec 2005 20:21:48 -0000 1.501
@@ -1,3 +1,24 @@
+2005-12-10 Mitz Pettel <opendarwin.org at mitzpettel.com>
+
+ Reviewed by Hyatt, landed by Darin.
+
+ - fixed http://bugzilla.opendarwin.org/show_bug.cgi?id=5826
+ Blocks with direction:rtl and overflow:auto or scroll have incorrect scrollbars
+
+ * khtml/rendering/render_block.cpp: (khtml::RenderBlock::leftmostPosition):
+ * khtml/rendering/render_layer.cpp:
+ (khtml::RenderLayer::RenderLayer): Initialize
+ (khtml::RenderLayer::scrollOffset):
+ (khtml::RenderLayer::subtractScrollOffset):
+ (khtml::RenderLayer::scrollToOffset):
+ (khtml::RenderLayer::scrollRectToVisible):
+ (khtml::RenderLayer::updateScrollPositionFromScrollbars):
+ (khtml::RenderLayer::computeScrollDimensions):
+ (khtml::RenderLayer::updateScrollInfoAfterLayout):
+ * khtml/rendering/render_layer.h:
+ (khtml::RenderLayer::scrollXOffset):
+ (khtml::RenderLayer::scrollToYOffset):
+
2005-12-10 Graham Dennis <Graham.Dennis at gmail.com>
Reviewed by Hyatt, landed by Darin.
1.219 +2 -2 WebCore/khtml/rendering/render_block.cpp
Index: render_block.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_block.cpp,v
retrieving revision 1.218
retrieving revision 1.219
diff -u -r1.218 -r1.219
--- render_block.cpp 2 Dec 2005 03:48:08 -0000 1.218
+++ render_block.cpp 10 Dec 2005 20:21:56 -0000 1.219
@@ -2159,8 +2159,8 @@
int left = RenderFlow::leftmostPosition(includeOverflowInterior, includeSelf);
if (!includeOverflowInterior && hasOverflowClip())
return left;
-
- // FIXME: Check left overflow when we eventually support it.
+ if (includeSelf && m_overflowLeft < left)
+ left = m_overflowLeft;
if (m_floatingObjects) {
FloatingObject* r;
1.128 +27 -16 WebCore/khtml/rendering/render_layer.cpp
Index: render_layer.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_layer.cpp,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -r1.127 -r1.128
--- render_layer.cpp 2 Dec 2005 20:23:41 -0000 1.127
+++ render_layer.cpp 10 Dec 2005 20:21:56 -0000 1.128
@@ -124,6 +124,8 @@
m_height( 0 ),
m_scrollX( 0 ),
m_scrollY( 0 ),
+m_scrollOriginX( 0 ),
+m_scrollLeftOverflow( 0 ),
m_scrollWidth( 0 ),
m_scrollHeight( 0 ),
m_hBar( 0 ),
@@ -488,14 +490,14 @@
void
RenderLayer::scrollOffset(int& x, int& y)
{
- x += scrollXOffset();
+ x += scrollXOffset() + m_scrollLeftOverflow;
y += scrollYOffset();
}
void
RenderLayer::subtractScrollOffset(int& x, int& y)
{
- x -= scrollXOffset();
+ x -= scrollXOffset() + m_scrollLeftOverflow;
y -= scrollYOffset();
}
@@ -520,7 +522,7 @@
// complicated (since it will involve testing whether our layer
// is either occluded by another layer or clipped by an enclosing
// layer or contains fixed backgrounds, etc.).
- m_scrollX = x;
+ m_scrollX = x - m_scrollOriginX;
m_scrollY = y;
// Update the positions of our child layers.
@@ -545,7 +547,7 @@
if (updateScrollbars) {
if (m_hBar)
- m_hBar->setValue(m_scrollX);
+ m_hBar->setValue(scrollXOffset());
if (m_vBar)
m_vBar->setValue(m_scrollY);
}
@@ -557,8 +559,8 @@
QRect newRect = rect;
if (m_object->hasOverflowClip()) {
- QRect layerBounds = QRect(m_x + m_scrollX, m_y + m_scrollY, m_width, m_height);
- QRect exposeRect = QRect(rect.x() + m_scrollX, rect.y() + m_scrollY, rect.width(), rect.height());
+ QRect layerBounds = QRect(m_x + scrollXOffset(), m_y + m_scrollY, m_width, m_height);
+ QRect exposeRect = QRect(rect.x() + scrollXOffset(), rect.y() + m_scrollY, rect.width(), rect.height());
QRect r = getRectToExpose(layerBounds, exposeRect, alignX, alignY);
int xOffset = r.x() - m_x;
@@ -567,11 +569,11 @@
xOffset = kMax(0, kMin(m_scrollWidth - m_width, xOffset));
yOffset = kMax(0, kMin(m_scrollHeight - m_height, yOffset));
- if (xOffset != m_scrollX || yOffset != m_scrollY) {
- int diffX = m_scrollX;
+ if (xOffset != scrollXOffset() || yOffset != m_scrollY) {
+ int diffX = scrollXOffset();
int diffY = m_scrollY;
scrollToOffset(xOffset, yOffset);
- diffX = m_scrollX - diffX;
+ diffX = scrollXOffset() - diffX;
diffY = m_scrollY - diffY;
newRect.setX(rect.x() - diffX);
newRect.setY(rect.y() - diffY);
@@ -668,12 +670,12 @@
void RenderLayer::updateScrollPositionFromScrollbars()
{
bool needUpdate = false;
- int newX = m_scrollX;
+ int newX = scrollXOffset();
int newY = m_scrollY;
if (m_hBar) {
newX = m_hBar->value();
- if (newX != m_scrollX)
+ if (newX != scrollXOffset())
needUpdate = true;
}
@@ -795,15 +797,23 @@
void RenderLayer::computeScrollDimensions(bool* needHBar, bool* needVBar)
{
m_scrollDimensionsDirty = false;
-
- int rightPos = m_object->rightmostPosition(true, false) - m_object->borderLeft();
- int bottomPos = m_object->lowestPosition(true, false) - m_object->borderTop();
+
+ bool ltr = m_object->style()->direction() == LTR;
int clientWidth = m_object->clientWidth();
int clientHeight = m_object->clientHeight();
+ m_scrollLeftOverflow = ltr ? 0 : kMin(0, m_object->leftmostPosition(true, false) - m_object->borderLeft());
+
+ int rightPos = ltr ?
+ m_object->rightmostPosition(true, false) - m_object->borderLeft() :
+ clientWidth - m_scrollLeftOverflow;
+ int bottomPos = m_object->lowestPosition(true, false) - m_object->borderTop();
+
m_scrollWidth = kMax(rightPos, clientWidth);
m_scrollHeight = kMax(bottomPos, clientHeight);
+
+ m_scrollOriginX = ltr ? 0 : m_scrollWidth - clientWidth;
if (needHBar)
*needHBar = rightPos > clientWidth;
@@ -824,9 +834,9 @@
if (m_object->style()->overflow() != OMARQUEE) {
// Layout may cause us to be in an invalid scroll position. In this case we need
// to pull our scroll offsets back to the max (or push them up to the min).
- int newX = kMax(0, kMin(m_scrollX, scrollWidth() - m_object->clientWidth()));
+ int newX = kMax(0, kMin(scrollXOffset(), scrollWidth() - m_object->clientWidth()));
int newY = kMax(0, kMin(m_scrollY, scrollHeight() - m_object->clientHeight()));
- if (newX != m_scrollX || newY != m_scrollY)
+ if (newX != scrollXOffset() || newY != m_scrollY)
scrollToOffset(newX, newY);
}
@@ -869,6 +879,7 @@
if (pageStep < 0) pageStep = clientWidth;
m_hBar->setSteps(LINE_STEP, pageStep);
m_hBar->setKnobProportion(clientWidth, m_scrollWidth);
+ m_hBar->setValue(scrollXOffset());
}
if (m_vBar) {
int clientHeight = m_object->clientHeight();
1.59 +4 -2 WebCore/khtml/rendering/render_layer.h
Index: render_layer.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/rendering/render_layer.h,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- render_layer.h 21 Nov 2005 01:20:25 -0000 1.58
+++ render_layer.h 10 Dec 2005 20:21:57 -0000 1.59
@@ -240,11 +240,11 @@
// Scrolling methods for layers that can scroll their overflow.
void scrollOffset(int& x, int& y);
void subtractScrollOffset(int& x, int& y);
- int scrollXOffset() const { return m_scrollX; }
+ int scrollXOffset() const { return m_scrollX + m_scrollOriginX; }
int scrollYOffset() const { return m_scrollY; }
void scrollToOffset(int x, int y, bool updateScrollbars = true, bool repaint = true);
void scrollToXOffset(int x) { scrollToOffset(x, m_scrollY); }
- void scrollToYOffset(int y) { scrollToOffset(m_scrollX, y); }
+ void scrollToYOffset(int y) { scrollToOffset(m_scrollX + m_scrollOriginX, y); }
void scrollRectToVisible(const QRect &r, const ScrollAlignment& alignX = gAlignCenterIfNeeded, const ScrollAlignment& alignY = gAlignCenterIfNeeded);
QRect getRectToExpose(const QRect &visibleRect, const QRect &exposeRect, const ScrollAlignment& alignX, const ScrollAlignment& alignY);
void setHasHorizontalScrollbar(bool hasScrollbar);
@@ -368,6 +368,8 @@
// Our scroll offsets if the view is scrolled.
int m_scrollX;
int m_scrollY;
+ int m_scrollOriginX;
+ int m_scrollLeftOverflow;
// The width/height of our scrolled area.
int m_scrollWidth;
1.136 +9 -0 LayoutTests/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/LayoutTests/ChangeLog,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -r1.135 -r1.136
--- ChangeLog 10 Dec 2005 19:56:11 -0000 1.135
+++ ChangeLog 10 Dec 2005 20:21:57 -0000 1.136
@@ -1,5 +1,14 @@
2005-12-10 Darin Adler <darin at apple.com>
+ New layout test for http://bugzilla.opendarwin.org/show_bug.cgi?id=5826
+
+ * fast/overflow/overflow-rtl-expected.checksum: Added.
+ * fast/overflow/overflow-rtl-expected.png: Added.
+ * fast/overflow/overflow-rtl-expected.txt: Added.
+ * fast/overflow/overflow-rtl.html: Added.
+
+2005-12-10 Darin Adler <darin at apple.com>
+
New layout test for http://bugzilla.opendarwin.org/show_bug.cgi?id=3983
* fast/css/outline-auto-location-expected.checksum: Added.
1.1 LayoutTests/fast/overflow/overflow-rtl-expected.checksum
Index: overflow-rtl-expected.checksum
===================================================================
b2858b2cc7b04004a69f2ee90b229e6b
\ No newline at end of file
1.1 LayoutTests/fast/overflow/overflow-rtl-expected.png
<<Binary file>>
1.1 LayoutTests/fast/overflow/overflow-rtl-expected.txt
Index: overflow-rtl-expected.txt
===================================================================
layer at (0,0) size 800x600
RenderCanvas at (0,0) size 800x600
layer at (0,0) size 800x453
RenderBlock {HTML} at (0,0) size 800x453
RenderBody {BODY} at (8,16) size 784x429
RenderBlock {P} at (0,0) size 784x36
RenderText {TEXT} at (0,0) size 135x18
text run at (0,0) width 135: "This is a test case for "
RenderInline {I} at (0,0) size 777x36
RenderText {TEXT} at (135,0) size 777x36
text run at (135,0) width 642: "http://bugzilla.opendarwin.org/show_bug.cgi?id=5826 Blocks with direction:rtl and overflow:auto or"
text run at (0,18) width 197: "scroll have incorrect scrollbars"
RenderText {TEXT} at (197,18) size 4x18
text run at (197,18) width 4: "."
RenderBlock (anonymous) at (0,52) size 784x18
RenderText {TEXT} at (0,0) size 457x18
text run at (0,0) width 457: "The right column should be a mirror-image of the left column in terms of"
RenderBlock {UL} at (0,86) size 784x72
RenderListItem {LI} at (40,0) size 744x18
RenderListMarker at (0,0) size 0x14
RenderText {TEXT} at (0,0) size 164x18
text run at (0,0) width 164: "the presence of a scrollbar"
RenderListItem {LI} at (40,18) size 744x18
RenderListMarker at (0,0) size 0x14
RenderText {TEXT} at (0,0) size 234x18
text run at (0,0) width 234: "the initial position of the scroll thumb"
RenderListItem {LI} at (40,36) size 744x18
RenderListMarker at (0,0) size 0x14
RenderText {TEXT} at (0,0) size 451x18
text run at (0,0) width 451: "which letters are visible initially and when you scroll (in the top 3 rows)"
RenderListItem {LI} at (40,54) size 744x18
RenderListMarker at (0,0) size 0x14
RenderText {TEXT} at (0,0) size 578x18
text run at (0,0) width 578: "the position of the blue and olive boxes, initially and when you scroll (in the bottom 2 rows)"
RenderTable {TABLE} at (0,174) size 256x255
RenderTableSection {TBODY} at (0,0) size 0x255
RenderTableRow {TR} at (0,0) size 0x0
RenderTableCell {TD} at (2,2) size 125x251 [r=0 c=0 rs=1 cs=1]
RenderTableCell {TD} at (129,2) size 125x251 [r=0 c=1 rs=1 cs=1]
layer at (15,197) size 115x45 clip at (25,197) size 100x30 scrollWidth 188
RenderBlock {DIV} at (5,5) size 115x45 [bgcolor=#FFFF00] [border: (5px solid #008000) none (10px solid #FF0000)]
RenderText {TEXT} at (10,0) size 188x18
text run at (10,0) width 188: "abcdefghijklmnopqrstuvwxyz"
layer at (15,246) size 115x45 clip at (25,246) size 100x45
RenderBlock {DIV} at (5,54) size 115x45 [bgcolor=#FFFF00] [border: (5px solid #008000) none (10px solid #FF0000)]
RenderBlock {DIV} at (10,0) size 100x18 [bgcolor=#D3D3D3]
RenderText {TEXT} at (-88,0) size 188x18
text run at (-88,0) width 188: "abcdefghijklmnopqrstuvwxyz"
layer at (15,295) size 115x45 clip at (25,295) size 100x30 scrollWidth 188
RenderBlock {DIV} at (5,103) size 115x45 [bgcolor=#FFFF00] [border: (5px solid #008000) none (10px solid #FF0000)]
RenderBlock {DIV} at (10,0) size 100x18 [bgcolor=#D3D3D3]
RenderText {TEXT} at (0,0) size 188x18
text run at (0,0) width 188: "abcdefghijklmnopqrstuvwxyz"
layer at (15,344) size 115x45 clip at (25,344) size 100x45
RenderBlock (relative positioned) {DIV} at (5,152) size 115x45 [bgcolor=#FFFF00] [border: (5px solid #008000) none (10px solid #FF0000)]
layer at (71,364) size 8x4
RenderBlock (positioned) {DIV} at (56,20) size 8x4 [bgcolor=#0000FF]
layer at (-25,344) size 70x20 backgroundClip at (25,344) size 100x45 clip at (25,344) size 100x45 outlineClip at (25,344) size 100x45
RenderBlock (positioned) {DIV} at (-40,0) size 70x20 [bgcolor=#808000]
layer at (15,393) size 115x45 clip at (25,393) size 100x30 scrollWidth 150
RenderBlock (relative positioned) {DIV} at (5,201) size 115x45 [bgcolor=#FFFF00] [border: (5px solid #008000) none (10px solid #FF0000)]
layer at (71,413) size 8x4
RenderBlock (positioned) {DIV} at (56,20) size 8x4 [bgcolor=#0000FF]
layer at (105,393) size 70x20 backgroundClip at (25,393) size 100x30 clip at (25,393) size 100x30 outlineClip at (25,393) size 100x30
RenderBlock (positioned) {DIV} at (90,0) size 70x20 [bgcolor=#808000]
layer at (142,197) size 115x45 clip at (147,197) size 100x30 scrollX 88 scrollWidth 188
RenderBlock {DIV} at (5,5) size 115x45 [bgcolor=#FFFF00] [border: (10px solid #FF0000) none (5px solid #008000)]
RenderText {TEXT} at (-83,0) size 188x18
text run at (-83,0) width 188: "zyxwvutsrqponmlkjihgfedcba"
layer at (142,246) size 115x45 clip at (147,246) size 100x45
RenderBlock {DIV} at (5,54) size 115x45 [bgcolor=#FFFF00] [border: (10px solid #FF0000) none (5px solid #008000)]
RenderBlock {DIV} at (5,0) size 100x18 [bgcolor=#D3D3D3]
RenderText {TEXT} at (0,0) size 188x18
text run at (0,0) width 188: "zyxwvutsrqponmlkjihgfedcba"
layer at (142,295) size 115x45 clip at (147,295) size 100x30 scrollX 88 scrollWidth 188
RenderBlock {DIV} at (5,103) size 115x45 [bgcolor=#FFFF00] [border: (10px solid #FF0000) none (5px solid #008000)]
RenderBlock {DIV} at (5,0) size 100x18 [bgcolor=#D3D3D3]
RenderText {TEXT} at (-88,0) size 188x18
text run at (-88,0) width 188: "zyxwvutsrqponmlkjihgfedcba"
layer at (142,344) size 115x45 clip at (147,344) size 100x45
RenderBlock (relative positioned) {DIV} at (5,152) size 115x45 [bgcolor=#FFFF00] [border: (10px solid #FF0000) none (5px solid #008000)]
layer at (193,364) size 8x4
RenderBlock (positioned) {DIV} at (51,20) size 8x4 [bgcolor=#0000FF]
layer at (227,344) size 70x20 backgroundClip at (147,344) size 100x45 clip at (147,344) size 100x45 outlineClip at (147,344) size 100x45
RenderBlock (positioned) {DIV} at (85,0) size 70x20 [bgcolor=#808000]
layer at (142,393) size 115x45 clip at (147,393) size 100x30 scrollX 50 scrollWidth 150
RenderBlock (relative positioned) {DIV} at (5,201) size 115x45 [bgcolor=#FFFF00] [border: (10px solid #FF0000) none (5px solid #008000)]
layer at (193,413) size 8x4
RenderBlock (positioned) {DIV} at (51,20) size 8x4 [bgcolor=#0000FF]
layer at (97,393) size 70x20 backgroundClip at (147,393) size 100x30 clip at (147,393) size 100x30 outlineClip at (147,393) size 100x30
RenderBlock (positioned) {DIV} at (-45,0) size 70x20 [bgcolor=#808000]
1.1 LayoutTests/fast/overflow/overflow-rtl.html
Index: overflow-rtl.html
===================================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>overflow:auto with direction:rtl</title>
<style type="text/css">
div.test { background: yellow; height: 6ex; width: 100px; overflow: auto;
border-left: 10px solid red; border-right: 5px solid green; margin: 4px; }
div.rtl { direction: rtl; border-right: 10px solid red; border-left: 5px solid green; }
</style>
</head>
<body>
<p>
This is a test case for <i>http://bugzilla.opendarwin.org/show_bug.cgi?id=5826 Blocks with direction:rtl and overflow:auto or scroll have incorrect scrollbars</i>.
</p>
The right column should be a mirror-image of the left column in terms of
<ul>
<li>the presence of a scrollbar</li>
<li>the initial position of the scroll thumb</li>
<li>which letters are visible initially and when you scroll (in the top 3 rows)</li>
<li>the position of the blue and olive boxes, initially and when you scroll (in the bottom 2 rows)</li>
</ul>
<table>
<tr>
<td>
<div class="test">
abcdefghijklmnopqrstuvwxyz
</div>
<div class="test">
<div style="direction:rtl; background:lightgray;">abcdefghijklmnopqrstuvwxyz</div>
</div>
<div class="test">
<div style="direction:ltr; background:lightgray;">abcdefghijklmnopqrstuvwxyz</div>
</div>
<div class="test" style="position:relative;">
<div style="width:8px; height:4px; background:blue; position: absolute; left:46px; top:20px;"></div>
<div style="width:70px; height:20px; background:olive; position: absolute; left:-50px;"></div>
</div>
<div class="test" style="position:relative;">
<div style="width:8px; height:4px; background:blue; position: absolute; left:46px; top:20px;"></div>
<div style="width:70px; height:20px; background:olive; position: absolute; left:80px;"></div>
</div>
</td>
<td>
<div class="test rtl">
zyxwvutsrqponmlkjihgfedcba
</div>
<div class="test rtl">
<div style="direction:ltr; background:lightgray;">zyxwvutsrqponmlkjihgfedcba</div>
</div>
<div class="test rtl">
<div style="direction:rtl; background:lightgray;">zyxwvutsrqponmlkjihgfedcba</div>
</div>
<div class="test rtl" style="position:relative;">
<div style="width:8px; height:4px; background:blue; position: absolute; left:46px; top:20px;"></div>
<div style="width:70px; height:20px; background:olive; position: absolute; left:80px;"></div>
</div>
<div class="test rtl" style="position:relative;">
<div style="width:8px; height:4px; background:blue; position: absolute; left:46px; top:20px;"></div>
<div style="width:70px; height:20px; background:olive; position: absolute; left:-50px;"></div>
</div>
</td>
</tr>
</table>
</body>
</html>
More information about the webkit-changes
mailing list