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:

committed by
Commit Bot

parent
9a444eaa13
commit
6b947d3696
@@ -585,7 +585,10 @@ if (!is_ios && !is_fuchsia) {
|
|||||||
|
|
||||||
if (enable_plugins) {
|
if (enable_plugins) {
|
||||||
sources += [ "pdf/renderer/pdf_accessibility_tree_browsertest.cc" ]
|
sources += [ "pdf/renderer/pdf_accessibility_tree_browsertest.cc" ]
|
||||||
deps += [ "//components/pdf/renderer" ]
|
deps += [
|
||||||
|
"//components/pdf/renderer",
|
||||||
|
"//pdf:features",
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_android) {
|
if (is_android) {
|
||||||
|
@@ -25,6 +25,7 @@ jumbo_static_library("renderer") {
|
|||||||
"//content/public/renderer",
|
"//content/public/renderer",
|
||||||
"//gin",
|
"//gin",
|
||||||
"//ipc",
|
"//ipc",
|
||||||
|
"//pdf:features",
|
||||||
"//ppapi/host",
|
"//ppapi/host",
|
||||||
"//ppapi/proxy",
|
"//ppapi/proxy",
|
||||||
"//ppapi/proxy:ipc",
|
"//ppapi/proxy:ipc",
|
||||||
|
@@ -3,6 +3,7 @@ include_rules = [
|
|||||||
"+content/public/test",
|
"+content/public/test",
|
||||||
"+components/strings/grit/components_strings.h",
|
"+components/strings/grit/components_strings.h",
|
||||||
"+mojo/public/cpp/bindings",
|
"+mojo/public/cpp/bindings",
|
||||||
|
"+pdf/pdf_features.h",
|
||||||
"+ppapi",
|
"+ppapi",
|
||||||
"+skia/ext",
|
"+skia/ext",
|
||||||
"+third_party/blink/public",
|
"+third_party/blink/public",
|
||||||
|
@@ -16,6 +16,7 @@
|
|||||||
#include "content/public/renderer/render_frame.h"
|
#include "content/public/renderer/render_frame.h"
|
||||||
#include "content/public/renderer/render_view.h"
|
#include "content/public/renderer/render_view.h"
|
||||||
#include "content/public/renderer/renderer_ppapi_host.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 "third_party/blink/public/strings/grit/blink_strings.h"
|
||||||
#include "ui/accessibility/ax_enums.mojom.h"
|
#include "ui/accessibility/ax_enums.mojom.h"
|
||||||
#include "ui/accessibility/null_ax_action_target.h"
|
#include "ui/accessibility/null_ax_action_target.h"
|
||||||
@@ -500,7 +501,9 @@ void PdfAccessibilityTree::AddPageContent(
|
|||||||
--text_run_index;
|
--text_run_index;
|
||||||
continue;
|
continue;
|
||||||
} else if (IsObjectInTextRun(highlights, current_highlight_index,
|
} 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);
|
FinishStaticNode(&static_text_node, &static_text);
|
||||||
|
|
||||||
const ppapi::PdfAccessibilityHighlightInfo& highlight =
|
const ppapi::PdfAccessibilityHighlightInfo& highlight =
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
|
#include "base/test/scoped_feature_list.h"
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
#include "components/pdf/renderer/pdf_accessibility_tree.h"
|
#include "components/pdf/renderer/pdf_accessibility_tree.h"
|
||||||
#include "content/public/common/content_switches.h"
|
#include "content/public/common/content_switches.h"
|
||||||
@@ -12,6 +13,7 @@
|
|||||||
#include "content/public/renderer/renderer_ppapi_host.h"
|
#include "content/public/renderer/renderer_ppapi_host.h"
|
||||||
#include "content/public/test/fake_pepper_plugin_instance.h"
|
#include "content/public/test/fake_pepper_plugin_instance.h"
|
||||||
#include "content/public/test/render_view_test.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/strings/grit/blink_strings.h"
|
||||||
#include "third_party/blink/public/web/web_local_frame.h"
|
#include "third_party/blink/public/web/web_local_frame.h"
|
||||||
#include "third_party/blink/public/web/web_settings.h"
|
#include "third_party/blink/public/web/web_settings.h"
|
||||||
@@ -330,6 +332,11 @@ TEST_F(PdfAccessibilityTreeTest, TestPdfAccessibilityTreeCreation) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(PdfAccessibilityTreeTest, TestHighlightCreation) {
|
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(kFirstTextRun);
|
||||||
text_runs_.emplace_back(kSecondTextRun);
|
text_runs_.emplace_back(kSecondTextRun);
|
||||||
chars_.insert(chars_.end(), std::begin(kDummyCharsData),
|
chars_.insert(chars_.end(), std::begin(kDummyCharsData),
|
||||||
|
@@ -25,5 +25,8 @@ const base::Feature kPDFAnnotations {
|
|||||||
#endif // defined(OS_CHROMEOS)
|
#endif // defined(OS_CHROMEOS)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const base::Feature kAccessiblePDFHighlight{"AccessiblePDFHighlight",
|
||||||
|
base::FEATURE_DISABLED_BY_DEFAULT};
|
||||||
|
|
||||||
} // namespace features
|
} // namespace features
|
||||||
} // namespace chrome_pdf
|
} // namespace chrome_pdf
|
||||||
|
@@ -15,6 +15,7 @@ namespace features {
|
|||||||
|
|
||||||
extern const base::Feature kSaveEditedPDFForm;
|
extern const base::Feature kSaveEditedPDFForm;
|
||||||
extern const base::Feature kPDFAnnotations;
|
extern const base::Feature kPDFAnnotations;
|
||||||
|
extern const base::Feature kAccessiblePDFHighlight;
|
||||||
|
|
||||||
} // namespace features
|
} // namespace features
|
||||||
} // namespace chrome_pdf
|
} // namespace chrome_pdf
|
||||||
|
Reference in New Issue
Block a user