Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: Source/core/editing/htmlediting.cpp

Issue 242733004: canMergeLists() should make sure that the list items do not belong to the same list (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 if (nextList == rootList) 707 if (nextList == rootList)
708 break; 708 break;
709 list = nextList; 709 list = nextList;
710 } 710 }
711 711
712 return list; 712 return list;
713 } 713 }
714 714
715 bool canMergeLists(Element* firstList, Element* secondList) 715 bool canMergeLists(Element* firstList, Element* secondList)
716 { 716 {
717 if (!firstList || !secondList || !firstList->isHTMLElement() || !secondList- >isHTMLElement()) 717 if (!firstList || !secondList || firstList == secondList || !firstList->isHT MLElement() || !secondList->isHTMLElement())
yosin_UTC9 2014/04/22 04:42:52 I think caller should not pass same |Element| to |
718 return false; 718 return false;
719 719
720 return firstList->hasTagName(secondList->tagQName()) // make sure the list t ypes match (ol vs. ul) 720 return firstList->hasTagName(secondList->tagQName()) // make sure the list t ypes match (ol vs. ul)
721 && firstList->rendererIsEditable() && secondList->rendererIsEditable() // bo th lists are editable 721 && firstList->rendererIsEditable() && secondList->rendererIsEditable() // bo th lists are editable
722 && firstList->rootEditableElement() == secondList->rootEditableElement() // don't cross editing boundaries 722 && firstList->rootEditableElement() == secondList->rootEditableElement() // don't cross editing boundaries
723 && isVisiblyAdjacent(positionInParentAfterNode(*firstList), positionInParent BeforeNode(*secondList)); 723 && isVisiblyAdjacent(positionInParentAfterNode(*firstList), positionInParent BeforeNode(*secondList));
724 // Make sure there is no visible content between this li and the previous li st 724 // Make sure there is no visible content between this li and the previous li st
725 } 725 }
726 726
727 bool isRenderedTableElement(const Node* node) 727 bool isRenderedTableElement(const Node* node)
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 // if the selection starts just before a paragraph break, skip over it 1112 // if the selection starts just before a paragraph break, skip over it
1113 if (isEndOfParagraph(visiblePosition)) 1113 if (isEndOfParagraph(visiblePosition))
1114 return visiblePosition.next().deepEquivalent().downstream(); 1114 return visiblePosition.next().deepEquivalent().downstream();
1115 1115
1116 // otherwise, make sure to be at the start of the first selected node, 1116 // otherwise, make sure to be at the start of the first selected node,
1117 // instead of possibly at the end of the last node before the selection 1117 // instead of possibly at the end of the last node before the selection
1118 return visiblePosition.deepEquivalent().downstream(); 1118 return visiblePosition.deepEquivalent().downstream();
1119 } 1119 }
1120 1120
1121 } // namespace WebCore 1121 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698