Changeset 19149 in webkit


Ignore:
Timestamp:
Jan 26, 2007 3:40:01 AM (17 years ago)
Author:
bdash
Message:

2007-01-26 Mitz Pettel <mitz@webkit.org>

Reviewed by Darin.

Changed offset{Left,Top} to match Firefox. If the body element is statically
positioned, it is still returned as the offsetParent of elements whose containing
block is the initial containing block (the root), but their offset{Left,Top} are
relative to the root. If the body element is positioned, then offsets are relative
to it. The body's own offset{Left,Top} are always 0.

Test: fast/dom/Element/offsetLeft-offsetTop-body-quirk.html

  • rendering/RenderObject.cpp: (WebCore::RenderObject::offsetLeft): (WebCore::RenderObject::offsetTop):

2007-01-26 Mitz Pettel <mitz@webkit.org>

Reviewed by Darin.

  • editing/execCommand/findString-2.html:
  • editing/pasteboard/4947130.html:
  • editing/pasteboard/drop-text-without-selection.html:
  • editing/selection/anchor-focus1-expected.txt:
  • editing/selection/click-before-and-after-table.html:
  • editing/selection/drag-select-1.html:
  • editing/selection/editable-links-expected.txt:
  • editing/selection/mixed-editability-1.html:
  • editing/selection/paragraph-granularity.html:
  • editing/selection/selection-actions.html:
  • editing/selection/word-granularity.html:
  • fast/dom/Element/offsetLeft-offsetTop-body-quirk-expected.txt: Added.
  • fast/dom/Element/offsetLeft-offsetTop-body-quirk.html: Added.
  • fast/forms/drag-into-textarea.html:
  • fast/forms/listbox-selection-2.html:
  • fast/forms/listbox-selection.html:
  • fast/table/click-near-anonymous-table-expected.txt:
  • fast/table/click-near-anonymous-table.html:
