Changeset 294714 in webkit
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/editing/BreakBlockquoteCommand.cpp
r285920 r294714 27 27 #include "BreakBlockquoteCommand.h" 28 28 29 #include "CommonAtomStrings.h" 29 30 #include "Editing.h" 30 31 #include "ElementInlines.h" 31 32 #include "HTMLBRElement.h" 33 #include "HTMLDivElement.h" 32 34 #include "HTMLNames.h" 35 #include "NodeRenderStyle.h" 33 36 #include "NodeTraversal.h" 34 37 #include "RenderListItem.h" … … 68 71 69 72 // Find the top-most blockquote from the start. 70 Node*topBlockquote = highestEnclosingNodeOfType(pos, isMailBlockquote);73 RefPtr topBlockquote = highestEnclosingNodeOfType(pos, isMailBlockquote); 71 74 if (!topBlockquote || !topBlockquote->parentNode() || !topBlockquote->isElementNode()) 72 75 return; 73 74 auto breakNode = HTMLBRElement::create(document()); 75 76 bool isLastVisPosInNode = isLastVisiblePositionInNode(visiblePos, topBlockquote); 76 77 auto breakNode = [&]() -> Ref<HTMLElement> { 78 auto lineBreak = HTMLBRElement::create(document()); 79 RefPtr containerNode = pos.containerNode(); 80 if (!containerNode || !containerNode->renderStyle()) 81 return lineBreak; 82 83 auto* parentStyle = topBlockquote->parentNode()->renderStyle(); 84 if (!parentStyle) 85 return lineBreak; 86 87 if (parentStyle->direction() == containerNode->renderStyle()->direction()) 88 return lineBreak; 89 90 auto container = HTMLDivElement::create(document()); 91 container->setDir(autoAtom()); 92 container->appendChild(lineBreak); 93 return container; 94 }(); 95 96 bool isLastVisPosInNode = isLastVisiblePositionInNode(visiblePos, topBlockquote.get()); 77 97 78 98 // If the position is at the beginning of the top quoted content, we don't need to break the quote. 79 99 // Instead, insert the break before the blockquote, unless the position is as the end of the quoted content. 80 if (isFirstVisiblePositionInNode(visiblePos, topBlockquote ) && !isLastVisPosInNode) {100 if (isFirstVisiblePositionInNode(visiblePos, topBlockquote.get()) && !isLastVisPosInNode) { 81 101 insertNodeBefore(breakNode.copyRef(), *topBlockquote); 82 102 setEndingSelection(VisibleSelection(positionBeforeNode(breakNode.ptr()), Affinity::Downstream, endingSelection().isDirectional()));
Note:
See TracChangeset
for help on using the changeset viewer.