OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 | 5 |
6 /** | 6 /** |
7 * @fileoverview The local InstantExtended NTP. | 7 * @fileoverview The local InstantExtended NTP. |
8 */ | 8 */ |
9 | 9 |
10 | 10 |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
691 | 691 |
692 // Container of tile contents. | 692 // Container of tile contents. |
693 var innerElem = createAndAppendElement(tileElem, 'div', CLASSES.TILE_INNER); | 693 var innerElem = createAndAppendElement(tileElem, 'div', CLASSES.TILE_INNER); |
694 | 694 |
695 // The iframe which renders the page title. | 695 // The iframe which renders the page title. |
696 var titleElem = document.createElement('iframe'); | 696 var titleElem = document.createElement('iframe'); |
697 // Enable tab navigation on the iframe, which will move the selection to the | 697 // Enable tab navigation on the iframe, which will move the selection to the |
698 // link element (which also has a tabindex). | 698 // link element (which also has a tabindex). |
699 titleElem.tabIndex = '0'; | 699 titleElem.tabIndex = '0'; |
700 | 700 |
701 // Make the iframe invisible to screen readers. | |
dmazzoni
2015/01/29 18:48:44
Let's reword this slightly. It implies that we're
Mathieu
2015/01/29 18:53:35
Done.
| |
702 titleElem.setAttribute('role', 'presentation'); | |
703 | |
701 // Why iframes have IDs: | 704 // Why iframes have IDs: |
702 // | 705 // |
703 // On navigating back to the NTP we see several onmostvisitedchange() events | 706 // On navigating back to the NTP we see several onmostvisitedchange() events |
704 // in series with incrementing RIDs. After the first event, a set of iframes | 707 // in series with incrementing RIDs. After the first event, a set of iframes |
705 // begins loading RIDs n, n+1, ..., n+k-1; after the second event, these get | 708 // begins loading RIDs n, n+1, ..., n+k-1; after the second event, these get |
706 // destroyed and a new set begins loading RIDs n+k, n+k+1, ..., n+2k-1. | 709 // destroyed and a new set begins loading RIDs n+k, n+k+1, ..., n+2k-1. |
707 // Now due to crbug.com/68841, Chrome incorrectly loads the content for the | 710 // Now due to crbug.com/68841, Chrome incorrectly loads the content for the |
708 // first set of iframes into the most recent set of iframes. | 711 // first set of iframes into the most recent set of iframes. |
709 // | 712 // |
710 // Giving iframes distinct ids seems to cause some invalidation and prevent | 713 // Giving iframes distinct ids seems to cause some invalidation and prevent |
(...skipping 11 matching lines...) Expand all Loading... | |
722 if (NTP_DESIGN.thumbnailFallback) { | 725 if (NTP_DESIGN.thumbnailFallback) { |
723 var fallbackElem = createAndAppendElement( | 726 var fallbackElem = createAndAppendElement( |
724 innerElem, 'div', CLASSES.THUMBNAIL_FALLBACK); | 727 innerElem, 'div', CLASSES.THUMBNAIL_FALLBACK); |
725 if (NTP_DESIGN.thumbnailFallback === THUMBNAIL_FALLBACK.DOT) | 728 if (NTP_DESIGN.thumbnailFallback === THUMBNAIL_FALLBACK.DOT) |
726 createAndAppendElement(fallbackElem, 'div', CLASSES.DOT); | 729 createAndAppendElement(fallbackElem, 'div', CLASSES.DOT); |
727 } | 730 } |
728 | 731 |
729 // The iframe which renders either a thumbnail or domain element. | 732 // The iframe which renders either a thumbnail or domain element. |
730 var thumbnailElem = document.createElement('iframe'); | 733 var thumbnailElem = document.createElement('iframe'); |
731 thumbnailElem.tabIndex = '-1'; | 734 thumbnailElem.tabIndex = '-1'; |
735 // Make the iframe invisible to screen readers. | |
732 thumbnailElem.setAttribute('aria-hidden', 'true'); | 736 thumbnailElem.setAttribute('aria-hidden', 'true'); |
737 titleElem.setAttribute('role', 'presentation'); | |
dmazzoni
2015/01/29 18:48:43
This one is unnecessary, the iframe is already inv
Mathieu
2015/01/29 18:53:35
Done.
| |
733 // Keep this ID here. See comment above. | 738 // Keep this ID here. See comment above. |
734 thumbnailElem.id = 'thumb-' + rid; | 739 thumbnailElem.id = 'thumb-' + rid; |
735 thumbnailElem.className = CLASSES.THUMBNAIL; | 740 thumbnailElem.className = CLASSES.THUMBNAIL; |
736 thumbnailElem.src = getMostVisitedThumbnailIframeUrl(rid, position); | 741 thumbnailElem.src = getMostVisitedThumbnailIframeUrl(rid, position); |
737 innerElem.appendChild(thumbnailElem); | 742 innerElem.appendChild(thumbnailElem); |
738 | 743 |
739 // The button used to blacklist this page. | 744 // The button used to blacklist this page. |
740 var blacklistButton = createAndAppendElement( | 745 var blacklistButton = createAndAppendElement( |
741 innerElem, 'div', CLASSES.BLACKLIST_BUTTON); | 746 innerElem, 'div', CLASSES.BLACKLIST_BUTTON); |
742 createAndAppendElement( | 747 createAndAppendElement( |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1201 | 1206 |
1202 return { | 1207 return { |
1203 init: init, | 1208 init: init, |
1204 listen: listen | 1209 listen: listen |
1205 }; | 1210 }; |
1206 } | 1211 } |
1207 | 1212 |
1208 if (!window.localNTPUnitTest) { | 1213 if (!window.localNTPUnitTest) { |
1209 LocalNTP().listen(); | 1214 LocalNTP().listen(); |
1210 } | 1215 } |
OLD | NEW |