summaryrefslogtreecommitdiff
path: root/Source/WebKit2/WebProcess/WebPage
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-25 15:09:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-25 15:09:11 +0200
commita89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd (patch)
treeb7abd9f49ae1d4d2e426a5883bfccd42b8e2ee12 /Source/WebKit2/WebProcess/WebPage
parent8d473cf9743f1d30a16a27114e93bd5af5648d23 (diff)
downloadqtwebkit-a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd.tar.gz
Imported WebKit commit eb5c1b8fe4d4b1b90b5137433fc58a91da0e6878 (http://svn.webkit.org/repository/webkit/trunk@118516)
Diffstat (limited to 'Source/WebKit2/WebProcess/WebPage')
-rw-r--r--Source/WebKit2/WebProcess/WebPage/FindController.cpp2
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.cpp22
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.h11
-rw-r--r--Source/WebKit2/WebProcess/WebPage/WebPage.messages.in2
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h3
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm63
-rw-r--r--Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm6
-rw-r--r--Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp2
-rw-r--r--Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp12
9 files changed, 77 insertions, 46 deletions
diff --git a/Source/WebKit2/WebProcess/WebPage/FindController.cpp b/Source/WebKit2/WebProcess/WebPage/FindController.cpp
index 4918dde36..7f00bc7dc 100644
--- a/Source/WebKit2/WebProcess/WebPage/FindController.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/FindController.cpp
@@ -156,7 +156,7 @@ void FindController::findString(const String& string, FindOptions options, unsig
bool found = m_webPage->corePage()->findString(string, core(options));
- m_webPage->drawingArea()->dispatchAfterEnsuringUpdatedScrollPosition(bind(&FindController::updateFindUIAfterPageScroll, this, found, string, options, maxMatchCount));
+ m_webPage->drawingArea()->dispatchAfterEnsuringUpdatedScrollPosition(WTF::bind(&FindController::updateFindUIAfterPageScroll, this, found, string, options, maxMatchCount));
}
void FindController::hideFindUI()
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
index 9daace6a7..a07b675f9 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -192,7 +192,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
#if PLATFORM(MAC)
, m_windowIsVisible(false)
, m_isSmartInsertDeleteEnabled(parameters.isSmartInsertDeleteEnabled)
- , m_layerHostingMode(LayerHostingModeDefault)
+ , m_layerHostingMode(parameters.layerHostingMode)
, m_keyboardEventBeingInterpreted(0)
#elif PLATFORM(WIN)
, m_nativeWindow(parameters.nativeWindow)
@@ -240,7 +240,9 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
pageClients.contextMenuClient = new WebContextMenuClient(this);
#endif
pageClients.editorClient = new WebEditorClient(this);
+#if ENABLE(DRAG_SUPPORT)
pageClients.dragClient = new WebDragClient(this);
+#endif
pageClients.backForwardClient = WebBackForwardListProxy::create(this);
#if ENABLE(INSPECTOR)
pageClients.inspectorClient = new WebInspectorClient(this);
@@ -324,9 +326,8 @@ WebPage::~WebPage()
m_sandboxExtensionTracker.invalidate();
-#if PLATFORM(MAC)
- ASSERT(m_pluginViews.isEmpty());
-#endif
+ for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it)
+ (*it)->webPageDestroyed();
#ifndef NDEBUG
webPageCounter.decrement();
@@ -856,6 +857,7 @@ void WebPage::setResizesToContentsUsingLayoutSize(const IntSize& targetLayoutSiz
m_page->settings()->setAcceleratedCompositingForFixedPositionEnabled(true);
m_page->settings()->setFixedElementsLayoutRelativeToFrame(true);
+ m_page->settings()->setFixedPositionCreatesStackingContext(true);
// Schedule a layout to use the new target size.
if (!view->layoutPending()) {
@@ -1012,6 +1014,9 @@ void WebPage::scalePage(double scale, const IntPoint& origin)
{
m_page->setPageScaleFactor(scale, origin);
+ for (HashSet<PluginView*>::const_iterator it = m_pluginViews.begin(), end = m_pluginViews.end(); it != end; ++it)
+ (*it)->pageScaleFactorDidChange();
+
send(Messages::WebPageProxy::PageScaleFactorDidChange(scale));
}
@@ -1937,6 +1942,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
settings->setFrameFlatteningEnabled(store.getBoolValueForKey(WebPreferencesKey::frameFlatteningEnabledKey()));
settings->setPrivateBrowsingEnabled(store.getBoolValueForKey(WebPreferencesKey::privateBrowsingEnabledKey()));
settings->setDeveloperExtrasEnabled(store.getBoolValueForKey(WebPreferencesKey::developerExtrasEnabledKey()));
+ settings->setJavaScriptExperimentsEnabled(store.getBoolValueForKey(WebPreferencesKey::javaScriptExperimentsEnabledKey()));
settings->setTextAreasAreResizable(store.getBoolValueForKey(WebPreferencesKey::textAreasAreResizableKey()));
settings->setNeedsSiteSpecificQuirks(store.getBoolValueForKey(WebPreferencesKey::needsSiteSpecificQuirksKey()));
settings->setJavaScriptCanOpenWindowsAutomatically(store.getBoolValueForKey(WebPreferencesKey::javaScriptCanOpenWindowsAutomaticallyKey()));
@@ -1975,6 +1981,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
settings->setShowRepaintCounter(store.getBoolValueForKey(WebPreferencesKey::compositingRepaintCountersVisibleKey()));
settings->setCSSCustomFilterEnabled(store.getBoolValueForKey(WebPreferencesKey::cssCustomFilterEnabledKey()));
settings->setCSSRegionsEnabled(store.getBoolValueForKey(WebPreferencesKey::cssRegionsEnabledKey()));
+ settings->setCSSGridLayoutEnabled(store.getBoolValueForKey(WebPreferencesKey::cssGridLayoutEnabledKey()));
settings->setRegionBasedColumnsEnabled(store.getBoolValueForKey(WebPreferencesKey::regionBasedColumnsEnabledKey()));
settings->setWebGLEnabled(store.getBoolValueForKey(WebPreferencesKey::webGLEnabledKey()));
settings->setMediaPlaybackRequiresUserGesture(store.getBoolValueForKey(WebPreferencesKey::mediaPlaybackRequiresUserGestureKey()));
@@ -2099,6 +2106,8 @@ bool WebPage::handleEditingKeyboardEvent(KeyboardEvent* evt)
}
#endif
+#if ENABLE(DRAG_SUPPORT)
+
#if PLATFORM(WIN)
void WebPage::performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WebCore::DragDataMap& dataMap, uint32_t flags)
{
@@ -2251,6 +2260,8 @@ void WebPage::mayPerformUploadDragDestinationAction()
m_pendingDropExtensionsForFileUpload[i]->consumePermanently();
m_pendingDropExtensionsForFileUpload.clear();
}
+
+#endif // ENABLE(DRAG_SUPPORT)
WebUndoStep* WebPage::webUndoStep(uint64_t stepID)
{
@@ -2484,8 +2495,6 @@ void WebPage::mainFrameDidLayout()
}
}
-#if PLATFORM(MAC)
-
void WebPage::addPluginView(PluginView* pluginView)
{
ASSERT(!m_pluginViews.contains(pluginView));
@@ -2500,6 +2509,7 @@ void WebPage::removePluginView(PluginView* pluginView)
m_pluginViews.remove(pluginView);
}
+#if PLATFORM(MAC)
void WebPage::setWindowIsVisible(bool windowIsVisible)
{
m_windowIsVisible = windowIsVisible;
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h
index d18c401bf..4b2b76c8c 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h
@@ -306,10 +306,10 @@ public:
void exitAcceleratedCompositingMode();
#endif
-#if PLATFORM(MAC)
void addPluginView(PluginView*);
void removePluginView(PluginView*);
+#if PLATFORM(MAC)
LayerHostingMode layerHostingMode() const { return m_layerHostingMode; }
void setLayerHostingMode(LayerHostingMode);
@@ -454,6 +454,8 @@ public:
void replaceSelectionWithText(WebCore::Frame*, const String&);
void clearSelection();
+
+#if ENABLE(DRAG_SUPPORT)
#if PLATFORM(WIN)
void performDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, const WebCore::DragDataMap&, uint32_t flags);
#elif PLATFORM(QT) || PLATFORM(GTK)
@@ -465,6 +467,7 @@ public:
void willPerformLoadDragDestinationAction();
void mayPerformUploadDragDestinationAction();
+#endif // ENABLE(DRAG_SUPPORT)
void beginPrinting(uint64_t frameID, const PrintInfo&);
void endPrinting();
@@ -704,6 +707,9 @@ private:
WebCore::IntSize m_viewSize;
OwnPtr<DrawingArea> m_drawingArea;
+
+ HashSet<PluginView*> m_pluginViews;
+
bool m_useFixedLayout;
bool m_drawsBackground;
@@ -730,9 +736,6 @@ private:
// The accessibility position of the view.
WebCore::IntPoint m_accessibilityPosition;
- // All plug-in views on this web page.
- HashSet<PluginView*> m_pluginViews;
-
// The layer hosting mode.
LayerHostingMode m_layerHostingMode;
diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
index 8381f2603..4bab8ac42 100644
--- a/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
+++ b/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
@@ -140,6 +140,7 @@ messages -> WebPage {
HideFindUI()
CountStringMatches(WTF::String string, uint32_t findOptions, unsigned maxMatchCount)
+#if ENABLE(DRAG_SUPPORT)
# Drag and drop.
#if PLATFORM(WIN)
PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, HashMap<UINT,Vector<String>> dataMap, uint32_t flags)
@@ -151,6 +152,7 @@ messages -> WebPage {
PerformDragControllerAction(uint64_t action, WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t draggingSourceOperationMask, WTF::String dragStorageName, uint32_t flags, WebKit::SandboxExtension::Handle sandboxExtensionHandle, WebKit::SandboxExtension::HandleArray sandboxExtensionsForUpload)
#endif
DragEnded(WebCore::IntPoint clientPosition, WebCore::IntPoint globalPosition, uint64_t operation)
+#endif
# Popup menu.
DidChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h
index 8608f0755..9d0b0779e 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h
+++ b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h
@@ -86,6 +86,8 @@ private:
virtual void setDeviceScaleFactor(float) OVERRIDE;
virtual void setLayerHostingMode(uint32_t) OVERRIDE;
+ void updateLayerHostingContext();
+
void setRootCompositingLayer(CALayer *);
void createPageOverlayLayer();
@@ -95,7 +97,6 @@ private:
WebCore::LayerFlushScheduler m_layerFlushScheduler;
OwnPtr<LayerHostingContext> m_layerHostingContext;
- LayerHostingMode m_layerHostingMode;
RetainPtr<CALayer> m_rootLayer;
RetainPtr<CALayer> m_pendingRootCompositingLayer;
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
index 9a7ccdf64..5ed96e13d 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
@@ -83,8 +83,7 @@ TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea(WebPage* webPage, c
m_rootLayer.get().opaque = YES;
m_rootLayer.get().geometryFlipped = YES;
- m_layerHostingContext = LayerHostingContext::createForPort(WebProcess::shared().compositingRenderServerPort());
- m_layerHostingContext->setRootLayer(m_rootLayer.get());
+ updateLayerHostingContext();
LayerTreeContext layerTreeContext;
layerTreeContext.contextID = m_layerHostingContext->contextID();
@@ -142,9 +141,15 @@ bool TiledCoreAnimationDrawingArea::forceRepaintAsync(uint64_t callbackID)
if (m_layerTreeStateIsFrozen)
return false;
+ // FIXME: It is possible for the drawing area to be destroyed before the bound block
+ // is invoked, so grab a reference to the web page here so we can access the drawing area through it.
+ // (The web page is already kept alive by dispatchAfterEnsuringUpdatedScrollPosition).
+ // A better fix would be to make sure that we keep the drawing area alive if there are outstanding calls.
+ WebPage* webPage = m_webPage;
dispatchAfterEnsuringUpdatedScrollPosition(bind(^{
- m_webPage->drawingArea()->forceRepaint();
- m_webPage->send(Messages::WebPageProxy::VoidCallback(callbackID));
+ if (DrawingArea* drawingArea = webPage->drawingArea())
+ drawingArea->forceRepaint();
+ webPage->send(Messages::WebPageProxy::VoidCallback(callbackID));
}));
return true;
}
@@ -346,34 +351,40 @@ void TiledCoreAnimationDrawingArea::setDeviceScaleFactor(float deviceScaleFactor
void TiledCoreAnimationDrawingArea::setLayerHostingMode(uint32_t opaqueLayerHostingMode)
{
LayerHostingMode layerHostingMode = static_cast<LayerHostingMode>(opaqueLayerHostingMode);
- if (layerHostingMode != m_layerHostingContext->layerHostingMode()) {
- // The mode has changed.
-
- // First, invalidate the old hosting context.
+ if (layerHostingMode == m_webPage->layerHostingMode())
+ return;
+
+ m_webPage->setLayerHostingMode(layerHostingMode);
+
+ updateLayerHostingContext();
+
+ // Finally, inform the UIProcess that the context has changed.
+ LayerTreeContext layerTreeContext;
+ layerTreeContext.contextID = m_layerHostingContext->contextID();
+ m_webPage->send(Messages::DrawingAreaProxy::UpdateAcceleratedCompositingMode(0, layerTreeContext));
+}
+
+void TiledCoreAnimationDrawingArea::updateLayerHostingContext()
+{
+ // Invalidate the old context.
+ if (m_layerHostingContext) {
m_layerHostingContext->invalidate();
m_layerHostingContext = nullptr;
+ }
- // Create a new context and set it up.
- switch (layerHostingMode) {
- case LayerHostingModeDefault:
- m_layerHostingContext = LayerHostingContext::createForPort(WebProcess::shared().compositingRenderServerPort());
- break;
+ // Create a new context and set it up.
+ switch (m_webPage->layerHostingMode()) {
+ case LayerHostingModeDefault:
+ m_layerHostingContext = LayerHostingContext::createForPort(WebProcess::shared().compositingRenderServerPort());
+ break;
#if HAVE(LAYER_HOSTING_IN_WINDOW_SERVER)
- case LayerHostingModeInWindowServer:
- m_layerHostingContext = LayerHostingContext::createForWindowServer();
- break;
+ case LayerHostingModeInWindowServer:
+ m_layerHostingContext = LayerHostingContext::createForWindowServer();
+ break;
#endif
- }
-
- m_layerHostingContext->setRootLayer(m_rootLayer.get());
-
- m_webPage->setLayerHostingMode(layerHostingMode);
-
- // Finally, inform the UIProcess that the context has changed.
- LayerTreeContext layerTreeContext;
- layerTreeContext.contextID = m_layerHostingContext->contextID();
- m_webPage->send(Messages::DrawingAreaProxy::UpdateAcceleratedCompositingMode(0, layerTreeContext));
}
+
+ m_layerHostingContext->setRootLayer(m_rootLayer.get());
}
void TiledCoreAnimationDrawingArea::setRootCompositingLayer(CALayer *layer)
diff --git a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
index c6ba01255..9e0c13775 100644
--- a/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
+++ b/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
@@ -710,9 +710,11 @@ void WebPage::shouldDelayWindowOrderingEvent(const WebKit::WebMouseEvent& event,
if (!frame)
return;
+#if ENABLE(DRAG_SUPPORT)
HitTestResult hitResult = frame->eventHandler()->hitTestResultAtPoint(frame->view()->windowToContents(event.position()), true);
if (hitResult.isSelected())
result = frame->eventHandler()->eventMayStartDrag(platform(event));
+#endif
}
void WebPage::acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent& event, bool& result)
@@ -724,9 +726,11 @@ void WebPage::acceptsFirstMouse(int eventNumber, const WebKit::WebMouseEvent& ev
HitTestResult hitResult = frame->eventHandler()->hitTestResultAtPoint(frame->view()->windowToContents(event.position()), true);
frame->eventHandler()->setActivationEventNumber(eventNumber);
+#if ENABLE(DRAG_SUPPORT)
if (hitResult.isSelected())
result = frame->eventHandler()->eventMayStartDrag(platform(event));
- else
+ else
+#endif
result = !!hitResult.scrollbar();
}
diff --git a/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp
index 964366e8d..9039454af 100644
--- a/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp
@@ -69,7 +69,7 @@ LayerTreeHostQt::LayerTreeHostQt(WebPage* webPage)
: LayerTreeHost(webPage)
, m_notifyAfterScheduledLayerFlush(false)
, m_isValid(true)
- , m_waitingForUIProcess(false)
+ , m_waitingForUIProcess(true)
, m_isSuspended(false)
, m_contentsScale(1)
, m_shouldSendScrollPositionUpdate(true)
diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
index 7180a8c88..40071982b 100644
--- a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
+++ b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp
@@ -336,12 +336,12 @@ void WebPage::confirmComposition(const String& compositionString, int64_t select
Editor* editor = targetFrame->editor();
editor->confirmComposition(compositionString);
- RefPtr<Range> selectionRange;
- if (selectionStart != -1) {
- Element* scope = targetFrame->selection()->rootEditableElement();
- selectionRange = TextIterator::rangeFromLocationAndLength(scope, selectionStart, selectionLength);
- ASSERT_WITH_MESSAGE(selectionRange, "Invalid selection: [%lld:%lld] in text of length %d", static_cast<long long>(selectionStart), static_cast<long long>(selectionLength), scope->innerText().length());
- }
+ if (selectionStart == -1)
+ return;
+
+ Element* scope = targetFrame->selection()->rootEditableElement();
+ RefPtr<Range> selectionRange = TextIterator::rangeFromLocationAndLength(scope, selectionStart, selectionLength);
+ ASSERT_WITH_MESSAGE(selectionRange, "Invalid selection: [%lld:%lld] in text of length %d", static_cast<long long>(selectionStart), static_cast<long long>(selectionLength), scope->innerText().length());
if (selectionRange) {
VisibleSelection selection(selectionRange.get(), SEL_DEFAULT_AFFINITY);