[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.18-1-697-g2f78b87
enrica at apple.com
enrica at apple.com
Wed Jan 20 22:19:29 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit cc4968ead4dfdef74cb97ff82b4db29fb76b44c7
Author: enrica at apple.com <enrica at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Jan 11 18:04:58 2010 +0000
Cannot focus on an empty editable span in a non editable div.
https://bugs.webkit.org/show_bug.cgi?id=33411
<rdar://problem/5982901>
Reviewed by Darin Adler.
WebCore:
We now allow to set the focus inside an empty inline element if it is the only
editable element inside non-editable content.
* dom/Position.cpp:
(WebCore::Position::isCandidate): Extended to allow positions in inline elements when
at the border between editable and non editable content.
(WebCore::Position::getInlineBoxAndOffset): Modified to be able to calculate the caret
position inside an empty inline.
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::mergeParagraphs): When merging, we don't always find a break
element, since now an editable inline is a VisiblePosition if it is at editability boundary.
* editing/VisibleSelection.h: Updated comment on the use of Position member variables
instead of VisiblePosition.
* page/Frame.cpp:
(WebCore::Frame::selectionLayoutChanged): Changed to avoid multiple calls to upstream and
downstream on the same position.
LayoutTests:
* editing/deleting/6026335-expected.txt: Updated to reflect the lack of extra break element.
* editing/selection/mixed-editability-10-expected.txt: Updated to cover the new case.
* editing/selection/mixed-editability-10.html: Updated to cover the new case.
* platform/mac/editing/deleting/5115601-expected.txt: Updated to reflect the lack of extra break element.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53085 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index b71e3a6..b172318 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-01-08 Enrica Casucci <enrica at apple.com>
+
+ Reviewed by Darin Adler.
+
+ Cannot focus on an empty editable span in a non editable div.
+ https://bugs.webkit.org/show_bug.cgi?id=33411
+ <rdar://problem/5982901>
+
+ * editing/deleting/6026335-expected.txt: Updated to reflect the lack of extra break element.
+ * editing/selection/mixed-editability-10-expected.txt: Updated to cover the new case.
+ * editing/selection/mixed-editability-10.html: Updated to cover the new case.
+ * platform/mac/editing/deleting/5115601-expected.txt: Updated to reflect the lack of extra break element.
+
2010-01-08 Nate Chapin <japhet at chromium.org>
Reviewed by Dimitri Glazkov.
diff --git a/LayoutTests/editing/deleting/6026335-expected.txt b/LayoutTests/editing/deleting/6026335-expected.txt
index fc13bb8..ba7fada 100644
--- a/LayoutTests/editing/deleting/6026335-expected.txt
+++ b/LayoutTests/editing/deleting/6026335-expected.txt
@@ -1,4 +1,4 @@
This tests deleting a selection that starts at the beginning of an editable pocket inside a non-editable table. The caret should not disappear during the delete and should be placed inside the editable span. When text is then inserted, it should be placed inside that span.
-<div contenteditable="false"><span> </span><span contenteditable="true" id="start">Text<br></span></div>
+<div contenteditable="false"><span> </span><span contenteditable="true" id="start">Text</span></div>
diff --git a/LayoutTests/editing/selection/mixed-editability-10-expected.txt b/LayoutTests/editing/selection/mixed-editability-10-expected.txt
index c739819..09bb276 100644
--- a/LayoutTests/editing/selection/mixed-editability-10-expected.txt
+++ b/LayoutTests/editing/selection/mixed-editability-10-expected.txt
@@ -12,6 +12,9 @@ Hello
Hello World
#5 DIV element empty
+#6 non editable DIV element with an editable empty span element
+
+Hello:
Anchor ([object HTMLDivElement], 0 caret[40,540] refpos=40) is correct.
Anchor ([object HTMLDivElement], 3 caret[75,540] refpos=75) is correct.
Anchor ([object HTMLDivElement], 1 caret[43,472] refpos=43) is correct.
@@ -19,3 +22,4 @@ Anchor ([object HTMLDivElement], 0 caret[8,472] refpos=8) is correct.
Anchor ([object HTMLDivElement], 0 caret[73,404] refpos=73) is correct.
Anchor ([object HTMLDivElement], 3 caret[47,336] refpos=47) is correct.
Anchor ([object HTMLDivElement], 0 caret[58,268] refpos=58) is correct.
+Anchor ([object HTMLElement], 0 caret[0,600] refpos=0) is correct.
diff --git a/LayoutTests/editing/selection/mixed-editability-10.html b/LayoutTests/editing/selection/mixed-editability-10.html
index fb7c1e7..9e390d5 100644
--- a/LayoutTests/editing/selection/mixed-editability-10.html
+++ b/LayoutTests/editing/selection/mixed-editability-10.html
@@ -20,6 +20,10 @@
<p>#5 DIV element empty</p>
<div style="width:100px;background-color:#cee;text-align: center;" contenteditable="true" id="edit5">
</div>
+ <p>#6 non editable DIV element with an editable empty span element</p>
+ <div id="nonedit6" style="width:100px;background-color:#cee;">
+ Hello: <span id="edit6" contenteditable="true"> </span>
+ </div>
<ul id="console"></ul>
</body>
<script>
@@ -98,6 +102,12 @@ function automaticTest() {
x = elem.offsetLeft;
y = elem.offsetTop + elem.offsetHeight / 2;
runTest(x, y, elem, 0, (elem.offsetLeft + elem.offsetWidth)/2 + 4);
+
+ // the div is non editable and contains an empty editable span
+ elem = document.getElementById("edit6");
+ x = document.getElementById("nonedit6").offsetLeft + document.getElementById("nonedit6").offsetWidth / 2;
+ y = document.getElementById("nonedit6").offsetTop + document.getElementById("nonedit6").offsetHeight / 2;
+ runTest(x, y, elem, 0, 0);
}
}
diff --git a/LayoutTests/platform/mac/editing/deleting/5115601-expected.txt b/LayoutTests/platform/mac/editing/deleting/5115601-expected.txt
index 95a97d8..adcc69f 100644
--- a/LayoutTests/platform/mac/editing/deleting/5115601-expected.txt
+++ b/LayoutTests/platform/mac/editing/deleting/5115601-expected.txt
@@ -16,6 +16,5 @@ layer at (0,0) size 800x600
RenderInline {SPAN} at (0,0) size 298x18
RenderText {#text} at (2,2) size 298x18
text run at (2,2) width 298: "This sentence should be inside the editable cell."
- RenderBR {BR} at (300,16) size 0x0
RenderBlock (anonymous) at (0,28) size 784x0
caret: position 0 of child 0 {#text} of child 0 {SPAN} of child 0 {SPAN} of child 0 {TD} of child 0 {TR} of child 0 {TBODY} of child 1 {TABLE} of child 2 {DIV} of child 1 {BODY} of child 0 {HTML} of document
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ba190b4..72410e6 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2010-01-08 Enrica Casucci <enrica at apple.com>
+
+ Reviewed by Darin Adler.
+
+ Cannot focus on an empty editable span in a non editable div.
+ https://bugs.webkit.org/show_bug.cgi?id=33411
+ <rdar://problem/5982901>
+
+ We now allow to set the focus inside an empty inline element if it is the only
+ editable element inside non-editable content.
+
+ * dom/Position.cpp:
+ (WebCore::Position::isCandidate): Extended to allow positions in inline elements when
+ at the border between editable and non editable content.
+ (WebCore::Position::getInlineBoxAndOffset): Modified to be able to calculate the caret
+ position inside an empty inline.
+ * editing/DeleteSelectionCommand.cpp:
+ (WebCore::DeleteSelectionCommand::mergeParagraphs): When merging, we don't always find a break
+ element, since now an editable inline is a VisiblePosition if it is at editability boundary.
+ * editing/VisibleSelection.h: Updated comment on the use of Position member variables
+ instead of VisiblePosition.
+ * page/Frame.cpp:
+ (WebCore::Frame::selectionLayoutChanged): Changed to avoid multiple calls to upstream and
+ downstream on the same position.
+
2010-01-06 Dimitri Glazkov <dglazkov at chromium.org>
Reviewed by Nikolas Zimmermann.
diff --git a/WebCore/dom/Position.cpp b/WebCore/dom/Position.cpp
index c83965b..592cd2c 100644
--- a/WebCore/dom/Position.cpp
+++ b/WebCore/dom/Position.cpp
@@ -744,13 +744,17 @@ bool Position::isCandidate() const
if (isTableElement(node()) || editingIgnoresContent(node()))
return (atFirstEditingPositionForNode() || atLastEditingPositionForNode()) && !nodeIsUserSelectNone(node()->parent());
- if (!m_anchorNode->hasTagName(htmlTag) && renderer->isBlockFlow()) {
+ if (m_anchorNode->hasTagName(htmlTag))
+ return false;
+
+ if (renderer->isBlockFlow()) {
if (toRenderBlock(renderer)->height() || m_anchorNode->hasTagName(bodyTag)) {
if (!Position::hasRenderedNonAnonymousDescendantsWithHeight(renderer))
return atFirstEditingPositionForNode() && !Position::nodeIsUserSelectNone(node());
return m_anchorNode->isContentEditable() && !Position::nodeIsUserSelectNone(node()) && atEditingBoundary();
}
- }
+ } else
+ return m_anchorNode->isContentEditable() && !Position::nodeIsUserSelectNone(node()) && atEditingBoundary();
return false;
}
@@ -1009,9 +1013,15 @@ void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDi
return;
}
}
- inlineBox = renderer->isBox() ? toRenderBox(renderer)->inlineBoxWrapper() : 0;
- if (!inlineBox || (caretOffset > inlineBox->caretMinOffset() && caretOffset < inlineBox->caretMaxOffset()))
+ if (renderer->isBox()) {
+ inlineBox = toRenderBox(renderer)->inlineBoxWrapper();
+ if (!inlineBox || (caretOffset > inlineBox->caretMinOffset() && caretOffset < inlineBox->caretMaxOffset()))
+ return;
+ } else {
+ Position pos = positionInParentBeforeNode(node()).upstream();
+ pos.getInlineBoxAndOffset(DOWNSTREAM, primaryDirection, inlineBox, caretOffset);
return;
+ }
} else {
RenderText* textRenderer = toRenderText(renderer);
diff --git a/WebCore/editing/DeleteSelectionCommand.cpp b/WebCore/editing/DeleteSelectionCommand.cpp
index 9e4ba29..f07f038 100644
--- a/WebCore/editing/DeleteSelectionCommand.cpp
+++ b/WebCore/editing/DeleteSelectionCommand.cpp
@@ -589,10 +589,11 @@ void DeleteSelectionCommand::mergeParagraphs()
// The rule for merging into an empty block is: only do so if its farther to the right.
// FIXME: Consider RTL.
if (!m_startsAtEmptyLine && isStartOfParagraph(mergeDestination) && startOfParagraphToMove.absoluteCaretBounds().x() > mergeDestination.absoluteCaretBounds().x()) {
- ASSERT(mergeDestination.deepEquivalent().downstream().node()->hasTagName(brTag));
- removeNodeAndPruneAncestors(mergeDestination.deepEquivalent().downstream().node());
- m_endingPosition = startOfParagraphToMove.deepEquivalent();
- return;
+ if (mergeDestination.deepEquivalent().downstream().node()->hasTagName(brTag)) {
+ removeNodeAndPruneAncestors(mergeDestination.deepEquivalent().downstream().node());
+ m_endingPosition = startOfParagraphToMove.deepEquivalent();
+ return;
+ }
}
// Block images, tables and horizontal rules cannot be made inline with content at mergeDestination. If there is
diff --git a/WebCore/editing/VisibleSelection.h b/WebCore/editing/VisibleSelection.h
index e346b27..bbcecf2 100644
--- a/WebCore/editing/VisibleSelection.h
+++ b/WebCore/editing/VisibleSelection.h
@@ -114,7 +114,11 @@ private:
void adjustSelectionToAvoidCrossingEditingBoundaries();
void updateSelectionType();
- // FIXME: These should all be VisiblePositions
+ // We need to store these as Positions because VisibleSelection is
+ // used to store values in editing commands for use when
+ // undoing the command. We need to be able to create a selection that, while currently
+ // invalid, will be valid once the changes are undone.
+
Position m_base; // Where the first click happened
Position m_extent; // Where the end click happened
Position m_start; // Leftmost position when expanded to respect granularity
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index 79beed3..993b27b 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -672,11 +672,13 @@ void Frame::selectionLayoutChanged()
// as the start of the selection, the selection painting code will think that content on the line containing 'foo' is selected
// and will fill the gap before 'bar'.
Position startPos = selection.start();
- if (startPos.downstream().isCandidate())
- startPos = startPos.downstream();
+ Position candidate = startPos.downstream();
+ if (candidate.isCandidate())
+ startPos = candidate;
Position endPos = selection.end();
- if (endPos.upstream().isCandidate())
- endPos = endPos.upstream();
+ candidate = endPos.upstream();
+ if (candidate.isCandidate())
+ endPos = candidate;
// We can get into a state where the selection endpoints map to the same VisiblePosition when a selection is deleted
// because we don't yet notify the SelectionController of text removal.
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list