Reviewed by John Sullivan.
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Aug 2007 22:20:37 +0000 (22:20 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Aug 2007 22:20:37 +0000 (22:20 +0000)
        <rdar://problem/5410937> HIWebView in SimpleCarbonWeb doesn't seem to be getting adequate invalidation when window is resized

        This is a more localized fix for yesterday's change. Now explicitly call _web_layoutIfNeededRecursive inside the
        HIWebView Draw() function. Adds a FIXME to explain that we need to do layout before Carbon has decided what regions to draw.
        Doing layout in Draw() will potentially cause drawing to happen in two passes, but this has always been a problem in Carbon.

        * Carbon/HIWebView.m:
        (Draw): Call _web_layoutIfNeededRecursive on the main WebHTMLView.
        (SetFocusPart): Fix to work in ObjC++ (now that HIWebView.m is treated as a ObjC++ file.)
        * WebView/WebView.mm: Removes the 4 displayIfNeeded methods from yesterday's change.
        * WebKit.xcodeproj/project.pbxproj: Force the file type of HIWebView.m to ObjC++ so WebHTMLViewInternal.h can be included.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@25217 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/Carbon/HIWebView.m
WebKit/ChangeLog
WebKit/WebKit.xcodeproj/project.pbxproj
WebKit/WebView/WebView.mm

index 79b283fab2166af5cba58b539295498a9a1c6ccf..00c088e6ddddff4b3f4b3350d7a8474cfd5b1a50 100644 (file)
 
 #ifndef __LP64__
 
-#include "HIWebView.h"
+#import "HIWebView.h"
 
-#include "CarbonWindowAdapter.h"
-
-#include <WebKit/WebKit.h>
-#include "HIViewAdapter.h"
-#include <WebKitSystemInterface.h>
+#import "CarbonWindowAdapter.h"
+#import "HIViewAdapter.h"
+#import "WebHTMLViewInternal.h"
+#import "WebKit.h"
 
 #import <objc/objc-runtime.h>
+#import <WebKitSystemInterface.h>
 
 @interface NSWindow (AppKitSecretsHIWebViewKnows)
 - (void)_removeWindowRef;
@@ -46,6 +46,8 @@
 - (void)_clearDirtyRectsForTree;
 @end
 
+extern "C" void HIWebViewRegisterClass();
+
 @interface MenuItemProxy : NSObject <NSValidatedUserInterfaceItem>
 {
     int     _tag;
@@ -143,7 +145,6 @@ static const EventTypeSpec kEvents[] = {
 
 static HIWebView*              HIWebViewConstructor( HIViewRef inView );
 static void                            HIWebViewDestructor( HIWebView* view );
-void                    HIWebViewRegisterClass( void );
 
 static OSStatus                        HIWebViewEventHandler(
                                                                EventHandlerCallRef     inCallRef,
@@ -367,6 +368,15 @@ Draw( HIWebView* inView, RgnHandle limitRgn, CGContextRef inContext )
 //    printf( "Drawing: drawRect is (%g %g) (%g %g)\n", hiRect.origin.x, hiRect.origin.y,
 //            hiRect.size.width, hiRect.size.height );
 
+    // FIXME: We need to do layout before Carbon has decided what region needs drawn.
+    // In Cocoa we make sure to do layout and invalidate any new regions before draw, so everything
+    // can be drawn in one pass. Doing a layout here will cause new regions to be invalidated, but they
+    // will not all be drawn in this pass since we already have a fixed rect we are going to display.
+
+    NSView <WebDocumentView> *documentView = [[[inView->fWebView mainFrame] frameView] documentView];
+    if ([documentView isKindOfClass:[WebHTMLView class]])
+        [(WebHTMLView *)documentView _web_layoutIfNeededRecursive];
+
     if ( inView->fIsComposited )
         [inView->fWebView displayIfNeededInRect: *(NSRect*)&hiRect];
     else
@@ -877,7 +887,10 @@ SetFocusPart(
 
         // Advance the keyboard focus, maybe right off of this view.  Maybe a subview of this one already has the keyboard focus, maybe not.
         freshlyMadeFirstResponderView = AdvanceFocus( view, goForward );
-        partCodeToReturn = freshlyMadeFirstResponderView ? desiredFocus : kControlFocusNoPart;
+        if (freshlyMadeFirstResponderView)
+            partCodeToReturn = desiredFocus;
+        else
+            partCodeToReturn = kControlFocusNoPart;
         //NSLog(freshlyMadeFirstResponderView ? @"Advanced the key focus." : @"Relinquished the key focus.");
     }
        else
index 04e12ac0f1a731a2b2d611af0fd6a05f22506972..e10e77f591ea1662941411768b978f630a9eefcc 100644 (file)
@@ -1,3 +1,19 @@
+2007-08-24  Timothy Hatcher  <timothy@apple.com>
+
+        Reviewed by John Sullivan.
+
+        <rdar://problem/5410937> HIWebView in SimpleCarbonWeb doesn't seem to be getting adequate invalidation when window is resized
+
+        This is a more localized fix for yesterday's change. Now explicitly call _web_layoutIfNeededRecursive inside the
+        HIWebView Draw() function. Adds a FIXME to explain that we need to do layout before Carbon has decided what regions to draw.
+        Doing layout in Draw() will potentially cause drawing to happen in two passes, but this has always been a problem in Carbon.
+
+        * Carbon/HIWebView.m:
+        (Draw): Call _web_layoutIfNeededRecursive on the main WebHTMLView.
+        (SetFocusPart): Fix to work in ObjC++ (now that HIWebView.m is treated as a ObjC++ file.)
+        * WebView/WebView.mm: Removes the 4 displayIfNeeded methods from yesterday's change.
+        * WebKit.xcodeproj/project.pbxproj: Force the file type of HIWebView.m to ObjC++ so WebHTMLViewInternal.h can be included.
+
 2007-08-23  Timothy Hatcher  <timothy@apple.com>
 
         Reviewed by Dave Hyatt.
index 088c4be09c53c2c4637ec8b89d941bdc93624d5c..431117726992e37b7da3cd145f534032063a2635 100644 (file)
                F7EBEE9A03F9DBA103CA0DE6 /* HIViewAdapter.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HIViewAdapter.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F7EBEE9B03F9DBA103CA0DE6 /* HIViewAdapter.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = HIViewAdapter.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F7EBEEAA03F9DBA103CA0DE6 /* HIWebView.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HIWebView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
-               F7EBEEAB03F9DBA103CA0DE6 /* HIWebView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = HIWebView.m; sourceTree = "<group>"; usesTabs = 0; };
+               F7EBEEAB03F9DBA103CA0DE6 /* HIWebView.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; path = HIWebView.m; sourceTree = "<group>"; usesTabs = 0; };
                F8CA15B5029A39D901000122 /* WebAuthenticationPanel.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebAuthenticationPanel.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                F8CA15B6029A39D901000122 /* WebAuthenticationPanel.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebAuthenticationPanel.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 /* End PBXFileReference section */
index 436506fa84e6a9d2fad6dabdc2261998d4368dc6..2d35f6091a7088e6ced3579a4b82562fa8516ef9 100644 (file)
@@ -2005,38 +2005,6 @@ NS_ENDHANDLER
     [self _close];
 }
 
-- (void)displayIfNeeded
-{
-    NSView <WebDocumentView> *documentView = [[[self mainFrame] frameView] documentView];
-    if ([documentView isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView *)documentView _web_layoutIfNeededRecursive];
-    [super displayIfNeeded];
-}
-
-- (void)displayIfNeededIgnoringOpacity
-{
-    NSView <WebDocumentView> *documentView = [[[self mainFrame] frameView] documentView];
-    if ([documentView isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView *)documentView _web_layoutIfNeededRecursive];
-    [super displayIfNeededIgnoringOpacity];
-}
-
-- (void)displayIfNeededInRect:(NSRect) rect
-{
-    NSView <WebDocumentView> *documentView = [[[self mainFrame] frameView] documentView];
-    if ([documentView isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView *)documentView _web_layoutIfNeededRecursive];
-    [super displayIfNeededInRect:rect];
-}
-
-- (void)displayIfNeededInRectIgnoringOpacity:(NSRect) rect
-{
-    NSView <WebDocumentView> *documentView = [[[self mainFrame] frameView] documentView];
-    if ([documentView isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView *)documentView _web_layoutIfNeededRecursive];
-    [super displayIfNeededInRectIgnoringOpacity:rect];
-}
-
 - (void)setShouldCloseWithWindow:(BOOL)close
 {
     _private->shouldCloseWithWindow = close;