Title: [154702] trunk
Revision
154702
Author
[email protected]
Date
2013-08-27 12:21:00 -0700 (Tue, 27 Aug 2013)

Log Message

cell width / offsetTop incorrect
https://bugs.webkit.org/show_bug.cgi?id=11582

Reviewed by David Hyatt.

Source/WebCore:

The offsetTop and offsetLeft of sections, rows and cells should include the table's border. There are separate
problems with the offset[Top|Left] of table sections and the offsetLeft of rows which are covered under bugs 119020
and 119021 respectively - here we stick to just fixing the inclusion of the border as it doesn't require rebaselining
a lot of tests.

Test: fast/table/offset-top-includes-border.html

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::adjustedPositionRelativeToOffsetParent):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::layoutRows):

LayoutTests:

* fast/dom/Element/offsetTop-table-cell-expected.txt:
* fast/dom/Element/offsetTop-table-cell.html:
* fast/table/offset-top-includes-border-expected.txt: Added.
* fast/table/offset-top-includes-border.html: Added.
* platform/mac/editing/selection/5057506-2-expected.txt:
* platform/mac/editing/selection/5057506-expected.txt:
* platform/qt/editing/selection/5057506-2-expected.txt:
* platform/qt/editing/selection/5057506-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (154701 => 154702)


--- trunk/LayoutTests/ChangeLog	2013-08-27 18:32:57 UTC (rev 154701)
+++ trunk/LayoutTests/ChangeLog	2013-08-27 19:21:00 UTC (rev 154702)
@@ -1,3 +1,19 @@
+2013-08-27  Robert Hogan  <[email protected]>
+
+        cell width / offsetTop incorrect
+        https://bugs.webkit.org/show_bug.cgi?id=11582
+
+        Reviewed by David Hyatt.
+
+        * fast/dom/Element/offsetTop-table-cell-expected.txt:
+        * fast/dom/Element/offsetTop-table-cell.html:
+        * fast/table/offset-top-includes-border-expected.txt: Added.
+        * fast/table/offset-top-includes-border.html: Added.
+        * platform/mac/editing/selection/5057506-2-expected.txt:
+        * platform/mac/editing/selection/5057506-expected.txt:
+        * platform/qt/editing/selection/5057506-2-expected.txt:
+        * platform/qt/editing/selection/5057506-expected.txt:
+
 2013-08-27  Renata Hodovan  <[email protected]>
 
         Missing null-check of parent renderer in WebCore::HTMLEmbedElement::rendererIsNeeded()

Modified: trunk/LayoutTests/fast/dom/Element/offsetTop-table-cell-expected.txt (154701 => 154702)


--- trunk/LayoutTests/fast/dom/Element/offsetTop-table-cell-expected.txt	2013-08-27 18:32:57 UTC (rev 154701)
+++ trunk/LayoutTests/fast/dom/Element/offsetTop-table-cell-expected.txt	2013-08-27 19:21:00 UTC (rev 154702)
@@ -2,10 +2,10 @@
 
 Table 1 row 2 top offset:50
 Table 1 cell 2 top offset:50
-Table 2 row 1 top offset:0
-Table 2 cell 1 top offset:0
-Table 2 cell 2 top offset:0
-Table 2 cell 3 top offset:0
+Table 2 row 1 top offset:1
+Table 2 cell 1 top offset:1
+Table 2 cell 2 top offset:1
+Table 2 cell 3 top offset:1
 Table 3 cell 1 top offset:0
 Table 4 div 1 top offset:50
 Test result: PASS

Modified: trunk/LayoutTests/fast/dom/Element/offsetTop-table-cell.html (154701 => 154702)


--- trunk/LayoutTests/fast/dom/Element/offsetTop-table-cell.html	2013-08-27 18:32:57 UTC (rev 154701)
+++ trunk/LayoutTests/fast/dom/Element/offsetTop-table-cell.html	2013-08-27 19:21:00 UTC (rev 154702)
@@ -32,7 +32,7 @@
     console.innerText += "Table 4 div 1 top offset:" + div5Offset;
     console.innerText += "\n";
     console.innerText += "Test result: "
-    console.innerText += (rowOffset == 50 && cellOffset == 50 && tr1Offset == 0 
+    console.innerText += (rowOffset == 50 && cellOffset == 50 && tr1Offset == 1 
         && tr1Offset == td2Offset && tr1Offset == td3Offset && td4Offset == 0 && div5Offset == 50 ? "PASS" : "FAIL");
 }
 </script>

