Changeset 37046 in webkit
- Timestamp:
- Sep 28, 2008 4:31:25 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r37045 r37046 1 2008-09-28 Timothy Hatcher <timothy@apple.com> 2 3 Remove the scrollIntoViewIfNeeded() call when drawing the 4 Inspector node highlight. 5 6 <rdar://problem/6115804> Don't scroll when highlighting (21000) 7 https://bugs.webkit.org/show_bug.cgi?id=21000 8 9 Reviewed by Dan Bernstein. 10 11 * page/InspectorController.cpp: 12 (WebCore::InspectorController::drawNodeHighlight): 13 1 14 2008-09-28 David Hyatt <hyatt@apple.com> 2 15 -
trunk/WebCore/page/InspectorController.cpp
r36960 r37046 2500 2500 else 2501 2501 element = static_cast<Element*>(m_highlightedNode->parent()); 2502 element->scrollIntoViewIfNeeded();2503 2502 overlayRect = view->visibleContentRect(); 2504 2503 } -
trunk/WebKit/mac/ChangeLog
r37039 r37046 1 2008-09-28 Timothy Hatcher <timothy@apple.com> 2 3 Improves the Web Inspector node highlight so it does not scroll 4 to reveal the node in the page. This makes the highlight less 5 invasive and causes less things to change on screen. Also makes 6 the highlight redraw when the WebView draws, so it stays current 7 if the node changes on the page for any reason. 8 9 <rdar://problem/6115804> Don't scroll when highlighting (21000) 10 https://bugs.webkit.org/show_bug.cgi?id=21000 11 12 Reviewed by Dan Bernstein. 13 14 * WebCoreSupport/WebInspectorClient.mm: 15 (-[WebInspectorWindowController highlightNode:]): Call setNeedsDisplay:YES 16 if there is an existing highlight. 17 (-[WebInspectorWindowController didAttachWebNodeHighlight:]): Set the current 18 highlight node on the inspected WebView. 19 (-[WebInspectorWindowController willDetachWebNodeHighlight:]): Set the current 20 highlight node on the inspected WebView to nil. 21 * WebInspector/WebNodeHighlight.m: 22 (-[WebNodeHighlight setNeedsUpdateInTargetViewRect:]): Disable screen updates 23 until flush for the inspected window. Invalidate the whole highlight view since 24 we don't know the rect that needs updated since the highlight can be larger than 25 the highlighted element due to the margins and other factors. 26 * WebInspector/WebNodeHighlightView.m: 27 * WebView/WebHTMLView.mm: 28 (-[WebHTMLView drawSingleRect:]): Call setNeedsUpdateInTargetViewRect: on the 29 current highlight node. 30 * WebView/WebView.mm: 31 (-[WebViewPrivate dealloc]): Release the current highlight node. 32 (-[WebView setCurrentNodeHighlight:]): Set the current highlight node. 33 (-[WebView currentNodeHighlight]): Return the current highlight node. 34 * WebView/WebViewInternal.h: 35 1 36 2008-09-28 David Kilzer <ddkilzer@apple.com> 2 37 -
trunk/WebKit/mac/WebCoreSupport/WebInspectorClient.mm
r36714 r37046 1 1 /* 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 62 62 - (void)detach; 63 63 - (void)setAttachedWindowHeight:(unsigned)height; 64 - (void)highlightAndScrollToNode:(DOMNode *)node;65 64 - (void)highlightNode:(DOMNode *)node; 66 65 - (void)hideHighlight; … … 124 123 void WebInspectorClient::highlight(Node* node) 125 124 { 126 [m_windowController.get() highlight AndScrollToNode:kit(node)];125 [m_windowController.get() highlightNode:kit(node)]; 127 126 } 128 127 … … 393 392 #pragma mark - 394 393 395 - (void)highlightAndScrollToNode:(DOMNode *)node396 {397 NSRect bounds = [node boundingBox];398 if (!NSIsEmptyRect(bounds)) {399 // FIXME: this needs to use the frame the node coordinates are in400 NSRect visible = [[[[_inspectedWebView mainFrame] frameView] documentView] visibleRect];401 BOOL needsScroll = !NSContainsRect(visible, bounds) && !NSContainsRect(bounds, visible);402 403 // only scroll if the bounds isn't in the visible rect and dosen't contain the visible rect404 if (needsScroll) {405 // scroll to the parent element if we aren't focused on an element406 DOMElement *element;407 if ([node isKindOfClass:[DOMElement class]])408 element = (DOMElement *)node;409 else410 element = (DOMElement *)[node parentNode];411 [element scrollIntoViewIfNeeded:YES];412 413 // give time for the scroll to happen414 [self performSelector:@selector(highlightNode:) withObject:node afterDelay:0.25];415 } else416 [self highlightNode:node];417 }418 }419 420 394 - (void)highlightNode:(DOMNode *)node 421 395 { … … 429 403 [_currentHighlight setDelegate:self]; 430 404 [_currentHighlight attach]; 431 } 432 433 // FIXME: this is a hack until we hook up a didDraw and didScroll call in WebHTMLView 434 [[_currentHighlight highlightView] setNeedsDisplay:YES]; 405 } else 406 [[_currentHighlight highlightView] setNeedsDisplay:YES]; 435 407 } 436 408 … … 441 413 [_currentHighlight release]; 442 414 _currentHighlight = nil; 415 } 416 417 #pragma mark - 418 #pragma mark WebNodeHighlight delegate 419 420 - (void)didAttachWebNodeHighlight:(WebNodeHighlight *)highlight 421 { 422 [_inspectedWebView setCurrentNodeHighlight:highlight]; 423 } 424 425 - (void)willDetachWebNodeHighlight:(WebNodeHighlight *)highlight 426 { 427 [_inspectedWebView setCurrentNodeHighlight:nil]; 443 428 } 444 429 -
trunk/WebKit/mac/WebInspector/WebNodeHighlight.m
r35850 r37046 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 149 149 ASSERT(_targetView); 150 150 151 [_highlightView setNeedsDisplayInRect:[_targetView _web_convertRect:rect toView:_highlightView]]; 152 153 // Redraw highlight view immediately so it updates in sync with the target view 154 // if we called disableScreenUpdatesUntilFlush on the target view earlier. This 155 // is especially visible when resizing the window. 151 [[_targetView window] disableScreenUpdatesUntilFlush]; 152 153 // Mark the whole highlight view as needing display since we don't know what areas 154 // need updated, since the highlight can be larger than the element to show margins. 155 [_highlightView setNeedsDisplay:YES]; 156 157 // Redraw highlight view immediately so it updates in sync with the target view. 158 // This is especially visible when resizing the window, scrolling or with DHTML. 156 159 [_highlightView displayIfNeeded]; 157 160 } -
trunk/WebKit/mac/WebInspector/WebNodeHighlightView.m
r35689 r37046 1 1 /* 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved.2 * Copyright (C) 2006, 2008 Apple Computer, Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 35 35 36 36 using namespace WebCore; 37 38 #define OVERLAY_MAX_ALPHA 0.739 #define OVERLAY_WHITE_VALUE 0.140 41 #define BORDER_THICKNESS 1.042 37 43 38 @implementation WebNodeHighlightView … … 88 83 } 89 84 90 - (void)setNeedsDisplayInRect:(NSRect)rect91 {92 // Redisplay a slightly larger rect to account for the border93 rect = NSInsetRect(rect, -1 * BORDER_THICKNESS, -1 * BORDER_THICKNESS);94 [super setNeedsDisplayInRect:rect];95 }96 97 85 @end -
trunk/WebKit/mac/WebView/WebHTMLView.mm
r36919 r37046 52 52 #import "WebKitVersionChecks.h" 53 53 #import "WebLocalizableStrings.h" 54 #import "WebNodeHighlight.h" 54 55 #import "WebNSAttributedStringExtras.h" 55 56 #import "WebNSEventExtras.h" … … 2938 2939 [[self _frame] _drawRect:rect]; 2939 2940 2941 WebView *webView = [self _webView]; 2942 2940 2943 // This hack is needed for <rdar://problem/5023545>. We can hit a race condition where drawRect will be 2941 2944 // called after the WebView has closed. If the client did not properly close the WebView and set the 2942 2945 // UIDelegate to nil, then the UIDelegate will be stale and this code will crash. 2943 2946 static BOOL version3OrLaterClient = WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITHOUT_QUICKBOOKS_QUIRK); 2944 if (version3OrLaterClient) { 2945 WebView *webView = [self _webView]; 2947 if (version3OrLaterClient) 2946 2948 [[webView _UIDelegateForwarder] webView:webView didDrawRect:[webView convertRect:rect fromView:self]]; 2947 } 2949 2950 if (WebNodeHighlight *currentHighlight = [webView currentNodeHighlight]) 2951 [currentHighlight setNeedsUpdateInTargetViewRect:[self convertRect:rect toView:[currentHighlight targetView]]]; 2948 2952 2949 2953 [(WebClipView *)[self superview] resetAdditionalClip]; -
trunk/WebKit/mac/WebView/WebView.mm
r36962 r37046 66 66 #import "WebKitVersionChecks.h" 67 67 #import "WebLocalizableStrings.h" 68 #import "WebNodeHighlight.h" 68 69 #import "WebNSDataExtras.h" 69 70 #import "WebNSDataExtrasPrivate.h" … … 329 330 330 331 WebInspector *inspector; 332 WebNodeHighlight *currentNodeHighlight; 331 333 332 334 BOOL allowsUndo; … … 512 514 513 515 [inspector release]; 516 [currentNodeHighlight release]; 517 514 518 [hostWindow release]; 515 519 … … 2942 2946 } 2943 2947 2948 - (void)setCurrentNodeHighlight:(WebNodeHighlight *)nodeHighlight 2949 { 2950 id old = _private->currentNodeHighlight; 2951 _private->currentNodeHighlight = [nodeHighlight retain]; 2952 [old release]; 2953 } 2954 2955 - (WebNodeHighlight *)currentNodeHighlight 2956 { 2957 return _private->currentNodeHighlight; 2958 } 2959 2944 2960 @end 2945 2961 -
trunk/WebKit/mac/WebView/WebViewInternal.h
r36880 r37046 53 53 @class WebBasePluginPackage; 54 54 @class WebDownload; 55 @class WebNodeHighlight; 55 56 56 57 @interface WebView (WebViewEditingExtras) … … 114 115 - (BOOL)_isMIMETypeRegisteredAsPlugin:(NSString *)MIMEType; 115 116 117 - (void)setCurrentNodeHighlight:(WebNodeHighlight *)nodeHighlight; 118 - (WebNodeHighlight *)currentNodeHighlight; 119 116 120 - (void)addPluginInstanceView:(NSView *)view; 117 121 - (void)removePluginInstanceView:(NSView *)view;
Note: See TracChangeset
for help on using the changeset viewer.