0

Guard PDF highlight accessibility feature behind a flag

Bug: 1008775
Change-Id: I6d379d28079e6669210f0094e7116937994997da
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1911879
Commit-Queue: Ankit Kumar 🌪️ <ankk@microsoft.com>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Dominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#718193}
This commit is contained in:
Ankit Kumar 🌪️
2019-11-22 17:48:47 +00:00
committed by Commit Bot
parent 9a444eaa13
commit 6b947d3696
7 changed files with 21 additions and 2 deletions

@ -585,7 +585,10 @@ if (!is_ios && !is_fuchsia) {
if (enable_plugins) {
sources += [ "pdf/renderer/pdf_accessibility_tree_browsertest.cc" ]
deps += [ "//components/pdf/renderer" ]
deps += [
"//components/pdf/renderer",
"//pdf:features",
]
}
if (is_android) {

@ -25,6 +25,7 @@ jumbo_static_library("renderer") {
"//content/public/renderer",
"//gin",
"//ipc",
"//pdf:features",
"//ppapi/host",
"//ppapi/proxy",
"//ppapi/proxy:ipc",

@ -3,6 +3,7 @@ include_rules = [
"+content/public/test",
"+components/strings/grit/components_strings.h",
"+mojo/public/cpp/bindings",
"+pdf/pdf_features.h",
"+ppapi",
"+skia/ext",
"+third_party/blink/public",

@ -16,6 +16,7 @@
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_view.h"
#include "content/public/renderer/renderer_ppapi_host.h"
#include "pdf/pdf_features.h"
#include "third_party/blink/public/strings/grit/blink_strings.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/null_ax_action_target.h"
@ -500,7 +501,9 @@ void PdfAccessibilityTree::AddPageContent(
--text_run_index;
continue;
} else if (IsObjectInTextRun(highlights, current_highlight_index,
text_run_index)) {
text_run_index) &&
base::FeatureList::IsEnabled(
chrome_pdf::features::kAccessiblePDFHighlight)) {
FinishStaticNode(&static_text_node, &static_text);
const ppapi::PdfAccessibilityHighlightInfo& highlight =

@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/path_service.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "components/pdf/renderer/pdf_accessibility_tree.h"
#include "content/public/common/content_switches.h"
@ -12,6 +13,7 @@
#include "content/public/renderer/renderer_ppapi_host.h"
#include "content/public/test/fake_pepper_plugin_instance.h"
#include "content/public/test/render_view_test.h"
#include "pdf/pdf_features.h"
#include "third_party/blink/public/strings/grit/blink_strings.h"
#include "third_party/blink/public/web/web_local_frame.h"
#include "third_party/blink/public/web/web_settings.h"
@ -330,6 +332,11 @@ TEST_F(PdfAccessibilityTreeTest, TestPdfAccessibilityTreeCreation) {
}
TEST_F(PdfAccessibilityTreeTest, TestHighlightCreation) {
// Enable feature flag
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(
chrome_pdf::features::kAccessiblePDFHighlight);
text_runs_.emplace_back(kFirstTextRun);
text_runs_.emplace_back(kSecondTextRun);
chars_.insert(chars_.end(), std::begin(kDummyCharsData),

@ -25,5 +25,8 @@ const base::Feature kPDFAnnotations {
#endif // defined(OS_CHROMEOS)
};
const base::Feature kAccessiblePDFHighlight{"AccessiblePDFHighlight",
base::FEATURE_DISABLED_BY_DEFAULT};
} // namespace features
} // namespace chrome_pdf

@ -15,6 +15,7 @@ namespace features {
extern const base::Feature kSaveEditedPDFForm;
extern const base::Feature kPDFAnnotations;
extern const base::Feature kAccessiblePDFHighlight;
} // namespace features
} // namespace chrome_pdf