|
|
Created:
7 years, 5 months ago by zturner Modified:
7 years, 4 months ago Reviewers:
sky CC:
chromium-reviews, yusukes+watch_chromium.org, jam, penghuang+watch_chromium.org, joi+watch-content_chromium.org, nona+watch_chromium.org, darin-cc_chromium.org, James Su Base URL:
svn://svn.chromium.org/chrome/trunk/src Visibility:
Public. |
DescriptionFix issue where window bounds were being passed with wrong coordinates.
This was causing the date time chooser, and perhaps other controls as
well, to display at the wrong location when popping up.
The RenderWidgetHostView base class dictates that the coordinates to SetBounds() should be in screen coordinates.
BUG=176221
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=214518
Patch Set 1 #
Total comments: 2
Patch Set 2 : Fix indentation issues. #Patch Set 3 : Fix issue with SetSize() adjusting the origin. #
Total comments: 3
Patch Set 4 : Address review comments #Patch Set 5 : Adds unit test to catch coordinate system related errors in the RWHVA. #
Total comments: 2
Patch Set 6 : Address review comments #Patch Set 7 : Fix line endings once and for all (hopefully) #
Messages
Total messages: 19 (0 generated)
jochen@ may be a better reviewer for this patch since he's owner on browser/renderer_host/, but since we already talked about this CL in person I put you on here. Feel free to change to jochen@ if you think it's more appropriate.
LGTM https://codereview.chromium.org/19681003/diff/1/content/browser/renderer_host... File content/browser/renderer_host/render_widget_host_view_aura.cc (right): https://codereview.chromium.org/19681003/diff/1/content/browser/renderer_host... content/browser/renderer_host/render_widget_host_view_aura.cc:762: aura::RootWindow* root_window = window_->GetRootWindow(); Please add a comment as to why this is necessary. https://codereview.chromium.org/19681003/diff/1/content/browser/renderer_host... content/browser/renderer_host/render_widget_host_view_aura.cc:764: aura::client::GetScreenPositionClient(root_window); nit: indent 2 more.
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/zturner@chromium.org/19681003/5001
Retried try job too often on linux_chromeos for step(s) content_browsertests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_chro...
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/zturner@chromium.org/19681003/5001
Retried try job too often on linux_chromeos for step(s) content_browsertests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_chro...
Hi sky@, would you mind reviewing one more time? In theory I have the go ahead to submit this since you already LGTMed, but it broke stuff on linux_chromeos so I had to fix. It's a pretty small CL so I think it should only take a few seconds. to re-review. I had to re-base due to a merge conflict and I forgot to upload the rebase as an individual CL, so the diff between 2 and 3 will be messed up. The change is small enough that you can probably re-review the entire thing, or I can just tell you the differences between 2 and 3: 1) RWHVA::SetBounds() 2) RWHVA::InternalSetBounds() 3) RWHVA::SetSize() The comment in SetSize() explains the reason for the linux_chromeos test failures.
Can you add test coverage of this? https://codereview.chromium.org/19681003/diff/51001/content/browser/renderer_... File content/browser/renderer_host/render_widget_host_view_aura.cc (right): https://codereview.chromium.org/19681003/diff/51001/content/browser/renderer_... content/browser/renderer_host/render_widget_host_view_aura.cc:768: aura::client::GetScreenPositionClient(root); nit: indent 2 more. https://codereview.chromium.org/19681003/diff/51001/content/browser/renderer_... content/browser/renderer_host/render_widget_host_view_aura.cc:778: void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) { Make position match that of header.
https://codereview.chromium.org/19681003/diff/51001/content/browser/renderer_... File content/browser/renderer_host/render_widget_host_view_aura.cc (right): https://codereview.chromium.org/19681003/diff/51001/content/browser/renderer_... content/browser/renderer_host/render_widget_host_view_aura.cc:778: void RenderWidgetHostViewAura::InternalSetBounds(const gfx::Rect& rect) { On 2013/07/25 14:55:31, sky wrote: > Make position match that of header. Ahh, I actually thought I had, but I positioned it relative to MaybeCreateResizeLock(). But that function was also positioned incorrectly, so I've moved both. For some reason, the diff view is showing this as though I moved everything else but these two functions, so the diff view my be confusing.
Created patch sets 4 and 5 to address review comments and add test coverage.
LGTM https://codereview.chromium.org/19681003/diff/75001/content/browser/renderer_... File content/browser/renderer_host/render_widget_host_view_aura_unittest.cc (right): https://codereview.chromium.org/19681003/diff/75001/content/browser/renderer_... content/browser/renderer_host/render_widget_host_view_aura_unittest.cc:229: screen_position_client.reset(new TestScreenPositionClient()); Any reason to use a scoped_ptr here rather than on the stack? https://codereview.chromium.org/19681003/diff/75001/content/browser/renderer_... content/browser/renderer_host/render_widget_host_view_aura_unittest.cc:245: EXPECT_EQ(final_bounds_in_screen, bounds_in_screen); nit: if you compare strings (rect has a ToString() method) on failure you get something readable.
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/zturner@chromium.org/19681003/81001
Retried try job too often on win7_aura for step(s) interactive_ui_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win7_aura&...
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/zturner@chromium.org/19681003/81001
Failed to apply patch for content/browser/renderer_host/render_widget_host_view_aura.cc: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file content/browser/renderer_host/render_widget_host_view_aura.cc Hunk #1 FAILED at 1. 1 out of 1 hunk FAILED -- saving rejects to file content/browser/renderer_host/render_widget_host_view_aura.cc.rej Patch: content/browser/renderer_host/render_widget_host_view_aura.cc Index: content/browser/renderer_host/render_widget_host_view_aura.cc diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index ba4e9b1cd7b162127c8d75f8d944e5e9e9ce8935..46bcaf89fb0cfe7dda83812cfecb0f493cf1d666 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -1,3151 +1,3161 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/renderer_host/render_widget_host_view_aura.h" - -#include "base/bind.h" -#include "base/bind_helpers.h" -#include "base/command_line.h" -#include "base/debug/trace_event.h" -#include "base/logging.h" -#include "base/message_loop/message_loop.h" -#include "base/strings/string_number_conversions.h" -#include "cc/output/compositor_frame.h" -#include "cc/output/compositor_frame_ack.h" -#include "cc/output/copy_output_request.h" -#include "cc/output/copy_output_result.h" -#include "cc/resources/texture_mailbox.h" -#include "content/browser/accessibility/browser_accessibility_manager.h" -#include "content/browser/accessibility/browser_accessibility_state_impl.h" -#include "content/browser/renderer_host/backing_store_aura.h" -#include "content/browser/renderer_host/dip_util.h" -#include "content/browser/renderer_host/overscroll_controller.h" -#include "content/browser/renderer_host/render_view_host_delegate.h" -#include "content/browser/renderer_host/render_widget_host_impl.h" -#include "content/browser/renderer_host/touch_smooth_scroll_gesture_aura.h" -#include "content/browser/renderer_host/ui_events_helper.h" -#include "content/browser/renderer_host/web_input_event_aura.h" -#include "content/common/gpu/client/gl_helper.h" -#include "content/common/gpu/gpu_messages.h" -#include "content/common/view_messages.h" -#include "content/port/browser/render_widget_host_view_frame_subscriber.h" -#include "content/port/browser/render_widget_host_view_port.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/content_browser_client.h" -#include "content/public/browser/render_process_host.h" -#include "content/public/browser/render_view_host.h" -#include "content/public/browser/user_metrics.h" -#include "content/public/common/content_switches.h" -#include "media/base/video_util.h" -#include "skia/ext/image_operations.h" -#include "third_party/WebKit/public/web/WebCompositionUnderline.h" -#include "third_party/WebKit/public/web/WebInputEvent.h" -#include "third_party/WebKit/public/web/WebScreenInfo.h" -#include "ui/aura/client/activation_client.h" -#include "ui/aura/client/aura_constants.h" -#include "ui/aura/client/cursor_client.h" -#include "ui/aura/client/cursor_client_observer.h" -#include "ui/aura/client/focus_client.h" -#include "ui/aura/client/screen_position_client.h" -#include "ui/aura/client/stacking_client.h" -#include "ui/aura/client/tooltip_client.h" -#include "ui/aura/client/window_types.h" -#include "ui/aura/env.h" -#include "ui/aura/root_window.h" -#include "ui/aura/window.h" -#include "ui/aura/window_destruction_observer.h" -#include "ui/aura/window_observer.h" -#include "ui/aura/window_tracker.h" -#include "ui/base/clipboard/scoped_clipboard_writer.h" -#include "ui/base/events/event.h" -#include "ui/base/events/event_utils.h" -#include "ui/base/gestures/gesture_recognizer.h" -#include "ui/base/hit_test.h" -#include "ui/base/ime/input_method.h" -#include "ui/base/ui_base_types.h" -#include "ui/compositor/layer.h" -#include "ui/gfx/canvas.h" -#include "ui/gfx/display.h" -#include "ui/gfx/rect_conversions.h" -#include "ui/gfx/screen.h" -#include "ui/gfx/size_conversions.h" -#include "ui/gfx/skia_util.h" - -#if defined(OS_WIN) -#include "base/win/windows_version.h" -#include "content/browser/accessibility/browser_accessibility_manager_win.h" -#include "content/browser/accessibility/browser_accessibility_win.h" -#include "ui/base/win/hidden_window.h" -#include "ui/gfx/gdi_util.h" -#endif - -using gfx::RectToSkIRect; -using gfx::SkIRectToRect; - -using WebKit::WebScreenInfo; -using WebKit::WebTouchEvent; - -namespace content { -namespace { - -// In mouse lock mode, we need to prevent the (invisible) cursor from hitting -// the border of the view, in order to get valid movement information. However, -// forcing the cursor back to the center of the view after each mouse move -// doesn't work well. It reduces the frequency of useful mouse move messages -// significantly. Therefore, we move the cursor to the center of the view only -// if it approaches the border. |kMouseLockBorderPercentage| specifies the width -// of the border area, in percentage of the corresponding dimension. -const int kMouseLockBorderPercentage = 15; - -// When accelerated compositing is enabled and a widget resize is pending, -// we delay further resizes of the UI. The following constant is the maximum -// length of time that we should delay further UI resizes while waiting for a -// resized frame from a renderer. -const int kResizeLockTimeoutMs = 67; - -#if defined(OS_WIN) -// Used to associate a plugin HWND with its RenderWidgetHostViewAura instance. -const wchar_t kWidgetOwnerProperty[] = L"RenderWidgetHostViewAuraOwner"; - -BOOL CALLBACK WindowDestroyingCallback(HWND window, LPARAM param) { - RenderWidgetHostViewAura* widget = - reinterpret_cast<RenderWidgetHostViewAura*>(param); - if (GetProp(window, kWidgetOwnerProperty) == widget) { - // Properties set on HWNDs must be removed to avoid leaks. - RemoveProp(window, kWidgetOwnerProperty); - RenderWidgetHostViewBase::DetachPluginWindowsCallback(window); - } - return TRUE; -} - -BOOL CALLBACK HideWindowsCallback(HWND window, LPARAM param) { - RenderWidgetHostViewAura* widget = - reinterpret_cast<RenderWidgetHostViewAura*>(param); - if (GetProp(window, kWidgetOwnerProperty) == widget) - SetParent(window, ui::GetHiddenWindow()); - return TRUE; -} - -BOOL CALLBACK ShowWindowsCallback(HWND window, LPARAM param) { - RenderWidgetHostViewAura* widget = - reinterpret_cast<RenderWidgetHostViewAura*>(param); - - if (GetProp(window, kWidgetOwnerProperty) == widget) { - HWND parent = - widget->GetNativeView()->GetRootWindow()->GetAcceleratedWidget(); - SetParent(window, parent); - } - return TRUE; -} - -struct CutoutRectsParams { - RenderWidgetHostViewAura* widget; - std::vector<gfx::Rect> cutout_rects; - std::map<HWND, WebPluginGeometry>* geometry; -}; - -// Used to update the region for the windowed plugin to draw in. We start with -// the clip rect from the renderer, then remove the cutout rects from the -// renderer, and then remove the transient windows from the root window and the -// constrained windows from the parent window. -BOOL CALLBACK SetCutoutRectsCallback(HWND window, LPARAM param) { - CutoutRectsParams* params = reinterpret_cast<CutoutRectsParams*>(param); - - if (GetProp(window, kWidgetOwnerProperty) == params->widget) { - // First calculate the offset of this plugin from the root window, since - // the cutouts are relative to the root window. - HWND parent = params->widget->GetNativeView()->GetRootWindow()-> - GetAcceleratedWidget(); - POINT offset; - offset.x = offset.y = 0; - MapWindowPoints(window, parent, &offset, 1); - - // Now get the cached clip rect and cutouts for this plugin window that came - // from the renderer. - std::map<HWND, WebPluginGeometry>::iterator i = params->geometry->begin(); - while (i != params->geometry->end() && - i->second.window != window && - GetParent(i->second.window) != window) { - ++i; - } - - if (i == params->geometry->end()) { - NOTREACHED(); - return TRUE; - } - - HRGN hrgn = CreateRectRgn(i->second.clip_rect.x(), - i->second.clip_rect.y(), - i->second.clip_rect.right(), - i->second.clip_rect.bottom()); - // We start with the cutout rects that came from the renderer, then add the - // ones that came from transient and constrained windows. - std::vector<gfx::Rect> cutout_rects = i->second.cutout_rects; - for (size_t i = 0; i < params->cutout_rects.size(); ++i) { - gfx::Rect offset_cutout = params->cutout_rects[i]; - offset_cutout.Offset(-offset.x, -offset.y); - cutout_rects.push_back(offset_cutout); - } - gfx::SubtractRectanglesFromRegion(hrgn, cutout_rects); - SetWindowRgn(window, hrgn, TRUE); - } - return TRUE; -} - -// A callback function for EnumThreadWindows to enumerate and dismiss -// any owned popup windows. -BOOL CALLBACK DismissOwnedPopups(HWND window, LPARAM arg) { - const HWND toplevel_hwnd = reinterpret_cast<HWND>(arg); - - if (::IsWindowVisible(window)) { - const HWND owner = ::GetWindow(window, GW_OWNER); - if (toplevel_hwnd == owner) { - ::PostMessage(window, WM_CANCELMODE, 0, 0); - } - } - - return TRUE; -} -#endif - -void UpdateWebTouchEventAfterDispatch(WebKit::WebTouchEvent* event, - WebKit::WebTouchPoint* point) { - if (point->state != WebKit::WebTouchPoint::StateReleased && - point->state != WebKit::WebTouchPoint::StateCancelled) - return; - --event->touchesLength; - for (unsigned i = point - event->touches; - i < event->touchesLength; - ++i) … (message too large)
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/zturner@chromium.org/19681003/104001
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/zturner@chromium.org/19681003/104001
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/zturner@chromium.org/19681003/104001
Message was sent while issue was closed.
Change committed as 214518 |