Bug 282097 - Part 10: Ensure input commands are enabled. r=enndeakin
authorJ. Ryan Stinnett <jryans@gmail.com>
Wed, 10 Jul 2013 09:14:21 -0500
changeset 138146 0daef1c8ef648bfe2b2795d0ad7e8b2c14c3cc5c
parent 138145 116295f5b522a5be506d942319dc47c8d5bbf391
child 138147 4504582d908ce343aaaceb3a19b0c3e2bf2887d6
push id30839
push userryanvm@gmail.com
push dateThu, 11 Jul 2013 14:25:52 +0000
treeherdermozilla-inbound@0daef1c8ef64 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenndeakin
bugs282097
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 282097 - Part 10: Ensure input commands are enabled. r=enndeakin
content/html/content/src/nsTextEditorState.cpp
--- a/content/html/content/src/nsTextEditorState.cpp
+++ b/content/html/content/src/nsTextEditorState.cpp
@@ -789,17 +789,24 @@ DoCommandCallback(const char *aCommand, 
 
   if (!controllers) {
     NS_WARNING("Could not get controllers");
     return;
   }
 
   nsCOMPtr<nsIController> controller;
   controllers->GetControllerForCommand(aCommand, getter_AddRefs(controller));
-  if (controller) {
+  if (!controller) {
+    return;
+  }
+
+  bool commandEnabled;
+  nsresult rv = controller->IsCommandEnabled(aCommand, &commandEnabled);
+  NS_ENSURE_SUCCESS_VOID(rv);
+  if (commandEnabled) {
     controller->DoCommand(aCommand);
   }
 }
 
 NS_IMETHODIMP
 nsTextInputListener::HandleEvent(nsIDOMEvent* aEvent)
 {
   nsCOMPtr<nsIDOMKeyEvent> keyEvent(do_QueryInterface(aEvent));