mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:07:34 +00:00
Everywhere: Rename left/right-click to primary/secondary
This resolves #10641.
This commit is contained in:
parent
a6ccf6659a
commit
d6a0726302
79 changed files with 183 additions and 183 deletions
|
@ -53,7 +53,7 @@ void ButtonBox::paint(PaintContext& context, PaintPhase phase)
|
|||
|
||||
void ButtonBox::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned)
|
||||
{
|
||||
if (button != GUI::MouseButton::Left || !dom_node().enabled())
|
||||
if (button != GUI::MouseButton::Primary || !dom_node().enabled())
|
||||
return;
|
||||
|
||||
m_being_pressed = true;
|
||||
|
@ -65,7 +65,7 @@ void ButtonBox::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsi
|
|||
|
||||
void ButtonBox::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned button, unsigned)
|
||||
{
|
||||
if (!m_tracking_mouse || button != GUI::MouseButton::Left || !dom_node().enabled())
|
||||
if (!m_tracking_mouse || button != GUI::MouseButton::Primary || !dom_node().enabled())
|
||||
return;
|
||||
|
||||
// NOTE: Handling the click may run arbitrary JS, which could disappear this node.
|
||||
|
|
|
@ -39,7 +39,7 @@ void CheckBox::paint(PaintContext& context, PaintPhase phase)
|
|||
|
||||
void CheckBox::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned)
|
||||
{
|
||||
if (button != GUI::MouseButton::Left || !dom_node().enabled())
|
||||
if (button != GUI::MouseButton::Primary || !dom_node().enabled())
|
||||
return;
|
||||
|
||||
m_being_pressed = true;
|
||||
|
@ -51,7 +51,7 @@ void CheckBox::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsig
|
|||
|
||||
void CheckBox::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned button, unsigned)
|
||||
{
|
||||
if (!m_tracking_mouse || button != GUI::MouseButton::Left || !dom_node().enabled())
|
||||
if (!m_tracking_mouse || button != GUI::MouseButton::Primary || !dom_node().enabled())
|
||||
return;
|
||||
|
||||
// NOTE: Changing the checked state of the DOM node may run arbitrary JS, which could disappear this node.
|
||||
|
|
|
@ -28,7 +28,7 @@ Label::~Label()
|
|||
|
||||
void Label::handle_mousedown_on_label(Badge<TextNode>, const Gfx::IntPoint&, unsigned button)
|
||||
{
|
||||
if (button != GUI::MouseButton::Left)
|
||||
if (button != GUI::MouseButton::Primary)
|
||||
return;
|
||||
|
||||
if (auto* control = control_node(); control)
|
||||
|
@ -39,7 +39,7 @@ void Label::handle_mousedown_on_label(Badge<TextNode>, const Gfx::IntPoint&, uns
|
|||
|
||||
void Label::handle_mouseup_on_label(Badge<TextNode>, const Gfx::IntPoint& position, unsigned button)
|
||||
{
|
||||
if (!m_tracking_mouse || button != GUI::MouseButton::Left)
|
||||
if (!m_tracking_mouse || button != GUI::MouseButton::Primary)
|
||||
return;
|
||||
|
||||
// NOTE: Changing the checked state of the DOM node may run arbitrary JS, which could disappear this node.
|
||||
|
|
|
@ -39,7 +39,7 @@ void RadioButton::paint(PaintContext& context, PaintPhase phase)
|
|||
|
||||
void RadioButton::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, unsigned button, unsigned)
|
||||
{
|
||||
if (button != GUI::MouseButton::Left || !dom_node().enabled())
|
||||
if (button != GUI::MouseButton::Primary || !dom_node().enabled())
|
||||
return;
|
||||
|
||||
m_being_pressed = true;
|
||||
|
@ -51,7 +51,7 @@ void RadioButton::handle_mousedown(Badge<EventHandler>, const Gfx::IntPoint&, un
|
|||
|
||||
void RadioButton::handle_mouseup(Badge<EventHandler>, const Gfx::IntPoint& position, unsigned button, unsigned)
|
||||
{
|
||||
if (!m_tracking_mouse || button != GUI::MouseButton::Left || !dom_node().enabled())
|
||||
if (!m_tracking_mouse || button != GUI::MouseButton::Primary || !dom_node().enabled())
|
||||
return;
|
||||
|
||||
// NOTE: Changing the checked state of the DOM node may run arbitrary JS, which could disappear this node.
|
||||
|
|
|
@ -168,7 +168,7 @@ bool EventHandler::handle_mouseup(const Gfx::IntPoint& position, unsigned button
|
|||
handled_event = true;
|
||||
}
|
||||
|
||||
if (button == GUI::MouseButton::Left)
|
||||
if (button == GUI::MouseButton::Primary)
|
||||
m_in_mouse_selection = false;
|
||||
return handled_event;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned butt
|
|||
if (!layout_root() || layout_root() != node->document().layout_node())
|
||||
return true;
|
||||
|
||||
if (button == GUI::MouseButton::Right && is<HTML::HTMLImageElement>(*node)) {
|
||||
if (button == GUI::MouseButton::Secondary && is<HTML::HTMLImageElement>(*node)) {
|
||||
auto& image_element = verify_cast<HTML::HTMLImageElement>(*node);
|
||||
auto image_url = image_element.document().parse_url(image_element.src());
|
||||
if (auto* page = m_frame.page())
|
||||
|
@ -236,7 +236,7 @@ bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned butt
|
|||
auto href = link->href();
|
||||
auto url = document->parse_url(href);
|
||||
dbgln("Web::EventHandler: Clicking on a link to {}", url);
|
||||
if (button == GUI::MouseButton::Left) {
|
||||
if (button == GUI::MouseButton::Primary) {
|
||||
if (href.starts_with("javascript:")) {
|
||||
document->run_javascript(href.substring_view(11, href.length() - 11));
|
||||
} else if (href.starts_with('#')) {
|
||||
|
@ -252,7 +252,7 @@ bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned butt
|
|||
m_frame.loader().load(url, FrameLoader::Type::Navigation);
|
||||
}
|
||||
}
|
||||
} else if (button == GUI::MouseButton::Right) {
|
||||
} else if (button == GUI::MouseButton::Secondary) {
|
||||
if (auto* page = m_frame.page())
|
||||
page->client().page_did_request_link_context_menu(m_frame.to_top_level_position(position), url, link->target(), modifiers);
|
||||
} else if (button == GUI::MouseButton::Middle) {
|
||||
|
@ -260,14 +260,14 @@ bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned butt
|
|||
page->client().page_did_middle_click_link(url, link->target(), modifiers);
|
||||
}
|
||||
} else {
|
||||
if (button == GUI::MouseButton::Left) {
|
||||
if (button == GUI::MouseButton::Primary) {
|
||||
auto result = layout_root()->hit_test(position, Layout::HitTestType::TextCursor);
|
||||
if (result.layout_node && result.layout_node->dom_node()) {
|
||||
m_frame.set_cursor_position(DOM::Position(*result.layout_node->dom_node(), result.index_in_node));
|
||||
layout_root()->set_selection({ { result.layout_node, result.index_in_node }, {} });
|
||||
m_in_mouse_selection = true;
|
||||
}
|
||||
} else if (button == GUI::MouseButton::Right) {
|
||||
} else if (button == GUI::MouseButton::Secondary) {
|
||||
if (auto* page = m_frame.page())
|
||||
page->client().page_did_request_context_menu(m_frame.to_top_level_position(position));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue