Skip to content

Add support for datalist#385

Merged
kenhys merged 6 commits into
masterfrom
add-support-datalist
Jun 3, 2026
Merged

Add support for datalist#385
kenhys merged 6 commits into
masterfrom
add-support-datalist

Conversation

@HashidaTKS

@HashidaTKS HashidaTKS commented May 26, 2026

Copy link
Copy Markdown
Contributor

Which issue(s) this PR fixes:

#384

Related: #151

What this PR does / why we need it:

This is a patch to add support for datalist of HTML5.
The datalist does not work when using external_message_pump and multi_threaded_message_loop is false.
We should change multi_threaded_message_loop to true and do not use external_message_pump.

m_bMultiThreadedMessageLoop = TRUE;
settings.multi_threaded_message_loop = m_bMultiThreadedMessageLoop;
settings.external_message_pump = false;

When multi_threaded_message_loop is true, shortcut keys and mouse wheels become to not work.
This patch adds some extra modification for them.

How to verify the fixed issue:

The steps to verify:

  • Start Chronos
    • Confirm that Chronos starts fine
  • Open https://developer.mozilla.org/ja/docs/Web/HTML/Reference/Elements/datalist
    • Confirm that a datalist select works fine
  • Open some sites
    • Confirm that the sites work fine
  • Open setting dialog
  • Select "画面表示設定"
  • Specify 250% to "ズーム表示"
  • Restart Chronos
    • Confirm that an initial zoom size is 250%
  • Input "Ctrl + -" to zoom out
  • Click a "+" button of a following displayed zoom popup
    • image
    • Confirm that status bar's bottom right zoom magnification rate is changed following as popup dialog's zoom magnification rate
    • image
  • Execute the following shortcuts
    • Confirm that all shortcuts works fine
キー操作 対応する機能
Ctrl + N 新規作成-タブ
Ctrl + T 新規作成-タブ
Ctrl + Shift + T 最近閉じたタブを開く
Ctrl + P 印刷
Ctrl + W 閉じる
Alt + F4 全てのタブを閉じる
Ctrl + Tab 次のタブ
Shift + Ctrl + Tab 前のタブ
Ctrl + X 切り取り
Ctrl + C コピー
Ctrl + V 貼り付け
Ctrl + A 全て選択
Ctrl + F このページの検索
Tab クリック可能な項目間を移動(次)
Shift + Tab クリック可能な項目間を移動(前)
Space または PgDn ページを1画面ずつ下にスクロール
Shift + Space または PgUp ページを1画面ずつ上にスクロール
マウスホイール ページを垂直方向にスクロール
Shift + マウスホイール ページを水平方向にスクロール
Alt + <- 前に戻る
Alt + -> 次に進む
Esc 読み込みの中止
F5 最新の情報に更新
Ctrl + R 最新の情報に更新
Alt + Home ホームページを開く
F11 全画面表示
Alt + D アドレスバーにフォーカス移動
Ctrl + L アドレスバーにフォーカス移動
F6 アドレスバーにフォーカス移動
Ctrl + K 検索バーにフォーカス移動
Ctrl + 1 1つ目のタブに切り替え
Ctrl + 2 2つ目のタブに切り替え
Ctrl + 3 3つ目のタブに切り替え
Ctrl + 4 4つ目のタブに切り替え
Ctrl + 5 5つ目のタブに切り替え
Ctrl + 6 6つ目のタブに切り替え
Ctrl + 7 7つ目のタブに切り替え
Ctrl + 8 8つ目のタブに切り替え
Ctrl + 9 最後のタブに切り替え
Ctrl + - ページの縮小サイズ表示
Ctrl + + ページの拡大サイズ表示
Ctrl + 0 ページを100%サイズ表示
Ctrl + マウスホイール ページの拡大縮小表示
Shift + リンククリック リンクを新しいタブとして開く
Ctrl + リンククリック リンクを新しくバックグラウンドタブとして開く

@HashidaTKS HashidaTKS marked this pull request as draft May 26, 2026 09:06
@HashidaTKS

HashidaTKS commented May 26, 2026

Copy link
Copy Markdown
Contributor Author

生成AIに頼った部分があり、まだ精査ができていない。

m_bMultiThreadedMessageLoop = TRUE;
settings.multi_threaded_message_loop = m_bMultiThreadedMessageLoop;
settings.external_message_pump = false;

の部分を変更しないで、現在の延長上で対処する方向性も検討してから、こちらの方針の方が良いとなったら精査する。

@HashidaTKS

Copy link
Copy Markdown
Contributor Author

元々ではあるのだが、Chromimumが出力する画面の拡大率のポップアップで+-ボタンを押したときも、右下の拡大率が連動しない。

@HashidaTKS

HashidaTKS commented May 28, 2026

Copy link
Copy Markdown
Contributor Author

