OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 | 50 |
51 function highlightElement(element, shadowColor, backgroundColor) | 51 function highlightElement(element, shadowColor, backgroundColor) |
52 { | 52 { |
53 unhighlightElement(element); | 53 unhighlightElement(element); |
54 | 54 |
55 var highlightWithOverlay = function() | 55 var highlightWithOverlay = function() |
56 { | 56 { |
57 var overlay = addElementOverlay(element); | 57 var overlay = addElementOverlay(element); |
58 | 58 |
| 59 // If the element isn't displayed no overlay will be added. |
| 60 // Moreover, we don't need to highlight anything then. |
| 61 if (!overlay) |
| 62 return; |
| 63 |
59 highlightElement(overlay, shadowColor, backgroundColor); | 64 highlightElement(overlay, shadowColor, backgroundColor); |
60 overlay.style.pointerEvents = "none"; | 65 overlay.style.pointerEvents = "none"; |
61 | 66 |
62 element._unhighlight = function() | 67 element._unhighlight = function() |
63 { | 68 { |
64 overlay.parentNode.removeChild(overlay); | 69 overlay.parentNode.removeChild(overlay); |
65 }; | 70 }; |
66 }; | 71 }; |
67 | 72 |
68 var highlightWithStyleAttribute = function() | 73 var highlightWithStyleAttribute = function() |
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 lastRightClickEventValid = false; | 734 lastRightClickEventValid = false; |
730 else | 735 else |
731 lastRightClickEvent = null; | 736 lastRightClickEvent = null; |
732 break; | 737 break; |
733 } | 738 } |
734 }); | 739 }); |
735 | 740 |
736 if (window == window.top) | 741 if (window == window.top) |
737 ext.backgroundPage.sendMessage({type: "report-html-page"}); | 742 ext.backgroundPage.sendMessage({type: "report-html-page"}); |
738 } | 743 } |
OLD | NEW |