Source/WebCore/ChangeLog

 12012-06-26 Ryosuke Niwa <rniwa@webkit.org>
 2
 3 Stop calling node() and deprecatedEditingOffset() in comparePositions
 4 https://bugs.webkit.org/show_bug.cgi?id=54535
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Replaced depreactedNode() and deprecatedEditingOffset() by containerNode() and computeOffsetInContainerNode()
 9 in comparePositions().
 10
 11 In addition, fixed a bunch of bugs in DeleteSelectionCommand::handleSpecialCaseBRDelete revealed by this change:
 12 - Use node after position instead of deprecated node in determinig whether start and end positions at a br.
 13 - Don't set m_startsAtEmptyLine true when BR is wrapped in a block element. The only reason this code had worked
 14 was positions like (div, offset, 0) and (br, before) in <div><br> were treated differently, which we no longer do.
 15
 16 * editing/DeleteSelectionCommand.cpp:
 17 (WebCore::DeleteSelectionCommand::handleSpecialCaseBRDelete):
 18 * editing/htmlediting.cpp:
 19 (WebCore::comparePositions):
 20
1212012-06-26 Christophe Dumez <christophe.dumez@intel.com>
222
323 [EFL] Use eina_file_ls() in EFL implementation of FileSystem listDirectory()
121300

Source/WebCore/editing/DeleteSelectionCommand.cpp