Location:
trunk
Files:
2 added
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r19148 r19149  
     12007-01-26  Mitz Pettel  <mitz@webkit.org>
     2
     3        Reviewed by Darin.
     4
     5        - test and updated tests and results for
     6          http://bugs.webkit.org/show_bug.cgi?id=11109
     7          REGRESSION (r15471): menus are offset on eink.com
     8          <rdar://problem/4824760>
     9
     10        * editing/execCommand/findString-2.html:
     11        * editing/pasteboard/4947130.html:
     12        * editing/pasteboard/drop-text-without-selection.html:
     13        * editing/selection/anchor-focus1-expected.txt:
     14        * editing/selection/click-before-and-after-table.html:
     15        * editing/selection/drag-select-1.html:
     16        * editing/selection/editable-links-expected.txt:
     17        * editing/selection/mixed-editability-1.html:
     18        * editing/selection/paragraph-granularity.html:
     19        * editing/selection/selection-actions.html:
     20        * editing/selection/word-granularity.html:
     21        * fast/dom/Element/offsetLeft-offsetTop-body-quirk-expected.txt: Added.
     22        * fast/dom/Element/offsetLeft-offsetTop-body-quirk.html: Added.
     23        * fast/forms/drag-into-textarea.html:
     24        * fast/forms/listbox-selection-2.html:
     25        * fast/forms/listbox-selection.html:
     26        * fast/table/click-near-anonymous-table-expected.txt:
     27        * fast/table/click-near-anonymous-table.html:
     28
    1292007-01-26  Mitz Pettel  <mitz@webkit.org>
    230
  • trunk/LayoutTests/editing/execCommand/findString-2.html

    r17562 r19149  
    1010if (window.layoutTestController) {
    1111    var e = document.getElementById("selectme");
    12     // The 8 here is the default margin on the body element.
    13     var x = 8 + e.offsetLeft + e.offsetWidth / 2;
    14     var y = 8 + e.offsetTop + e.offsetHeight / 2;
     12    var x = e.offsetLeft + e.offsetWidth / 2;
     13    var y = e.offsetTop + e.offsetHeight / 2;
    1514    eventSender.mouseMoveTo(x, y);
    1615    eventSender.mouseDown();
  • trunk/LayoutTests/editing/pasteboard/4947130.html

    r19061 r19149  
    1818
    1919    var img = document.getElementById("img");
    20     var left = img.offsetParent.offsetLeft + img.offsetLeft;
    21     var top = img.offsetParent.offsetTop + img.offsetTop;
     20    var left = img.offsetLeft;
     21    var top = img.offsetTop;
    2222    var x = left + img.offsetWidth / 2;
    2323    var y = top + img.offsetHeight / 2;
     
    2727    eventSender.leapForward(1300);
    2828
    29     eventSender.mouseMoveTo(left - 20, y);
     29    eventSender.mouseMoveTo(left - 28, y);
    3030    eventSender.mouseUp();
    3131
  • trunk/LayoutTests/editing/pasteboard/drop-text-without-selection.html

    r17562 r19149  
    2626    var link = document.getElementById("link");
    2727
    28     // The 8 here is the default margin on the body element.
    29     var xOff = 8;
    30     var yOff = 8;
    31    
    32     var x = xOff + link.offsetLeft + link.offsetWidth / 2;
    33     var y = yOff + link.offsetTop + link.offsetHeight / 2;
     28    var x = link.offsetLeft + link.offsetWidth / 2;
     29    var y = link.offsetTop + link.offsetHeight / 2;
    3430
    3531    eventSender.mouseMoveTo(x, y);
     
    3935    var field = document.getElementById("field");
    4036   
    41     x = xOff + field.offsetLeft + field.offsetWidth / 2;
    42     y = yOff + field.offsetTop + field.offsetHeight / 2;
     37    x = field.offsetLeft + field.offsetWidth / 2;
     38    y = field.offsetTop + field.offsetHeight / 2;
    4339
    4440    eventSender.mouseMoveTo(x, y);
  • trunk/LayoutTests/editing/selection/anchor-focus1-expected.txt

    r16011 r19149  
    1 EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     1EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 2 of #text > SPAN > DIV > BODY > HTML > #document to 2 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    22EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    3 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > SPAN > DIV > BODY > HTML > #document to 1 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > SPAN > DIV > BODY > HTML > #document to 4 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     3EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 2 of #text > SPAN > DIV > BODY > HTML > #document to 2 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > SPAN > DIV > BODY > HTML > #document to 4 of #text > SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    44EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    55This tests the anchorNode, anchorOffset, focusNode and focusOffset properties of the Selection object. These properties are part of Mozilla's Selection object API, and so their values should be consistent in both browsers.
  • trunk/LayoutTests/editing/selection/click-before-and-after-table.html

    r17562 r19149  
    2929    var s, x, y, e, top, bottom, left, right;
    3030    table = document.getElementById("table");
    31     // The 8 here is the default margin on the body element.
    32     top = 8 + table.offsetTop;
    33     left = 8 + table.offsetLeft;
     31
     32    top = table.offsetTop;
     33    left = table.offsetLeft;
    3434    bottom = top + table.offsetHeight;
    3535    right = left + table.offsetWidth;
  • trunk/LayoutTests/editing/selection/drag-select-1.html

    r17753 r19149  
    2424   
    2525    var start = document.getElementById("start");
    26     var startx = start.offsetParent.offsetLeft + start.offsetLeft + start.offsetWidth / 2;
    27     var starty = start.offsetParent.offsetTop + start.offsetTop + start.offsetHeight / 2;
     26    var startx = -8 + start.offsetLeft + start.offsetWidth / 2;
     27    var starty = start.offsetTop + start.offsetHeight / 2;
    2828    eventSender.mouseMoveTo(startx, starty);
    2929    eventSender.mouseDown();
    3030
    3131    var end = document.getElementById("end");
    32     endx = end.offsetParent.offsetLeft + end.offsetLeft + end.offsetWidth / 2;
    33     endy = end.offsetParent.offsetTop + end.offsetTop + end.offsetHeight / 2;
     32    endx = -8 + end.offsetLeft + end.offsetWidth / 2;
     33    endy = end.offsetTop + end.offsetHeight / 2;
    3434
    3535    var steps = 20;
  • trunk/LayoutTests/editing/selection/editable-links-expected.txt

    r17562 r19149  
    11EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of HTML > #document to 2 of HTML > #document
    22EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
    3 EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 5 of #text > A > BODY > HTML > #document to 5 of #text > A > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
     3EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 6 of #text > A > BODY > HTML > #document to 6 of #text > A > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
    44EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
    55layer at (0,0) size 800x600
     
    1515      RenderText {#text} at (142,0) size 4x18
    1616        text run at (142,0) width 4: "."
    17 caret: position 5 of child 0 {#text} of child 3 {A} of child 1 {BODY} of child 0 {HTML} of document
     17caret: position 6 of child 0 {#text} of child 3 {A} of child 1 {BODY} of child 0 {HTML} of document
  • trunk/LayoutTests/editing/selection/mixed-editability-1.html

    r17562 r19149  
    1414    var x, y;
    1515   
    16     // The 8 here is the default margin on the body element.
    17     x = 8 + start.offsetLeft + start.offsetWidth / 2;
    18     y = 8 + start.offsetTop + start.offsetHeight / 2;
     16    x = start.offsetLeft + start.offsetWidth / 2;
     17    y = start.offsetTop + start.offsetHeight / 2;
    1918   
    2019    eventSender.mouseMoveTo(x, y);
  • trunk/LayoutTests/editing/selection/paragraph-granularity.html

    r17562 r19149  
    1212    var start = document.getElementById("start");
    1313   
    14     x = start.offsetLeft + 10;
     14    x = start.offsetLeft + 2;
    1515    y = start.offsetTop + 10;
    1616   
     
    2424    var end = document.getElementById("end");
    2525   
    26     x = end.offsetLeft + end.offsetWidth + 10;
     26    x = end.offsetLeft + end.offsetWidth + 2;
    2727    y = end.offsetTop + 10;
    2828   
  • trunk/LayoutTests/editing/selection/selection-actions.html

    r17562 r19149  
    1212    var start = document.getElementById("start");
    1313   
    14     x = start.offsetLeft + 10;
    15     y = start.offsetTop + 10;
     14    x = start.offsetLeft + 2;
     15    y = start.offsetTop + 2;
    1616   
    1717    eventSender.mouseMoveTo(x, y);
  • trunk/LayoutTests/editing/selection/word-granularity.html

    r17562 r19149  
    1212    var start = document.getElementById("start");
    1313   
    14     x = start.offsetLeft + 10;
     14    x = start.offsetLeft + 2;
    1515    y = start.offsetTop + 10;
    1616   
     
    2222    var end = document.getElementById("end");
    2323   
    24     x = end.offsetLeft + end.offsetWidth + 10;
     24    x = end.offsetLeft + end.offsetWidth + 2;
    2525    y = end.offsetTop + 10;
    2626   
  • trunk/LayoutTests/fast/forms/drag-into-textarea.html

    r16026 r19149  
    33function runTest() {
    44    var input = document.getElementById("input");
    5     var x = 8 + input.offsetLeft + input.offsetWidth / 2;
    6     var y = 8 + input.offsetTop + input.offsetHeight / 2;
     5    var x = input.offsetLeft + input.offsetWidth / 2;
     6    var y = input.offsetTop + input.offsetHeight / 2;
    77
    88    var textarea = document.getElementById("textarea");
    9     var tx = 8 + textarea.offsetLeft + textarea.offsetWidth / 2;
    10     var ty = 8 + textarea.offsetTop + textarea.offsetHeight / 2;
     9    var tx = textarea.offsetLeft + textarea.offsetWidth / 2;
     10    var ty = textarea.offsetTop + textarea.offsetHeight / 2;
    1111
    1212    input.select();
  • trunk/LayoutTests/fast/forms/listbox-selection-2.html

    r19037 r19149  
    5858                var borderPaddingTop = 15;
    5959                var borderPaddingLeft = 15;
    60                 var y = 8 + index * itemHeight - window.pageYOffset + borderPaddingTop;
     60                var y = index * itemHeight - window.pageYOffset + borderPaddingTop;
    6161                var event = document.createEvent("MouseEvent");
    62                 event.initMouseEvent("mousedown", true, true, document.defaultView, 1, sl.offsetLeft + 8 + borderPaddingLeft, sl.offsetTop + y, sl.offsetLeft + 8 + borderPaddingLeft, sl.offsetTop + y, false, false, shift, meta, 0, document);
     62                event.initMouseEvent("mousedown", true, true, document.defaultView, 1, sl.offsetLeft +  borderPaddingLeft, sl.offsetTop + y, sl.offsetLeft + borderPaddingLeft, sl.offsetTop + y, false, false, shift, meta, 0, document);
    6363                sl.dispatchEvent(event);
    6464            }
  • trunk/LayoutTests/fast/forms/listbox-selection.html

    r17498 r19149  
    112112            function mouseDownOnSelect(selId, index, shift, meta) {
    113113                var sl = document.getElementById(selId);
    114                 var itemHeight = 15;
    115                 var y = 10 + index * itemHeight - window.pageYOffset;
     114                var itemHeight = 14;
     115                var border = 1;
     116                var y = border + index * itemHeight - window.pageYOffset;
    116117                var event = document.createEvent("MouseEvent");
    117                 event.initMouseEvent("mousedown", true, true, document.defaultView, 1, sl.offsetLeft + 10, sl.offsetTop + y, sl.offsetLeft + 10, sl.offsetTop + y, false, false, shift, meta, 0, document);
     118                event.initMouseEvent("mousedown", true, true, document.defaultView, 1, sl.offsetLeft + border, sl.offsetTop + y, sl.offsetLeft + border, sl.offsetTop + y, false, false, shift, meta, 0, document);
    118119                sl.dispatchEvent(event);
    119120            }
  • trunk/LayoutTests/fast/table/click-near-anonymous-table-expected.txt

    r17562 r19149  
    4040                RenderText {#text} at (0,0) size 176x18
    4141                  text run at (0,0) width 176: "Click to the right of this text"
    42 caret: position 40 of child 0 {#text} of child 7 {DIV} of child 7 {DIV} of child 1 {BODY} of child 0 {HTML} of document
     42caret: position 9 of child 0 {#text} of child 7 {DIV} of child 7 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  • trunk/LayoutTests/fast/table/click-near-anonymous-table.html

    r15471 r19149  
    88                return;
    99            var target = document.getElementById("target");
    10             // The 8 here is the default margin on the body element.
    11             var baseX = 8 + target.offsetLeft;
    12             var baseY = 8 + target.offsetTop;
     10
    1311            for (i = 0; i < target.children.length; i++) {
    1412                var div = target.children[i];
    15                 var clickX = baseX + target.offsetLeft + target.offsetWidth + 5;
    16                 var clickY = baseY + target.offsetTop + target.offsetHeight + 5;
     13                var clickX = div.offsetLeft + div.offsetWidth + 5;
     14                var clickY = div.offsetTop + 5;
    1715                eventSender.mouseMoveTo(clickX, clickY);
    1816                eventSender.mouseDown();
  • trunk/WebCore/ChangeLog

    r19148 r19149  
    112007-01-26  Mitz Pettel  <mitz@webkit.org>
    22
    3         Reviewed by Reviewed by Darin and Maciej.
     3        Reviewed by Darin.
     4
     5        - fix http://bugs.webkit.org/show_bug.cgi?id=11109
     6          REGRESSION (r15471): menus are offset on eink.com
     7          <rdar://problem/4824760>
     8
     9        Changed offset{Left,Top} to match Firefox. If the body element is statically
     10        positioned, it is still returned as the offsetParent of elements whose containing
     11        block is the initial containing block (the root), but their offset{Left,Top} are
     12        relative to the root. If the body element is positioned, then offsets are relative
     13        to it. The body's own offset{Left,Top} are always 0.
     14
     15        Test: fast/dom/Element/offsetLeft-offsetTop-body-quirk.html
     16
     17        * rendering/RenderObject.cpp:
     18        (WebCore::RenderObject::offsetLeft):
     19        (WebCore::RenderObject::offsetTop):
     20
     212007-01-26  Mitz Pettel  <mitz@webkit.org>
     22
     23        Reviewed by Darin and Maciej.
    424
    525        - fix http://bugs.webkit.org/show_bug.cgi?id=10983
  • trunk/WebCore/rendering/RenderObject.cpp

    r19148 r19149  
    517517            curr = curr->parent();
    518518        }
     519        if (offsetPar->isBody() && !offsetPar->isRelPositioned() && !offsetPar->isPositioned())
     520            x += offsetPar->xPos();
    519521    }
    520522    return x;
     
    536538            curr = curr->parent();
    537539        }
     540        if (offsetPar->isBody() && !offsetPar->isRelPositioned() && !offsetPar->isPositioned())
     541            y += offsetPar->yPos();
    538542    }
    539543    return y;
Note: See TracChangeset for help on using the changeset viewer.