Added: trunk/LayoutTests/fast/table/offset-top-includes-border-expected.txt (0 => 154702)


--- trunk/LayoutTests/fast/table/offset-top-includes-border-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/table/offset-top-includes-border-expected.txt	2013-08-27 19:21:00 UTC (rev 154702)
@@ -0,0 +1,3 @@
+webkit.org/b/11582: The offsetTop of tbody, rows and cells should include the table's border. The tbody should include border-spacing in its offsetTop and offsetLeft too but that is a separate and more involved bug (webkit.org/b/119020) which when it's resolved should change the offsets from 14 to 19 for the tbody in this test. The offsetLeft for the row is also wrong (webkit.org/b/119021), fixing it will require a lot of rebaselining.
+
+PASS

Added: trunk/LayoutTests/fast/table/offset-top-includes-border.html (0 => 154702)


--- trunk/LayoutTests/fast/table/offset-top-includes-border.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/offset-top-includes-border.html	2013-08-27 19:21:00 UTC (rev 154702)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<head>
+<style>
+body, td, tr, tbody {
+    margin: 0px;
+    padding: 4px;
+    border: solid black 4px;
+}
+table {
+    margin: 0px;
+    padding: 4px;
+    border-spacing: 5px;
+}
+</style>
+<script src=""
+</head>
+<p>webkit.org/b/11582: The offsetTop of tbody, rows and cells should include the table's border. The tbody should include border-spacing in its
+   offsetTop and offsetLeft too but that is a separate and more involved bug (webkit.org/b/119020) which when it's resolved should change the 
+   offsets from 14 to 19 for the tbody in this test. The offsetLeft for the row is also wrong (webkit.org/b/119021), fixing it will require a 
+   lot of rebaselining.</p>
+<body>
+    <table border="10">
+        <tbody data-offset-y=14 data-offset-x=14>
+            <tr data-offset-y=19 data-offset-x=14>
+                <td data-offset-y=19 data-offset-x=19>
+                </td>
+            </tr>
+        </tbody>
+    </table>
+    <script>
+    checkLayout('table');
+    </script>
+</body>

Modified: trunk/LayoutTests/platform/mac/editing/selection/5057506-2-expected.txt (154701 => 154702)


--- trunk/LayoutTests/platform/mac/editing/selection/5057506-2-expected.txt	2013-08-27 18:32:57 UTC (rev 154701)
+++ trunk/LayoutTests/platform/mac/editing/selection/5057506-2-expected.txt	2013-08-27 19:21:00 UTC (rev 154702)
@@ -1,5 +1,5 @@
-ALERT: 34
-ALERT: 108
+ALERT: 35
+ALERT: 109
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600

Modified: trunk/LayoutTests/platform/mac/editing/selection/5057506-expected.txt (154701 => 154702)


--- trunk/LayoutTests/platform/mac/editing/selection/5057506-expected.txt	2013-08-27 18:32:57 UTC (rev 154701)
+++ trunk/LayoutTests/platform/mac/editing/selection/5057506-expected.txt	2013-08-27 19:21:00 UTC (rev 154702)
@@ -1,5 +1,5 @@
-ALERT: 34
-ALERT: 108
+ALERT: 35
+ALERT: 109
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600

Modified: trunk/LayoutTests/platform/qt/editing/selection/5057506-2-expected.txt (154701 => 154702)


--- trunk/LayoutTests/platform/qt/editing/selection/5057506-2-expected.txt	2013-08-27 18:32:57 UTC (rev 154701)
+++ trunk/LayoutTests/platform/qt/editing/selection/5057506-2-expected.txt	2013-08-27 19:21:00 UTC (rev 154702)
@@ -1,5 +1,5 @@
-ALERT: 33
-ALERT: 112.5
+ALERT: 34
+ALERT: 113.5
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600

Modified: trunk/LayoutTests/platform/qt/editing/selection/5057506-expected.txt (154701 => 154702)


