#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/core/page/touch_adjustment.h"
#include "third_party/blink/renderer/core/dom/container_node.h"
#include "third_party/blink/renderer/core/dom/node.h"
#include "third_party/blink/renderer/core/dom/node_computed_style.h"
#include "third_party/blink/renderer/core/dom/text.h"
#include "third_party/blink/renderer/core/editing/editing_behavior.h"
#include "third_party/blink/renderer/core/editing/editing_utilities.h"
#include "third_party/blink/renderer/core/editing/editor.h"
#include "third_party/blink/renderer/core/editing/frame_selection.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/html/html_frame_owner_element.h"
#include "third_party/blink/renderer/core/html/html_iframe_element.h"
#include "third_party/blink/renderer/core/input/touch_action_util.h"
#include "third_party/blink/renderer/core/layout/layout_box.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"
#include "third_party/blink/renderer/core/layout/layout_text.h"
#include "third_party/blink/renderer/core/page/chrome_client.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/style/computed_style.h"
#include "third_party/blink/renderer/platform/text/text_break_iterator.h"
#include "ui/display/screen_info.h"
#include "ui/gfx/geometry/point_conversions.h"
#include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/quad_f.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/size.h"
namespace blink {
namespace touch_adjustment {
const float kZeroTolerance = …;
constexpr LayoutUnit kMaxAdjustmentSizeDip(32);
constexpr LayoutUnit kMinAdjustmentSizeDip(20);
class SubtargetGeometry { … };
}
}
WTF_ALLOW_MOVE_INIT_AND_COMPARE_WITH_MEM_FUNCTIONS(…)
namespace blink {
namespace touch_adjustment {
SubtargetGeometryList;
NodeFilter;
AppendSubtargetsForNode;
DistanceFunction;
bool NodeRespondsToTapGesture(Node* node) { … }
bool NodeIsZoomTarget(Node* node) { … }
bool ProvidesContextMenuItems(Node* node) { … }
bool NodeRespondsToTapOrMove(Node* node) { … }
static inline void AppendQuadsToSubtargetList(
Vector<gfx::QuadF>& quads,
Node* node,
SubtargetGeometryList& subtargets) { … }
static inline void AppendBasicSubtargetsForNode(
Node* node,
SubtargetGeometryList& subtargets) { … }
static inline void AppendContextSubtargetsForNode(
Node* node,
SubtargetGeometryList& subtargets) { … }
static inline Node* ParentShadowHostOrOwner(const Node* node) { … }
void CompileSubtargetList(const HeapVector<Member<Node>>& intersected_nodes,
SubtargetGeometryList& subtargets,
NodeFilter node_filter,
AppendSubtargetsForNode append_subtargets_for_node) { … }
float ZoomableIntersectionQuotient(const gfx::Point& touch_hotspot,
const gfx::Rect& touch_area,
const SubtargetGeometry& subtarget) { … }
float HybridDistanceFunction(const gfx::Point& touch_hotspot,
const gfx::Rect& touch_rect,
const SubtargetGeometry& subtarget) { … }
gfx::PointF ConvertToRootFrame(LocalFrameView* view, gfx::PointF pt) { … }
void AdjustPointToRect(gfx::PointF& point, const gfx::Rect& rect) { … }
bool SnapTo(const SubtargetGeometry& geom,
const gfx::Point& touch_point,
const gfx::Rect& touch_area,
gfx::Point& snapped_point) { … }
bool FindNodeWithLowestDistanceMetric(Node*& adjusted_node,
gfx::Point& adjusted_point,
const gfx::Point& touch_hotspot,
const gfx::Rect& touch_area,
SubtargetGeometryList& subtargets,
DistanceFunction distance_function) { … }
bool FindBestCandidate(Node*& adjusted_node,
gfx::Point& adjusted_point,
const gfx::Point& touch_hotspot,
const gfx::Rect& touch_area,
const HeapVector<Member<Node>>& nodes,
NodeFilter node_filter,
AppendSubtargetsForNode append_subtargets_for_node) { … }
}
bool FindBestTouchAdjustmentCandidate(
TouchAdjustmentCandidateType candidate_type,
Node*& candidate_node,
gfx::Point& candidate_point,
const gfx::Point& touch_hotspot,
const gfx::Rect& touch_area,
const HeapVector<Member<Node>>& nodes) { … }
PhysicalSize GetHitTestRectForAdjustment(LocalFrame& frame,
const PhysicalSize& touch_area) { … }
}