| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.define('bookmarks', function() { | 5 cr.define('bookmarks', function() { |
| 6 /** | 6 /** |
| 7 * @param {BookmarkElement} element | 7 * @param {BookmarkElement} element |
| 8 * @return {boolean} | 8 * @return {boolean} |
| 9 */ | 9 */ |
| 10 function isBookmarkItem(element) { | 10 function isBookmarkItem(element) { |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 | 579 |
| 580 // Don't allow dropping below an expanded sidebar folder item since it is | 580 // Don't allow dropping below an expanded sidebar folder item since it is |
| 581 // confusing to the user anyway. | 581 // confusing to the user anyway. |
| 582 if (isOverFolderNode && !state.closedFolders.has(overElement.itemId) && | 582 if (isOverFolderNode && !state.closedFolders.has(overElement.itemId) && |
| 583 bookmarks.util.hasChildFolders(overElement.itemId, state.nodes)) { | 583 bookmarks.util.hasChildFolders(overElement.itemId, state.nodes)) { |
| 584 return validDropPositions; | 584 return validDropPositions; |
| 585 } | 585 } |
| 586 | 586 |
| 587 var nextElement = overElement.nextElementSibling; | 587 var nextElement = overElement.nextElementSibling; |
| 588 | 588 |
| 589 // The template element sits past the end of the last bookmark element. | |
| 590 if (!isBookmarkItem(nextElement) && !isBookmarkFolderNode(nextElement)) | |
| 591 nextElement = null; | |
| 592 | |
| 593 // Cannot drop below if the item below is already in the drag source. | 589 // Cannot drop below if the item below is already in the drag source. |
| 594 if (!nextElement || !dragInfo.isDraggingBookmark(nextElement.itemId)) | 590 if (!nextElement || !dragInfo.isDraggingBookmark(nextElement.itemId)) |
| 595 validDropPositions |= DropPosition.BELOW; | 591 validDropPositions |= DropPosition.BELOW; |
| 596 | 592 |
| 597 return validDropPositions; | 593 return validDropPositions; |
| 598 }, | 594 }, |
| 599 | 595 |
| 600 /** | 596 /** |
| 601 * Determine whether we can drop the dragged items on the drop target. | 597 * Determine whether we can drop the dragged items on the drop target. |
| 602 * @private | 598 * @private |
| (...skipping 24 matching lines...) Expand all Loading... |
| 627 this.dropIndicator_.setTimeout = this.setTimeout_; | 623 this.dropIndicator_.setTimeout = this.setTimeout_; |
| 628 } | 624 } |
| 629 }; | 625 }; |
| 630 | 626 |
| 631 return { | 627 return { |
| 632 DNDManager: DNDManager, | 628 DNDManager: DNDManager, |
| 633 DragInfo: DragInfo, | 629 DragInfo: DragInfo, |
| 634 DropIndicator: DropIndicator, | 630 DropIndicator: DropIndicator, |
| 635 }; | 631 }; |
| 636 }); | 632 }); |
| OLD | NEW |