~osomon/webbrowser-app/locationBarController

« back to all changes in this revision

Viewing changes to src/app/webbrowser/Browser.qml

  • Committer: Olivier Tilloy
  • Date: 2015-03-25 11:21:51 UTC
  • Revision ID: olivier.tilloy@canonical.com-20150325112151-jeudcyu6uyqs0tbm
Factor out duplicated code into the common ChromeController component.

Show diffs side-by-side

added added

removed removed

Lines of Context:
493
493
 
494
494
                enabled: visible && !bottomEdgeHandle.dragging && !recentView.visible
495
495
 
496
 
                readonly property bool nearBottom: ((contentY + viewportHeight) / contentHeight) >= 0.98
 
496
                ChromeController {
 
497
                    id: chromeController
 
498
                    webview: webviewimpl
 
499
                    forceHide: recentView.visible
 
500
                }
 
501
 
497
502
                locationBarController {
498
503
                    height: webviewimpl.visible ? chrome.height : 0
499
 
                    mode: {
500
 
                        if (webviewimpl.loading || webviewimpl.forceShow) {
501
 
                            return Oxide.LocationBarController.ModeShown
502
 
                        } else if (webviewimpl.fullscreen || recentView.visible) {
503
 
                            return Oxide.LocationBarController.ModeHidden
504
 
                        } else if (webviewimpl.nearBottom) {
505
 
                            return Oxide.LocationBarController.ModeShown
506
 
                        } else {
507
 
                            return Oxide.LocationBarController.ModeAuto
508
 
                        }
509
 
                    }
510
 
                }
511
 
 
512
 
                // Work around the lack of a show() method on the location bar controller
513
 
                // (https://launchpad.net/bugs/1422920) by forcing its mode to ModeShown
514
 
                // for long enough (1000ms) to allow the animation to be committed.
515
 
                property bool forceShow: false
516
 
                Timer {
517
 
                    id: delayedResetMode
518
 
                    interval: 1000
519
 
                    onTriggered: forceShow = false
520
 
                }
521
 
                onFullscreenChanged: {
522
 
                    if (!fullscreen) {
523
 
                        forceShow = true
524
 
                        delayedResetMode.restart()
525
 
                    }
 
504
                    mode: chromeController.mode
526
505
                }
527
506
 
528
507
                //experimental.preferences.developerExtrasEnabled: developerExtrasEnabled