summaryrefslogtreecommitdiffstats
path: root/Source/WebKit/win/WebCoreSupport
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-18 13:36:51 +0100
committerSteve Block <steveblock@google.com>2011-05-24 15:38:28 +0100
commit2fc2651226baac27029e38c9d6ef883fa32084db (patch)
treee396d4bf89dcce6ed02071be66212495b1df1dec /Source/WebKit/win/WebCoreSupport
parentb3725cedeb43722b3b175aaeff70552e562d2c94 (diff)
downloadexternal_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.zip
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.gz
external_webkit-2fc2651226baac27029e38c9d6ef883fa32084db.tar.bz2
Merge WebKit at r78450: Initial merge by git.
Change-Id: I6d3e5f1f868ec266a0aafdef66182ddc3f265dc1
Diffstat (limited to 'Source/WebKit/win/WebCoreSupport')
-rw-r--r--Source/WebKit/win/WebCoreSupport/EmbeddedWidget.cpp4
-rw-r--r--Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp5
-rw-r--r--Source/WebKit/win/WebCoreSupport/WebChromeClient.h3
-rw-r--r--Source/WebKit/win/WebCoreSupport/WebDragClient.cpp151
-rw-r--r--Source/WebKit/win/WebCoreSupport/WebDragClient.h1
-rw-r--r--Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp2
-rw-r--r--Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h2
-rw-r--r--Source/WebKit/win/WebCoreSupport/WebInspectorClient.cpp14
-rw-r--r--Source/WebKit/win/WebCoreSupport/WebInspectorClient.h13
9 files changed, 24 insertions, 171 deletions
diff --git a/Source/WebKit/win/WebCoreSupport/EmbeddedWidget.cpp b/Source/WebKit/win/WebCoreSupport/EmbeddedWidget.cpp
index 371ff3a..fb2b564 100644
--- a/Source/WebKit/win/WebCoreSupport/EmbeddedWidget.cpp
+++ b/Source/WebKit/win/WebCoreSupport/EmbeddedWidget.cpp
@@ -120,7 +120,7 @@ void EmbeddedWidget::frameRectsChanged()
rgn = ::CreateRectRgn(0, 0, 0, 0);
::SetWindowRgn(m_window, rgn, FALSE);
} else {
- rgn = ::CreateRectRgn(m_clipRect.x(), m_clipRect.y(), m_clipRect.right(), m_clipRect.bottom());
+ rgn = ::CreateRectRgn(m_clipRect.x(), m_clipRect.y(), m_clipRect.maxX(), m_clipRect.maxY());
::SetWindowRgn(m_window, rgn, TRUE);
}
@@ -128,7 +128,7 @@ void EmbeddedWidget::frameRectsChanged()
::MoveWindow(m_window, m_windowRect.x(), m_windowRect.y(), m_windowRect.width(), m_windowRect.height(), TRUE);
if (clipToZeroRect) {
- rgn = ::CreateRectRgn(m_clipRect.x(), m_clipRect.y(), m_clipRect.right(), m_clipRect.bottom());
+ rgn = ::CreateRectRgn(m_clipRect.x(), m_clipRect.y(), m_clipRect.maxX(), m_clipRect.maxY());
::SetWindowRgn(m_window, rgn, TRUE);
}
}
diff --git a/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp
index f5cce4e..47ca713 100644
--- a/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp
+++ b/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp
@@ -862,6 +862,11 @@ bool WebChromeClient::selectItemWritingDirectionIsNatural()
return true;
}
+bool WebChromeClient::selectItemAlignmentFollowsMenuWritingDirection()
+{
+ return false;
+}
+
PassRefPtr<PopupMenu> WebChromeClient::createPopupMenu(PopupMenuClient* client) const
{
return adoptRef(new PopupMenuWin(client));
diff --git a/Source/WebKit/win/WebCoreSupport/WebChromeClient.h b/Source/WebKit/win/WebCoreSupport/WebChromeClient.h
index b6c2525..9298f1c 100644
--- a/Source/WebKit/win/WebCoreSupport/WebChromeClient.h
+++ b/Source/WebKit/win/WebCoreSupport/WebChromeClient.h
@@ -144,8 +144,6 @@ public:
virtual void formStateDidChange(const WebCore::Node*) { }
- virtual PassOwnPtr<WebCore::HTMLParserQuirks> createHTMLParserQuirks() { return 0; }
-
#if USE(ACCELERATED_COMPOSITING)
// Pass 0 as the GraphicsLayer to detatch the root layer.
virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*);
@@ -175,6 +173,7 @@ public:
#endif
virtual bool selectItemWritingDirectionIsNatural();
+ virtual bool selectItemAlignmentFollowsMenuWritingDirection();
virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const;
virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
diff --git a/Source/WebKit/win/WebCoreSupport/WebDragClient.cpp b/Source/WebKit/win/WebCoreSupport/WebDragClient.cpp
index 184df95..c232867 100644
--- a/Source/WebKit/win/WebCoreSupport/WebDragClient.cpp
+++ b/Source/WebKit/win/WebCoreSupport/WebDragClient.cpp
@@ -35,39 +35,11 @@
#include <WebCore/ClipboardWin.h>
#include <WebCore/DragController.h>
#include <WebCore/DragData.h>
-#include <WebCore/Font.h>
-#include <WebCore/FontDescription.h>
-#include <WebCore/FontSelector.h>
#include <WebCore/FrameView.h>
#include <WebCore/GraphicsContext.h>
#include <WebCore/Page.h>
-#include <WebCore/Settings.h>
-#include <WebCore/StringTruncator.h>
-#include <WebCore/TextRun.h>
-#include <WebCore/WebCoreTextRenderer.h>
#pragma warning(pop)
-namespace WebCore {
- HBITMAP allocImage(HDC dc, IntSize size, PlatformGraphicsContext** targetRef);
- void deallocContext(PlatformGraphicsContext* target);
-}
-
-
-#define DRAG_LABEL_BORDER_X 4
-// Keep border_y in synch with DragController::LinkDragBorderInset
-#define DRAG_LABEL_BORDER_Y 2
-#define DRAG_LABEL_RADIUS 5
-#define DRAG_LABEL_BORDER_Y_OFFSET 2
-
-#define MIN_DRAG_LABEL_WIDTH_BEFORE_CLIP 120
-
-// Observation says max size is 200x200
-#define MAX_DRAG_LABEL_WIDTH 200
-#define MAX_DRAG_LABEL_STRING_WIDTH (MAX_DRAG_LABEL_WIDTH - 2 * DRAG_LABEL_BORDER_X)
-
-#define DRAG_LINK_LABEL_FONT_SIZE 11
-#define DRAG_LINK_URL_FONT_SIZE 10
-
using namespace WebCore;
static DWORD draggingSourceOperationMaskToDragCursors(DragOperation op)
@@ -197,129 +169,6 @@ void WebDragClient::startDrag(DragImageRef image, const IntPoint& imageOrigin, c
}
}
-static Font dragLabelFont(int size, bool bold, FontRenderingMode renderingMode)
-{
- NONCLIENTMETRICS metrics;
- metrics.cbSize = sizeof(metrics);
- SystemParametersInfo(SPI_GETNONCLIENTMETRICS, metrics.cbSize, &metrics, 0);
- FontDescription desc;
- desc.setWeight(bold ? FontWeightBold : FontWeightNormal);
- FontFamily family;
- family.setFamily(metrics.lfSmCaptionFont.lfFaceName);
- desc.setFamily(family);
- desc.setSpecifiedSize((float)size);
- desc.setComputedSize((float)size);
- desc.setRenderingMode(renderingMode);
- Font result = Font(desc, 0, 0);
- result.update(0);
- return result;
-}
-
-DragImageRef WebDragClient::createDragImageForLink(KURL& url, const String& inLabel, Frame* frame)
-{
- // This is more or less an exact match for the Mac OS X code.
-
- const Font* labelFont;
- const Font* urlFont;
-
- if (frame->settings() && frame->settings()->fontRenderingMode() == AlternateRenderingMode) {
- static const Font alternateRenderingModeLabelFont = dragLabelFont(DRAG_LINK_LABEL_FONT_SIZE, true, AlternateRenderingMode);
- static const Font alternateRenderingModeURLFont = dragLabelFont(DRAG_LINK_URL_FONT_SIZE, false, AlternateRenderingMode);
- labelFont = &alternateRenderingModeLabelFont;
- urlFont = &alternateRenderingModeURLFont;
- } else {
- static const Font normalRenderingModeLabelFont = dragLabelFont(DRAG_LINK_LABEL_FONT_SIZE, true, NormalRenderingMode);
- static const Font normalRenderingModeURLFont = dragLabelFont(DRAG_LINK_URL_FONT_SIZE, false, NormalRenderingMode);
- labelFont = &normalRenderingModeLabelFont;
- urlFont = &normalRenderingModeURLFont;
- }
-
- bool drawURLString = true;
- bool clipURLString = false;
- bool clipLabelString = false;
-
- String urlString = url.string();
- String label = inLabel;
- if (label.isEmpty()) {
- drawURLString = false;
- label = urlString;
- }
-
- //First step in drawing the link drag image width
- TextRun labelRun(label.impl());
- TextRun urlRun(urlString.impl());
- IntSize labelSize(labelFont->width(labelRun), labelFont->ascent() + labelFont->descent());
-
- if (labelSize.width() > MAX_DRAG_LABEL_STRING_WIDTH){
- labelSize.setWidth(MAX_DRAG_LABEL_STRING_WIDTH);
- clipLabelString = true;
- }
-
- IntSize urlStringSize;
- IntSize imageSize(labelSize.width() + DRAG_LABEL_BORDER_X * 2,
- labelSize.height() + DRAG_LABEL_BORDER_Y * 2);
-
- if (drawURLString) {
- urlStringSize.setWidth(urlFont->width(urlRun));
- urlStringSize.setHeight(urlFont->ascent() + urlFont->descent());
- imageSize.setHeight(imageSize.height() + urlStringSize.height());
- if (urlStringSize.width() > MAX_DRAG_LABEL_STRING_WIDTH) {
- imageSize.setWidth(MAX_DRAG_LABEL_WIDTH);
- clipURLString = true;
- } else {
- imageSize.setWidth(std::max(labelSize.width(), urlStringSize.width()) + DRAG_LABEL_BORDER_X * 2);
- }
- }
-
- // We now know how big the image needs to be, so we create and
- // fill the background
- HBITMAP image = 0;
- HDC dc = GetDC(0);
- HDC workingDC = CreateCompatibleDC(dc);
- if (!workingDC) {
- ReleaseDC(0, dc);
- return 0;
- }
-
- PlatformGraphicsContext* contextRef;
- image = allocImage(workingDC, imageSize, &contextRef);
- if (!image) {
- DeleteDC(workingDC);
- ReleaseDC(0, dc);
- return 0;
- }
-
- ::SelectObject(workingDC, image);
- GraphicsContext context(contextRef);
- // On Mac alpha is {0.7, 0.7, 0.7, 0.8}, however we can't control alpha
- // for drag images on win, so we use 1
- static const Color backgroundColor(140, 140, 140);
- static const IntSize radii(DRAG_LABEL_RADIUS, DRAG_LABEL_RADIUS);
- IntRect rect(0, 0, imageSize.width(), imageSize.height());
- context.fillRoundedRect(rect, radii, radii, radii, radii, backgroundColor, ColorSpaceDeviceRGB);
-
- // Draw the text
- static const Color topColor(0, 0, 0, 255); //original alpha = 0.75
- static const Color bottomColor(255, 255, 255, 127); //original alpha = 0.5
- if (drawURLString) {
- if (clipURLString)
- urlString = StringTruncator::rightTruncate(urlString, imageSize.width() - (DRAG_LABEL_BORDER_X * 2.0f), *urlFont, false);
- IntPoint textPos(DRAG_LABEL_BORDER_X, imageSize.height() - (DRAG_LABEL_BORDER_Y_OFFSET + urlFont->descent()));
- WebCoreDrawDoubledTextAtPoint(context, urlString, textPos, *urlFont, topColor, bottomColor);
- }
-
- if (clipLabelString)
- label = StringTruncator::rightTruncate(label, imageSize.width() - (DRAG_LABEL_BORDER_X * 2.0f), *labelFont, false);
-
- IntPoint textPos(DRAG_LABEL_BORDER_X, DRAG_LABEL_BORDER_Y + labelFont->pixelSize());
- WebCoreDrawDoubledTextAtPoint(context, label, textPos, *labelFont, topColor, bottomColor);
-
- deallocContext(contextRef);
- DeleteDC(workingDC);
- ReleaseDC(0, dc);
- return image;
-}
-
void WebDragClient::dragControllerDestroyed()
{
delete this;
diff --git a/Source/WebKit/win/WebCoreSupport/WebDragClient.h b/Source/WebKit/win/WebCoreSupport/WebDragClient.h
index da2d208..303edd6 100644
--- a/Source/WebKit/win/WebCoreSupport/WebDragClient.h
+++ b/Source/WebKit/win/WebCoreSupport/WebDragClient.h
@@ -39,7 +39,6 @@ public:
virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint&);
virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard*);
virtual void startDrag(WebCore::DragImageRef, const WebCore::IntPoint&, const WebCore::IntPoint&, WebCore::Clipboard*, WebCore::Frame*, bool);
- virtual WebCore::DragImageRef createDragImageForLink(WebCore::KURL&, const WTF::String&, WebCore::Frame*);
private:
WebView* m_webView;
};
diff --git a/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
index 7fd2b98..710fec2 100644
--- a/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -628,7 +628,7 @@ void WebFrameLoaderClient::didDisplayInsecureContent()
frameLoadDelegatePriv2->didDisplayInsecureContent(webView);
}
-void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin* origin)
+void WebFrameLoaderClient::didRunInsecureContent(SecurityOrigin* origin, const KURL& insecureURL)
{
COMPtr<IWebSecurityOrigin> webSecurityOrigin = WebSecurityOrigin::createInstance(origin);
diff --git a/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h
index 573b58f..5fada31 100644
--- a/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h
+++ b/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h
@@ -99,7 +99,7 @@ public:
virtual void dispatchDidChangeBackForwardIndex() const;
virtual void didDisplayInsecureContent();
- virtual void didRunInsecureContent(WebCore::SecurityOrigin*);
+ virtual void didRunInsecureContent(WebCore::SecurityOrigin*, const WebCore::KURL&);
virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&);
virtual void setTitle(const WTF::String& title, const WebCore::KURL&);
diff --git a/Source/WebKit/win/WebCoreSupport/WebInspectorClient.cpp b/Source/WebKit/win/WebCoreSupport/WebInspectorClient.cpp
index 76ebc8f..2922485 100644
--- a/Source/WebKit/win/WebCoreSupport/WebInspectorClient.cpp
+++ b/Source/WebKit/win/WebCoreSupport/WebInspectorClient.cpp
@@ -173,7 +173,7 @@ void WebInspectorClient::openInspectorFrontend(InspectorController* inspectorCon
return;
m_frontendPage = core(frontendWebView.get());
- WebInspectorFrontendClient* frontendClient = new WebInspectorFrontendClient(m_inspectedWebView, m_inspectedWebViewHwnd, frontendHwnd, frontendWebView, frontendWebViewHwnd, this);
+ WebInspectorFrontendClient* frontendClient = new WebInspectorFrontendClient(m_inspectedWebView, m_inspectedWebViewHwnd, frontendHwnd, frontendWebView, frontendWebViewHwnd, this, createFrontendSettings());
m_frontendPage->inspectorController()->setInspectorFrontendClient(frontendClient);
m_frontendHwnd = frontendHwnd;
}
@@ -206,8 +206,8 @@ void WebInspectorClient::updateHighlight()
m_highlight->update();
}
-WebInspectorFrontendClient::WebInspectorFrontendClient(WebView* inspectedWebView, HWND inspectedWebViewHwnd, HWND frontendHwnd, const COMPtr<WebView>& frontendWebView, HWND frontendWebViewHwnd, WebInspectorClient* inspectorClient)
- : InspectorFrontendClientLocal(inspectedWebView->page()->inspectorController(), core(frontendWebView.get()))
+WebInspectorFrontendClient::WebInspectorFrontendClient(WebView* inspectedWebView, HWND inspectedWebViewHwnd, HWND frontendHwnd, const COMPtr<WebView>& frontendWebView, HWND frontendWebViewHwnd, WebInspectorClient* inspectorClient, PassOwnPtr<Settings> settings)
+ : InspectorFrontendClientLocal(inspectedWebView->page()->inspectorController(), core(frontendWebView.get()), settings)
, m_inspectedWebView(inspectedWebView)
, m_inspectedWebViewHwnd(inspectedWebViewHwnd)
, m_inspectorClient(inspectorClient)
@@ -271,8 +271,7 @@ void WebInspectorFrontendClient::attachWindow()
if (m_attached)
return;
- // FIXME: This flag can be saved to the flags storage directly.
- m_inspectedWebView->page()->inspectorController()->setInspectorStartsAttached(true);
+ m_inspectorClient->setInspectorStartsAttached(true);
closeWindowWithoutNotifications();
showWindowWithoutNotifications();
@@ -283,8 +282,7 @@ void WebInspectorFrontendClient::detachWindow()
if (!m_attached)
return;
- // FIXME: This flag can be saved to the flags storage directly.
- m_inspectedWebView->page()->inspectorController()->setInspectorStartsAttached(false);
+ m_inspectorClient->setInspectorStartsAttached(false);
closeWindowWithoutNotifications();
showWindowWithoutNotifications();
@@ -365,7 +363,7 @@ void WebInspectorFrontendClient::showWindowWithoutNotifications()
else {
// If no preference is set - default to an attached window. This is important for inspector LayoutTests.
// FIXME: This flag can be fetched directly from the flags storage.
- shouldAttach = m_inspectedWebView->page()->inspectorController()->inspectorStartsAttached();
+ shouldAttach = m_inspectorClient->inspectorStartsAttached();
if (shouldAttach && !canAttachWindow())
shouldAttach = false;
diff --git a/Source/WebKit/win/WebCoreSupport/WebInspectorClient.h b/Source/WebKit/win/WebCoreSupport/WebInspectorClient.h
index 0c38247..a059559 100644
--- a/Source/WebKit/win/WebCoreSupport/WebInspectorClient.h
+++ b/Source/WebKit/win/WebCoreSupport/WebInspectorClient.h
@@ -34,6 +34,7 @@
#include <WebCore/InspectorFrontendClientLocal.h>
#include <WebCore/PlatformString.h>
#include <WebCore/WindowMessageListener.h>
+#include <wtf/Forward.h>
#include <wtf/OwnPtr.h>
#include <windows.h>
@@ -58,11 +59,13 @@ public:
virtual void highlight(WebCore::Node*);
virtual void hideHighlight();
- virtual void populateSetting(const WTF::String& key, WTF::String* value);
- virtual void storeSetting(const WTF::String& key, const WTF::String& value);
-
virtual bool sendMessageToFrontend(const WTF::String&);
+ bool inspectorStartsAttached();
+ void setInspectorStartsAttached(bool);
+
+ void releaseFrontendPage();
+
void updateHighlight();
void frontendClosing()
{
@@ -70,9 +73,9 @@ public:
releaseFrontendPage();
}
- void releaseFrontendPage();
private:
~WebInspectorClient();
+ WTF::PassOwnPtr<WebCore::InspectorFrontendClientLocal::Settings> createFrontendSettings();
WebView* m_inspectedWebView;
WebCore::Page* m_frontendPage;
@@ -84,7 +87,7 @@ private:
class WebInspectorFrontendClient : public WebCore::InspectorFrontendClientLocal, WebCore::WindowMessageListener {
public:
- WebInspectorFrontendClient(WebView* inspectedWebView, HWND inspectedWebViewHwnd, HWND frontendHwnd, const COMPtr<WebView>& frotnendWebView, HWND frontendWebViewHwnd, WebInspectorClient* inspectorClient);
+ WebInspectorFrontendClient(WebView* inspectedWebView, HWND inspectedWebViewHwnd, HWND frontendHwnd, const COMPtr<WebView>& frotnendWebView, HWND frontendWebViewHwnd, WebInspectorClient*, WTF::PassOwnPtr<Settings>);
virtual void frontendLoaded();