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

Side by Side Diff: chrome/browser/resources/md_bookmarks/dnd_manager.js

Issue 2869273011: [MD Bookmarks] Convert bookmark list to iron-list. (Closed)
Patch Set: add comment, fix closure, rebase Created 3 years, 7 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 // 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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 587
588 // Don't allow dropping below an expanded sidebar folder item since it is 588 // Don't allow dropping below an expanded sidebar folder item since it is
589 // confusing to the user anyway. 589 // confusing to the user anyway.
590 if (isOverFolderNode && !state.closedFolders.has(overElement.itemId) && 590 if (isOverFolderNode && !state.closedFolders.has(overElement.itemId) &&
591 bookmarks.util.hasChildFolders(overElement.itemId, state.nodes)) { 591 bookmarks.util.hasChildFolders(overElement.itemId, state.nodes)) {
592 return validDropPositions; 592 return validDropPositions;
593 } 593 }
594 594
595 var nextElement = overElement.nextElementSibling; 595 var nextElement = overElement.nextElementSibling;
596 596
597 // The template element sits past the end of the last bookmark element.
598 if (!isBookmarkItem(nextElement) && !isBookmarkFolderNode(nextElement))
599 nextElement = null;
600
601 // Cannot drop below if the item below is already in the drag source. 597 // Cannot drop below if the item below is already in the drag source.
602 if (!nextElement || !dragInfo.isDraggingBookmark(nextElement.itemId)) 598 if (!nextElement || !dragInfo.isDraggingBookmark(nextElement.itemId))
603 validDropPositions |= DropPosition.BELOW; 599 validDropPositions |= DropPosition.BELOW;
604 600
605 return validDropPositions; 601 return validDropPositions;
606 }, 602 },
607 603
608 /** 604 /**
609 * Determine whether we can drop the dragged items on the drop target. 605 * Determine whether we can drop the dragged items on the drop target.
610 * @private 606 * @private
(...skipping 24 matching lines...) Expand all
635 this.dropIndicator_.setTimeout = this.setTimeout_; 631 this.dropIndicator_.setTimeout = this.setTimeout_;
636 } 632 }
637 }; 633 };
638 634
639 return { 635 return {
640 DNDManager: DNDManager, 636 DNDManager: DNDManager,
641 DragInfo: DragInfo, 637 DragInfo: DragInfo,
642 DropIndicator: DropIndicator, 638 DropIndicator: DropIndicator,
643 }; 639 };
644 }); 640 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/compiled_resources2.gyp ('k') | chrome/browser/resources/md_bookmarks/item.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698