Title: [294131] branches/safari-7614.1.13-branch/Source
- Revision
- 294131
- Author
- alanc...@apple.com
- Date
- 2022-05-12 17:55:13 -0700 (Thu, 12 May 2022)
Log Message
Cherry-pick r293968. rdar://problem/92892014
[macOS] REGRESSION (r293825): Find highlight snapshots are incorrectly scaled
https://bugs.webkit.org/show_bug.cgi?id=240203
rdar://92892014
Reviewed by Tim Horton.
Source/WebCore:
takeSnapshots() depends on the snapshot ImageBuffer::resolutionScale() to
set the size of the TextIndicatorData image. r293825 scaled the size of
the ImageBuffer before creation and moved the scaling to the GraphicsContext.
So we have correct scaled pixels but the resolutionScale is 1. So we get
enlarged incorrect image.
The fix is to revert r293825 and fix the iOS snapshot without having to
change snapshotFrameRectWithClip().
* page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRectWithClip):
Source/WebKit:
In getShareableBitmapForImageBufferWithQualifiedIdentifier(), we used to
pass the backendSize as the srcRect and the backendSize as the destRect
to GraphicsContext::drawImageBuffer(). The backendSize is the logicalSize
scaled by the resolutionScale. But in ImageBufferCGBackend::draw() we
scale the srcRect by the resolutionScale one more time. This double-
scaled srcRect draws a srcRect whose size = backendSize * resolutionScale
to a destRect whose size = backendSize. And this results in shrinking the
desired snapshot image by 1 / resolutionScale.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::getShareableBitmapForImageBufferWithQualifiedIdentifier):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@293968 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Modified Paths
Diff
Modified: branches/safari-7614.1.13-branch/Source/WebCore/ChangeLog (294130 => 294131)
--- branches/safari-7614.1.13-branch/Source/WebCore/ChangeLog 2022-05-13 00:55:10 UTC (rev 294130)
+++ branches/safari-7614.1.13-branch/Source/WebCore/ChangeLog 2022-05-13 00:55:13 UTC (rev 294131)
@@ -1,5 +1,66 @@
2022-05-12 Russell Epstein <repst...@apple.com>
+ Cherry-pick r293968. rdar://problem/92892014
+
+ [macOS] REGRESSION (r293825): Find highlight snapshots are incorrectly scaled
+ https://bugs.webkit.org/show_bug.cgi?id=240203
+ rdar://92892014
+
+ Reviewed by Tim Horton.
+
+ Source/WebCore:
+
+ takeSnapshots() depends on the snapshot ImageBuffer::resolutionScale() to
+ set the size of the TextIndicatorData image. r293825 scaled the size of
+ the ImageBuffer before creation and moved the scaling to the GraphicsContext.
+ So we have correct scaled pixels but the resolutionScale is 1. So we get
+ enlarged incorrect image.
+
+ The fix is to revert r293825 and fix the iOS snapshot without having to
+ change snapshotFrameRectWithClip().
+
+ * page/FrameSnapshotting.cpp:
+ (WebCore::snapshotFrameRectWithClip):
+
+ Source/WebKit:
+
+ In getShareableBitmapForImageBufferWithQualifiedIdentifier(), we used to
+ pass the backendSize as the srcRect and the backendSize as the destRect
+ to GraphicsContext::drawImageBuffer(). The backendSize is the logicalSize
+ scaled by the resolutionScale. But in ImageBufferCGBackend::draw() we
+ scale the srcRect by the resolutionScale one more time. This double-
+ scaled srcRect draws a srcRect whose size = backendSize * resolutionScale
+ to a destRect whose size = backendSize. And this results in shrinking the
+ desired snapshot image by 1 / resolutionScale.
+
+ * GPUProcess/graphics/RemoteRenderingBackend.cpp:
+ (WebKit::RemoteRenderingBackend::getShareableBitmapForImageBufferWithQualifiedIdentifier):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@293968 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2022-05-08 Said Abou-Hallawa <s...@apple.com>
+
+ [macOS] REGRESSION (r293825): Find highlight snapshots are incorrectly scaled
+ https://bugs.webkit.org/show_bug.cgi?id=240203
+ rdar://92892014
+
+ Reviewed by Tim Horton.
+
+ takeSnapshots() depends on the snapshot ImageBuffer::resolutionScale() to
+ set the size of the TextIndicatorData image. r293825 scaled the size of
+ the ImageBuffer before creation and moved the scaling to the GraphicsContext.
+ So we have correct scaled pixels but the resolutionScale is 1. So we get
+ enlarged incorrect image.
+
+ The fix is to revert r293825 and fix the iOS snapshot without having to
+ change snapshotFrameRectWithClip().
+
+ * page/FrameSnapshotting.cpp:
+ (WebCore::snapshotFrameRectWithClip):
+
+2022-05-12 Russell Epstein <repst...@apple.com>
+
Cherry-pick r293951. rdar://problem/92635604
Don't propagate GraphicsContextState change bits into TextPainter's glyph display list recorder
Modified: branches/safari-7614.1.13-branch/Source/WebCore/page/FrameSnapshotting.cpp (294130 => 294131)
--- branches/safari-7614.1.13-branch/Source/WebCore/page/FrameSnapshotting.cpp 2022-05-13 00:55:10 UTC (rev 294130)
+++ branches/safari-7614.1.13-branch/Source/WebCore/page/FrameSnapshotting.cpp 2022-05-13 00:55:13 UTC (rev 294131)
@@ -115,23 +115,19 @@
if (options.flags.contains(SnapshotFlags::PaintWithIntegralScaleFactor))
scaleFactor = ceilf(scaleFactor);
- auto scaledImageRect = imageRect;
- scaledImageRect.scale(scaleFactor);
-
auto purpose = options.flags.contains(SnapshotFlags::Shareable) ? RenderingPurpose::ShareableSnapshot : RenderingPurpose::Snapshot;
auto hostWindow = (document->view() && document->view()->root()) ? document->view()->root()->hostWindow() : nullptr;
- auto buffer = ImageBuffer::create(scaledImageRect.size(), purpose, 1, options.colorSpace, options.pixelFormat, { }, { hostWindow });
+ auto buffer = ImageBuffer::create(imageRect.size(), purpose, scaleFactor, options.colorSpace, options.pixelFormat, { }, { hostWindow });
if (!buffer)
return nullptr;
- buffer->context().translate(-scaledImageRect.location());
- buffer->context().scale(scaleFactor);
+ buffer->context().translate(-imageRect.location());
if (!clipRects.isEmpty()) {
Path clipPath;
for (auto& rect : clipRects)
- clipPath.addRect(rect);
+ clipPath.addRect(encloseRectToDevicePixels(rect, scaleFactor));
buffer->context().clipPath(clipPath);
}
Modified: branches/safari-7614.1.13-branch/Source/WebKit/ChangeLog (294130 => 294131)
--- branches/safari-7614.1.13-branch/Source/WebKit/ChangeLog 2022-05-13 00:55:10 UTC (rev 294130)
+++ branches/safari-7614.1.13-branch/Source/WebKit/ChangeLog 2022-05-13 00:55:13 UTC (rev 294131)
@@ -1,3 +1,64 @@
+2022-05-12 Russell Epstein <repst...@apple.com>
+
+ Cherry-pick r293968. rdar://problem/92892014
+
+ [macOS] REGRESSION (r293825): Find highlight snapshots are incorrectly scaled
+ https://bugs.webkit.org/show_bug.cgi?id=240203
+ rdar://92892014
+
+ Reviewed by Tim Horton.
+
+ Source/WebCore:
+
+ takeSnapshots() depends on the snapshot ImageBuffer::resolutionScale() to
+ set the size of the TextIndicatorData image. r293825 scaled the size of
+ the ImageBuffer before creation and moved the scaling to the GraphicsContext.
+ So we have correct scaled pixels but the resolutionScale is 1. So we get
+ enlarged incorrect image.
+
+ The fix is to revert r293825 and fix the iOS snapshot without having to
+ change snapshotFrameRectWithClip().
+
+ * page/FrameSnapshotting.cpp:
+ (WebCore::snapshotFrameRectWithClip):
+
+ Source/WebKit:
+
+ In getShareableBitmapForImageBufferWithQualifiedIdentifier(), we used to
+ pass the backendSize as the srcRect and the backendSize as the destRect
+ to GraphicsContext::drawImageBuffer(). The backendSize is the logicalSize
+ scaled by the resolutionScale. But in ImageBufferCGBackend::draw() we
+ scale the srcRect by the resolutionScale one more time. This double-
+ scaled srcRect draws a srcRect whose size = backendSize * resolutionScale
+ to a destRect whose size = backendSize. And this results in shrinking the
+ desired snapshot image by 1 / resolutionScale.
+
+ * GPUProcess/graphics/RemoteRenderingBackend.cpp:
+ (WebKit::RemoteRenderingBackend::getShareableBitmapForImageBufferWithQualifiedIdentifier):
+
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@293968 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2022-05-08 Said Abou-Hallawa <s...@apple.com>
+
+ [macOS] REGRESSION (r293825): Find highlight snapshots are incorrectly scaled
+ https://bugs.webkit.org/show_bug.cgi?id=240203
+ rdar://92892014
+
+ Reviewed by Tim Horton.
+
+ In getShareableBitmapForImageBufferWithQualifiedIdentifier(), we used to
+ pass the backendSize as the srcRect and the backendSize as the destRect
+ to GraphicsContext::drawImageBuffer(). The backendSize is the logicalSize
+ scaled by the resolutionScale. But in ImageBufferCGBackend::draw() we
+ scale the srcRect by the resolutionScale one more time. This double-
+ scaled srcRect draws a srcRect whose size = backendSize * resolutionScale
+ to a destRect whose size = backendSize. And this results in shrinking the
+ desired snapshot image by 1 / resolutionScale.
+
+ * GPUProcess/graphics/RemoteRenderingBackend.cpp:
+ (WebKit::RemoteRenderingBackend::getShareableBitmapForImageBufferWithQualifiedIdentifier):
+
2022-05-12 Alan Coon <alanc...@apple.com>
Cherry-pick r294126. rdar://problem/93208265
Modified: branches/safari-7614.1.13-branch/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp (294130 => 294131)
--- branches/safari-7614.1.13-branch/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp 2022-05-13 00:55:10 UTC (rev 294130)
+++ branches/safari-7614.1.13-branch/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp 2022-05-13 00:55:13 UTC (rev 294131)
@@ -292,6 +292,7 @@
if (!imageBuffer)
return;
auto backendSize = imageBuffer->backendSize();
+ auto logicalSize = imageBuffer->logicalSize();
auto resultSize = preserveResolution == PreserveResolution::Yes ? backendSize : imageBuffer->truncatedLogicalSize();
auto bitmap = ShareableBitmap::create(resultSize, { imageBuffer->colorSpace() });
if (!bitmap)
@@ -299,7 +300,7 @@
auto context = bitmap->createGraphicsContext();
if (!context)
return;
- context->drawImageBuffer(*imageBuffer, FloatRect { { }, resultSize }, FloatRect { { }, backendSize }, { CompositeOperator::Copy });
+ context->drawImageBuffer(*imageBuffer, FloatRect { { }, resultSize }, FloatRect { { }, logicalSize }, { CompositeOperator::Copy });
bitmap->createHandle(handle);
}();
completionHandler(WTFMove(handle));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes