[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
andersca at apple.com
andersca at apple.com
Sun Feb 20 22:52:07 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit a6e49d71789c9f9aa9541c5da1c728b922d231a4
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Jan 12 19:41:22 2011 +0000
2011-01-12 Anders Carlsson <andersca at apple.com>
Reviewed by Sam Weinig.
Make the new drawing area actually draw something
https://bugs.webkit.org/show_bug.cgi?id=52314
* Shared/UpdateInfo.cpp:
(WebKit::UpdateInfo::encode):
(WebKit::UpdateInfo::decode):
Encode and decode newly added fields.
* Shared/UpdateInfo.h:
Add a vector of update rects and a handle for the sharable bitmap.
* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::display):
Get the individual rects from the region and paint them into the shareable bitmap.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::mainFrameHasCustomRepresentation):
* WebProcess/WebPage/WebPage.h:
Add helper function.
* WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp:
(WebKit::ChunkedUpdateDrawingArea::paintIntoUpdateChunk):
Use helper function.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 4d1a689..adf7ac2 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -2,6 +2,34 @@
Reviewed by Sam Weinig.
+ Make the new drawing area actually draw something
+ https://bugs.webkit.org/show_bug.cgi?id=52314
+
+ * Shared/UpdateInfo.cpp:
+ (WebKit::UpdateInfo::encode):
+ (WebKit::UpdateInfo::decode):
+ Encode and decode newly added fields.
+
+ * Shared/UpdateInfo.h:
+ Add a vector of update rects and a handle for the sharable bitmap.
+
+ * WebProcess/WebPage/DrawingAreaImpl.cpp:
+ (WebKit::DrawingAreaImpl::display):
+ Get the individual rects from the region and paint them into the shareable bitmap.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::mainFrameHasCustomRepresentation):
+ * WebProcess/WebPage/WebPage.h:
+ Add helper function.
+
+ * WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp:
+ (WebKit::ChunkedUpdateDrawingArea::paintIntoUpdateChunk):
+ Use helper function.
+
+2011-01-12 Anders Carlsson <andersca at apple.com>
+
+ Reviewed by Sam Weinig.
+
Add UpdateInfo class
https://bugs.webkit.org/show_bug.cgi?id=52306
diff --git a/WebKit2/Shared/UpdateInfo.cpp b/WebKit2/Shared/UpdateInfo.cpp
index e86940e..0ba4ad3 100644
--- a/WebKit2/Shared/UpdateInfo.cpp
+++ b/WebKit2/Shared/UpdateInfo.cpp
@@ -33,6 +33,8 @@ void UpdateInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
{
encoder->encode(viewSize);
encoder->encode(updateRectBounds);
+ encoder->encode(updateRects);
+ encoder->encode(bitmapHandle);
}
bool UpdateInfo::decode(CoreIPC::ArgumentDecoder* decoder, UpdateInfo& result)
@@ -41,6 +43,10 @@ bool UpdateInfo::decode(CoreIPC::ArgumentDecoder* decoder, UpdateInfo& result)
return false;
if (!decoder->decode(result.updateRectBounds))
return false;
+ if (!decoder->decode(result.updateRects))
+ return false;
+ if (!decoder->decode(result.bitmapHandle))
+ return false;
return true;
}
diff --git a/WebKit2/Shared/UpdateInfo.h b/WebKit2/Shared/UpdateInfo.h
index 2200cf4..827f5e0 100644
--- a/WebKit2/Shared/UpdateInfo.h
+++ b/WebKit2/Shared/UpdateInfo.h
@@ -26,6 +26,7 @@
#ifndef UpdateInfo_h
#define UpdateInfo_h
+#include "SharedMemory.h"
#include <WebCore/IntRect.h>
#include <wtf/Noncopyable.h>
@@ -51,6 +52,12 @@ public:
// The bounds of the update rects.
WebCore::IntRect updateRectBounds;
+ // All the update rects, in view coordinates.
+ Vector<WebCore::IntRect> updateRects;
+
+ // The handle of the shareable bitmap containing the updates. Will be null if there are no updates.
+ SharedMemory::Handle bitmapHandle;
+
};
} // namespace WebKit
diff --git a/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp b/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
index 8902958..32b47d5 100644
--- a/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
+++ b/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
@@ -26,8 +26,11 @@
#include "DrawingAreaImpl.h"
#include "DrawingAreaProxyMessages.h"
+#include "ShareableBitmap.h"
+#include "UpdateInfo.h"
#include "WebPage.h"
#include "WebProcess.h"
+#include <WebCore/GraphicsContext.h>
#ifndef __APPLE__
#error "This drawing area is not ready for use by other ports yet."
@@ -122,7 +125,43 @@ void DrawingAreaImpl::display()
if (m_dirtyRegion.isEmpty())
return;
- // FIXME: Actually paint.
+ UpdateInfo updateInfo;
+ display(updateInfo);
+
+ // FIXME: Send over the updateInfo struct.
+}
+
+void DrawingAreaImpl::display(UpdateInfo& updateInfo)
+{
+ // FIXME: It would be better if we could avoid painting altogether when there is a custom representation.
+ if (m_webPage->mainFrameHasCustomRepresentation())
+ return;
+
+ IntRect bounds = m_dirtyRegion.bounds();
+ Vector<IntRect> rects = m_dirtyRegion.rects();
+
+ m_dirtyRegion = Region();
+
+ RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(bounds.size());
+
+ OwnPtr<GraphicsContext> graphicsContext = bitmap->createGraphicsContext();
+
+ m_webPage->layoutIfNeeded();
+
+ updateInfo.viewSize = m_webPage->size();
+ updateInfo.updateRectBounds = bounds;
+
+ graphicsContext->translate(-bounds.x(), -bounds.y());
+
+ for (size_t i = 0; i < rects.size(); ++i) {
+ m_webPage->drawRect(*graphicsContext, rects[i]);
+ updateInfo.updateRects.append(rects[i]);
+ }
+
+ // Layout can trigger more calls to setNeedsDisplay and we don't want to process them
+ // until the UI process has painted the update, so we stop the timer here.
+ m_displayTimer.stop();
}
+
} // namespace WebKit
diff --git a/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h b/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
index caec677..df97857 100644
--- a/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
+++ b/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
@@ -32,6 +32,8 @@
namespace WebKit {
+struct UpdateInfo;
+
class DrawingAreaImpl : public DrawingArea {
public:
static PassRefPtr<DrawingAreaImpl> create(DrawingAreaInfo::Identifier, WebPage*);
@@ -55,6 +57,7 @@ private:
void scheduleDisplay();
void display();
+ void display(UpdateInfo&);
Region m_dirtyRegion;
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 2d7ced9..9301d0a 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -1378,6 +1378,11 @@ void WebPage::replaceSelectionWithText(Frame* frame, const String& text)
frame->selection()->revealSelection(ScrollAlignment::alignToEdgeIfNeeded);
}
+bool WebPage::mainFrameHasCustomRepresentation() const
+{
+ return static_cast<WebFrameLoaderClient*>(mainFrame()->coreFrame()->loader()->client())->frameHasCustomRepresentation();
+}
+
#if PLATFORM(MAC)
void WebPage::addPluginView(PluginView* pluginView)
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index b8f65ec..ea319bb 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -296,6 +296,8 @@ public:
void replaceSelectionWithText(WebCore::Frame*, const String&);
+ bool mainFrameHasCustomRepresentation() const;
+
private:
WebPage(uint64_t pageID, const WebPageCreationParameters&);
diff --git a/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp b/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp
index 8fb82c8..6bcecfd 100644
--- a/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp
+++ b/WebKit2/WebProcess/WebPage/mac/ChunkedUpdateDrawingAreaMac.cpp
@@ -40,7 +40,7 @@ namespace WebKit {
void ChunkedUpdateDrawingArea::paintIntoUpdateChunk(UpdateChunk* updateChunk)
{
// FIXME: It would be better if we could avoid painting altogether when there is a custom representation.
- if (static_cast<WebFrameLoaderClient*>(m_webPage->mainFrame()->coreFrame()->loader()->client())->frameHasCustomRepresentation())
+ if (m_webPage->mainFrameHasCustomRepresentation())
return;
RetainPtr<CGColorSpaceRef> colorSpace(AdoptCF, CGColorSpaceCreateDeviceRGB());
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list