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

Side by Side Diff: Source/WebCore/platform/mac/ScrollViewMac.mm

Issue 13713003: Remove all of WebCore/platform/mac which is not mentioned in WebCore.gypi. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added back a couple needed headers Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2004, 2006, 2007, 2008 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26 #import "config.h"
27 #import "ScrollView.h"
28
29 #import "BlockExceptions.h"
30 #import "FloatRect.h"
31 #import "IntRect.h"
32 #import "Logging.h"
33 #import "NotImplemented.h"
34 #import "WebCoreFrameView.h"
35 #import <wtf/UnusedParam.h>
36
37 using namespace std;
38
39 @interface NSWindow (WebWindowDetails)
40 - (BOOL)_needsToResetDragMargins;
41 - (void)_setNeedsToResetDragMargins:(BOOL)needs;
42 @end
43
44 namespace WebCore {
45
46 inline NSScrollView<WebCoreFrameScrollView> *ScrollView::scrollView() const
47 {
48 ASSERT(!platformWidget() || [platformWidget() isKindOfClass:[NSScrollView cl ass]]);
49 ASSERT(!platformWidget() || [platformWidget() conformsToProtocol:@protocol(W ebCoreFrameScrollView)]);
50 return static_cast<NSScrollView<WebCoreFrameScrollView> *>(platformWidget()) ;
51 }
52
53 NSView *ScrollView::documentView() const
54 {
55 BEGIN_BLOCK_OBJC_EXCEPTIONS;
56 return [scrollView() documentView];
57 END_BLOCK_OBJC_EXCEPTIONS;
58 return nil;
59 }
60
61 void ScrollView::platformAddChild(Widget* child)
62 {
63 BEGIN_BLOCK_OBJC_EXCEPTIONS;
64 NSView *parentView = documentView();
65 NSView *childView = child->getOuterView();
66 ASSERT(![parentView isDescendantOf:childView]);
67
68 // Suppress the resetting of drag margins since we know we can't affect them .
69 NSWindow *window = [parentView window];
70 BOOL resetDragMargins = [window _needsToResetDragMargins];
71 [window _setNeedsToResetDragMargins:NO];
72 if ([childView superview] != parentView)
73 [parentView addSubview:childView];
74 [window _setNeedsToResetDragMargins:resetDragMargins];
75 END_BLOCK_OBJC_EXCEPTIONS;
76 }
77
78 void ScrollView::platformRemoveChild(Widget* child)
79 {
80 child->removeFromSuperview();
81 }
82
83 void ScrollView::platformSetScrollbarModes()
84 {
85 BEGIN_BLOCK_OBJC_EXCEPTIONS;
86 [scrollView() setScrollingModes:m_horizontalScrollbarMode vertical:m_vertica lScrollbarMode andLock:NO];
87 END_BLOCK_OBJC_EXCEPTIONS;
88 }
89
90 void ScrollView::platformScrollbarModes(ScrollbarMode& horizontal, ScrollbarMode & vertical) const
91 {
92 BEGIN_BLOCK_OBJC_EXCEPTIONS;
93 [scrollView() scrollingModes:&horizontal vertical:&vertical];
94 END_BLOCK_OBJC_EXCEPTIONS;
95 }
96
97 void ScrollView::platformSetCanBlitOnScroll(bool canBlitOnScroll)
98 {
99 BEGIN_BLOCK_OBJC_EXCEPTIONS;
100 [[scrollView() contentView] setCopiesOnScroll:canBlitOnScroll];
101 END_BLOCK_OBJC_EXCEPTIONS;
102 }
103
104 bool ScrollView::platformCanBlitOnScroll() const
105 {
106 return [[scrollView() contentView] copiesOnScroll];
107 }
108
109 IntRect ScrollView::platformVisibleContentRect(bool includeScrollbars) const
110 {
111 BEGIN_BLOCK_OBJC_EXCEPTIONS;
112 IntRect result = enclosingIntRect([scrollView() documentVisibleRect]);
113 if (includeScrollbars)
114 result.setSize(IntSize([scrollView() frame].size));
115 return result;
116 END_BLOCK_OBJC_EXCEPTIONS;
117 return IntRect();
118 }
119
120 void ScrollView::platformSetContentsSize()
121 {
122 BEGIN_BLOCK_OBJC_EXCEPTIONS;
123 int w = m_contentsSize.width();
124 int h = m_contentsSize.height();
125 LOG(Frames, "%p %@ at w %d h %d\n", documentView(), [(id)[documentView() cla ss] className], w, h);
126 [documentView() setFrameSize:NSMakeSize(max(0, w), max(0, h))];
127 END_BLOCK_OBJC_EXCEPTIONS;
128 }
129
130 void ScrollView::platformSetScrollbarsSuppressed(bool repaintOnUnsuppress)
131 {
132 BEGIN_BLOCK_OBJC_EXCEPTIONS;
133 [scrollView() setScrollBarsSuppressed:m_scrollbarsSuppressed
134 repaintOnUnsuppress:repaintOnUnsuppress];
135 END_BLOCK_OBJC_EXCEPTIONS;
136 }
137
138 void ScrollView::platformSetScrollPosition(const IntPoint& scrollPoint)
139 {
140 BEGIN_BLOCK_OBJC_EXCEPTIONS;
141 NSPoint floatPoint = scrollPoint;
142 NSPoint tempPoint = { max(-[scrollView() scrollOrigin].x, floatPoint.x), max (-[scrollView() scrollOrigin].y, floatPoint.y) }; // Don't use NSMakePoint to w ork around 4213314.
143 [documentView() scrollPoint:tempPoint];
144 END_BLOCK_OBJC_EXCEPTIONS;
145 }
146
147 bool ScrollView::platformScroll(ScrollDirection, ScrollGranularity)
148 {
149 // FIXME: It would be nice to implement this so that all of the code in WebF rameView could go away.
150 notImplemented();
151 return false;
152 }
153
154 void ScrollView::platformRepaintContentRectangle(const IntRect& rect, bool now)
155 {
156 BEGIN_BLOCK_OBJC_EXCEPTIONS;
157 NSView *view = documentView();
158 [view setNeedsDisplayInRect:rect];
159 if (now) {
160 [[view window] displayIfNeeded];
161 [[view window] flushWindowIfNeeded];
162 }
163 END_BLOCK_OBJC_EXCEPTIONS;
164 }
165
166 // "Containing Window" means the NSWindow's coord system, which is origin lower left
167
168 IntRect ScrollView::platformContentsToScreen(const IntRect& rect) const
169 {
170 BEGIN_BLOCK_OBJC_EXCEPTIONS;
171 if (NSView* documentView = this->documentView()) {
172 NSRect tempRect = rect;
173 tempRect = [documentView convertRect:tempRect toView:nil];
174 tempRect.origin = [[documentView window] convertBaseToScreen:tempRect.or igin];
175 return enclosingIntRect(tempRect);
176 }
177 END_BLOCK_OBJC_EXCEPTIONS;
178 return IntRect();
179 }
180
181 IntPoint ScrollView::platformScreenToContents(const IntPoint& point) const
182 {
183 BEGIN_BLOCK_OBJC_EXCEPTIONS;
184 if (NSView* documentView = this->documentView()) {
185 NSPoint windowCoord = [[documentView window] convertScreenToBase: point] ;
186 return IntPoint([documentView convertPoint:windowCoord fromView:nil]);
187 }
188 END_BLOCK_OBJC_EXCEPTIONS;
189 return IntPoint();
190 }
191
192 bool ScrollView::platformIsOffscreen() const
193 {
194 return ![platformWidget() window] || ![[platformWidget() window] isVisible];
195 }
196
197 #if USE(SCROLLBAR_PAINTER)
198 static inline NSScrollerKnobStyle toNSScrollerKnobStyle(ScrollbarOverlayStyle st yle)
199 {
200 switch (style) {
201 case ScrollbarOverlayStyleDark:
202 return NSScrollerKnobStyleDark;
203 case ScrollbarOverlayStyleLight:
204 return NSScrollerKnobStyleLight;
205 default:
206 return NSScrollerKnobStyleDefault;
207 }
208 }
209 #endif
210
211 void ScrollView::platformSetScrollbarOverlayStyle(ScrollbarOverlayStyle overlayS tyle)
212 {
213 #if USE(SCROLLBAR_PAINTER)
214 [scrollView() setScrollerKnobStyle:toNSScrollerKnobStyle(overlayStyle)];
215 #else
216 UNUSED_PARAM(overlayStyle);
217 #endif
218 }
219
220 void ScrollView::platformSetScrollOrigin(const IntPoint& origin, bool updatePosi tionAtAll, bool updatePositionSynchronously)
221 {
222 BEGIN_BLOCK_OBJC_EXCEPTIONS;
223 [scrollView() setScrollOrigin:origin updatePositionAtAll:updatePositionAtAll immediately:updatePositionSynchronously];
224 END_BLOCK_OBJC_EXCEPTIONS;
225 }
226
227 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/platform/mac/SSLKeyGeneratorMac.cpp ('k') | Source/WebCore/platform/mac/SearchPopupMenuMac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698