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-20130306135130.patch (text/plain), 9.65 KB, created by
Sergio Villar Senin
on 2013-03-06 04:56:55 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Sergio Villar Senin
Created:
2013-03-06 04:56:55 PST
Size:
9.65 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..18b77c0fbee93b43841a8f38e5e84f87ed2ff7d4 100644 >--- a/Source/WebCore/editing/markup.cpp >+++ b/Source/WebCore/editing/markup.cpp >@@ -515,6 +515,15 @@ static Node* highestAncestorToWrapMarkup(const Range* range, EAnnotateForInterch > // the structure and appearance of the copied markup. > specialCommonAncestor = ancestorToRetainStructureAndAppearance(commonAncestor); > >+ // If listItem contents are fully selected elements then wrap them with <li> to retain structure and appearance >+ 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..81c1fcf9788d10426d1be48118752422c82a92a4 >--- /dev/null >+++ b/LayoutTests/editing/selection/drag-list-item-expected.txt >@@ -0,0 +1,51 @@ >+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 (0,0) size 800x584 >+ RenderBlock {DIV} at (0,0) size 800x230 >+ RenderBlock {P} at (0,0) size 800x18 >+ RenderText {#text} at (0,0) size 549x19 >+ text run at (0,0) width 549: "Drag'Drop list items in a list. This test should be run with DRT for event sender access." >+ RenderBlock {OL} at (0,34) size 800x90 >+ RenderListItem {LI} at (40,0) size 760x18 >+ RenderListMarker at (-21,0) size 16x19: "1" >+ RenderText {#text} at (0,0) size 34x19 >+ text run at (0,0) width 34: "alpha" >+ RenderListItem {LI} at (40,18) size 760x18 >+ RenderListMarker at (-21,0) size 16x19: "2" >+ RenderBR {BR} at (0,0) size 0x19 >+ RenderListItem {LI} at (40,36) size 760x18 >+ RenderListMarker at (-21,0) size 16x19: "3" >+ RenderText {#text} at (0,0) size 46x19 >+ text run at (0,0) width 46: "gamma" >+ RenderListItem {LI} at (40,54) size 760x18 >+ RenderListMarker at (-21,0) size 16x19: "4" >+ RenderText {#text} at (0,0) size 30x19 >+ text run at (0,0) width 30: "delta" >+ RenderListItem {LI} at (40,72) size 760x18 >+ RenderListMarker at (-21,0) size 16x19: "5" >+ RenderText {#text} at (0,0) size 26x19 >+ text run at (0,0) width 26: "beta" >+ RenderBlock {OL} at (0,140) size 800x90 >+ RenderListItem {LI} at (40,0) size 760x18 >+ RenderListMarker at (-21,0) size 16x19: "1" >+ RenderText {#text} at (0,0) size 34x19 >+ text run at (0,0) width 34: "alpha" >+ RenderListItem {LI} at (40,18) size 760x18 >+ RenderListMarker at (-21,0) size 16x19: "2" >+ RenderBR {BR} at (0,0) size 0x19 >+ RenderListItem {LI} at (40,36) size 760x18 >+ RenderListMarker at (-21,0) size 16x19: "3" >+ RenderText {#text} at (0,0) size 30x19 >+ text run at (0,0) width 30: "delta" >+ RenderListItem {LI} at (40,54) size 760x18 >+ RenderListMarker at (-21,0) size 16x19: "4" >+ RenderText {#text} at (0,0) size 26x19 >+ text run at (0,0) width 26: "beta" >+ RenderListItem {LI} at (40,72) size 760x18 >+ RenderListMarker at (-21,0) size 16x19: "5" >+ RenderText {#text} at (0,0) size 46x19 >+ text run at (0,0) width 46: "gamma" >+selection start: position 0 of child 0 {#text} of child 6 {LI} of child 5 {OL} of child 1 {DIV} of body >+selection end: position 5 of child 0 {#text} of child 7 {LI} of child 5 {OL} of child 1 {DIV} of body >diff --git a/LayoutTests/editing/selection/drag-list-item.html b/LayoutTests/editing/selection/drag-list-item.html >new file mode 100644 >index 0000000000000000000000000000000000000000..a722177fe155a254ed0429bac7da1493ce527412 >--- /dev/null >+++ b/LayoutTests/editing/selection/drag-list-item.html >@@ -0,0 +1,54 @@ >+<html> >+ >+<body style="margin: 0; padding :0"> >+<div contenteditable="true"> >+<p>Drag'Drop list items in a list. This test should be run with DRT for event sender access.</p> >+<ol id="test1"> >+<li id="alpha">alpha</li> >+<li id="beta">beta</li> >+<li id="gamma">gamma</li> >+<li id="delta">delta</li> >+</ol> >+ >+<ol id="test2"> >+<li id="alpha2">alpha</li> >+<li id="beta2">beta</li> >+<li id="gamma2">gamma</li> >+<li id="delta2">delta</li> >+</ol> >+ >+</div> >+ >+<script> >+function editingTest(testElement, startSelectionElement, endSelectionElement, endSelectionElementOffset, targetElement) { >+ >+ var elem = document.getElementById(testElement); >+ var selection = window.getSelection(); >+ selection.setPosition(elem, 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(); >+ >+ 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(); >+} >+ >+if (window.testRunner) { >+ // First drag&drop a single item, "beta", to the end of "delta" >+ editingTest("test1", "beta", "beta", 4, "delta"); >+ >+ // Then drag&drop two items, "beta" and "gamma", to the end of "delta" >+ editingTest("test2", "beta2", "gamma2", 5, "delta2"); >+} >+</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