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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/ViewportControl.js

Issue 2340223002: DevTools: fix ViewportControl's text selection logic (Closed)
Patch Set: add test Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/console/console-viewport-selection-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 /** 560 /**
561 * @param {!Element} itemElement 561 * @param {!Element} itemElement
562 * @param {!Node} container 562 * @param {!Node} container
563 * @param {number} offset 563 * @param {number} offset
564 * @return {number} 564 * @return {number}
565 */ 565 */
566 _textOffsetInNode: function(itemElement, container, offset) 566 _textOffsetInNode: function(itemElement, container, offset)
567 { 567 {
568 var chars = 0; 568 var chars = 0;
569 var node = itemElement; 569 var node = itemElement;
570 while ((node = node.traverseNextTextNode()) && node !== container) 570 while ((node = node.traverseNextTextNode()) && !node.isSelfOrDescendant( container))
571 chars += node.textContent.length; 571 chars += node.textContent.length;
572 return chars + offset; 572 return chars + offset;
573 }, 573 },
574 574
575 /** 575 /**
576 * @param {!Event} event 576 * @param {!Event} event
577 */ 577 */
578 _onScroll: function(event) 578 _onScroll: function(event)
579 { 579 {
580 this.refresh(); 580 this.refresh();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 652
653 /** 653 /**
654 * @return {number} 654 * @return {number}
655 */ 655 */
656 _visibleHeight: function() 656 _visibleHeight: function()
657 { 657 {
658 // Use offsetHeight instead of clientHeight to avoid being affected by h orizontal scroll. 658 // Use offsetHeight instead of clientHeight to avoid being affected by h orizontal scroll.
659 return this.element.offsetHeight; 659 return this.element.offsetHeight;
660 } 660 }
661 } 661 }
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/console/console-viewport-selection-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698