@@void DeleteSelectionCommand::saveTypingS
297297
298298bool DeleteSelectionCommand::handleSpecialCaseBRDelete()
299299{
 300 Node* nodeAfterUpstreamStart = m_upstreamStart.computeNodeAfterPosition();
 301 Node* nodeAfterDownstreamStart = m_downstreamStart.computeNodeAfterPosition();
 302 // Upstream end will appear before BR due to canonicalization
 303 Node* nodeAfterUpstreamEnd = m_upstreamEnd.computeNodeAfterPosition();
 304
 305 if (!nodeAfterUpstreamStart || !nodeAfterDownstreamStart)
 306 return false;
 307
300308 // Check for special-case where the selection contains only a BR on a line by itself after another BR.
301  bool upstreamStartIsBR = m_upstreamStart.deprecatedNode()->hasTagName(brTag);
302  bool downstreamStartIsBR = m_downstreamStart.deprecatedNode()->hasTagName(brTag);
303  bool isBROnLineByItself = upstreamStartIsBR && downstreamStartIsBR && m_downstreamStart.deprecatedNode() == m_upstreamEnd.deprecatedNode();
 309 bool upstreamStartIsBR = nodeAfterUpstreamStart->hasTagName(brTag);
 310 bool downstreamStartIsBR = nodeAfterDownstreamStart->hasTagName(brTag);
 311 bool isBROnLineByItself = upstreamStartIsBR && downstreamStartIsBR && nodeAfterDownstreamStart == nodeAfterUpstreamEnd;
304312 if (isBROnLineByItself) {
305  removeNode(m_downstreamStart.deprecatedNode());
 313 removeNode(nodeAfterDownstreamStart);
306314 return true;
307315 }
308316
309  // Not a special-case delete per se, but we can detect that the merging of content between blocks
310  // should not be done.
311  if (upstreamStartIsBR && downstreamStartIsBR) {
 317 // FIXME: This code doesn't belong in here.
 318 // We detect the case where the start is an empty line consisting of BR not wrapped in a block element.
 319 if (upstreamStartIsBR && downstreamStartIsBR && !(isStartOfBlock(positionBeforeNode(nodeAfterUpstreamStart)) && isEndOfBlock(positionAfterNode(nodeAfterUpstreamStart)))) {
312320 m_startsAtEmptyLine = true;
313321 m_endingPosition = m_downstreamEnd;
314322 }
121106

Source/WebCore/editing/htmlediting.cpp

@@int comparePositions(const Position& a,
7878 if (!commonScope)
7979 return 0;
8080
81  Node* nodeA = commonScope->ancestorInThisScope(a.deprecatedNode());
 81 Node* nodeA = commonScope->ancestorInThisScope(a.containerNode());
8282 ASSERT(nodeA);
83  bool hasDescendentA = nodeA != a.deprecatedNode();
84  int offsetA = hasDescendentA ? 0 : a.deprecatedEditingOffset();
 83 bool hasDescendentA = nodeA != a.containerNode();
 84 int offsetA = hasDescendentA ? 0 : a.computeOffsetInContainerNode();
8585
86  Node* nodeB = commonScope->ancestorInThisScope(b.deprecatedNode());
 86 Node* nodeB = commonScope->ancestorInThisScope(b.containerNode());
8787 ASSERT(nodeB);
88  bool hasDescendentB = nodeB != b.deprecatedNode();
89  int offsetB = hasDescendentB ? 0 : b.deprecatedEditingOffset();
 88 bool hasDescendentB = nodeB != b.containerNode();
 89 int offsetB = hasDescendentB ? 0 : b.computeOffsetInContainerNode();
9090
9191 int bias = 0;
9292 if (nodeA == nodeB) {
121106

LayoutTests/ChangeLog

 12012-06-26 Ryosuke Niwa <rniwa@webkit.org>
 2
 3 Stop calling node() and deprecatedEditingOffset() in comparePositions
 4 https://bugs.webkit.org/show_bug.cgi?id=54535
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Rebaselined existing tests. There are no user-visible changes.
 9
 10 * editing/inseting/font-size-clears-from-typing-style-expected.txt: No longer keeps div's around
 11 when merging paragraphs.
 12 * platform/mac/editing/deleting/delete-br-002-expected.txt:
 13 * platform/mac/editing/deleting/delete-br-004-expected.txt:
 14 * platform/mac/editing/deleting/delete-br-005-expected.txt:
 15 * platform/mac/editing/deleting/delete-br-006-expected.txt:
 16
1172012-06-26 Alice Cheng <alice_cheng@apple.com>
218
319 Crash at WebCore::TextIterator::handleTextBox
121300

LayoutTests/editing/inserting/font-size-clears-from-typing-style-expected.txt

11Tests that we don't serialize redundant font-size in typingStyle. There should be no span or style attribute around A or B below.See https://bugs.webkit.org/show_bug.cgi?id=26279.
2 | <div>
3 | id="wrapper"
4 | "B<#selection-caret>A"
 2| "B<#selection-caret>A"
 3| <br>
121298

LayoutTests/platform/mac/editing/deleting/delete-br-002-expected.txt

@@EDITING DELEGATE: webViewDidChangeSelect
2424EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
2525EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
2626EDITING DELEGATE: shouldDeleteDOMRange:range from 2 of SPAN > DIV > BODY > HTML > #document to 3 of SPAN > DIV > BODY > HTML > #document
 27EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 3 of SPAN > DIV > BODY > HTML > #document to 3 of SPAN > DIV > BODY > HTML > #document toDOMRange:range from 2 of SPAN > DIV > BODY > HTML > #document to 2 of SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
2728EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
2829EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
2930layer at (0,0) size 800x600
121106

LayoutTests/platform/mac/editing/deleting/delete-br-004-expected.txt

@@EDITING DELEGATE: webViewDidChangeSelect
2525EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
2626EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
2727EDITING DELEGATE: shouldDeleteDOMRange:range from 3 of SPAN > DIV > BODY > HTML > #document to 4 of SPAN > DIV > BODY > HTML > #document
 28EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 9 of #text > SPAN > DIV > BODY > HTML > #document to 9 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 3 of SPAN > DIV > BODY > HTML > #document to 3 of SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
2829EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
2930EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
3031layer at (0,0) size 800x600

@@layer at (0,0) size 800x600
4243 RenderBR {BR} at (14,42) size 0x28
4344 RenderText {#text} at (14,70) size 92x28
4445 text run at (14,70) width 92: "years ago"
45  RenderText {#text} at (0,0) size 0x0
4646caret: position 0 of child 3 {#text} of child 1 {SPAN} of child 1 {DIV} of body
121106

LayoutTests/platform/mac/editing/deleting/delete-br-005-expected.txt

@@EDITING DELEGATE: webViewDidChangeSelect
2525EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
2626EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
2727EDITING DELEGATE: shouldDeleteDOMRange:range from 3 of SPAN > DIV > BODY > HTML > #document to 4 of SPAN > DIV > BODY > HTML > #document
 28EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 9 of #text > SPAN > DIV > BODY > HTML > #document to 9 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 3 of SPAN > DIV > BODY > HTML > #document to 3 of SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
2829EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
2930EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
3031EDITING DELEGATE: shouldDeleteDOMRange:range from 2 of SPAN > DIV > BODY > HTML > #document to 3 of SPAN > DIV > BODY > HTML > #document
 32EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 9 of #text > SPAN > DIV > BODY > HTML > #document to 9 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 2 of SPAN > DIV > BODY > HTML > #document to 2 of SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
3133EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
3234EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
3335layer at (0,0) size 800x600

@@layer at (0,0) size 800x600
4446 RenderBR {BR} at (218,36) size 0x0
4547 RenderText {#text} at (14,42) size 92x28
4648 text run at (14,42) width 92: "years ago"
47  RenderText {#text} at (0,0) size 0x0
4849caret: position 0 of child 2 {#text} of child 1 {SPAN} of child 1 {DIV} of body
121106

LayoutTests/platform/mac/editing/deleting/delete-br-006-expected.txt

@@EDITING DELEGATE: webViewDidChangeSelect
2525EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
2626EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
2727EDITING DELEGATE: shouldDeleteDOMRange:range from 3 of SPAN > DIV > BODY > HTML > #document to 4 of SPAN > DIV > BODY > HTML > #document
 28EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 9 of #text > SPAN > DIV > BODY > HTML > #document to 9 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 3 of SPAN > DIV > BODY > HTML > #document to 3 of SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
2829EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
2930EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
3031EDITING DELEGATE: shouldDeleteDOMRange:range from 2 of SPAN > DIV > BODY > HTML > #document to 3 of SPAN > DIV > BODY > HTML > #document
 32EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 9 of #text > SPAN > DIV > BODY > HTML > #document to 9 of #text > SPAN > DIV > BODY > HTML > #document toDOMRange:range from 2 of SPAN > DIV > BODY > HTML > #document to 2 of SPAN > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
3133EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
3234EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
3335EDITING DELEGATE: shouldDeleteDOMRange:range from 1 of SPAN > DIV > BODY > HTML > #document to 2 of SPAN > DIV > BODY > HTML > #document

@@layer at (0,0) size 800x600
4749 text run at (157,14) width 61: "seven "
4850 RenderText {#text} at (218,14) size 92x28
4951 text run at (218,14) width 92: "years ago"
50  RenderText {#text} at (0,0) size 0x0
5152caret: position 23 of child 0 {#text} of child 1 {SPAN} of child 1 {DIV} of body
121106