Changeset 162590 in webkit


Ignore:
Timestamp:
Jan 22, 2014 9:04:43 PM (10 years ago)
Author:
benjamin@webkit.org
Message:

Add a minimalistic SPI to control the layout size outside of WKView
https://bugs.webkit.org/show_bug.cgi?id=127403

Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-01-22
Reviewed by Sam Weinig.

The API lets a client of WKView force the layout size. Once the size
is set this way, default update is disabled and the client needs to
update the size systematically as needed. This is done to avoid double
layout or flickering.

  • UIProcess/API/Cocoa/WKViewPrivate.h:
  • UIProcess/API/ios/WKViewIOS.mm:

(-[WKView _frameOrBoundsChanged]):
(-[WKView overrideMinimumLayoutSize:]):

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r162584 r162590  
     12014-01-22  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        Add a minimalistic SPI to control the layout size outside of WKView
     4        https://bugs.webkit.org/show_bug.cgi?id=127403
     5
     6        Reviewed by Sam Weinig.
     7
     8        The API lets a client of WKView force the layout size. Once the size
     9        is set this way, default update is disabled and the client needs to
     10        update the size systematically as needed. This is done to avoid double
     11        layout or flickering.
     12
     13        * UIProcess/API/Cocoa/WKViewPrivate.h:
     14        * UIProcess/API/ios/WKViewIOS.mm:
     15        (-[WKView _frameOrBoundsChanged]):
     16        (-[WKView overrideMinimumLayoutSize:]):
     17
    1182014-01-22  Jinwoo Song  <jinwoo7.song@samsung.com>
    219
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h

    r160692 r162590  
    11/*
    2  * Copyright (C) 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4141#endif
    4242
    43 #if !TARGET_OS_IPHONE
     43#if TARGET_OS_IPHONE
     44
     45@property (nonatomic) CGSize minimumLayoutSizeOverride;
     46
     47#else
    4448
    4549- (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(WKFrameRef)frameRef;
  • trunk/Source/WebKit2/UIProcess/API/ios/WKViewIOS.mm

    r162121 r162590  
    11/*
    2  * Copyright (C) 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5050    BOOL _userHasChangedPageScale;
    5151    RetainPtr<_UIWebViewportHandler> _viewportHandler;
     52    BOOL _hasStaticMinimumLayoutSize;
    5253}
    5354
     
    258259{
    259260    CGRect bounds = [self bounds];
    260     [_viewportHandler update:^{
    261         [_viewportHandler setAvailableViewSize:bounds.size];
    262     }];
     261    if (!_hasStaticMinimumLayoutSize) {
     262        [_viewportHandler update:^{
     263            [_viewportHandler setAvailableViewSize:bounds.size];
     264        }];
     265    }
    263266    [_scrollView setFrame:bounds];
    264267    [_contentView setMinimumSize:bounds.size];
     
    299302}
    300303
     304- (CGSize)minimumLayoutSizeOverride
     305{
     306    ASSERT(_hasStaticMinimumLayoutSize);
     307    return [_viewportHandler availableViewSize];
     308}
     309
     310- (void)setMinimumLayoutSizeOverride:(CGSize)minimumLayoutSizeOverride
     311{
     312    _hasStaticMinimumLayoutSize = YES;
     313    [_viewportHandler update:^{
     314        [_viewportHandler setAvailableViewSize:minimumLayoutSizeOverride];
     315    }];
     316}
     317
    301318@end
Note: See TracChangeset for help on using the changeset viewer.