Commit 98092490 authored by MozLando's avatar MozLando
Browse files

Merge #5066



5066: Add setDynamicToolbarMaxHeight API r=pocmo a=hiikezoe
Co-authored-by: default avatarHiroyuki Ikezoe <hiroyuki.ikezoe@gmail.com>
parents 4a3f8fd0 056ad9f7
......@@ -141,6 +141,10 @@ class GeckoEngineView @JvmOverloads constructor(
currentGeckoView.setVerticalClipping(clippingHeight)
}
override fun setDynamicToolbarMaxHeight(height: Int) {
// no-op
}
override fun captureThumbnail(onFinish: (Bitmap?) -> Unit) {
val geckoResult = currentGeckoView.capturePixels()
geckoResult.then({ bitmap ->
......
......@@ -141,6 +141,10 @@ class GeckoEngineView @JvmOverloads constructor(
currentGeckoView.setVerticalClipping(clippingHeight)
}
override fun setDynamicToolbarMaxHeight(height: Int) {
currentGeckoView.setDynamicToolbarMaxHeight(height)
}
override fun captureThumbnail(onFinish: (Bitmap?) -> Unit) {
val geckoResult = currentGeckoView.capturePixels()
geckoResult.then({ bitmap ->
......
......@@ -85,6 +85,16 @@ class GeckoEngineViewTest {
verify(engineView.currentGeckoView).setVerticalClipping(42)
}
@Test
fun `setDynamicToolbarMaxHeight is forwarded to GeckoView instance`() {
val engineView = GeckoEngineView(context)
engineView.currentGeckoView = mock()
engineView.setDynamicToolbarMaxHeight(42)
verify(engineView.currentGeckoView).setDynamicToolbarMaxHeight(42)
}
@Test
fun `release method releases session from GeckoView`() {
val engineView = GeckoEngineView(context)
......
......@@ -118,6 +118,10 @@ class GeckoEngineView @JvmOverloads constructor(
currentGeckoView.setVerticalClipping(clippingHeight)
}
override fun setDynamicToolbarMaxHeight(height: Int) {
// no-op
}
override fun captureThumbnail(onFinish: (Bitmap?) -> Unit) {
val geckoResult = currentGeckoView.capturePixels()
geckoResult.then({ bitmap ->
......
......@@ -654,6 +654,10 @@ class SystemEngineView @JvmOverloads constructor(
// no-op
}
override fun setDynamicToolbarMaxHeight(height: Int) {
// no-op
}
override fun canScrollVerticallyUp() = session?.webView?.canScrollVertically(-1) ?: false
override fun canScrollVerticallyDown() = session?.webView?.canScrollVertically(1) ?: false
......
......@@ -95,6 +95,13 @@ interface EngineView {
* @param clippingHeight The height of the bottom clipped space in screen pixels.
*/
fun setVerticalClipping(clippingHeight: Int)
/**
* Sets the maximum height of the dynamic toolbar(s).
*
* @param height The maximum possible height of the toolbar.
*/
fun setDynamicToolbarMaxHeight(height: Int)
}
/**
......
......@@ -61,6 +61,7 @@ class EngineViewTest {
open class DummyEngineView(context: Context) : FrameLayout(context), EngineView {
override fun setVerticalClipping(clippingHeight: Int) {}
override fun setDynamicToolbarMaxHeight(height: Int) {}
override fun captureThumbnail(onFinish: (Bitmap?) -> Unit) = Unit
override fun render(session: EngineSession) {}
override fun release() {}
......@@ -69,6 +70,7 @@ class EngineViewTest {
// Class it not actually a View!
open class BrokenEngineView : EngineView {
override fun setVerticalClipping(clippingHeight: Int) {}
override fun setDynamicToolbarMaxHeight(height: Int) {}
override fun captureThumbnail(onFinish: (Bitmap?) -> Unit) = Unit
override fun render(session: EngineSession) {}
override fun release() {}
......
......@@ -94,6 +94,7 @@ class SwipeRefreshFeatureTest {
private open class DummyEngineView(context: Context) : FrameLayout(context), EngineView {
override fun canScrollVerticallyUp() = scrollY > 0
override fun setVerticalClipping(clippingHeight: Int) {}
override fun setDynamicToolbarMaxHeight(height: Int) {}
override fun captureThumbnail(onFinish: (Bitmap?) -> Unit) = Unit
override fun render(session: EngineSession) {}
override fun release() {}
......
......@@ -63,6 +63,8 @@ class FakeEngineView(context: Context) : TextView(context), EngineView {
override fun setVerticalClipping(clippingHeight: Int) {}
override fun setDynamicToolbarMaxHeight(height: Int) {}
override fun release() {}
}
......
......@@ -96,6 +96,9 @@ permalink: /changelog/
sitePermissions[Permission.LOCATION] // ALLOWED will be returned
```
* **engine-gecko-nightly**
* Adds setDynamicToolbarMaxHeight ApI.
* **feature-push**
* Added `unsubscribeAll` support from the Rust native layer.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment