WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-111556-20130306210024.patch (text/plain), 8.09 KB, created by
Sergio Villar Senin
on 2013-03-06 12:05:48 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Sergio Villar Senin
Created:
2013-03-06 12:05:48 PST
Size:
8.09 KB
patch
obsolete
>Subversion Revision: 144901 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c518f65770925c1a946011c495b8ab39d3e84229..3f03a436870f2048eb4a66b299d4d36d4cfc7efb 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2013-03-06 Sergio Villar Senin <svillar@igalia.com> >+ >+ Improve drag&drop of list items in contentEditable divs >+ https://bugs.webkit.org/show_bug.cgi?id=111556 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ A single fully selected <li> should generate the same markup as if >+ we were selecting some of them, i.e., we should preserve the list >+ structure and appearance. >+ >+ Test: editing/selection/drag-list-item.html >+ >+ * editing/htmlediting.cpp: >+ (WebCore::isListItem): modified constness. >+ * editing/htmlediting.h: >+ (WebCore): ditto. >+ * editing/markup.cpp: >+ (WebCore::highestAncestorToWrapMarkup): >+ > 2013-03-06 Allan Sandfeld Jensen <allan.jensen@digia.com> > > REGGRESSION (r142112): It made compositing tests fail on EFL, Qt. >diff --git a/Source/WebCore/editing/htmlediting.cpp b/Source/WebCore/editing/htmlediting.cpp >index 24eb6eafe59f14f8c3598721c2331b5135f3acac..8a903247219415a939bbbe7bf698bac73043df2c 100644 >--- a/Source/WebCore/editing/htmlediting.cpp >+++ b/Source/WebCore/editing/htmlediting.cpp >@@ -580,7 +580,7 @@ bool isListElement(Node *n) > return (n && (n->hasTagName(ulTag) || n->hasTagName(olTag) || n->hasTagName(dlTag))); > } > >-bool isListItem(Node *n) >+bool isListItem(const Node *n) > { > return n && n->renderer() && n->renderer()->isListItem(); > } >diff --git a/Source/WebCore/editing/htmlediting.h b/Source/WebCore/editing/htmlediting.h >index fa63254768a1228f43fa1b64d0095bc2385f7bb5..5f67264d0b744c1acb58eed9e4cd17f66b767c5d 100644 >--- a/Source/WebCore/editing/htmlediting.h >+++ b/Source/WebCore/editing/htmlediting.h >@@ -107,7 +107,7 @@ bool isTableCell(const Node*); > bool isEmptyTableCell(const Node*); > bool isTableStructureNode(const Node*); > bool isListElement(Node*); >-bool isListItem(Node*); >+bool isListItem(const Node*); > bool isNodeRendered(const Node*); > bool isNodeVisiblyContainedWithin(Node*, const Range*); > bool isRenderedAsNonInlineTableImageOrHR(const Node*); >diff --git a/Source/WebCore/editing/markup.cpp b/Source/WebCore/editing/markup.cpp >index d3277c3666667a3da6292a7a79a517ee15412c5c..afa8388f5e3dd428de8933af777faacf87ba1086 100644 >--- a/Source/WebCore/editing/markup.cpp >+++ b/Source/WebCore/editing/markup.cpp >@@ -515,6 +515,14 @@ static Node* highestAncestorToWrapMarkup(const Range* range, EAnnotateForInterch > // the structure and appearance of the copied markup. > specialCommonAncestor = ancestorToRetainStructureAndAppearance(commonAncestor); > >+ if (Node* parentListNode = enclosingNodeOfType(firstPositionInOrBeforeNode(range->firstNode()), isListItem)) { >+ if (WebCore::areRangesEqual(VisibleSelection::selectionFromContentsOfNode(parentListNode).toNormalizedRange().get(), range)) { >+ specialCommonAncestor = parentListNode->parentNode(); >+ while (specialCommonAncestor && !isListElement(specialCommonAncestor)) >+ specialCommonAncestor = specialCommonAncestor->parentNode(); >+ } >+ } >+ > // Retain the Mail quote level by including all ancestor mail block quotes. > if (Node* highestMailBlockquote = highestEnclosingNodeOfType(firstPositionInOrBeforeNode(range->firstNode()), isMailBlockquote, CanCrossEditingBoundary)) > specialCommonAncestor = highestMailBlockquote; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 058d4b6b4bd3986cfbe6dc22ed345f6bbfd5196e..1b9aec37838efdd24d6a8f6c0779d54f2d2065b4 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,18 @@ >+2013-03-06 Sergio Villar Senin <svillar@igalia.com> >+ >+ Improve drag&drop of list items in contentEditable divs >+ https://bugs.webkit.org/show_bug.cgi?id=111556 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added a new test case. The test performs 2 drag&drops, first of >+ all a selection of a single list item, and secondly a selection of >+ two list items. It checks that both behave the same way, i.e, the >+ whole <li> is moved and not only the text. >+ >+ * editing/selection/drag-list-item-expected.txt: Added. >+ * editing/selection/drag-list-item.html: Added. >+ > 2013-03-06 Allan Sandfeld Jensen <allan.jensen@digia.com> > > REGGRESSION (r142112): It made compositing tests fail on EFL, Qt. >diff --git a/LayoutTests/editing/selection/drag-list-item-expected.txt b/LayoutTests/editing/selection/drag-list-item-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..0a5a56347e7364a9bfac2c364e3d5ddc97a906aa >--- /dev/null >+++ b/LayoutTests/editing/selection/drag-list-item-expected.txt >@@ -0,0 +1,39 @@ >+This test drags a selection of one <li> and drops them after another <li> in the first list. The same test is repeated in the second list but this time with two selected items instead of one. It verifies that the behavior is independent of how many fully selected items we move, i.e. fully selected <li> are moved as <li> and not just as plain text >+ >+'beta' should appear as a new <li> after 'delta': >+| " >+" >+| <li> >+| id="alpha" >+| "alpha" >+| <li> >+| id="beta" >+| <br> >+| <li> >+| id="gamma" >+| "gamma" >+| <li> >+| id="delta" >+| "delta" >+| <li> >+| id="beta" >+| "beta" >+| " >+" >+ >+'beta' and 'gamma' should appear as <li> after 'delta': >+| <li> >+| id="alpha" >+| "alpha" >+| <li> >+| id="beta" >+| <br> >+| <li> >+| id="delta" >+| "delta" >+| <li> >+| id="beta" >+| "beta" >+| <li> >+| id="gamma" >+| "gamma" >diff --git a/LayoutTests/editing/selection/drag-list-item.html b/LayoutTests/editing/selection/drag-list-item.html >new file mode 100644 >index 0000000000000000000000000000000000000000..14bcc82a56f1d89bf5f4dd4ce87c72ad501bf3d0 >--- /dev/null >+++ b/LayoutTests/editing/selection/drag-list-item.html >@@ -0,0 +1,51 @@ >+<!DOCTYPE html> >+ >+<body> >+<script src="../../resources/dump-as-markup.js"></script> >+<div contenteditable="true"> >+<ol id="test"> >+<li id="alpha">alpha</li><li id="beta">beta</li><li id="gamma">gamma</li><li id="delta">delta</li> >+</ol> >+</div> >+ >+<script> >+Markup.description('This test drags a selection of one <li> and drops them after another <li> in the first list. The same test is repeated in the second list but this time with two selected items instead of one. It verifies that the behavior is independent of how many fully selected items we move, i.e. fully selected <li> are moved as <li> and not just as plain text'); >+ >+function editingTest(testElement, startSelectionElement, endSelectionElement, endSelectionElementOffset, targetElement) { >+ >+ var testElement = document.getElementById(testElement); >+ var selection = window.getSelection(); >+ selection.setPosition(testElement, 0); >+ >+ var start = document.getElementById(startSelectionElement); >+ var startx = start.offsetLeft; >+ var starty = start.offsetTop + start.offsetHeight / 2; >+ selection.setBaseAndExtent(start, 0, document.getElementById(endSelectionElement), endSelectionElementOffset); >+ >+ eventSender.mouseMoveTo(startx, starty); >+ eventSender.mouseDown(); >+ >+ eventSender.leapForward(300); >+ >+ var target = document.getElementById(targetElement); >+ var targetx = target.parentNode.offsetLeft + target.offsetLeft + target.offsetWidth / 2; >+ var targety = target.offsetTop + target.offsetHeight / 2; >+ >+ eventSender.mouseMoveTo(targetx, targety); >+ eventSender.mouseUp(); >+ >+ selection.collapse(); >+} >+ >+if (window.testRunner) { >+ editingTest("test", "beta", "beta", 4, "delta"); >+ Markup.dump(document.getElementById("test"), "'beta' should appear as a new <li> after 'delta'"); >+ >+ document.getElementById("test").innerHTML = "<li id=\"alpha\">alpha</li><li id=\"beta\">beta</li>" >+ + "<li id=\"gamma\">gamma</li><li id=\"delta\">delta</li>"; >+ editingTest("test", "beta", "gamma", 5, "delta"); >+ Markup.dump(document.getElementById("test"), "'beta' and 'gamma' should appear as <li> after 'delta'"); >+} >+</script> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 111556
:
191720
|
191807
|
192026