Merge lp:~unity-team/oxide/locationBarHeightOnScreenChange into lp:~oxide-developers/oxide/oxide.trunk

Proposed by Gerry Boland
Status: Merged
Merged at revision: 1462
Proposed branch: lp:~unity-team/oxide/locationBarHeightOnScreenChange
Merge into: lp:~oxide-developers/oxide/oxide.trunk
Diff against target: 80 lines (+17/-2)
3 files modified
qt/core/browser/oxide_qt_contents_view.cc (+6/-0)
qt/core/browser/oxide_qt_web_view.cc (+8/-2)
qt/core/browser/oxide_qt_web_view.h (+3/-0)
To merge this branch: bzr merge lp:~unity-team/oxide/locationBarHeightOnScreenChange
Reviewer Review Type Date Requested Status
Chris Coulson Needs Fixing
Michał Sawicz (community) Needs Fixing
Review via email: mp+293278@code.launchpad.net

Commit message

On screen scale change, need to recalculate the height of the location bar in terms of the new scale

To post a comment you must log in.
Revision history for this message
Michał Sawicz (saviq) wrote :

../../../../qt/core/browser/oxide_qt_web_view.cc: In member function ‘virtual void oxide::qt::WebView::updateLocationBarHeight() const’:
../../../../qt/core/browser/oxide_qt_web_view.cc:942:44: error: passing ‘const oxide::qt::WebView’ as ‘this’ argument discards qualifiers [-fpermissive]
   setLocationBarHeight(location_bar_height_);
                                            ^
../../../../qt/core/browser/oxide_qt_web_view.cc:934:6: note: in call to ‘virtual void oxide::qt::WebView::setLocationBarHeight(int)’
 void WebView::setLocationBarHeight(int height) {

:/

review: Needs Fixing
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Thanks, I've left a couple of comments inline

review: Needs Fixing
Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Thanks, there's a couple of bits that can be deleted now (see the comments inline)

review: Needs Fixing
Revision history for this message
Gerry Boland (gerboland) wrote :

Yep, done that (hadn't pushed), but now the offset of the location bar is wrong. Investigating (and marked the MP WIP, to avoid annoying you until I'm ready)

Revision history for this message
Gerry Boland (gerboland) wrote :

Chris has tested and not seeing the issue I was finding. I blame a deployment problem on my end. I'm going to double-check it, but this should be good to go

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qt/core/browser/oxide_qt_contents_view.cc'
2--- qt/core/browser/oxide_qt_contents_view.cc 2016-04-20 22:09:41 +0000
3+++ qt/core/browser/oxide_qt_contents_view.cc 2016-04-29 13:18:57 +0000
4@@ -54,6 +54,7 @@
5 #include "oxide_qt_type_conversions.h"
6 #include "oxide_qt_web_context_menu.h"
7 #include "oxide_qt_web_popup_menu.h"
8+#include "oxide_qt_web_view.h"
9
10 namespace oxide {
11 namespace qt {
12@@ -274,6 +275,11 @@
13
14 void ContentsView::screenUpdated() {
15 view()->ScreenUpdated();
16+
17+ // FIXME - need to recalculate location bar height in case scale changed
18+ oxide::qt::WebView::FromView(
19+ oxide::WebView::FromWebContents(view()->GetWebContents()))
20+ ->RescaleLocationBarHeight();
21 }
22
23 QVariant ContentsView::inputMethodQuery(Qt::InputMethodQuery query) const {
24
25=== modified file 'qt/core/browser/oxide_qt_web_view.cc'
26--- qt/core/browser/oxide_qt_web_view.cc 2016-04-21 09:53:42 +0000
27+++ qt/core/browser/oxide_qt_web_view.cc 2016-04-29 13:18:57 +0000
28@@ -249,6 +249,7 @@
29 : contents_view_(new ContentsView(view_client, handle)),
30 client_(client),
31 security_status_(security_status),
32+ location_bar_height_(0),
33 frame_tree_torn_down_(false) {
34 DCHECK(client);
35 DCHECK(handle);
36@@ -946,16 +947,21 @@
37 }
38
39 int WebView::locationBarHeight() const {
40- return DpiUtils::ConvertChromiumPixelsToQt(
41- web_view_->GetLocationBarHeight(), contents_view_->GetScreen());
42+ return location_bar_height_;
43 }
44
45 void WebView::setLocationBarHeight(int height) {
46+ location_bar_height_ = height;
47 web_view_->SetLocationBarHeight(
48 DpiUtils::ConvertQtPixelsToChromium(height,
49 contents_view_->GetScreen()));
50 }
51
52+ // FIXME: called on screen change, to recalculate location bar height if scale changed
53+void WebView::RescaleLocationBarHeight() {
54+ setLocationBarHeight(location_bar_height_);
55+}
56+
57 int WebView::locationBarOffset() const {
58 return DpiUtils::ConvertChromiumPixelsToQt(
59 web_view_->GetLocationBarOffset(), contents_view_->GetScreen());
60
61=== modified file 'qt/core/browser/oxide_qt_web_view.h'
62--- qt/core/browser/oxide_qt_web_view.h 2016-04-20 22:09:41 +0000
63+++ qt/core/browser/oxide_qt_web_view.h 2016-04-29 13:18:57 +0000
64@@ -88,6 +88,8 @@
65
66 const oxide::SecurityStatus& GetSecurityStatus() const;
67
68+ void RescaleLocationBarHeight(); //FIXME: called on screen change only
69+
70 private:
71 WebView(WebViewProxyClient* client,
72 ContentsViewProxyClient* view_client,
73@@ -276,6 +278,7 @@
74 QPointer<OxideQSecurityStatus> security_status_;
75 QList<QObject*> message_handlers_;
76
77+ int location_bar_height_;
78 bool frame_tree_torn_down_;
79
80 std::unique_ptr<content::HostZoomMap::Subscription> track_zoom_subscription_;

Subscribers

People subscribed via source and target branches

to all changes: