Changeset 150194 in webkit


Ignore:
Timestamp:
May 16, 2013 11:40:16 AM (11 years ago)
Author:
Simon Fraser
Message:

Re-land r150168 with some OS version guards.

  • WebView/WebFrameView.mm:

(-[WebFrameView drawRect:]):
(-[WebFrameView wantsUpdateLayer]):
(-[WebFrameView updateLayer]):

Location:
trunk/Source/WebKit/mac
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/mac/ChangeLog

    r150180 r150194  
     12013-05-16  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Re-land r150168 with some OS version guards.
     4
     5        * WebView/WebFrameView.mm:
     6        (-[WebFrameView drawRect:]):
     7        (-[WebFrameView wantsUpdateLayer]):
     8        (-[WebFrameView updateLayer]):
     9
    1102013-05-16  Commit Queue  <commit-queue@webkit.org>
    211
  • trunk/Source/WebKit/mac/WebView/WebFrameView.mm

    r150180 r150194  
    8080@end
    8181
     82#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
     83@interface NSView (Details)
     84- (void)setBackgroundColor:(NSColor *)color;
     85@end
     86#endif
     87
    8288enum {
    8389    SpaceKey = 0x0020
     
    459465- (void)drawRect:(NSRect)rect
    460466{
    461     if ([self documentView] == nil) {
     467    if (![self documentView]) {
    462468        // Need to paint ourselves if there's no documentView to do it instead.
    463469        if ([[self _webView] drawsBackground]) {
     
    474480    }
    475481}
     482
     483#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
     484- (BOOL)wantsUpdateLayer
     485{
     486    return YES;
     487}
     488
     489- (void)updateLayer
     490{
     491    // Do what -drawRect: does but by setting a backgroundColor on the view. This avoids
     492    // backing store for this view when the WebView is layer-backed.
     493    if (![self documentView]) {
     494        if ([[self _webView] drawsBackground]) {
     495            [self setBackgroundColor:[[self _webView] backgroundColor]];
     496            return;
     497        }
     498    } else {
     499#ifndef NDEBUG
     500        if ([[self _scrollView] drawsBackground]) {
     501            [self setBackgroundColor:[NSColor cyanColor]];
     502            return;
     503        }
     504#endif
     505    }
     506
     507    [self setBackgroundColor:[NSColor clearColor]];
     508}
     509#endif
    476510
    477511- (NSRect)visibleRect
Note: See TracChangeset for help on using the changeset viewer.