Changeset 185461 in webkit


Ignore:
Timestamp:
Jun 11, 2015, 11:01:44 AM (10 years ago)
Author:
Simon Fraser
Message:

Missing content in UIWebView snapshots sometimes
https://bugs.webkit.org/show_bug.cgi?id=145779
rdar://problem/20744708

Reviewed by Darin Adler.

When expanding collapsed parts of quoted text on iOS, sometimes the "concertina"
images would be blank. This happened because we'd fail to create tiles for regions
outside the LegacyTileCache's visibleRect.

Fix by giving LegacyTileCache an optional override visibleRect, which is set
and cleared during -renderInContext: using the context clip rect.

  • platform/ios/LegacyTileCache.h:
  • platform/ios/LegacyTileCache.mm:

(WebCore::LegacyTileCache::visibleRectInLayer):
(WebCore::LegacyTileCache::setOverrideVisibleRect):

  • platform/ios/LegacyTileLayer.mm:

(-[LegacyTileHostLayer renderInContext:]):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r185459 r185461  
     12015-06-08  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Missing content in UIWebView snapshots sometimes
     4        https://bugs.webkit.org/show_bug.cgi?id=145779
     5        rdar://problem/20744708
     6
     7        Reviewed by Darin Adler.
     8       
     9        When expanding collapsed parts of quoted text on iOS, sometimes the "concertina"
     10        images would be blank. This happened because we'd fail to create tiles for regions
     11        outside the LegacyTileCache's visibleRect.
     12       
     13        Fix by giving LegacyTileCache an optional override visibleRect, which is set
     14        and cleared during -renderInContext: using the context clip rect.
     15
     16        * platform/ios/LegacyTileCache.h:
     17        * platform/ios/LegacyTileCache.mm:
     18        (WebCore::LegacyTileCache::visibleRectInLayer):
     19        (WebCore::LegacyTileCache::setOverrideVisibleRect):
     20        * platform/ios/LegacyTileLayer.mm:
     21        (-[LegacyTileHostLayer renderInContext:]):
     22
    1232015-06-11  Daniel Bates  <dabates@apple.com>
    224
  • trunk/Source/WebCore/platform/ios/LegacyTileCache.h

    r183234 r185461  
    3535#include "Timer.h"
    3636#include <wtf/Noncopyable.h>
     37#include <wtf/Optional.h>
    3738#include <wtf/PassRefPtr.h>
    3839#include <wtf/RetainPtr.h>
     
    140141    unsigned tileCapacityForGrid(LegacyTileGrid*);
    141142    Color colorForGridTileBorder(LegacyTileGrid*) const;
     143    void setOverrideVisibleRect(Optional<FloatRect>);
    142144
    143145    void doPendingRepaints();
     
    184186    RetainPtr<LegacyTileCacheTombstone> m_tombstone;
    185187
     188    Optional<FloatRect> m_overrideVisibleRect;
     189
    186190    TilingMode m_tilingMode;
    187191    TilingDirection m_tilingDirection;
  • trunk/Source/WebCore/platform/ios/LegacyTileCache.mm

    r185116 r185461  
    111111FloatRect LegacyTileCache::visibleRectInLayer(CALayer *layer) const
    112112{
     113    if (m_overrideVisibleRect)
     114        return [layer convertRect:m_overrideVisibleRect.value() fromLayer:hostLayer()];
     115
    113116    return [layer convertRect:[m_window extendedVisibleRect] fromLayer:hostLayer()];
     117}
     118
     119void LegacyTileCache::setOverrideVisibleRect(Optional<FloatRect> rect)
     120{
     121    m_overrideVisibleRect = rect;
    114122}
    115123
  • trunk/Source/WebCore/platform/ios/LegacyTileLayer.mm

    r183234 r185461  
    3333#include "WebCoreThread.h"
    3434
     35using namespace WebCore;
     36
    3537@implementation LegacyTileHostLayer
     38
    3639- (id)initWithTileGrid:(WebCore::LegacyTileGrid*)tileGrid
    3740{
     
    5558    if (pthread_main_np())
    5659        WebThreadLock();
     60
     61    CGRect dirtyRect = CGContextGetClipBoundingBox(context);
     62    _tileGrid->tileCache().setOverrideVisibleRect(FloatRect(dirtyRect));
    5763    _tileGrid->tileCache().doLayoutTiles();
     64
    5865    [super renderInContext:context];
     66
     67    _tileGrid->tileCache().setOverrideVisibleRect(Nullopt);
    5968}
    6069@end
Note: See TracChangeset for help on using the changeset viewer.