[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

timothy at apple.com timothy at apple.com
Wed Dec 22 15:59:50 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 0a0875bcc23855fdb60f35f83918ef3643eb6b0a
Author: timothy at apple.com <timothy at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 17 20:07:00 2010 +0000

    Provide a way to create a WKView (WebPage) that is hidden from
    the InjectedBundle. This is needed for the Web Inspector.
    
    https://webkit.org/b/49670
    
    Reviewed by Sam Weinig.
    
    * Shared/WebPageCreationParameters.cpp:
    (WebKit::WebPageCreationParameters::encode): Added visibleToInjectedBundle.
    (WebKit::WebPageCreationParameters::decode): Ditto.
    * Shared/WebPageCreationParameters.h: Ditto.
    * UIProcess/API/C/win/WKView.cpp:
    (WKViewCreate): Pass VisibleToInjectedBundle to the WebView create function.
    * UIProcess/API/C/win/WKViewPrivate.cpp:
    (WKViewCreateForWebInspector): Added. Not used yet. Passes HiddenFromInjectedBundle
    to the WebView create function.
    * UIProcess/API/C/win/WKViewPrivate.h: Added WKViewCreateForWebInspector.
    * UIProcess/API/mac/WKView.mm:
    (-[WKView initWithFrame:pageNamespaceRef:hiddenFromInjectedBundle:]): Added hiddenFromInjectedBundle
    parameter and calls WebPageProxy::setVisibleToInjectedBundle.
    (-[WKView initWithFrame:pageNamespaceRef:]): Calls initWithFrame:pageNamespaceRef:hiddenFromInjectedBundle:
    and passes NO for hiddenFromInjectedBundle.
    (-[WKView initWithFrame:]): Cleaned up by removing the local assignment to self and just returns the result.
    * UIProcess/API/mac/WKViewInternal.h: Added initWithFrame:pageNamespaceRef:hiddenFromInjectedBundle:.
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::WebPageProxy): Initialize m_visibleToInjectedBundle from the creation parameters.
    (WebKit::WebPageProxy::creationParameters): Set visibleToInjectedBundle using m_visibleToInjectedBundle.
    * UIProcess/WebPageProxy.h: Added m_visibleToInjectedBundle.
    (WebKit::WebPageProxy::visibleToInjectedBundle): Added. Return m_visibleToInjectedBundle.
    (WebKit::WebPageProxy::setVisibleToInjectedBundle): Added. Set m_visibleToInjectedBundle.
    * UIProcess/win/WebView.cpp:
    (WebKit::WebView::WebView): Added InjectedBundleVisibility parameter and calls
    WebPageProxy::setVisibleToInjectedBundle.
    * UIProcess/win/WebView.h: Added InjectedBundleVisibility enum.
    (WebKit::WebView::create): Added InjectedBundleVisibility parameter.
    * WebProcess/WebPage/WebPage.cpp:
    (WebKit::WebPage::create): Checks visibleToInjectedBundle before talking to the injected bundle.
    (WebKit::WebPage::WebPage): Initialize m_isVisibleToInjectedBundle from the creation parameters.
    (WebKit::WebPage::close): Checks m_isVisibleToInjectedBundle before talking to the injected bundle.
    * WebProcess/WebPage/WebPage.h: Added m_isVisibleToInjectedBundle.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72229 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index b62892c..24cd543 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,46 @@
+2010-11-17  Timothy Hatcher  <timothy at apple.com>
+
+        Provide a way to create a WKView (WebPage) that is hidden from
+        the InjectedBundle. This is needed for the Web Inspector.
+
+        https://webkit.org/b/49670
+
+        Reviewed by Sam Weinig.
+
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode): Added visibleToInjectedBundle.
+        (WebKit::WebPageCreationParameters::decode): Ditto.
+        * Shared/WebPageCreationParameters.h: Ditto.
+        * UIProcess/API/C/win/WKView.cpp:
+        (WKViewCreate): Pass VisibleToInjectedBundle to the WebView create function.
+        * UIProcess/API/C/win/WKViewPrivate.cpp:
+        (WKViewCreateForWebInspector): Added. Not used yet. Passes HiddenFromInjectedBundle
+        to the WebView create function.
+        * UIProcess/API/C/win/WKViewPrivate.h: Added WKViewCreateForWebInspector.
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView initWithFrame:pageNamespaceRef:hiddenFromInjectedBundle:]): Added hiddenFromInjectedBundle
+        parameter and calls WebPageProxy::setVisibleToInjectedBundle.
+        (-[WKView initWithFrame:pageNamespaceRef:]): Calls initWithFrame:pageNamespaceRef:hiddenFromInjectedBundle:
+        and passes NO for hiddenFromInjectedBundle.
+        (-[WKView initWithFrame:]): Cleaned up by removing the local assignment to self and just returns the result.
+        * UIProcess/API/mac/WKViewInternal.h: Added initWithFrame:pageNamespaceRef:hiddenFromInjectedBundle:.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy): Initialize m_visibleToInjectedBundle from the creation parameters.
+        (WebKit::WebPageProxy::creationParameters): Set visibleToInjectedBundle using m_visibleToInjectedBundle.
+        * UIProcess/WebPageProxy.h: Added m_visibleToInjectedBundle.
+        (WebKit::WebPageProxy::visibleToInjectedBundle): Added. Return m_visibleToInjectedBundle.
+        (WebKit::WebPageProxy::setVisibleToInjectedBundle): Added. Set m_visibleToInjectedBundle.
+        * UIProcess/win/WebView.cpp:
+        (WebKit::WebView::WebView): Added InjectedBundleVisibility parameter and calls
+        WebPageProxy::setVisibleToInjectedBundle.
+        * UIProcess/win/WebView.h: Added InjectedBundleVisibility enum.
+        (WebKit::WebView::create): Added InjectedBundleVisibility parameter.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::create): Checks visibleToInjectedBundle before talking to the injected bundle.
+        (WebKit::WebPage::WebPage): Initialize m_isVisibleToInjectedBundle from the creation parameters.
+        (WebKit::WebPage::close): Checks m_isVisibleToInjectedBundle before talking to the injected bundle.
+        * WebProcess/WebPage/WebPage.h: Added m_isVisibleToInjectedBundle.
+
 2010-11-17  Andras Becsi  <abecsi at webkit.org>
 
         Unreviewed buildfix.
diff --git a/WebKit2/Shared/WebPageCreationParameters.cpp b/WebKit2/Shared/WebPageCreationParameters.cpp
index ea731d4..28fad62 100644
--- a/WebKit2/Shared/WebPageCreationParameters.cpp
+++ b/WebKit2/Shared/WebPageCreationParameters.cpp
@@ -34,6 +34,7 @@ void WebPageCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const
     encoder->encode(viewSize);
     encoder->encode(store);
     encoder->encode(drawingAreaInfo);
+    encoder->encode(visibleToInjectedBundle);
 
 #if PLATFORM(WIN)
     encoder->encode(reinterpret_cast<uint64_t>(nativeWindow));
@@ -48,6 +49,8 @@ bool WebPageCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, WebPag
         return false;
     if (!decoder->decode(parameters.drawingAreaInfo))
         return false;
+    if (!decoder->decode(parameters.visibleToInjectedBundle))
+        return false;
 
 #if PLATFORM(WIN)
     uint64_t nativeWindow;
diff --git a/WebKit2/Shared/WebPageCreationParameters.h b/WebKit2/Shared/WebPageCreationParameters.h
index 4f6a98f..a1c91a9 100644
--- a/WebKit2/Shared/WebPageCreationParameters.h
+++ b/WebKit2/Shared/WebPageCreationParameters.h
@@ -44,6 +44,7 @@ struct WebPageCreationParameters {
     WebCore::IntSize viewSize;
     WebPreferencesStore store;
     DrawingAreaBase::DrawingAreaInfo drawingAreaInfo;
+    bool visibleToInjectedBundle;
 #if PLATFORM(WIN)
     HWND nativeWindow;
 #endif
diff --git a/WebKit2/UIProcess/API/C/win/WKView.cpp b/WebKit2/UIProcess/API/C/win/WKView.cpp
index e90a286..95df964 100644
--- a/WebKit2/UIProcess/API/C/win/WKView.cpp
+++ b/WebKit2/UIProcess/API/C/win/WKView.cpp
@@ -37,7 +37,7 @@ WKTypeID WKViewGetTypeID()
 
 WKViewRef WKViewCreate(RECT rect, WKPageNamespaceRef pageNamespaceRef, HWND parentWindow)
 {
-    RefPtr<WebView> view = WebView::create(rect, toImpl(pageNamespaceRef), parentWindow);
+    RefPtr<WebView> view = WebView::create(rect, toImpl(pageNamespaceRef), parentWindow, VisibleToInjectedBundle);
     return toAPI(view.release().releaseRef());
 }
 
diff --git a/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp b/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp
index 00c3595..a5d4689 100644
--- a/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp
+++ b/WebKit2/UIProcess/API/C/win/WKViewPrivate.cpp
@@ -30,6 +30,12 @@
 
 using namespace WebKit;
 
+WKViewRef WKViewCreateForWebInspector(RECT rect, WKPageNamespaceRef pageNamespaceRef, HWND parentWindow)
+{
+    RefPtr<WebView> view = WebView::create(rect, toImpl(pageNamespaceRef), parentWindow, HiddenFromInjectedBundle);
+    return toAPI(view.release().releaseRef());
+}
+
 void WKViewSetOverrideCursor(WKViewRef viewRef, HCURSOR overrideCursor)
 {
     toImpl(viewRef)->setOverrideCursor(overrideCursor);
diff --git a/WebKit2/UIProcess/API/C/win/WKViewPrivate.h b/WebKit2/UIProcess/API/C/win/WKViewPrivate.h
index 5f89fd4..9d2a7dd 100644
--- a/WebKit2/UIProcess/API/C/win/WKViewPrivate.h
+++ b/WebKit2/UIProcess/API/C/win/WKViewPrivate.h
@@ -33,6 +33,8 @@
 extern "C" {
 #endif
 
+WK_EXPORT WKViewRef WKViewCreateForWebInspector(RECT rect, WKPageNamespaceRef pageNamespace, HWND parentWindow);
+
 WK_EXPORT void WKViewSetOverrideCursor(WKViewRef viewRef, HCURSOR overrideCursor);
 
 #ifdef __cplusplus
diff --git a/WebKit2/UIProcess/API/mac/WKView.mm b/WebKit2/UIProcess/API/mac/WKView.mm
index 59ad3e9..884b516 100644
--- a/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/WebKit2/UIProcess/API/mac/WKView.mm
@@ -114,7 +114,7 @@ struct EditCommandState {
 
 @implementation WKView
 
-- (id)initWithFrame:(NSRect)frame pageNamespaceRef:(WKPageNamespaceRef)pageNamespaceRef
+- (id)initWithFrame:(NSRect)frame pageNamespaceRef:(WKPageNamespaceRef)pageNamespaceRef hiddenFromInjectedBundle:(BOOL)hiddenFromInjectedBundle
 {
     self = [super initWithFrame:frame];
     if (!self)
@@ -136,27 +136,29 @@ struct EditCommandState {
     _data->_page = toImpl(pageNamespaceRef)->createWebPage();
     _data->_page->setPageClient(_data->_pageClient.get());
     _data->_page->setDrawingArea(ChunkedUpdateDrawingAreaProxy::create(self));
+    _data->_page->setVisibleToInjectedBundle(!hiddenFromInjectedBundle);
     _data->_page->initializeWebPage(IntSize(frame.size));
     _data->_page->setIsInWindow([self window]);
-    
+
     _data->_menuEntriesCount = 0;
     _data->_isPerformingUpdate = false;
     _data->_isSelectionNone = YES;
     _data->_isSelectionEditable = NO;
     _data->_isSelectionInPasswordField = NO;
     _data->_hasMarkedText = NO;
-    
+
     return self;
 }
 
+- (id)initWithFrame:(NSRect)frame pageNamespaceRef:(WKPageNamespaceRef)pageNamespaceRef
+{
+    return [self initWithFrame:frame pageNamespaceRef:pageNamespaceRef hiddenFromInjectedBundle:NO];
+}
+
 - (id)initWithFrame:(NSRect)frame
 {
     WebContext* context = WebContext::sharedProcessContext();
-    self = [self initWithFrame:frame pageNamespaceRef:toAPI(context->createPageNamespace())];
-    if (!self)
-        return nil;
-
-    return self;
+    return [self initWithFrame:frame pageNamespaceRef:toAPI(context->createPageNamespace())];
 }
 
 - (void)dealloc
diff --git a/WebKit2/UIProcess/API/mac/WKViewInternal.h b/WebKit2/UIProcess/API/mac/WKViewInternal.h
index ea70eb7..a331e67 100644
--- a/WebKit2/UIProcess/API/mac/WKViewInternal.h
+++ b/WebKit2/UIProcess/API/mac/WKViewInternal.h
@@ -31,6 +31,8 @@ namespace WebKit {
 }
 
 @interface WKView (Internal)
+- (id)initWithFrame:(NSRect)frame pageNamespaceRef:(WKPageNamespaceRef)pageNamespaceRef hiddenFromInjectedBundle:(BOOL)hiddenFromInjectedBundle;
+
 - (void)_processDidCrash;
 - (void)_didRelaunchProcess;
 - (void)_takeFocus:(BOOL)direction;
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index ebaab0e..d952400 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -96,6 +96,7 @@ WebPageProxy::WebPageProxy(WebPageNamespace* pageNamespace, uint64_t pageID)
     , m_textZoomFactor(1)
     , m_pageZoomFactor(1)
     , m_viewScaleFactor(1)
+    , m_visibleToInjectedBundle(true)
     , m_isValid(true)
     , m_isClosed(false)
     , m_inDecidePolicyForMIMEType(false)
@@ -1464,6 +1465,7 @@ WebPageCreationParameters WebPageProxy::creationParameters(const IntSize& size)
     parameters.viewSize = size;
     parameters.store = pageNamespace()->context()->preferences()->store();
     parameters.drawingAreaInfo = m_drawingArea->info();
+    parameters.visibleToInjectedBundle = m_visibleToInjectedBundle;
 
 #if PLATFORM(WIN)
     parameters.nativeWindow = m_pageClient->nativeWindow();
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index b14dd4a..104c033 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -115,6 +115,9 @@ public:
     DrawingAreaProxy* drawingArea() { return m_drawingArea.get(); }
     void setDrawingArea(PassOwnPtr<DrawingAreaProxy>);
 
+    bool visibleToInjectedBundle() const { return m_visibleToInjectedBundle; }
+    void setVisibleToInjectedBundle(bool visible) { m_visibleToInjectedBundle = visible; }
+
     WebBackForwardList* backForwardList() { return m_backForwardList.get(); }
 
     WebInspectorProxy* inspector();
@@ -418,7 +421,9 @@ private:
     double m_textZoomFactor;
     double m_pageZoomFactor;
     double m_viewScaleFactor;
-    
+
+    bool m_visibleToInjectedBundle;
+
     // If the process backing the web page is alive and kicking.
     bool m_isValid;
 
diff --git a/WebKit2/UIProcess/win/WebView.cpp b/WebKit2/UIProcess/win/WebView.cpp
index 3b8eec5..c26eeed 100644
--- a/WebKit2/UIProcess/win/WebView.cpp
+++ b/WebKit2/UIProcess/win/WebView.cpp
@@ -182,7 +182,7 @@ bool WebView::registerWebViewWindowClass()
     return !!::RegisterClassEx(&wcex);
 }
 
-WebView::WebView(RECT rect, WebPageNamespace* pageNamespace, HWND parentWindow)
+WebView::WebView(RECT rect, WebPageNamespace* pageNamespace, HWND parentWindow, InjectedBundleVisibility injectedBundleVisibility)
     : m_rect(rect)
     , m_topLevelParentWindow(0)
     , m_toolTipWindow(0)
@@ -197,6 +197,7 @@ WebView::WebView(RECT rect, WebPageNamespace* pageNamespace, HWND parentWindow)
     m_page = pageNamespace->createWebPage();
     m_page->setPageClient(this);
     m_page->setDrawingArea(ChunkedUpdateDrawingAreaProxy::create(this));
+    m_page->setVisibleToInjectedBundle(injectedBundleVisibility == VisibleToInjectedBundle);
 
     m_window = ::CreateWindowEx(0, kWebKit2WebViewWindowClassName, 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
         rect.top, rect.left, rect.right - rect.left, rect.bottom - rect.top, parentWindow ? parentWindow : HWND_MESSAGE, 0, instanceHandle(), this);
diff --git a/WebKit2/UIProcess/win/WebView.h b/WebKit2/UIProcess/win/WebView.h
index 07cc001..ae5a833 100644
--- a/WebKit2/UIProcess/win/WebView.h
+++ b/WebKit2/UIProcess/win/WebView.h
@@ -39,11 +39,16 @@ namespace WebKit {
 class DrawingAreaProxy;
 class WebPageNamespace;
 
+enum InjectedBundleVisibility {
+    HiddenFromInjectedBundle,
+    VisibleToInjectedBundle
+};
+
 class WebView : public APIObject, public PageClient, WebCore::WindowMessageListener {
 public:
-    static PassRefPtr<WebView> create(RECT rect, WebPageNamespace* pageNamespace, HWND parentWindow)
+    static PassRefPtr<WebView> create(RECT rect, WebPageNamespace* pageNamespace, HWND parentWindow, InjectedBundleVisibility visibility)
     {
-        return adoptRef(new WebView(rect, pageNamespace, parentWindow));
+        return adoptRef(new WebView(rect, pageNamespace, parentWindow, visibility));
     }
     ~WebView();
 
@@ -57,7 +62,7 @@ public:
     WebPageProxy* page() const { return m_page.get(); }
 
 private:
-    WebView(RECT, WebPageNamespace*, HWND parentWindow);
+    WebView(RECT, WebPageNamespace*, HWND parentWindow, InjectedBundleVisibility);
 
     virtual Type type() const { return TypeView; }
 
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 7fac5bc..7a1bafd 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -100,7 +100,7 @@ PassRefPtr<WebPage> WebPage::create(uint64_t pageID, const WebPageCreationParame
 {
     RefPtr<WebPage> page = adoptRef(new WebPage(pageID, parameters));
 
-    if (WebProcess::shared().injectedBundle())
+    if (parameters.visibleToInjectedBundle && WebProcess::shared().injectedBundle())
         WebProcess::shared().injectedBundle()->didCreatePage(page.get());
 
     return page.release();
@@ -110,6 +110,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
     : m_viewSize(parameters.viewSize)
     , m_isInRedo(false)
     , m_isClosed(false)
+    , m_isVisibleToInjectedBundle(parameters.visibleToInjectedBundle)
 #if PLATFORM(MAC)
     , m_windowIsVisible(false)
 #elif PLATFORM(WIN)
@@ -132,7 +133,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
     updatePreferences(parameters.store);
 
     m_page->setGroupName("WebKit2Group");
-    
+
     platformInitialize();
     Settings::setMinDOMTimerInterval(0.004);
 
@@ -291,7 +292,7 @@ void WebPage::close()
 
     m_isClosed = true;
 
-    if (WebProcess::shared().injectedBundle())
+    if (m_isVisibleToInjectedBundle && WebProcess::shared().injectedBundle())
         WebProcess::shared().injectedBundle()->willDestroyPage(this);
 
     m_inspector = 0;
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index 491be53..6c3057c 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -289,6 +289,7 @@ private:
 
     bool m_isInRedo;
     bool m_isClosed;
+    bool m_isVisibleToInjectedBundle;
 
 #if PLATFORM(MAC)
     // Whether the containing window is visible or not.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list