マウスのホイール操作による拡大縮小に対応するために、CEF側のウィンドウメッセージをフックして、ホイール操作による拡大縮小であればChronosの親ウィンドウに投げ直すという処理をしていた。ただ、それだと不十分で、前述のように、CEFが表示する拡大率のポップアップの+-で拡大率を操作したとき、Chronosの表示する右下の拡大率が連動しない(Chronos側の処理が呼ばれないため)。このCEFが表示する拡大率のポップアップについては、イベントハンドラーなども用意されていない。そのため、Chronos側でポーリングしてCEFが保持している拡大率が変わっているかどうかを確認する方式をとることとした。ポーリング間隔を250msとしたので、拡大してから右下の拡大率に反映されるまで最大250msかかるが、通常の使用では問題がないはずである。

メッセージをフックする方式では影響範囲が大きいが(潜在的に全ての操作に関わる)、こちらの方式の方が影響範囲が小さくて済む。そのため、メッセージをフックする方法はやめて、こちらの方式に統一する。

@HashidaTKS

Copy link
Copy Markdown
Contributor Author

設定ファイルのDefaultZoomSizeが効かなくなっている。

@HashidaTKS HashidaTKS changed the title WIP: Add support datalist WIP: Add support for datalist May 29, 2026
@HashidaTKS HashidaTKS requested a review from kenhys May 29, 2026 08:05
@HashidaTKS HashidaTKS marked this pull request as ready for review May 29, 2026 08:05
The datalist does not work when using external_message_pump and multi_threaded_message_loop is false.
We should modify multi_threaded_message_loop to true and do not use external_message_pump.

When multi_threaded_message_loop is true, shortcut keys and mouse wheels become to not work.
This patch adds some extra modification for them.

* Transfer CEF's shortcut keys used by Chronos to Chronos
* Sync to CEF's zoom magnification by polling.
@HashidaTKS HashidaTKS force-pushed the add-support-datalist branch from 330cbeb to b47b31e Compare May 29, 2026 08:22
@HashidaTKS HashidaTKS changed the title WIP: Add support for datalist Add support for datalist May 29, 2026
Comment thread BroView.cpp Outdated
m_nBrowserID = 0;
m_bDevToolsWnd = FALSE;
m_bFindNext = FALSE;
m_iZoomTimerID = 1367;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

値はユニークなら何でも良い。マクロ定義の方が良いかも。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

マクロにした。
それによりメンバ変数を定義する意味がなくなったので、このメンバ変数は削除した。

Comment thread BroView.cpp Outdated
for (const auto& [key, value] : m_mapScaleToZoomSize)
{
double diff = value - dNewZoom;
if (diff < 0.0) diff = -diff;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better diff = std::abs(diff) because -0.0 will be converted into +0.0.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified.

Comment thread BroView.cpp Outdated
m_cefBrowser = browser;
m_nBrowserID = nBrowserId;
this->PostMessage(WM_SIZE);
SetTimer(m_iZoomTimerID, 250, NULL);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use proper macro definition for 250 msec.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified.

Comment thread BroView.cpp Outdated
{
if (value == m_dbZoomSize)
double diff = value - m_dbZoomSize;
if (diff < 0.0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diff = std::abs(diff); might be better.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of diff, delta might be meaningful for numeric operations.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified.

@kenhys

kenhys commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

設定ファイルのDefaultZoomSizeが効かなくなっている。

再現しているようにみえる。

@kenhys

kenhys commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

datalistの挙動で気になった些細な違いについてメモ

  • Chronos その他で色を選択しダイアログがポップアップした状態でページ内をクリックしても、カラーダイアログが残ったまま。スクロールしてもカラー選択ダイアログは消えない。
  • Chrome 148.0.7778.217: カラーダイアログ表示中にスクロールしても消えない(Chronosと同じ)。ページ内をクリックしたらダイアログは消える
  • Edge 148.0.3967.96: カラーダイアログ表示中にスクロールしても消えない(Chronosと同じ)。ページ内をクリックしたらダイアログは消える

たんにベースとしているcefのバージョン違いの影響かもしれない。

@HashidaTKS HashidaTKS force-pushed the add-support-datalist branch from 3ef7bae to b96c984 Compare June 3, 2026 05:43
@HashidaTKS

Copy link
Copy Markdown
Contributor Author

設定ファイルのDefaultZoomSizeが効かなくなっている。

再現しているようにみえる。

ネイティブ版でChronosDefault.confを編集して試されていますか?
その場合、現在のネイティブ版では%APPLOCAL%配下の以前のユーザーごとのChronos.confを見てしまい、以前設定している100%が優先されて、ChronosDefault.confの方のDefaultZoomSizeが効かなくなったように見えているかもしれません。

@HashidaTKS HashidaTKS requested a review from kenhys June 3, 2026 07:48

@kenhys kenhys left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@kenhys kenhys merged commit e7ef8be into master Jun 3, 2026
1 of 3 checks passed
@kenhys kenhys deleted the add-support-datalist branch June 3, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants