Chromium Code Reviews| 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 |