org.chromium.chrome.browser.tabmodel.TabModelImpl Java Examples
The following examples show how to use
org.chromium.chrome.browser.tabmodel.TabModelImpl.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Tab.java From AndroidChromium with Apache License 2.0 | 6 votes |
/** * Called when offset values related with fullscreen functionality has been changed by the * compositor. * @param topControlsOffsetY The Y offset of the top controls in physical pixels. * @param bottomControlsOffsetY The Y offset of the bottom controls in physical pixels. * @param contentOffsetY The Y offset of the content in physical pixels. * @param isNonFullscreenPage Whether a current page is non-fullscreen page or not. */ private void onOffsetsChanged( float topControlsOffsetY, float bottomControlsOffsetY, float contentOffsetY, boolean isNonFullscreenPage) { mPreviousTopControlsOffsetY = topControlsOffsetY; mPreviousBottomControlsOffsetY = bottomControlsOffsetY; mPreviousContentOffsetY = contentOffsetY; if (mFullscreenManager == null) return; if (isNonFullscreenPage || isNativePage()) { mFullscreenManager.setPositionsForTabToNonFullscreen(); } else { mFullscreenManager.setPositionsForTab(topControlsOffsetY, bottomControlsOffsetY, contentOffsetY); } TabModelImpl.setActualTabSwitchLatencyMetricRequired(); }
Example #2
Source File: Tab.java From 365browser with Apache License 2.0 | 6 votes |
/** * Called when offset values related with fullscreen functionality has been changed by the * compositor. * @param topControlsOffsetY The Y offset of the top controls in physical pixels. * {@code Float.NaN} if the value is invalid and the cached value should be used. * @param bottomControlsOffsetY The Y offset of the bottom controls in physical pixels. * {@code Float.NaN} if the value is invalid and the cached value should be used. * @param contentOffsetY The Y offset of the content in physical pixels. */ void onOffsetsChanged( float topControlsOffsetY, float bottomControlsOffsetY, float contentOffsetY) { if (!Float.isNaN(topControlsOffsetY)) mPreviousTopControlsOffsetY = topControlsOffsetY; if (!Float.isNaN(bottomControlsOffsetY)) { mPreviousBottomControlsOffsetY = bottomControlsOffsetY; } if (!Float.isNaN(contentOffsetY)) mPreviousContentOffsetY = contentOffsetY; if (mFullscreenManager == null) return; if (isShowingSadTab() || isNativePage()) { mFullscreenManager.setPositionsForTabToNonFullscreen(); } else { mFullscreenManager.setPositionsForTab(mPreviousTopControlsOffsetY, mPreviousBottomControlsOffsetY, mPreviousContentOffsetY); } TabModelImpl.setActualTabSwitchLatencyMetricRequired(); }
Example #3
Source File: Tab.java From delion with Apache License 2.0 | 5 votes |
/** * Called when offset values related with fullscreen functionality has been changed by the * compositor. * @param topControlsOffsetY The Y offset of the top controls in physical pixels. * @param contentOffsetY The Y offset of the content in physical pixels. * @param isNonFullscreenPage Whether a current page is non-fullscreen page or not. */ private void onOffsetsChanged(float topControlsOffsetY, float contentOffsetY, boolean isNonFullscreenPage) { mPreviousFullscreenTopControlsOffsetY = topControlsOffsetY; mPreviousFullscreenContentOffsetY = contentOffsetY; if (mFullscreenManager == null) return; if (isNonFullscreenPage || isNativePage()) { mFullscreenManager.setPositionsForTabToNonFullscreen(); } else { mFullscreenManager.setPositionsForTab(topControlsOffsetY, contentOffsetY); } TabModelImpl.setActualTabSwitchLatencyMetricRequired(); }
Example #4
Source File: CompositorView.java From AndroidChromium with Apache License 2.0 | 5 votes |
/** * Converts the layout into compositor layers. This is to be called on every frame the layout * is changing. * @param provider Provides the layout to be rendered. * @param forRotation Whether or not this is a special draw during a rotation. */ public void finalizeLayers(final LayoutProvider provider, boolean forRotation, final DrawingInfo progressBarDrawingInfo) { TraceEvent.begin("CompositorView:finalizeLayers"); Layout layout = provider.getActiveLayout(); if (layout == null || mNativeCompositorView == 0) { TraceEvent.end("CompositorView:finalizeLayers"); return; } if (!mPreloadedResources) { // Attempt to prefetch any necessary resources mResourceManager.preloadResources(AndroidResourceType.STATIC, StaticResourcePreloads.getSynchronousResources(getContext()), StaticResourcePreloads.getAsynchronousResources(getContext())); mPreloadedResources = true; } // IMPORTANT: Do not do anything that impacts the compositor layer tree before this line. // If you do, you could inadvertently trigger follow up renders. For further information // see dtrainor@, tedchoc@, or klobag@. provider.getViewportPixel(mCacheViewport); nativeSetLayoutBounds(mNativeCompositorView); SceneLayer sceneLayer = provider.getUpdatedActiveSceneLayer(mCacheViewport, mLayerTitleCache, mTabContentManager, mResourceManager, provider.getFullscreenManager()); nativeSetSceneLayer(mNativeCompositorView, sceneLayer); final LayoutTab[] tabs = layout.getLayoutTabsToRender(); final int tabsCount = tabs != null ? tabs.length : 0; mLastLayerCount = tabsCount; TabModelImpl.flushActualTabSwitchLatencyMetric(); nativeFinalizeLayers(mNativeCompositorView); TraceEvent.end("CompositorView:finalizeLayers"); }
Example #5
Source File: CompositorView.java From 365browser with Apache License 2.0 | 5 votes |
/** * Converts the layout into compositor layers. This is to be called on every frame the layout * is changing. * @param provider Provides the layout to be rendered. * @param forRotation Whether or not this is a special draw during a rotation. */ public void finalizeLayers(final LayoutProvider provider, boolean forRotation, final DrawingInfo progressBarDrawingInfo) { TraceEvent.begin("CompositorView:finalizeLayers"); Layout layout = provider.getActiveLayout(); if (layout == null || mNativeCompositorView == 0) { TraceEvent.end("CompositorView:finalizeLayers"); return; } if (!mPreloadedResources) { // Attempt to prefetch any necessary resources mResourceManager.preloadResources(AndroidResourceType.STATIC, StaticResourcePreloads.getSynchronousResources(getContext()), StaticResourcePreloads.getAsynchronousResources(getContext())); mPreloadedResources = true; } // IMPORTANT: Do not do anything that impacts the compositor layer tree before this line. // If you do, you could inadvertently trigger follow up renders. For further information // see dtrainor@, tedchoc@, or klobag@. nativeSetLayoutBounds(mNativeCompositorView); SceneLayer sceneLayer = provider.getUpdatedActiveSceneLayer(mLayerTitleCache, mTabContentManager, mResourceManager, provider.getFullscreenManager()); nativeSetSceneLayer(mNativeCompositorView, sceneLayer); TabModelImpl.flushActualTabSwitchLatencyMetric(); nativeFinalizeLayers(mNativeCompositorView); TraceEvent.end("CompositorView:finalizeLayers"); }
Example #6
Source File: CompositorView.java From delion with Apache License 2.0 | 4 votes |
/** * Converts the layout into compositor layers. This is to be called on every frame the layout * is changing. * @param provider Provides the layout to be rendered. * @param forRotation Whether or not this is a special draw during a rotation. */ public void finalizeLayers(final LayoutProvider provider, boolean forRotation, final DrawingInfo progressBarDrawingInfo) { TraceEvent.begin("CompositorView:finalizeLayers"); Layout layout = provider.getActiveLayout(); if (layout == null || mNativeCompositorView == 0) { TraceEvent.end("CompositorView:finalizeLayers"); return; } if (!mPreloadedResources) { // Attempt to prefetch any necessary resources mResourceManager.preloadResources(AndroidResourceType.STATIC, StaticResourcePreloads.getSynchronousResources(getContext()), StaticResourcePreloads.getAsynchronousResources(getContext())); mPreloadedResources = true; } // IMPORTANT: Do not do anything that impacts the compositor layer tree before this line. // If you do, you could inadvertently trigger follow up renders. For further information // see dtrainor@, tedchoc@, or klobag@. // TODO(jscholler): change 1.0f to dpToPx once the native part is fully supporting dp. mRenderHost.getVisibleViewport(mCacheVisibleViewport); mCacheVisibleViewport.right = mCacheVisibleViewport.left + mSurfaceWidth; mCacheVisibleViewport.bottom = mCacheVisibleViewport.top + mSurfaceHeight; provider.getViewportPixel(mCacheViewport); nativeSetLayoutViewport(mNativeCompositorView, mCacheViewport.left, mCacheViewport.top, mCacheViewport.width(), mCacheViewport.height(), mCacheVisibleViewport.left, mCacheVisibleViewport.top, 1.0f); SceneLayer sceneLayer = provider.getUpdatedActiveSceneLayer(mCacheViewport, mCacheVisibleViewport, mLayerTitleCache, mTabContentManager, mResourceManager, provider.getFullscreenManager()); nativeSetSceneLayer(mNativeCompositorView, sceneLayer); final LayoutTab[] tabs = layout.getLayoutTabsToRender(); final int tabsCount = tabs != null ? tabs.length : 0; mLastLayerCount = tabsCount; TabModelImpl.flushActualTabSwitchLatencyMetric(); nativeFinalizeLayers(mNativeCompositorView); TraceEvent.end("CompositorView:finalizeLayers"); }