Chromium Code Reviews| Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js |
| diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js |
| index e483f40de44b8eb657e834ab9f28c9904ab2851c..80700d9185bd631b5a07c8cc81b298b819fc0db8 100644 |
| --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js |
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js |
| @@ -578,7 +578,23 @@ CommandHandler.onCommand = function(command) { |
| .withRichSpeechAndBraille(current, null, Output.EventType.NAVIGATE) |
| .go(); |
| return false; |
| - |
| + case 'viewGraphicAsBraille': |
| + // Find the first node within the current range that supports image data. |
| + var imageNode = AutomationUtil.findNodePost( |
| + current.start.node, Dir.FORWARD, |
| + AutomationPredicate.supportsImageData); |
| + if (imageNode) { |
| + ChromeVoxState.instance.nodeDisplayingBrailleImage = imageNode; |
| + if (imageNode.imageDataUrl) { |
| + cvox.ChromeVox.braille.writeRawImage(imageNode.imageDataUrl); |
| + cvox.ChromeVox.braille.freeze(); |
| + } else { |
| + // Request image data. If it succeeds, we will get a |
| + // IMAGE_FRAME_UPDATED event. |
| + imageNode.getImageData(0, 0); |
|
David Tseng
2017/02/24 05:39:46
I think we should install the event handler direct
dmazzoni
2017/02/27 06:56:24
Done.
|
| + } |
| + } |
| + return false; |
| // Table commands. |
| case 'previousRow': |
| dir = Dir.BACKWARD; |