Reviewed by Darin.
authoradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 23 Apr 2006 19:16:26 +0000 (19:16 +0000)
committeradele <adele@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 23 Apr 2006 19:16:26 +0000 (19:16 +0000)
        - http://bugzilla.opendarwin.org/show_bug.cgi?id=6905
          DumpRenderTree needs a way to force painting (to allow invalidation tests)

        * DumpRenderTree/DumpRenderTree.m:
        (dump): If display() has been called during the test, grab the pixels from
        the view, after letting it repaint invalidated rects.
        (+[LayoutTestController isSelectorExcludedFromWebScript:]):
        (-[LayoutTestController display]): Added. Calls -display on the view
        and changes the subsequent behavior of dump().
        (dumpRenderTree):

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

WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/DumpRenderTree.m
WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj

index 99b2676..f556a42 100644 (file)
@@ -1,3 +1,18 @@
+2006-04-23  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Darin.
+
+        - http://bugzilla.opendarwin.org/show_bug.cgi?id=6905
+          DumpRenderTree needs a way to force painting (to allow invalidation tests)
+
+        * DumpRenderTree/DumpRenderTree.m:
+        (dump): If display() has been called during the test, grab the pixels from
+        the view, after letting it repaint invalidated rects.
+        (+[LayoutTestController isSelectorExcludedFromWebScript:]):
+        (-[LayoutTestController display]): Added. Calls -display on the view
+        and changes the subsequent behavior of dump().
+        (dumpRenderTree):
+
 2006-04-22  Alexey Proskuryakov  <ap@nypop.com>
 
         Reviewed by Maciej.
index 11fc881..4885cfe 100644 (file)
@@ -86,6 +86,7 @@ static BOOL dumpSelectionRect;
 static BOOL dumpTitleChanges;
 static int dumpPixels = NO;
 static int dumpAllPixels = NO;
+static BOOL readFromWindow = NO;
 static int testRepaintDefault = NO;
 static BOOL testRepaint = NO;
 static int repaintSweepHorizontallyDefault = NO;
@@ -397,7 +398,15 @@ static void dump(void)
             NSGraphicsContext* nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:cgContext flipped:NO];
             [NSGraphicsContext setCurrentContext:nsContext];
 
-            if (!testRepaint)
+            if (readFromWindow) {
+                NSBitmapImageRep *imageRep;
+                [view displayIfNeeded];
+                [view lockFocus];
+                imageRep = [[NSBitmapImageRep alloc] initWithFocusedViewRect:[view frame]];
+                [view unlockFocus];
+                [imageRep draw];
+                [imageRep release];
+            } else if (!testRepaint)
                 [view displayRectIgnoringOpacity:NSMakeRect(0, 0, webViewSize.width, webViewSize.height) inContext:nsContext];
             else if (!repaintSweepHorizontally) {
                 NSRect line = NSMakeRect(0, 0, webViewSize.width, 1);
@@ -578,6 +587,7 @@ static void dump(void)
             || aSelector == @selector(setWindowIsKey:)
             || aSelector == @selector(setMainFrameIsFirstResponder:)
             || aSelector == @selector(dumpSelectionRect)
+            || aSelector == @selector(display)
             || aSelector == @selector(testRepaint)
             || aSelector == @selector(repaintSweepHorizontally))
         return NO;
@@ -639,6 +649,12 @@ static void dump(void)
         [(WebHTMLView *)documentView _updateFocusState];
 }
 
+- (void)display
+{
+    [[frame webView] display];
+    readFromWindow = YES;
+}
+
 - (void)testRepaint
 {
     testRepaint = YES;
@@ -682,6 +698,7 @@ static void dumpRenderTree(const char *pathOrURL)
     dumpAsText = NO;
     dumpSelectionRect = NO;
     dumpTitleChanges = NO;
+    readFromWindow = NO;
     testRepaint = testRepaintDefault;
     repaintSweepHorizontally = repaintSweepHorizontallyDefault;
     if (currentTest != nil)
index 8145b56..ed1af5a 100644 (file)
                22181BD009DC8C4B008342E8 /* ObjCPluginFunction.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = ObjCPluginFunction.m; sourceTree = "<group>"; };
                32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DumpRenderTreePrefix.h; sourceTree = "<group>"; };
                9335435F03D75502008635CE /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
-               9340995408540CAF007F3BC8 /* DumpRenderTree */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = DumpRenderTree; sourceTree = BUILT_PRODUCTS_DIR; };
+               9340995408540CAF007F3BC8 /* DumpRenderTree */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = DumpRenderTree; sourceTree = BUILT_PRODUCTS_DIR; };
                93442CF408F8BA4900BFE8CA /* TextInputController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextInputController.h; sourceTree = "<group>"; };
                93442CF508F8BA4900BFE8CA /* TextInputController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TextInputController.m; sourceTree = "<group>"; };
                A803FCB709CAAAB0009B2A37 /* EventSendingController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = EventSendingController.h; sourceTree = "<group>"; };