Title: [185461] trunk/Source/WebCore
- Revision
- 185461
- Author
- [email protected]
- Date
- 2015-06-11 11:01:44 -0700 (Thu, 11 Jun 2015)
Log 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:]):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (185460 => 185461)
--- trunk/Source/WebCore/ChangeLog 2015-06-11 17:45:35 UTC (rev 185460)
+++ trunk/Source/WebCore/ChangeLog 2015-06-11 18:01:44 UTC (rev 185461)
@@ -1,3 +1,25 @@
+2015-06-08 Simon Fraser <[email protected]>
+
+ 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:]):
+
2015-06-11 Daniel Bates <[email protected]>
Simplify event handling logic for search cancel button
Modified: trunk/Source/WebCore/platform/ios/LegacyTileCache.h (185460 => 185461)
--- trunk/Source/WebCore/platform/ios/LegacyTileCache.h 2015-06-11 17:45:35 UTC (rev 185460)
+++ trunk/Source/WebCore/platform/ios/LegacyTileCache.h 2015-06-11 18:01:44 UTC (rev 185461)
@@ -34,6 +34,7 @@
#include "IntSize.h"
#include "Timer.h"
#include <wtf/Noncopyable.h>
+#include <wtf/Optional.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RetainPtr.h>
#include <wtf/Threading.h>
@@ -139,6 +140,7 @@
CALayer* hostLayer() const;
unsigned tileCapacityForGrid(LegacyTileGrid*);
Color colorForGridTileBorder(LegacyTileGrid*) const;
+ void setOverrideVisibleRect(Optional<FloatRect>);
void doPendingRepaints();
@@ -183,6 +185,8 @@
// Ensure there are no async calls on a dead tile cache.
RetainPtr<LegacyTileCacheTombstone> m_tombstone;
+ Optional<FloatRect> m_overrideVisibleRect;
+
TilingMode m_tilingMode;
TilingDirection m_tilingDirection;
Modified: trunk/Source/WebCore/platform/ios/LegacyTileCache.mm (185460 => 185461)
--- trunk/Source/WebCore/platform/ios/LegacyTileCache.mm 2015-06-11 17:45:35 UTC (rev 185460)
+++ trunk/Source/WebCore/platform/ios/LegacyTileCache.mm 2015-06-11 18:01:44 UTC (rev 185461)
@@ -110,9 +110,17 @@
FloatRect LegacyTileCache::visibleRectInLayer(CALayer *layer) const
{
+ if (m_overrideVisibleRect)
+ return [layer convertRect:m_overrideVisibleRect.value() fromLayer:hostLayer()];
+
return [layer convertRect:[m_window extendedVisibleRect] fromLayer:hostLayer()];
}
+void LegacyTileCache::setOverrideVisibleRect(Optional<FloatRect> rect)
+{
+ m_overrideVisibleRect = rect;
+}
+
bool LegacyTileCache::tilesOpaque() const
{
return m_tilesOpaque;
Modified: trunk/Source/WebCore/platform/ios/LegacyTileLayer.mm (185460 => 185461)
--- trunk/Source/WebCore/platform/ios/LegacyTileLayer.mm 2015-06-11 17:45:35 UTC (rev 185460)
+++ trunk/Source/WebCore/platform/ios/LegacyTileLayer.mm 2015-06-11 18:01:44 UTC (rev 185461)
@@ -32,7 +32,10 @@
#include "LegacyTileGrid.h"
#include "WebCoreThread.h"
+using namespace WebCore;
+
@implementation LegacyTileHostLayer
+
- (id)initWithTileGrid:(WebCore::LegacyTileGrid*)tileGrid
{
self = [super init];
@@ -54,8 +57,14 @@
{
if (pthread_main_np())
WebThreadLock();
+
+ CGRect dirtyRect = CGContextGetClipBoundingBox(context);
+ _tileGrid->tileCache().setOverrideVisibleRect(FloatRect(dirtyRect));
_tileGrid->tileCache().doLayoutTiles();
+
[super renderInContext:context];
+
+ _tileGrid->tileCache().setOverrideVisibleRect(Nullopt);
}
@end
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes