0

[PDF Ink Signatures] Restructure InkBrushBehavior

Update InkBrushBehavior to match the latest changes to
ink::BrushBehavior. Although InkBrushBehavior is not actively used,
keeping it in sync will make it easier to use, should it be needed.

Bug: 339682315
Change-Id: I3397ad1284a0b2738805b8426a871206f69359ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5805411
Reviewed-by: Andy Phan <andyphan@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Reviewed-by: Alan Screen <awscreen@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1346279}
This commit is contained in:
Lei Zhang
2024-08-23 23:39:48 +00:00
committed by Chromium LUCI CQ
parent 2d833ca660
commit a9f1eee7ed
3 changed files with 37 additions and 12 deletions

@ -26,6 +26,7 @@ source_set("interface") {
"ink_affine_transform.cc",
"ink_affine_transform.h",
"ink_brush.h",
"ink_brush_behavior.cc",
"ink_brush_behavior.h",
"ink_brush_family.h",
"ink_brush_paint.cc",

@ -0,0 +1,13 @@
// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "pdf/ink/ink_brush_behavior.h"
namespace chrome_pdf {
InkBrushBehavior::InkBrushBehavior() = default;
InkBrushBehavior::~InkBrushBehavior() = default;
} // namespace chrome_pdf

@ -6,22 +6,16 @@
#define PDF_INK_INK_BRUSH_BEHAVIOR_H_
#include <cstdint>
#include <optional>
#include <vector>
namespace chrome_pdf {
struct InkBrushBehavior {
struct EnabledToolTypes {
bool operator==(const EnabledToolTypes& other) const;
bool operator!=(const EnabledToolTypes& other) const;
bool unknown = false;
bool mouse = false;
bool touch = false;
bool stylus = false;
bool HasAnyTypes() const;
bool HasAllTypes() const;
};
static constexpr EnabledToolTypes kAllToolTypes = {.unknown = true,
@ -36,12 +30,29 @@ struct InkBrushBehavior {
kTiltXAndY,
};
bool operator==(const InkBrushBehavior& other) const;
bool operator!=(const InkBrushBehavior& other) const;
// TODO(crbug.com/339682315): Add more types if needed.
enum class Type {
kFallbackFilter,
kToolTypeFilter,
};
float response_time_seconds;
EnabledToolTypes enabled_tool_types = kAllToolTypes;
std::optional<OptionalInputProperty> is_fallback_for;
// Deliberately avoid using absl::variant in this header.
struct BaseNode {
Type type;
};
struct FallbackFilterNode : public BaseNode {
OptionalInputProperty is_fallback_for;
};
struct ToolTypeFilterNode : public BaseNode {
EnabledToolTypes enabled_tool_types;
};
InkBrushBehavior();
~InkBrushBehavior();
std::vector<BaseNode> nodes;
};
} // namespace chrome_pdf