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

Unified Diff: content/browser/accessibility/accessibility_mode_helper.cc

Issue 145283003: Switch AccessibilityMode to be a bitmap (Closed) Base URL: https://chromium.googlesource.com/chromium/src@enable
Patch Set: Tweak AccessibilityModeHelperTest Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/accessibility/accessibility_mode_helper.cc
diff --git a/content/browser/accessibility/accessibility_mode_helper.cc b/content/browser/accessibility/accessibility_mode_helper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8e16c3ff56c14467eeede1fbb6de089a31ca4144
--- /dev/null
+++ b/content/browser/accessibility/accessibility_mode_helper.cc
@@ -0,0 +1,31 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/accessibility/accessibility_mode_helper.h"
+
+namespace content {
+
+unsigned int AddAccessibilityMode(unsigned int to,
+ AccessibilityMode mode_to_add) {
+ return to | mode_to_add;
David Tseng 2014/02/04 20:25:51 Do we want to enforce which modes can be set at th
aboxhall 2014/02/05 16:02:47 I think editable text only overrides the other mod
+}
+
+unsigned int RemoveAccessibilityMode(unsigned int from,
+ AccessibilityMode mode_to_remove) {
+ if (!(mode_to_remove & AccessibilityModeFlagRenderer))
+ return from ^ (mode_to_remove & from);
+
+ unsigned int to_remove = mode_to_remove;
+
+ // AccessibilityModeFlagPlatform depends on AccessibilityModeFlagRenderer;
+ // don't turn off the latter if the former will remain on.
+ if (!(mode_to_remove & AccessibilityModeFlagPlatform) &&
+ (from & AccessibilityModeFlagPlatform)) {
+ to_remove ^= AccessibilityModeFlagRenderer;
+ }
+
+ return from ^ (to_remove & from);
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698