[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

enrica at apple.com enrica at apple.com
Thu Apr 8 00:39:01 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 19b5598eb25506312b75be08dde4f7b28c32920a
Author: enrica at apple.com <enrica at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 16 22:02:03 2009 +0000

    WebCore: Right clicking in a table cell creates a selection that extends into the next cell.
    <rdar://problem/5565465>
    https://bugs.webkit.org/show_bug.cgi?id=32622
    
    Reviewed by Eric Seidel.
    
    Avoid extending the selection to the next cell if we start from an empty cell.
    
    Test: editing/selection/empty-cell-right-click.html
    
    * editing/TypingCommand.cpp:
    (WebCore::TypingCommand::deleteKeyPressed): Replaced the code that check for empty table cell
    with a call to the new function.
    * editing/VisibleSelection.cpp:
    (WebCore::VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity): Extends the
    selection only if we are not starting from an empty table cell.
    * editing/htmlediting.cpp:
    (WebCore::isEmptyTableCell): Added a function since this check is performed now in two places.
    * editing/htmlediting.h: Added isEmptyTableCell declaration.
    
    LayoutTests: Right clicking in a table cell creates a selection that extends into the next cell.
    <rdar://problem/5565465>
    https://bugs.webkit.org/show_bug.cgi?id=32622
    
    Reviewed by Eric Seidel.
    
    * editing/selection/empty-cell-right-click-expected.txt: Added.
    * editing/selection/empty-cell-right-click.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52220 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 2911942..d67dbcc 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2009-12-16  Enrica Casucci  <enrica at apple.com>
+
+        Reviewed by Eric Seidel.
+
+        Right clicking in a table cell creates a selection that extends into the next cell.
+        <rdar://problem/5565465>
+        https://bugs.webkit.org/show_bug.cgi?id=32622
+
+        * editing/selection/empty-cell-right-click-expected.txt: Added.
+        * editing/selection/empty-cell-right-click.html: Added.
+
 2009-12-16  Dirk Schulze  <krit at webkit.org>
 
         Reviewed by Nikolas Zimmermann.
diff --git a/LayoutTests/editing/selection/empty-cell-right-click-expected.txt b/LayoutTests/editing/selection/empty-cell-right-click-expected.txt
new file mode 100644
index 0000000..46434a4
--- /dev/null
+++ b/LayoutTests/editing/selection/empty-cell-right-click-expected.txt
@@ -0,0 +1,20 @@
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document to 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document to 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document toDOMRange:range from 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document to 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document to 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document toDOMRange:range from 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document to 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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 784x27
+        RenderTable {TABLE} at (0,0) size 164x27 [border: (1px outset #808080)]
+          RenderTableSection {TBODY} at (1,1) size 162x25
+            RenderTableRow {TR} at (0,0) size 162x25
+              RenderTableCell {TD} at (0,10) size 54x4 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              RenderTableCell {TD} at (54,10) size 54x4 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+              RenderTableCell {TD} at (108,10) size 54x4 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
+caret: position 0 of child 0 {TD} of child 0 {TR} of child 0 {TBODY} of child 1 {TABLE} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/LayoutTests/editing/selection/empty-cell-right-click.html b/LayoutTests/editing/selection/empty-cell-right-click.html
new file mode 100644
index 0000000..1af741c
--- /dev/null
+++ b/LayoutTests/editing/selection/empty-cell-right-click.html
@@ -0,0 +1,22 @@
+<html> 
+<head>
+<title>Right clicking on an empty cell should not extend the selection to the next cell.</title> 
+</head> 
+<body>
+<div contentEditable="true">
+<table border="1" cellspacing="0"><tr><td id="first" width="50" height="25pt"></td><td width="50" height="25pt"></td><td width="50" height="25pt"></td></tr></table>
+</div>
+</body>
+<script>
+if (window.layoutTestController) {   
+    window.layoutTestController.dumpEditingCallbacks();
+    var elem = document.getElementById("first");
+    x = elem.offsetLeft + elem.offsetWidth / 2;
+    y = elem.offsetTop + elem.offsetHeight / 2;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();
+    eventSender.mouseUp();
+    eventSender.contextClick();
+}
+</script>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e5d15c9..b01e0da 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2009-12-16  Enrica Casucci  <enrica at apple.com>
+
+        Reviewed by Eric Seidel.
+
+        Right clicking in a table cell creates a selection that extends into the next cell.
+        <rdar://problem/5565465>
+        https://bugs.webkit.org/show_bug.cgi?id=32622
+        
+        Avoid extending the selection to the next cell if we start from an empty cell.
+
+        Test: editing/selection/empty-cell-right-click.html
+
+        * editing/TypingCommand.cpp:
+        (WebCore::TypingCommand::deleteKeyPressed): Replaced the code that check for empty table cell
+        with a call to the new function.
+        * editing/VisibleSelection.cpp:
+        (WebCore::VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity): Extends the
+        selection only if we are not starting from an empty table cell.
+        * editing/htmlediting.cpp:
+        (WebCore::isEmptyTableCell): Added a function since this check is performed now in two places.
+        * editing/htmlediting.h: Added isEmptyTableCell declaration.
+
 2009-12-16  Dirk Schulze  <krit at webkit.org>
 
         Reviewed by Nikolas Zimmermann.
diff --git a/WebCore/editing/TypingCommand.cpp b/WebCore/editing/TypingCommand.cpp
index 1dc87a8..1c9db90 100644
--- a/WebCore/editing/TypingCommand.cpp
+++ b/WebCore/editing/TypingCommand.cpp
@@ -450,9 +450,8 @@ void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool killRing)
             }
             
             VisiblePosition visibleStart(endingSelection().visibleStart());
-            Node *startNode = visibleStart.deepEquivalent().node();
             // If we have a caret selection on an empty cell, we have nothing to do.
-            if (startNode && startNode->renderer() && (startNode->renderer()->isTableCell() || (startNode->renderer()->isBR() && startNode->parentNode()->renderer() && startNode->parentNode()->renderer()->isTableCell())))
+            if (isEmptyTableCell(visibleStart.deepEquivalent().node()))
                 return;
 
             // If the caret is at the start of a paragraph after a table, move content into the last table cell.
diff --git a/WebCore/editing/VisibleSelection.cpp b/WebCore/editing/VisibleSelection.cpp
index 68d5a3e..baef2b5 100644
--- a/WebCore/editing/VisibleSelection.cpp
+++ b/WebCore/editing/VisibleSelection.cpp
@@ -301,7 +301,7 @@ void VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity()
             VisiblePosition wordEnd(endOfWord(originalEnd, side));
             VisiblePosition end(wordEnd);
             
-            if (isEndOfParagraph(originalEnd)) {
+            if (isEndOfParagraph(originalEnd) && !isEmptyTableCell(m_start.node())) {
                 // Select the paragraph break (the space from the end of a paragraph to the start of 
                 // the next one) to match TextEdit.
                 end = wordEnd.next();
diff --git a/WebCore/editing/htmlediting.cpp b/WebCore/editing/htmlediting.cpp
index 8b1c98d..9cd2a8e 100644
--- a/WebCore/editing/htmlediting.cpp
+++ b/WebCore/editing/htmlediting.cpp
@@ -851,6 +851,11 @@ bool isTableCell(const Node* node)
     return r->isTableCell();
 }
 
+bool isEmptyTableCell(const Node* node)
+{
+    return node && node->renderer() && (node->renderer()->isTableCell() || (node->renderer()->isBR() && node->parentNode()->renderer() && node->parentNode()->renderer()->isTableCell()));     
+}
+
 PassRefPtr<HTMLElement> createDefaultParagraphElement(Document* document)
 {
     return new HTMLDivElement(divTag, document);
diff --git a/WebCore/editing/htmlediting.h b/WebCore/editing/htmlediting.h
index 43048e0..c5a44ac 100644
--- a/WebCore/editing/htmlediting.h
+++ b/WebCore/editing/htmlediting.h
@@ -87,6 +87,7 @@ bool isTabSpanTextNode(const Node*);
 bool isMailBlockquote(const Node*);
 bool isTableElement(Node*);
 bool isTableCell(const Node*);
+bool isEmptyTableCell(const Node*);
 bool isTableStructureNode(const Node*);
 bool isListElement(Node*);
 bool isNodeRendered(const Node*);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list