mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Disable URL bar hit testing while scrolling in Servo
This commit is contained in:
parent
5c1d130217
commit
aaefaee5dc
5 changed files with 68 additions and 19 deletions
|
@ -35,6 +35,12 @@ void BrowserPage::BindServoEvents() {
|
||||||
reloadButton().IsEnabled(true);
|
reloadButton().IsEnabled(true);
|
||||||
stopButton().IsEnabled(false);
|
stopButton().IsEnabled(false);
|
||||||
});
|
});
|
||||||
|
servoControl().OnCaptureGesturesStarted([=] {
|
||||||
|
servoControl().Focus(FocusState::Programmatic);
|
||||||
|
navigationBar().IsHitTestVisible(false);
|
||||||
|
});
|
||||||
|
servoControl().OnCaptureGesturesEnded(
|
||||||
|
[=] { navigationBar().IsHitTestVisible(true); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserPage::LoadServoURI(Uri uri) {
|
void BrowserPage::LoadServoURI(Uri uri) {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
<RowDefinition Height="auto"/>
|
<RowDefinition Height="auto"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid Grid.Row="0">
|
<Grid Grid.Row="0" x:Name="navigationBar">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="auto"/>
|
<ColumnDefinition Width="auto"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
|
|
|
@ -32,9 +32,22 @@ void ServoControl::Shutdown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ServoControl::OnLoaded(IInspectable const &, RoutedEventArgs const &) {
|
void ServoControl::OnLoaded(IInspectable const &, RoutedEventArgs const &) {
|
||||||
Panel().PointerReleased(
|
auto panel = Panel();
|
||||||
|
panel.PointerReleased(
|
||||||
std::bind(&ServoControl::OnSurfaceClicked, this, _1, _2));
|
std::bind(&ServoControl::OnSurfaceClicked, this, _1, _2));
|
||||||
Panel().ManipulationDelta(
|
panel.ManipulationStarted(
|
||||||
|
[=](IInspectable const &,
|
||||||
|
Input::ManipulationStartedRoutedEventArgs const &e) {
|
||||||
|
mOnCaptureGesturesStartedEvent();
|
||||||
|
e.Handled(true);
|
||||||
|
});
|
||||||
|
panel.ManipulationCompleted(
|
||||||
|
[=](IInspectable const &,
|
||||||
|
Input::ManipulationCompletedRoutedEventArgs const &e) {
|
||||||
|
mOnCaptureGesturesEndedEvent();
|
||||||
|
e.Handled(true);
|
||||||
|
});
|
||||||
|
panel.ManipulationDelta(
|
||||||
std::bind(&ServoControl::OnSurfaceManipulationDelta, this, _1, _2));
|
std::bind(&ServoControl::OnSurfaceManipulationDelta, this, _1, _2));
|
||||||
InitializeConditionVariable(&mGLCondVar);
|
InitializeConditionVariable(&mGLCondVar);
|
||||||
InitializeCriticalSection(&mGLLock);
|
InitializeCriticalSection(&mGLLock);
|
||||||
|
|
|
@ -15,34 +15,59 @@ struct ServoControl : ServoControlT<ServoControl>, public servo::ServoDelegate {
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
Windows::Foundation::Uri LoadURIOrSearch(hstring);
|
Windows::Foundation::Uri LoadURIOrSearch(hstring);
|
||||||
|
|
||||||
void OnLoaded(IInspectable const &, Windows::UI::Xaml::RoutedEventArgs const &);
|
void OnLoaded(IInspectable const &,
|
||||||
|
Windows::UI::Xaml::RoutedEventArgs const &);
|
||||||
|
|
||||||
winrt::event_token
|
winrt::event_token
|
||||||
OnURLChanged(Windows::Foundation::EventHandler<hstring> const &handler){
|
OnURLChanged(Windows::Foundation::EventHandler<hstring> const &handler) {
|
||||||
return mOnURLChangedEvent.add(handler);
|
return mOnURLChangedEvent.add(handler);
|
||||||
};
|
};
|
||||||
void OnURLChanged(winrt::event_token const& token) noexcept { mOnURLChangedEvent.remove(token); }
|
void OnURLChanged(winrt::event_token const &token) noexcept {
|
||||||
|
mOnURLChangedEvent.remove(token);
|
||||||
|
}
|
||||||
|
|
||||||
winrt::event_token
|
winrt::event_token
|
||||||
OnTitleChanged(Windows::Foundation::EventHandler<hstring> const &handler){
|
OnTitleChanged(Windows::Foundation::EventHandler<hstring> const &handler) {
|
||||||
return mOnTitleChangedEvent.add(handler);
|
return mOnTitleChangedEvent.add(handler);
|
||||||
};
|
};
|
||||||
void OnTitleChanged(winrt::event_token const& token) noexcept { mOnTitleChangedEvent.remove(token); }
|
void OnTitleChanged(winrt::event_token const &token) noexcept {
|
||||||
|
mOnTitleChangedEvent.remove(token);
|
||||||
|
}
|
||||||
|
|
||||||
winrt::event_token OnHistoryChanged(HistoryChangedDelegate const &handler){
|
winrt::event_token OnHistoryChanged(HistoryChangedDelegate const &handler) {
|
||||||
return mOnHistoryChangedEvent.add(handler);
|
return mOnHistoryChangedEvent.add(handler);
|
||||||
};
|
};
|
||||||
void OnHistoryChanged(winrt::event_token const& token) noexcept { mOnHistoryChangedEvent.remove(token); }
|
void OnHistoryChanged(winrt::event_token const &token) noexcept {
|
||||||
|
mOnHistoryChangedEvent.remove(token);
|
||||||
|
}
|
||||||
|
|
||||||
winrt::event_token OnLoadStarted(LoadStatusChangedDelegate const &handler){
|
winrt::event_token OnLoadStarted(EventDelegate const &handler) {
|
||||||
return mOnLoadStartedEvent.add(handler);
|
return mOnLoadStartedEvent.add(handler);
|
||||||
};
|
};
|
||||||
void OnLoadStarted(winrt::event_token const& token) noexcept { mOnLoadStartedEvent.remove(token); }
|
void OnLoadStarted(winrt::event_token const &token) noexcept {
|
||||||
|
mOnLoadStartedEvent.remove(token);
|
||||||
|
}
|
||||||
|
|
||||||
winrt::event_token OnLoadEnded(LoadStatusChangedDelegate const &handler){
|
winrt::event_token OnLoadEnded(EventDelegate const &handler) {
|
||||||
return mOnLoadEndedEvent.add(handler);
|
return mOnLoadEndedEvent.add(handler);
|
||||||
};
|
};
|
||||||
void OnLoadEnded(winrt::event_token const& token) noexcept { mOnLoadEndedEvent.remove(token); }
|
void OnLoadEnded(winrt::event_token const &token) noexcept {
|
||||||
|
mOnLoadEndedEvent.remove(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
winrt::event_token OnCaptureGesturesStarted(EventDelegate const &handler) {
|
||||||
|
return mOnCaptureGesturesStartedEvent.add(handler);
|
||||||
|
};
|
||||||
|
void OnCaptureGesturesStarted(winrt::event_token const &token) noexcept {
|
||||||
|
mOnCaptureGesturesStartedEvent.remove(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
winrt::event_token OnCaptureGesturesEnded(EventDelegate const &handler) {
|
||||||
|
return mOnCaptureGesturesEndedEvent.add(handler);
|
||||||
|
};
|
||||||
|
void OnCaptureGesturesEnded(winrt::event_token const &token) noexcept {
|
||||||
|
mOnCaptureGesturesEndedEvent.remove(token);
|
||||||
|
}
|
||||||
|
|
||||||
virtual void WakeUp();
|
virtual void WakeUp();
|
||||||
virtual void OnServoLoadStarted();
|
virtual void OnServoLoadStarted();
|
||||||
|
@ -61,8 +86,11 @@ private:
|
||||||
winrt::event<Windows::Foundation::EventHandler<hstring>> mOnURLChangedEvent;
|
winrt::event<Windows::Foundation::EventHandler<hstring>> mOnURLChangedEvent;
|
||||||
winrt::event<Windows::Foundation::EventHandler<hstring>> mOnTitleChangedEvent;
|
winrt::event<Windows::Foundation::EventHandler<hstring>> mOnTitleChangedEvent;
|
||||||
winrt::event<HistoryChangedDelegate> mOnHistoryChangedEvent;
|
winrt::event<HistoryChangedDelegate> mOnHistoryChangedEvent;
|
||||||
winrt::event<LoadStatusChangedDelegate> mOnLoadStartedEvent;
|
winrt::event<EventDelegate> mOnLoadStartedEvent;
|
||||||
winrt::event<LoadStatusChangedDelegate> mOnLoadEndedEvent;
|
winrt::event<EventDelegate> mOnLoadEndedEvent;
|
||||||
|
winrt::event<EventDelegate> mOnCaptureGesturesStartedEvent;
|
||||||
|
winrt::event<EventDelegate> mOnCaptureGesturesEndedEvent;
|
||||||
|
|
||||||
hstring mInitialURL = L"https://servo.org";
|
hstring mInitialURL = L"https://servo.org";
|
||||||
|
|
||||||
Windows::UI::Xaml::Controls::SwapChainPanel ServoControl::Panel();
|
Windows::UI::Xaml::Controls::SwapChainPanel ServoControl::Panel();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace ServoApp {
|
namespace ServoApp {
|
||||||
|
|
||||||
delegate void LoadStatusChangedDelegate();
|
delegate void EventDelegate();
|
||||||
delegate void HistoryChangedDelegate(Boolean back, Boolean forward);
|
delegate void HistoryChangedDelegate(Boolean back, Boolean forward);
|
||||||
|
|
||||||
runtimeclass ServoControl : Windows.UI.Xaml.Controls.Control {
|
runtimeclass ServoControl : Windows.UI.Xaml.Controls.Control {
|
||||||
|
@ -11,8 +11,10 @@ namespace ServoApp {
|
||||||
void Stop();
|
void Stop();
|
||||||
Windows.Foundation.Uri LoadURIOrSearch(String url);
|
Windows.Foundation.Uri LoadURIOrSearch(String url);
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
event LoadStatusChangedDelegate OnLoadStarted;
|
event EventDelegate OnLoadStarted;
|
||||||
event LoadStatusChangedDelegate OnLoadEnded;
|
event EventDelegate OnLoadEnded;
|
||||||
|
event EventDelegate OnCaptureGesturesStarted;
|
||||||
|
event EventDelegate OnCaptureGesturesEnded;
|
||||||
event HistoryChangedDelegate OnHistoryChanged;
|
event HistoryChangedDelegate OnHistoryChanged;
|
||||||
event Windows.Foundation.EventHandler<String> OnTitleChanged;
|
event Windows.Foundation.EventHandler<String> OnTitleChanged;
|
||||||
event Windows.Foundation.EventHandler<String> OnURLChanged;
|
event Windows.Foundation.EventHandler<String> OnURLChanged;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue