LayoutTests:
authorantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Feb 2007 00:18:21 +0000 (00:18 +0000)
committerantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Feb 2007 00:18:21 +0000 (00:18 +0000)
        Reviewed by Maciej.

        Test for REGRESSION: Google Calendar cell highlight misplaced
        http://bugs.webkit.org/show_bug.cgi?id=12687

        * fast/block/positioning/offsetLeft-offsetTop-borders-expected.checksum: Added.
        * fast/block/positioning/offsetLeft-offsetTop-borders-expected.png: Added.
        * fast/block/positioning/offsetLeft-offsetTop-borders-expected.txt: Added.
        * fast/block/positioning/offsetLeft-offsetTop-borders.html: Added.

WebCore:

        Reviewed by Maciej.

        REGRESSION: Google Calendar cell highlight misplaced
        http://bugs.webkit.org/show_bug.cgi?id=12687

        Make offsetLeft/offsetTop/offsetParent behavior match Firefox.

        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::offsetLeft):
        (WebCore::RenderObject::offsetTop):
        (WebCore::RenderObject::offsetParent):

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

LayoutTests/ChangeLog
LayoutTests/fast/block/positioning/offsetLeft-offsetTop-borders-expected.checksum [new file with mode: 0644]
LayoutTests/fast/block/positioning/offsetLeft-offsetTop-borders-expected.png [new file with mode: 0644]
LayoutTests/fast/block/positioning/offsetLeft-offsetTop-borders-expected.txt [new file with mode: 0644]
LayoutTests/fast/block/positioning/offsetLeft-offsetTop-borders.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderObject.cpp

index 05ad4f5fb8aa3f3db59ecc52ccccb4bac975543c..e14a3b5bb9df1f6838429ece467027146dd52dd6 100644 (file)
@@ -1,3 +1,15 @@
+2007-02-12  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Maciej.
+        
+        Test for REGRESSION: Google Calendar cell highlight misplaced
+        http://bugs.webkit.org/show_bug.cgi?id=12687
+
+        * fast/block/positioning/offsetLeft-offsetTop-borders-expected.checksum: Added.
+        * fast/block/positioning/offsetLeft-offsetTop-borders-expected.png: Added.
+        * fast/block/positioning/offsetLeft-offsetTop-borders-expected.txt: Added.
+        * fast/block/positioning/offsetLeft-offsetTop-borders.html: Added.
+
 2007-02-11  Antti Koivisto  <antti@apple.com>
 
         Reviewed by Maciej.
diff --git a/LayoutTests/fast/block/positioning/offsetLeft-offsetTop-borders-expected.checksum b/LayoutTests/fast/block/positioning/offsetLeft-offsetTop-borders-expected.checksum
new file mode 100644 (file)
index 0000000..d79fd2c
--- /dev/null
@@ -0,0 +1 @@
+b41cf50c3baf578654132eeaf52d9d0d
\ No newline at end of file
diff --git a/LayoutTests/fast/block/positioning/offsetLeft-offsetTop-borders-expected.png b/LayoutTests/fast/block/positioning/offsetLeft-offsetTop-borders-expected.png
new file mode 100644 (file)
index 0000000..1c63216
Binary files /dev/null and b/LayoutTests/fast/block/positioning/offsetLeft-offsetTop-borders-expected.png differ
diff --git a/LayoutTests/fast/block/positioning/offsetLeft-offsetTop-borders-expected.txt b/LayoutTests/fast/block/positioning/offsetLeft-offsetTop-borders-expected.txt
new file mode 100644 (file)
index 0000000..cfaec7d
--- /dev/null
@@ -0,0 +1,37 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderBlock {DIV} at (0,0) size 784x162
+        RenderBR {BR} at (0,0) size 0x18
+        RenderText {#text} at (0,18) size 326x18
+          text run at (0,18) width 326: "-------------------------------------------------offsetLeft:12"
+        RenderBR {BR} at (326,32) size 0x0
+        RenderText {#text} at (0,36) size 326x18
+          text run at (0,36) width 326: "-------------------------------------------------offsetLeft:10"
+        RenderBR {BR} at (326,50) size 0x0
+        RenderText {#text} at (0,54) size 318x18
+          text run at (0,54) width 318: "-------------------------------------------------offsetLeft:8"
+        RenderBR {BR} at (318,68) size 0x0
+        RenderText {#text} at (0,72) size 318x18
+          text run at (0,72) width 318: "-------------------------------------------------offsetLeft:0"
+        RenderBR {BR} at (318,86) size 0x0
+        RenderText {#text} at (0,90) size 326x18
+          text run at (0,90) width 326: "-------------------------------------------------offsetTop:12"
+        RenderBR {BR} at (326,104) size 0x0
+        RenderText {#text} at (0,108) size 326x18
+          text run at (0,108) width 326: "-------------------------------------------------offsetTop:10"
+        RenderBR {BR} at (326,122) size 0x0
+        RenderText {#text} at (0,126) size 318x18
+          text run at (0,126) width 318: "-------------------------------------------------offsetTop:8"
+        RenderBR {BR} at (318,140) size 0x0
+        RenderText {#text} at (0,144) size 318x18
+          text run at (0,144) width 318: "-------------------------------------------------offsetTop:0"
+layer at (8,8) size 160x160
+  RenderBlock (positioned) {DIV} at (8,8) size 160x160 [border: (5px solid #008000)]
+layer at (23,23) size 100x100
+  RenderBlock (relative positioned) {DIV} at (15,15) size 100x100 [border: (13px solid #0000FF)]
+    RenderBlock {DIV} at (25,25) size 50x22 [border: (2px solid #FF0000)]
+      RenderText {#text} at (2,2) size 18x18
+        text run at (2,2) width 18: "jee"
diff --git a/LayoutTests/fast/block/positioning/offsetLeft-offsetTop-borders.html b/LayoutTests/fast/block/positioning/offsetLeft-offsetTop-borders.html
new file mode 100644 (file)
index 0000000..0f2dda2
--- /dev/null
@@ -0,0 +1,24 @@
+<html>
+<head>
+
+<body style='margin:8px'>
+<div>
+<div style="position: absolute; width: 150px; height: 150px; border: 5px solid green;">
+<div style="position: relative; width: 50px; height: 50px; border:13px solid blue; padding:12px;margin:10px">
+<div id='x' style="border:2px solid red">
+jee
+</div>
+</div>
+</div>
+<script>
+var el = document.getElementById('x');
+while (el) {
+document.write('<br>-------------------------------------------------offsetLeft:'+el.offsetLeft);
+el = el.offsetParent;
+}
+el = document.getElementById('x');
+while (el) {
+document.write('<br>-------------------------------------------------offsetTop:'+el.offsetTop);
+el = el.offsetParent;
+}
+</script>
index b56c630ab7f7cf46d18e57b6af7524d8548cb58b..1449effa15211b0838a380eb0171d7d96fc26f65 100644 (file)
@@ -1,3 +1,17 @@
+2007-02-12  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Maciej.
+        
+        REGRESSION: Google Calendar cell highlight misplaced
+        http://bugs.webkit.org/show_bug.cgi?id=12687
+        
+        Make offsetLeft/offsetTop/offsetParent behavior match Firefox.
+
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::offsetLeft):
+        (WebCore::RenderObject::offsetTop):
+        (WebCore::RenderObject::offsetParent):
+
 2007-02-10  Antti Koivisto  <antti@apple.com>
 
         Reviewed by Maciej.
index 9289e7da4b5a6397d889dcc948f081ecb8105bac..bce8e1712a2b0db8a7da9c7611f8dbc5ac68e454 100644 (file)
@@ -507,7 +507,7 @@ int RenderObject::offsetLeft() const
     RenderObject* offsetPar = offsetParent();
     if (!offsetPar)
         return 0;
-    int x = xPos();
+    int x = xPos() - offsetPar->borderLeft();
     if (!isPositioned()) {
         if (isRelPositioned())
             x += static_cast<const RenderBox*>(this)->relativePositionOffsetX();
@@ -527,7 +527,7 @@ int RenderObject::offsetTop() const
     RenderObject* offsetPar = offsetParent();
     if (!offsetPar)
         return 0;
-    int y = yPos();
+    int y = yPos() - offsetPar->borderTop();
     if (!isPositioned()) {
         if (isRelPositioned())
             y += static_cast<const RenderBox*>(this)->relativePositionOffsetY();
@@ -552,9 +552,9 @@ RenderObject* RenderObject::offsetParent() const
     bool skipTables = isPositioned() || isRelPositioned();
     RenderObject* curr = parent();
     while (curr && (!curr->element() ||
-                    (!curr->isPositioned() && !curr->isRelPositioned() &&
-                        !(!style()->htmlHacks() && skipTables ? curr->isRoot() : curr->isBody())))) {
-        if (!skipTables && curr->element() && (curr->isTableCell() || curr->isTable()))
+                    (!curr->isPositioned() && !curr->isRelPositioned() && !curr->isBody()))) {
+        if (!skipTables && curr->element() && (curr->element()->hasTagName(tableTag) || 
+                                               curr->element()->hasTagName(tdTag) || curr->element()->hasTagName(thTag)))
             break;
         curr = curr->parent();
     }