Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.mm

Issue 248383002: Revert of mac: History swiping doesn't work right with iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 #include <QuartzCore/QuartzCore.h> 8 #include <QuartzCore/QuartzCore.h>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 return ui::GetImageScale(ui::GetScaleFactorForNativeView(view)); 136 return ui::GetImageScale(ui::GetScaleFactorForNativeView(view));
137 } 137 }
138 138
139 // Private methods: 139 // Private methods:
140 @interface RenderWidgetHostViewCocoa () 140 @interface RenderWidgetHostViewCocoa ()
141 @property(nonatomic, assign) NSRange selectedRange; 141 @property(nonatomic, assign) NSRange selectedRange;
142 @property(nonatomic, assign) NSRange markedRange; 142 @property(nonatomic, assign) NSRange markedRange;
143 143
144 + (BOOL)shouldAutohideCursorForEvent:(NSEvent*)event; 144 + (BOOL)shouldAutohideCursorForEvent:(NSEvent*)event;
145 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r; 145 - (id)initWithRenderWidgetHostViewMac:(RenderWidgetHostViewMac*)r;
146 - (void)gotWheelEventConsumed:(BOOL)consumed; 146 - (void)gotUnhandledWheelEvent;
147 - (void)scrollOffsetPinnedToLeft:(BOOL)left toRight:(BOOL)right;
148 - (void)setHasHorizontalScrollbar:(BOOL)has_horizontal_scrollbar;
147 - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv; 149 - (void)keyEvent:(NSEvent*)theEvent wasKeyEquivalent:(BOOL)equiv;
148 - (void)windowDidChangeBackingProperties:(NSNotification*)notification; 150 - (void)windowDidChangeBackingProperties:(NSNotification*)notification;
149 - (void)windowChangedGlobalFrame:(NSNotification*)notification; 151 - (void)windowChangedGlobalFrame:(NSNotification*)notification;
150 - (void)drawBackingStore:(BackingStoreMac*)backingStore 152 - (void)drawBackingStore:(BackingStoreMac*)backingStore
151 dirtyRect:(CGRect)dirtyRect 153 dirtyRect:(CGRect)dirtyRect
152 inContext:(CGContextRef)context; 154 inContext:(CGContextRef)context;
153 - (void)checkForPluginImeCancellation; 155 - (void)checkForPluginImeCancellation;
154 - (void)updateScreenProperties; 156 - (void)updateScreenProperties;
155 - (void)setResponderDelegate: 157 - (void)setResponderDelegate:
156 (NSObject<RenderWidgetHostViewMacDelegate>*)delegate; 158 (NSObject<RenderWidgetHostViewMacDelegate>*)delegate;
(...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 } 1855 }
1854 1856
1855 gfx::GLSurfaceHandle RenderWidgetHostViewMac::GetCompositingSurface() { 1857 gfx::GLSurfaceHandle RenderWidgetHostViewMac::GetCompositingSurface() {
1856 // TODO(kbr): may be able to eliminate PluginWindowHandle argument 1858 // TODO(kbr): may be able to eliminate PluginWindowHandle argument
1857 // completely on Mac OS. 1859 // completely on Mac OS.
1858 return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::NATIVE_TRANSPORT); 1860 return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::NATIVE_TRANSPORT);
1859 } 1861 }
1860 1862
1861 void RenderWidgetHostViewMac::SetHasHorizontalScrollbar( 1863 void RenderWidgetHostViewMac::SetHasHorizontalScrollbar(
1862 bool has_horizontal_scrollbar) { 1864 bool has_horizontal_scrollbar) {
1865 [cocoa_view_ setHasHorizontalScrollbar:has_horizontal_scrollbar];
1863 } 1866 }
1864 1867
1865 void RenderWidgetHostViewMac::SetScrollOffsetPinning( 1868 void RenderWidgetHostViewMac::SetScrollOffsetPinning(
1866 bool is_pinned_to_left, bool is_pinned_to_right) { 1869 bool is_pinned_to_left, bool is_pinned_to_right) {
1870 [cocoa_view_ scrollOffsetPinnedToLeft:is_pinned_to_left
1871 toRight:is_pinned_to_right];
1867 } 1872 }
1868 1873
1869 bool RenderWidgetHostViewMac::LockMouse() { 1874 bool RenderWidgetHostViewMac::LockMouse() {
1870 if (mouse_locked_) 1875 if (mouse_locked_)
1871 return true; 1876 return true;
1872 1877
1873 mouse_locked_ = true; 1878 mouse_locked_ = true;
1874 1879
1875 // Lock position of mouse cursor and hide it. 1880 // Lock position of mouse cursor and hide it.
1876 CGAssociateMouseAndMouseCursorPosition(NO); 1881 CGAssociateMouseAndMouseCursorPosition(NO);
(...skipping 11 matching lines...) Expand all
1888 mouse_locked_ = false; 1893 mouse_locked_ = false;
1889 1894
1890 // Unlock position of mouse cursor and unhide it. 1895 // Unlock position of mouse cursor and unhide it.
1891 CGAssociateMouseAndMouseCursorPosition(YES); 1896 CGAssociateMouseAndMouseCursorPosition(YES);
1892 [NSCursor unhide]; 1897 [NSCursor unhide];
1893 1898
1894 if (render_widget_host_) 1899 if (render_widget_host_)
1895 render_widget_host_->LostMouseLock(); 1900 render_widget_host_->LostMouseLock();
1896 } 1901 }
1897 1902
1898 void RenderWidgetHostViewMac::HandledWheelEvent( 1903 void RenderWidgetHostViewMac::UnhandledWheelEvent(
1899 const blink::WebMouseWheelEvent& event, 1904 const blink::WebMouseWheelEvent& event) {
1900 bool consumed) { 1905 // Only record a wheel event as unhandled if JavaScript handlers got a chance
1906 // to see it (no-op wheel events are ignored by the event dispatcher)
1901 if (event.deltaX || event.deltaY) 1907 if (event.deltaX || event.deltaY)
1902 [cocoa_view_ gotWheelEventConsumed:consumed]; 1908 [cocoa_view_ gotUnhandledWheelEvent];
1903 } 1909 }
1904 1910
1905 bool RenderWidgetHostViewMac::Send(IPC::Message* message) { 1911 bool RenderWidgetHostViewMac::Send(IPC::Message* message) {
1906 if (render_widget_host_) 1912 if (render_widget_host_)
1907 return render_widget_host_->Send(message); 1913 return render_widget_host_->Send(message);
1908 delete message; 1914 delete message;
1909 return false; 1915 return false;
1910 } 1916 }
1911 1917
1912 void RenderWidgetHostViewMac::SoftwareFrameWasFreed( 1918 void RenderWidgetHostViewMac::SoftwareFrameWasFreed(
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
2351 responderDelegate_.reset([delegate retain]); 2357 responderDelegate_.reset([delegate retain]);
2352 } 2358 }
2353 2359
2354 - (void)resetCursorRects { 2360 - (void)resetCursorRects {
2355 if (currentCursor_) { 2361 if (currentCursor_) {
2356 [self addCursorRect:[self visibleRect] cursor:currentCursor_]; 2362 [self addCursorRect:[self visibleRect] cursor:currentCursor_];
2357 [currentCursor_ setOnMouseEntered:YES]; 2363 [currentCursor_ setOnMouseEntered:YES];
2358 } 2364 }
2359 } 2365 }
2360 2366
2361 - (void)gotWheelEventConsumed:(BOOL)consumed { 2367 - (void)gotUnhandledWheelEvent {
2362 [responderDelegate_ gotWheelEventConsumed:consumed]; 2368 if (responderDelegate_ &&
2369 [responderDelegate_
2370 respondsToSelector:@selector(gotUnhandledWheelEvent)]) {
2371 [responderDelegate_ gotUnhandledWheelEvent];
2372 }
2373 }
2374
2375 - (void)scrollOffsetPinnedToLeft:(BOOL)left toRight:(BOOL)right {
2376 if (responderDelegate_ &&
2377 [responderDelegate_
2378 respondsToSelector:@selector(scrollOffsetPinnedToLeft:toRight:)]) {
2379 [responderDelegate_ scrollOffsetPinnedToLeft:left toRight:right];
2380 }
2381 }
2382
2383 - (void)setHasHorizontalScrollbar:(BOOL)has_horizontal_scrollbar {
2384 if (responderDelegate_ &&
2385 [responderDelegate_
2386 respondsToSelector:@selector(setHasHorizontalScrollbar:)]) {
2387 [responderDelegate_ setHasHorizontalScrollbar:has_horizontal_scrollbar];
2388 }
2363 } 2389 }
2364 2390
2365 - (BOOL)respondsToSelector:(SEL)selector { 2391 - (BOOL)respondsToSelector:(SEL)selector {
2366 // Trickiness: this doesn't mean "does this object's superclass respond to 2392 // Trickiness: this doesn't mean "does this object's superclass respond to
2367 // this selector" but rather "does the -respondsToSelector impl from the 2393 // this selector" but rather "does the -respondsToSelector impl from the
2368 // superclass say that this class responds to the selector". 2394 // superclass say that this class responds to the selector".
2369 if ([super respondsToSelector:selector]) 2395 if ([super respondsToSelector:selector])
2370 return YES; 2396 return YES;
2371 2397
2372 if (responderDelegate_) 2398 if (responderDelegate_)
(...skipping 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after
4296 } 4322 }
4297 4323
4298 - (void)disableRendering { 4324 - (void)disableRendering {
4299 // Disable the fade-out animation as the layer is removed. 4325 // Disable the fade-out animation as the layer is removed.
4300 ScopedCAActionDisabler disabler; 4326 ScopedCAActionDisabler disabler;
4301 [self removeFromSuperlayer]; 4327 [self removeFromSuperlayer];
4302 renderWidgetHostView_ = nil; 4328 renderWidgetHostView_ = nil;
4303 } 4329 }
4304 4330
4305 @end // implementation SoftwareLayer 4331 @end // implementation SoftwareLayer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698