Changeset 58847 in webkit


Ignore:
Timestamp:
May 5, 2010 5:37:03 PM (14 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/7932072> Iframes in composited layers don’t repaint correctly (affects Yahoo! Mail with Flash Player 10.1)
https://bugs.webkit.org/show_bug.cgi?id=38427

Reviewed by Simon Fraser.

WebCore:

Test: compositing/iframes/iframe-in-composited-layer.html

  • WebCore.base.exp: Export FrameView::isEnclosedInCompositingLayer().
  • page/FrameView.cpp:

(WebCore::FrameView::isEnclosedInCompositingLayer): Added this predicate.

  • page/FrameView.h:

WebKit:

  • WebKit.xcodeproj/project.pbxproj: Renamed WebClipView.m to WebClipView.mm and changed it to

Objective-C++.

WebKit/mac:

  • WebView/WebClipView.m: Renamed to WebClipView.mm.
  • WebView/WebClipView.mm:

(-[WebClipView visibleRect]): Added this override, which for instances used for WebFrameViews in
composited layers, returns the clip view’s entire bounds. This prevents drawing from being clipped to
AppKit’s idea of what part of the view would be visible if it was drawn as part of the view hierarchy.
Since it is drawn into a compositing layer, that’s irrelevant, and we should not be clipping.

  • WebView/WebHTMLView.mm:

(setCursor): Style tweak.
(setNeedsDisplayInRect): Added. Replaces the default implementation of -[NSView setNeedsDisplayInRect:],
so that if the receiver is a descendant of a WebFrameView that draws into a composited layer, the invalidation
is routed back through the WebCore FrameView, which propagates it to the layer.
(+[WebHTMLViewPrivate initialize]): Swizzle the setNeedsDisplayInRect: override in.
(-[WebHTMLView visibleRect]): Removed whitespace.

  • WebView/WebView.mm:

(layerSyncRunLoopObserverCallBack): If we bailed out on syncing, due to pending layout, do an eager layout
in preparation for the displaying of compositing layers.

LayoutTests:

  • compositing/iframes/iframe-in-composited-layer.html: Added.
  • platform/mac/compositing/iframes/iframe-in-composited-layer-expected.checksum: Added.
  • platform/mac/compositing/iframes/iframe-in-composited-layer-expected.png: Added.
  • platform/mac/compositing/iframes/iframe-in-composited-layer-expected.txt: Added.
Location:
trunk
Files:
4 added
10 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r58845 r58847  
     12010-05-05  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        <rdar://problem/7932072> Iframes in composited layers don’t repaint correctly (affects Yahoo! Mail with Flash Player 10.1)
     6        https://bugs.webkit.org/show_bug.cgi?id=38427
     7
     8        * compositing/iframes/iframe-in-composited-layer.html: Added.
     9        * platform/mac/compositing/iframes/iframe-in-composited-layer-expected.checksum: Added.
     10        * platform/mac/compositing/iframes/iframe-in-composited-layer-expected.png: Added.
     11        * platform/mac/compositing/iframes/iframe-in-composited-layer-expected.txt: Added.
     12
    1132010-05-05  Chris Marrin  <cmarrin@apple.com>
    214
  • trunk/WebCore/ChangeLog

    r58845 r58847  
     12010-05-05  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        <rdar://problem/7932072> Iframes in composited layers don’t repaint correctly (affects Yahoo! Mail with Flash Player 10.1)
     6        https://bugs.webkit.org/show_bug.cgi?id=38427
     7
     8        Test: compositing/iframes/iframe-in-composited-layer.html
     9
     10        * WebCore.base.exp: Export FrameView::isEnclosedInCompositingLayer().
     11        * page/FrameView.cpp:
     12        (WebCore::FrameView::isEnclosedInCompositingLayer): Added this predicate.
     13        * page/FrameView.h:
     14
    1152010-05-05  Chris Marrin  <cmarrin@apple.com>
    216
  • trunk/WebCore/WebCore.base.exp

    r58821 r58847  
    600600__ZN7WebCore6Widget12setFrameRectERKNS_7IntRectE
    601601__ZN7WebCore6Widget16removeFromParentEv
     602__ZN7WebCore6Widget17frameRectsChangedEv
    602603__ZN7WebCore6Widget20retainPlatformWidgetEv
    603604__ZN7WebCore6Widget21releasePlatformWidgetEv
     
    610611__ZN7WebCore6WidgetC2EP6NSView
    611612__ZN7WebCore6WidgetD2Ev
    612 __ZN7WebCore6Widget17frameRectsChangedEv
    613613__ZN7WebCore7Console21shouldPrintExceptionsEv
    614614__ZN7WebCore7Console24setShouldPrintExceptionsEb
     
    999999__ZNK7WebCore9FrameView13paintBehaviorEv
    10001000__ZNK7WebCore9FrameView20isSoftwareRenderableEv
     1001__ZNK7WebCore9FrameView28isEnclosedInCompositingLayerEv
    10011002__ZNK7WebCore9PageCache10frameCountEv
    10021003__ZNK7WebCore9PageCache21autoreleasedPageCountEv
  • trunk/WebCore/page/FrameView.cpp

    r58445 r58847  
    476476        page->chrome()->client()->setNeedsOneShotDrawingSynchronization();
    477477}
     478
     479bool FrameView::isEnclosedInCompositingLayer() const
     480{
     481    RenderObject* frameOwnerRenderer = m_frame->ownerRenderer();
     482    return frameOwnerRenderer && frameOwnerRenderer->containerForRepaint();
     483}
     484
    478485#endif // USE(ACCELERATED_COMPOSITING)
    479486
  • trunk/WebCore/page/FrameView.h

    r58615 r58847  
    104104    // content rendered via the normal painting path.
    105105    void setNeedsOneShotDrawingSynchronization();
     106
     107    bool isEnclosedInCompositingLayer() const;
    106108#endif
    107109    // Only used with accelerated compositing, but outside the #ifdef to make linkage easier.
  • trunk/WebKit/ChangeLog

    r58778 r58847  
     12010-05-05  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        <rdar://problem/7932072> Iframes in composited layers don’t repaint correctly (affects Yahoo! Mail with Flash Player 10.1)
     6        https://bugs.webkit.org/show_bug.cgi?id=38427
     7
     8        * WebKit.xcodeproj/project.pbxproj: Renamed WebClipView.m to WebClipView.mm and changed it to
     9        Objective-C++.
     10
    1112010-05-03  Darin Adler  <darin@apple.com>
    212
  • trunk/WebKit/WebKit.xcodeproj/project.pbxproj

    r58350 r58847  
    270270                939810E40824BF01008DF038 /* WebJavaScriptTextInputPanel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9345D4EB0365C5B2008635CE /* WebJavaScriptTextInputPanel.m */; };
    271271                939810E80824BF01008DF038 /* WebViewFactory.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5F7174D02885C5B018635CA /* WebViewFactory.mm */; };
    272                 939810EB0824BF01008DF038 /* WebClipView.m in Sources */ = {isa = PBXBuildFile; fileRef = 933D659A03413FF2008635CE /* WebClipView.m */; };
     272                939810EB0824BF01008DF038 /* WebClipView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 933D659A03413FF2008635CE /* WebClipView.mm */; };
    273273                939810ED0824BF01008DF038 /* WebDataSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 39446071020F50ED0ECA1767 /* WebDataSource.mm */; };
    274274                939810EF0824BF01008DF038 /* WebDefaultContextMenuDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5152FADE033FC50400CA2ACD /* WebDefaultContextMenuDelegate.mm */; };
     
    577577                9325FBDC07D829AE00159862 /* IDNScriptWhiteList.txt */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = text; path = IDNScriptWhiteList.txt; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    578578                933D659903413FF2008635CE /* WebClipView.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebClipView.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    579                 933D659A03413FF2008635CE /* WebClipView.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebClipView.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     579                933D659A03413FF2008635CE /* WebClipView.mm */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; indentWidth = 4; path = WebClipView.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    580580                9345D17C0365BF35008635CE /* English */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = wrapper.nib; name = English; path = Panels/English.lproj/WebAuthenticationPanel.nib; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    581581                9345D4EA0365C5B2008635CE /* WebJavaScriptTextInputPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebJavaScriptTextInputPanel.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     
    11021102                                8373435B0624EE0D00F3B289 /* WebArchive.mm */,
    11031103                                933D659903413FF2008635CE /* WebClipView.h */,
    1104                                 933D659A03413FF2008635CE /* WebClipView.m */,
     1104                                933D659A03413FF2008635CE /* WebClipView.mm */,
    11051105                                39446070020F50ED0ECA1767 /* WebDataSource.h */,
    11061106                                39446071020F50ED0ECA1767 /* WebDataSource.mm */,
     
    17911791                                5241ADF60B1BC48A004012BD /* WebCache.mm in Sources */,
    17921792                                14D825300AF955090004F057 /* WebChromeClient.mm in Sources */,
    1793                                 939810EB0824BF01008DF038 /* WebClipView.m in Sources */,
     1793                                939810EB0824BF01008DF038 /* WebClipView.mm in Sources */,
    17941794                                065AD5A40B0C32C7005A2B1D /* WebContextMenuClient.mm in Sources */,
    17951795                                939810BF0824BF01008DF038 /* WebCoreStatistics.mm in Sources */,
  • trunk/WebKit/mac/ChangeLog

    r58846 r58847  
     12010-05-05  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        <rdar://problem/7932072> Iframes in composited layers don’t repaint correctly (affects Yahoo! Mail with Flash Player 10.1)
     6        https://bugs.webkit.org/show_bug.cgi?id=38427
     7
     8        * WebView/WebClipView.m: Renamed to WebClipView.mm.
     9        * WebView/WebClipView.mm:
     10        (-[WebClipView visibleRect]): Added this override, which for instances used for WebFrameViews in
     11        composited layers, returns the clip view’s entire bounds. This prevents drawing from being clipped to
     12        AppKit’s idea of what part of the view would be visible if it was drawn as part of the view hierarchy.
     13        Since it is drawn into a compositing layer, that’s irrelevant, and we should not be clipping.
     14        * WebView/WebHTMLView.mm:
     15        (setCursor): Style tweak.
     16        (setNeedsDisplayInRect): Added. Replaces the default implementation of -[NSView setNeedsDisplayInRect:],
     17        so that if the receiver is a descendant of a WebFrameView that draws into a composited layer, the invalidation
     18        is routed back through the WebCore FrameView, which propagates it to the layer.
     19        (+[WebHTMLViewPrivate initialize]): Swizzle the setNeedsDisplayInRect: override in.
     20        (-[WebHTMLView visibleRect]): Removed whitespace.
     21        * WebView/WebView.mm:
     22        (layerSyncRunLoopObserverCallBack): If we bailed out on syncing, due to pending layout, do an eager layout
     23        in preparation for the displaying of compositing layers.
     24
    1252010-05-05  John Sullivan  <sullivan@apple.com>
    226
  • trunk/WebKit/mac/WebView/WebClipView.mm

    r58764 r58847  
    2929#import "WebClipView.h"
    3030
    31 #import <WebKit/WebHTMLView.h>
    32 #import <WebKit/WebNSViewExtras.h>
    33 #import <WebKit/WebViewPrivate.h>
    34 #import <wtf/Assertions.h>
     31#import "WebFrameInternal.h"
     32#import "WebFrameView.h"
     33#import "WebViewPrivate.h"
     34#import <WebCore/FrameView.h>
    3535
    3636// WebClipView's entire reason for existing is to set the clip used by focus ring redrawing.
     
    4141
    4242// FIXME: Change terminology from "additional clip" to "focus ring clip".
     43
     44using namespace WebCore;
    4345
    4446@interface NSView (WebViewMethod)
     
    6769    return self;
    6870}
     71
     72#if USE(ACCELERATED_COMPOSITING)
     73- (NSRect)visibleRect
     74{
     75    WebFrameView *webFrameView = (WebFrameView *)[[self superview] superview];
     76    if (![webFrameView isKindOfClass:[WebFrameView class]])
     77        return [super visibleRect];
     78
     79    if (Frame* coreFrame = core([webFrameView webFrame])) {
     80        if (FrameView* frameView = coreFrame->view()) {
     81            if (frameView->isEnclosedInCompositingLayer())
     82                return [self bounds];
     83        }
     84    }
     85
     86    return [super visibleRect];
     87}
     88#endif
    6989
    7090- (void)resetAdditionalClip
  • trunk/WebKit/mac/WebView/WebHTMLView.mm

    r58802 r58847  
    181181
    182182// Overriding an internal method is a hack; <rdar://problem/7662987> tracks finding a better solution.
    183 static void setCursor(NSWindow* self, SEL cmd, NSPoint point)
     183static void setCursor(NSWindow *self, SEL cmd, NSPoint point)
    184184{
    185185    if (needsCursorRectsSupportAtPoint(self, point))
     
    223223- (NSRect)_dirtyRect;
    224224- (void)_setDrawsOwnDescendants:(BOOL)drawsOwnDescendants;
     225- (BOOL)_drawnByAncestor;
    225226- (void)_propagateDirtyRectsToOpaqueAncestors;
    226227- (void)_windowChangedKeyState;
     
    229230#endif
    230231@end
     232
     233#if USE(ACCELERATED_COMPOSITING)
     234static IMP oldSetNeedsDisplayInRectIMP;
     235
     236static void setNeedsDisplayInRect(NSView *self, SEL cmd, NSRect invalidRect)
     237{
     238    if (![self _drawnByAncestor]) {
     239        oldSetNeedsDisplayInRectIMP(self, cmd, invalidRect);
     240        return;
     241    }
     242
     243    static Class webFrameViewClass = [WebFrameView class];
     244    WebFrameView *enclosingWebFrameView = (WebFrameView *)self;
     245    while (enclosingWebFrameView && ![enclosingWebFrameView isKindOfClass:webFrameViewClass])
     246        enclosingWebFrameView = (WebFrameView *)[enclosingWebFrameView superview];
     247
     248    if (!enclosingWebFrameView) {
     249        oldSetNeedsDisplayInRectIMP(self, cmd, invalidRect);
     250        return;
     251    }
     252
     253    FrameView* frameView = core([enclosingWebFrameView webFrame])->view();
     254    if (!frameView || !frameView->isEnclosedInCompositingLayer()) {
     255        oldSetNeedsDisplayInRectIMP(self, cmd, invalidRect);
     256        return;
     257    }
     258
     259    NSRect invalidRectInWebFrameViewCoordinates = [enclosingWebFrameView convertRect:invalidRect fromView:self];
     260    IntRect invalidRectInFrameViewCoordinates(invalidRectInWebFrameViewCoordinates);
     261    if (![enclosingWebFrameView isFlipped])
     262        invalidRectInFrameViewCoordinates.setY(frameView->frameRect().size().height() - invalidRectInFrameViewCoordinates.bottom());
     263
     264    frameView->invalidateRect(invalidRectInFrameViewCoordinates);
     265}
     266#endif // USE(ACCELERATED_COMPOSITING)
    231267
    232268@interface NSApplication (WebNSApplicationDetails)
     
    504540        ASSERT(oldSetCursorForMouseLocationIMP);
    505541    }
    506 #else
     542
     543#if USE(ACCELERATED_COMPOSITING)
     544    if (!oldSetNeedsDisplayInRectIMP) {
     545        Method setNeedsDisplayInRectMethod = class_getInstanceMethod([NSView class], @selector(setNeedsDisplayInRect:));
     546        ASSERT(setNeedsDisplayInRectMethod);
     547        oldSetNeedsDisplayInRectIMP = method_setImplementation(setNeedsDisplayInRectMethod, (IMP)setNeedsDisplayInRect);
     548        ASSERT(oldSetNeedsDisplayInRectIMP);
     549    }
     550#endif // USE(ACCELERATED_COMPOSITING)
     551
     552#else // defined(BUILDING_ON_TIGER)
    507553    if (!oldSetCursorIMP) {
    508554        Method setCursorMethod = class_getInstanceMethod([NSCursor class], @selector(set));
     
    33343380    if (!([[self superview] isKindOfClass:[WebClipView class]]))
    33353381        return [super visibleRect];
    3336        
     3382
    33373383    WebClipView *clipView = (WebClipView *)[self superview];
    33383384
  • trunk/WebKit/mac/WebView/WebView.mm

    r58846 r58847  
    56235623    if ([webView _syncCompositingChanges])
    56245624        [webView _clearLayerSyncLoopObserver];
     5625    else {
     5626        // Since the WebView does not need display, -viewWillDraw will not be called. Perform pending layout now,
     5627        // so that the layers draw with up-to-date layout.
     5628        [webView _viewWillDrawInternal];
     5629    }
    56255630}
    56265631
Note: See TracChangeset for help on using the changeset viewer.