--- trunk/LayoutTests/platform/qt/editing/selection/5057506-expected.txt	2013-08-27 18:32:57 UTC (rev 154701)
+++ trunk/LayoutTests/platform/qt/editing/selection/5057506-expected.txt	2013-08-27 19:21:00 UTC (rev 154702)
@@ -1,5 +1,5 @@
-ALERT: 33
-ALERT: 112.5
+ALERT: 34
+ALERT: 113.5
 layer at (0,0) size 800x600
   RenderView at (0,0) size 800x600
 layer at (0,0) size 800x600
@@ -26,5 +26,5 @@
         RenderBlock {DIV} at (0,29) size 784x19
           RenderText {#text} at (0,0) size 20x19
             text run at (0,0) width 20: "bar"
-selection start: position 0 of child 0 {#text} of child 0 {SPAN} of child 0 {TD} of child 0 {TR} of child 0 {TBODY} of child 1 {TABLE} of child 2 {DIV} of body
+selection start: position 3 of child 0 {#text} of child 0 {SPAN} of child 0 {TD} of child 0 {TR} of child 0 {TBODY} of child 1 {TABLE} of child 2 {DIV} of body
 selection end:   position 0 of child 3 {DIV} of child 2 {DIV} of body

Modified: trunk/Source/WebCore/ChangeLog (154701 => 154702)


--- trunk/Source/WebCore/ChangeLog	2013-08-27 18:32:57 UTC (rev 154701)
+++ trunk/Source/WebCore/ChangeLog	2013-08-27 19:21:00 UTC (rev 154702)
@@ -1,3 +1,22 @@
+2013-08-27  Robert Hogan  <[email protected]>
+
+        cell width / offsetTop incorrect
+        https://bugs.webkit.org/show_bug.cgi?id=11582
+
+        Reviewed by David Hyatt.
+
+        The offsetTop and offsetLeft of sections, rows and cells should include the table's border. There are separate
+        problems with the offset[Top|Left] of table sections and the offsetLeft of rows which are covered under bugs 119020
+        and 119021 respectively - here we stick to just fixing the inclusion of the border as it doesn't require rebaselining
+        a lot of tests.
+
+        Test: fast/table/offset-top-includes-border.html
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::adjustedPositionRelativeToOffsetParent):
+        * rendering/RenderTableSection.cpp:
+        (WebCore::RenderTableSection::layoutRows):
+
 2013-08-27  Jacky Jiang  <[email protected]>
 
         [BlackBerry] Rotate device from landscape to portrait during youtube streaming will cause device screen flash with video list page

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (154701 => 154702)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2013-08-27 18:32:57 UTC (rev 154701)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2013-08-27 19:21:00 UTC (rev 154702)
@@ -37,6 +37,7 @@
 #include "RenderLayer.h"
 #include "RenderNamedFlowThread.h"
 #include "RenderRegion.h"
+#include "RenderTable.h"
 #include "RenderView.h"
 #include "ScrollingConstraints.h"
 #include "Settings.h"
@@ -490,7 +491,7 @@
     // return the distance between the canvas origin and the left border edge 
     // of the element and stop this algorithm.
     if (const RenderBoxModelObject* offsetParent = this->offsetParent()) {
-        if (offsetParent->isBox() && !offsetParent->isBody())
+        if (offsetParent->isBox() && !offsetParent->isBody() && !offsetParent->isTable())
             referencePoint.move(-toRenderBox(offsetParent)->borderLeft(), -toRenderBox(offsetParent)->borderTop());
         if (!isOutOfFlowPositioned() || flowThreadContainingBlock()) {
             if (isRelPositioned())

Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (154701 => 154702)


--- trunk/Source/WebCore/rendering/RenderTableSection.cpp	2013-08-27 18:32:57 UTC (rev 154701)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp	2013-08-27 19:21:00 UTC (rev 154702)
@@ -524,6 +524,8 @@
     for (unsigned r = 0; r < totalRows; r++) {
         // Set the row's x/y position and width/height.
         if (RenderTableRow* rowRenderer = m_grid[r].rowRenderer) {
+            // FIXME: the x() position of the row should be table()->hBorderSpacing() so that it can 
+            // report the correct offsetLeft. However, that will require a lot of rebaselining of test results.
             rowRenderer->setLocation(LayoutPoint(0, m_rowPos[r]));
             rowRenderer->setLogicalWidth(logicalWidth());
             rowRenderer->setLogicalHeight(m_rowPos[r + 1] - m_rowPos[r] - vspacing);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to