Reviewed by harrison
<rdar://problem/
4655880> Up/Down arrows skip over To Do
* editing/selection/mixed-editability-3-expected.checksum: Added.
* editing/selection/mixed-editability-3-expected.png: Added.
* editing/selection/mixed-editability-3-expected.txt: Added.
* editing/selection/mixed-editability-3.html: Added.
* editing/selection/mixed-editability-4-expected.checksum: Added.
* editing/selection/mixed-editability-4-expected.png: Added.
* editing/selection/mixed-editability-4-expected.txt: Added.
* editing/selection/mixed-editability-4.html: Added.
* editing/selection/mixed-editability-5-expected.checksum: Added.
* editing/selection/mixed-editability-5-expected.png: Added.
* editing/selection/mixed-editability-5-expected.txt: Added.
* editing/selection/mixed-editability-5.html: Added.
WebCore:
Reviewed by harrison
<rdar://problem/
4655880> Up/Down arrows skip over To Do
* bridge/mac/WebCoreFrameBridge.mm:
(-[WebCoreFrameBridge canDeleteRange:]): Added a FIXME.
* dom/Node.cpp: Removed the unused inSameRootEditableElement.
* dom/Node.h:
* editing/SelectionController.cpp:
(WebCore::SelectionController::modify): Added documentboundary to granularities in order test a fix.
* editing/visible_units.cpp:
(WebCore::previousLinePosition): Use highestEditableRoot so that this function can move from
editable content into editable content that's embedded in non-editable content.
(WebCore::nextLinePosition): Ditto.
(WebCore::startOfEditableContent): Renamed from startOfEditableRoot and use highestEditableRoot.
This is the behavior that callers desire. This fixes Command + Up/Down.
(WebCore::endOfEditableContent): Ditto.
* editing/visible_units.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16365
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-09-14 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by harrison
+
+ <rdar://problem/4655880> Up/Down arrows skip over To Do
+
+ * editing/selection/mixed-editability-3-expected.checksum: Added.
+ * editing/selection/mixed-editability-3-expected.png: Added.
+ * editing/selection/mixed-editability-3-expected.txt: Added.
+ * editing/selection/mixed-editability-3.html: Added.
+ * editing/selection/mixed-editability-4-expected.checksum: Added.
+ * editing/selection/mixed-editability-4-expected.png: Added.
+ * editing/selection/mixed-editability-4-expected.txt: Added.
+ * editing/selection/mixed-editability-4.html: Added.
+ * editing/selection/mixed-editability-5-expected.checksum: Added.
+ * editing/selection/mixed-editability-5-expected.png: Added.
+ * editing/selection/mixed-editability-5-expected.txt: Added.
+ * editing/selection/mixed-editability-5.html: Added.
+
2006-09-14 Graham Dennis <graham.dennis@gmail.com>
Reviewed by Justin Garcia.
--- /dev/null
+ea15d1992fb7b8803e6583675cd95c85
\ No newline at end of file
--- /dev/null
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldEndEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document to 1 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+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 {P} at (0,0) size 784x36
+ RenderText {#text} at (0,0) size 754x36
+ text run at (0,0) width 459: "This tests moving the caret forward through content of mixed editability. "
+ text run at (459,0) width 295: "The caret should move down one line from the"
+ text run at (0,18) width 470: "editable piece to the editable piece that's embedded in a non-editable piece."
+ RenderBlock {DIV} at (0,52) size 784x64
+ RenderBlock (anonymous) at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 49x18
+ text run at (0,0) width 49: "editable"
+ RenderTable {TABLE} at (0,18) size 59x28 [border: (1px outset #808080)]
+ RenderTableSection {TBODY} at (1,1) size 57x26
+ RenderTableRow {TR} at (0,2) size 57x22
+ RenderTableCell {TD} at (2,2) size 53x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (2,2) size 49x18
+ text run at (2,2) width 49: "editable"
+ RenderBlock (anonymous) at (0,46) size 784x18
+ RenderText {#text} at (0,0) size 49x18
+ text run at (0,0) width 49: "editable"
+caret: position 0 of child 0 {#text} of child 0 {TD} of child 0 {TR} of child 0 {TBODY} of child 1 {TABLE} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
--- /dev/null
+<p>This tests moving the caret forward through content of mixed editability. The caret should move down one line from the editable piece to the editable piece that's embedded in a non-editable piece.</p>
+
+<div contenteditable="true" id="test">
+editable
+<table border="1" contenteditable="false"><tr><td contenteditable="true">editable</td></tr></table>
+editable
+</div>
+
+<script>
+var e = document.getElementById("test");
+var s = window.getSelection();
+
+s.setPosition(e, 0);
+
+s.modify("move", "forward", "line");
+</script>
\ No newline at end of file
--- /dev/null
+592209256035f36c3d2c6b25a6e7f245
\ No newline at end of file
--- /dev/null
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document to 1 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldEndEditingInDOMRange:range from 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document to 1 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+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 {P} at (0,0) size 784x36
+ RenderText {#text} at (0,0) size 754x36
+ text run at (0,0) width 459: "This tests moving the caret forward through content of mixed editability. "
+ text run at (459,0) width 295: "The caret should move down one line from the"
+ text run at (0,18) width 470: "editable piece to the editable piece that's embedded in a non-editable piece."
+ RenderBlock {DIV} at (0,52) size 784x64
+ RenderBlock (anonymous) at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 49x18
+ text run at (0,0) width 49: "editable"
+ RenderTable {TABLE} at (0,18) size 59x28 [border: (1px outset #808080)]
+ RenderTableSection {TBODY} at (1,1) size 57x26
+ RenderTableRow {TR} at (0,2) size 57x22
+ RenderTableCell {TD} at (2,2) size 53x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (2,2) size 49x18
+ text run at (2,2) width 49: "editable"
+ RenderBlock (anonymous) at (0,46) size 784x18
+ RenderText {#text} at (0,0) size 49x18
+ text run at (0,0) width 49: "editable"
+caret: position 2 of child 0 {#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
--- /dev/null
+<p>This tests moving the caret forward through content of mixed editability. The caret should move down one line from the editable piece to the editable piece that's embedded in a non-editable piece.</p>
+
+<div contenteditable="true">
+editable
+<table border="1" contenteditable="false"><tr><td contenteditable="true" id="test">editable</td></tr></table>
+editable
+</div>
+
+<script>
+var e = document.getElementById("test");
+var s = window.getSelection();
+
+s.setPosition(e, 0);
+
+s.modify("move", "backward", "line");
+</script>
\ No newline at end of file
--- /dev/null
+e288d0e5cccccc08bb276fa070e4e7fd
\ No newline at end of file
--- /dev/null
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document to 1 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldEndEditingInDOMRange:range from 0 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document to 1 of TD > TR > TBODY > TABLE > DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+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 {P} at (0,0) size 784x36
+ RenderText {#text} at (0,0) size 754x36
+ text run at (0,0) width 459: "This tests moving the caret forward through content of mixed editability. "
+ text run at (459,0) width 295: "The caret should move down one line from the"
+ text run at (0,18) width 470: "editable piece to the editable piece that's embedded in a non-editable piece."
+ RenderBlock {DIV} at (0,52) size 784x64
+ RenderBlock (anonymous) at (0,0) size 784x18
+ RenderText {#text} at (0,0) size 49x18
+ text run at (0,0) width 49: "editable"
+ RenderTable {TABLE} at (0,18) size 59x28 [border: (1px outset #808080)]
+ RenderTableSection {TBODY} at (1,1) size 57x26
+ RenderTableRow {TR} at (0,2) size 57x22
+ RenderTableCell {TD} at (2,2) size 53x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+ RenderText {#text} at (2,2) size 49x18
+ text run at (2,2) width 49: "editable"
+ RenderBlock (anonymous) at (0,46) size 784x18
+ RenderText {#text} at (0,0) size 49x18
+ text run at (0,0) width 49: "editable"
+caret: position 9 of child 2 {#text} of child 2 {DIV} of child 0 {BODY} of child 0 {HTML} of document
--- /dev/null
+<p>This tests moving the caret forward through content of mixed editability. The caret should move down one line from the editable piece to the editable piece that's embedded in a non-editable piece.</p>
+
+<div contenteditable="true">
+editable
+<table border="1" contenteditable="false"><tr><td contenteditable="true" id="test">editable</td></tr></table>
+editable
+</div>
+
+<script>
+var e = document.getElementById("test");
+var s = window.getSelection();
+
+s.setPosition(e, 0);
+
+s.modify("move", "forward", "documentBoundary");
+</script>
\ No newline at end of file
+2006-09-14 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by harrison
+
+ <rdar://problem/4655880> Up/Down arrows skip over To Do
+
+ * bridge/mac/WebCoreFrameBridge.mm:
+ (-[WebCoreFrameBridge canDeleteRange:]): Added a FIXME.
+ * dom/Node.cpp: Removed the unused inSameRootEditableElement.
+ * dom/Node.h:
+ * editing/SelectionController.cpp:
+ (WebCore::SelectionController::modify): Added documentboundary to granularities in order test a fix.
+ * editing/visible_units.cpp:
+ (WebCore::previousLinePosition): Use highestEditableRoot so that this function can move from
+ editable content into editable content that's embedded in non-editable content.
+ (WebCore::nextLinePosition): Ditto.
+ (WebCore::startOfEditableContent): Renamed from startOfEditableRoot and use highestEditableRoot.
+ This is the behavior that callers desire. This fixes Command + Up/Down.
+ (WebCore::endOfEditableContent): Ditto.
+ * editing/visible_units.h:
+
2006-09-14 Karthik Kumar <karthikkumar@gmail.com>
Reviewed by timothy. Landed by aroben.
mainGroup = 0867D691FE84028FC02AAC07 /* WebKit */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
- projectRoot = "";
targets = (
93F198A508245E59001E9ABC /* WebCore */,
DD041FBE09D9DDBE0010AF2A /* Derived Sources */,
if ([range collapsed]) {
VisiblePosition start(startContainer, [range startOffset], DOWNSTREAM);
- if (isStartOfEditableContent(start))
+ VisiblePosition previous = start.previous();
+ // FIXME: We sometimes allow deletions at the start of editable roots, like when the caret is in an empty list item.
+ if (previous.isNull() || previous.deepEquivalent().node()->rootEditableElement() != startContainer->rootEditableElement())
return NO;
}
return result;
}
-bool Node::inSameRootEditableElement(Node *n)
-{
- return n ? rootEditableElement() == n->rootEditableElement() : false;
-}
-
bool Node::inSameContainingBlockFlowElement(Node *n)
{
return n ? enclosingBlockFlowElement() == n->enclosingBlockFlowElement() : false;
Element* enclosingInlineElement() const;
Element* rootEditableElement() const;
- bool inSameRootEditableElement(Node*);
bool inSameContainingBlockFlowElement(Node*);
// Used by the parser. Checks against the DTD, unlike DOM operations like appendChild().
granularity = LineGranularity;
else if (granularityStringLower == "paragraph")
granularity = ParagraphGranularity;
+ else if (granularityStringLower == "documentboundary")
+ granularity = DocumentBoundary;
else
return false;
{
Position p = visiblePosition.deepEquivalent();
Node *node = p.node();
+ Node* highestRoot = highestEditableRoot(p);
if (!node)
return VisiblePosition();
while (n && startBlock == n->enclosingBlockFlowElement())
n = n->previousEditable();
while (n) {
- if (!n->inSameRootEditableElement(node))
+ if (highestEditableRoot(Position(n, 0)) != highestRoot)
break;
Position pos(n, n->caretMinOffset());
if (pos.inRenderedContent()) {
{
Position p = visiblePosition.deepEquivalent();
Node *node = p.node();
+ Node* highestRoot = highestEditableRoot(p);
if (!node)
return VisiblePosition();
while (n && startBlock == n->enclosingBlockFlowElement())
n = n->nextEditable();
while (n) {
- if (!n->inSameRootEditableElement(node))
+ if (highestEditableRoot(Position(n, 0)) != highestRoot)
break;
Position pos(n, n->caretMinOffset());
if (pos.inRenderedContent()) {
// ---------
-VisiblePosition startOfEditableContent(const VisiblePosition &c)
+VisiblePosition startOfEditableContent(const VisiblePosition& visiblePosition)
{
- Position p = c.deepEquivalent();
- Node *node = p.node();
- if (!node)
+ Node* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent());
+ if (!highestRoot)
return VisiblePosition();
- return VisiblePosition(node->rootEditableElement(), 0, DOWNSTREAM);
+ return VisiblePosition(highestRoot, 0, DOWNSTREAM);
}
-VisiblePosition endOfEditableContent(const VisiblePosition &c)
+VisiblePosition endOfEditableContent(const VisiblePosition& visiblePosition)
{
- Position p = c.deepEquivalent();
- Node *node = p.node();
- if (!node)
+ Node* highestRoot = highestEditableRoot(visiblePosition.deepEquivalent());
+ if (!highestRoot)
return VisiblePosition();
- node = node->rootEditableElement();
- if (!node)
- return VisiblePosition();
-
- return VisiblePosition(node, node->childNodeCount(), DOWNSTREAM);
-}
-
-bool inSameEditableContent(const VisiblePosition &a, const VisiblePosition &b)
-{
- Position ap = a.deepEquivalent();
- Node *an = ap.node();
- if (!an)
- return false;
-
- Position bp = b.deepEquivalent();
- Node *bn = bp.node();
- if (!bn)
- return false;
-
- if (!an->isContentEditable() || !bn->isContentEditable())
- return false;
-
- return an->rootEditableElement() == bn->rootEditableElement();
-}
-
-bool isStartOfEditableContent(const VisiblePosition &p)
-{
- return !inSameEditableContent(p, p.previous());
-}
-
-bool isEndOfEditableContent(const VisiblePosition &p)
-{
- return !inSameEditableContent(p, p.next());
+ return VisiblePosition(highestRoot, maxDeepOffset(highestRoot), DOWNSTREAM);
}
}
bool isEndOfDocument(const VisiblePosition &);
// editable content
-VisiblePosition startOfEditableContent(const VisiblePosition &);
-VisiblePosition endOfEditableContent(const VisiblePosition &);
-bool inSameEditableContent(const VisiblePosition &, const VisiblePosition &);
-bool isStartOfEditableContent(const VisiblePosition &);
-bool isEndOfEditableContent(const VisiblePosition &);
+VisiblePosition startOfEditableContent(const VisiblePosition&);
+VisiblePosition endOfEditableContent(const VisiblePosition&);
} // namespace WebCore