Initial patch.
[vuplus_webkit] / Source / WebKit / mac / WebView / WebFrame.mm
index bd4460a..3caf327 100644 (file)
@@ -363,19 +363,17 @@ WebView *getWebView(WebFrame *webFrame)
 
     Frame* coreFrame = _private->coreFrame;
     for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) {
-        if ([webView _usesDocumentViews]) {
-            // Don't call setDrawsBackground:YES here because it may be NO because of a load
-            // in progress; WebFrameLoaderClient keeps it set to NO during the load process.
-            WebFrame *webFrame = kit(frame);
-            if (!drawsBackground)
-                [[[webFrame frameView] _scrollView] setDrawsBackground:NO];
-            [[[webFrame frameView] _scrollView] setBackgroundColor:backgroundColor];
-            id documentView = [[webFrame frameView] documentView];
-            if ([documentView respondsToSelector:@selector(setDrawsBackground:)])
-                [documentView setDrawsBackground:drawsBackground];
-            if ([documentView respondsToSelector:@selector(setBackgroundColor:)])
-                [documentView setBackgroundColor:backgroundColor];
-        }
+        // Don't call setDrawsBackground:YES here because it may be NO because of a load
+        // in progress; WebFrameLoaderClient keeps it set to NO during the load process.
+        WebFrame *webFrame = kit(frame);
+        if (!drawsBackground)
+            [[[webFrame frameView] _scrollView] setDrawsBackground:NO];
+        [[[webFrame frameView] _scrollView] setBackgroundColor:backgroundColor];
+        id documentView = [[webFrame frameView] documentView];
+        if ([documentView respondsToSelector:@selector(setDrawsBackground:)])
+            [documentView setDrawsBackground:drawsBackground];
+        if ([documentView respondsToSelector:@selector(setBackgroundColor:)])
+            [documentView setBackgroundColor:backgroundColor];
 
         if (FrameView* view = frame->view()) {
             view->setTransparent(!drawsBackground);
@@ -415,27 +413,21 @@ WebView *getWebView(WebFrame *webFrame)
 
 - (BOOL)_hasSelection
 {
-    if ([getWebView(self) _usesDocumentViews]) {
-        id documentView = [_private->webFrameView documentView];    
-
-        // optimization for common case to avoid creating potentially large selection string
-        if ([documentView isKindOfClass:[WebHTMLView class]])
-            if (Frame* coreFrame = _private->coreFrame)
-                return coreFrame->selection()->isRange();
+    id documentView = [_private->webFrameView documentView];    
 
-        if ([documentView conformsToProtocol:@protocol(WebDocumentText)])
-            return [[documentView selectedString] length] > 0;
-        
-        return NO;
-    }
+    // optimization for common case to avoid creating potentially large selection string
+    if ([documentView isKindOfClass:[WebHTMLView class]])
+        if (Frame* coreFrame = _private->coreFrame)
+            return coreFrame->selection()->isRange();
 
-    Frame* coreFrame = _private->coreFrame;
-    return coreFrame && coreFrame->selection()->isRange();
+    if ([documentView conformsToProtocol:@protocol(WebDocumentText)])
+        return [[documentView selectedString] length] > 0;
+    
+    return NO;
 }
 
 - (void)_clearSelection
 {
-    ASSERT([getWebView(self) _usesDocumentViews]);
     id documentView = [_private->webFrameView documentView];    
     if ([documentView conformsToProtocol:@protocol(WebDocumentText)])
         [documentView deselectAll];
@@ -545,11 +537,9 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
         return NO;
 
     // If we're drawing into a bitmap, we might be snapshotting, or drawing into a layer-backed view.
-    if ([getWebView(self) _usesDocumentViews]) {
-        id documentView = [_private->webFrameView documentView];
-        if ([documentView isKindOfClass:[WebHTMLView class]] && [(WebHTMLView *)documentView _web_isDrawingIntoLayer])
-            return NO;
-    }
+    id documentView = [_private->webFrameView documentView];
+    if ([documentView isKindOfClass:[WebHTMLView class]] && [(WebHTMLView *)documentView _web_isDrawingIntoLayer])
+        return NO;
 
     return [getWebView(self) _includesFlattenedCompositingLayersWhenDrawingToBitmap];
 }
@@ -833,7 +823,6 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     FrameView* view = _private->coreFrame->view();
     if (!view)
         return;
-    ASSERT([getWebView(self) _usesDocumentViews]);
     // FIXME: These are fake modifier keys here, but they should be real ones instead.
     PlatformMouseEvent event(IntPoint(windowLoc), globalPoint(windowLoc, [view->platformWidget() window]),
         LeftButton, MouseEventMoved, 0, false, false, false, false, currentTime());
@@ -1177,7 +1166,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
     }
     
     if (Document* document = _private->coreFrame->document()) {
-#if ENABLE(DATABASE)
+#if ENABLE(SQL_DATABASE)
         if (document->hasOpenDatabases())
             [result setObject:[NSNumber numberWithBool:YES] forKey:WebFrameUsesDatabases];
 #endif
@@ -1411,7 +1400,6 @@ static inline WebDataSource *dataSource(DocumentLoader* loader)
 
 - (WebFrameView *)frameView
 {
-    ASSERT(!getWebView(self) || [getWebView(self) _usesDocumentViews]);
     return _private->webFrameView;
 }