Commit 2e3cbd9a authored by eseidel's avatar eseidel

2006-03-03 Eric Seidel <eseidel@apple.com>

        Reviewed by mjs.

        Wire up WidgetWin, CursorWin, ScrollViewWin.
        Stub out methods for selection and cursors.

        * Viewer/ImageDocument.h:
        * WebCore.vcproj/WebCore/WebCore.vcproj:
        * bridge/win/FrameWin.cpp:
        * khtml/ecma/kjs_proxy.cpp:
        (WebCore::KJSProxyImpl::initScriptIfNeeded):
        * platform/IntRect.h:
        (WebCore::IntRect::IntRect):
        * platform/Widget.h:
        * platform/win/CursorWin.cpp:
        (WebCore::eastResizeCursor):
        (WebCore::northResizeCursor):
        (WebCore::northEastResizeCursor):
        (WebCore::northWestResizeCursor):
        (WebCore::southResizeCursor):
        (WebCore::southEastResizeCursor):
        (WebCore::southWestResizeCursor):
        (WebCore::westResizeCursor):
        * platform/win/IntRectWin.cpp:
        (WebCore::IntRect::IntRect):
        (WebCore::IntRect::operator RECT):
        * platform/win/MouseEventWin.cpp:
        * platform/win/ScrollViewWin.cpp: Added.
        (WebCore::ScrollView::updateContents):
        * platform/win/TemporaryLinkStubs.cpp:
        (QTextEdit::textWithHardLineBreaks):
        (QLineEdit::setPlaceholderString):
        (QScrollBar::scroll):
        (GraphicsContext::beginTransparencyLayer):
        (Widget::setIsSelected):
        (QLineEdit::selectedText):
        (QComboBox::sizeHint):
        (KWQFileButton::focusPolicy):
        (QTextEdit::focusPolicy):
        (QSlider::focusPolicy):
        (QListBox::focusPolicy):
        (QLineEdit::focusPolicy):
        (WebCore::moveCursor):
        (ScrollView::scrollBy):
        (KWQKCookieJar::cookieEnabled):
        (WebCore::TransferJob::TransferJob):
        (WebCore::screenDepth):
        (WebCore::usableScreenRect):
        (FrameWin::getObjectInstanceForWidget):
        (FrameWin::getEmbedInstanceForWidget):
        (FrameWin::getAppletInstanceForWidget):
        (FrameWin::passMouseDownEventToWidget):
        (FrameWin::issuePasteCommand):
        (FrameWin::issueTransposeCommand):
        (QSlider::setFont):
        (QLineEdit::setFont):
        (QListBox::setFont):
        (QFontMetrics::QFontMetrics):
        (QComboBox::setFont):
        (QTextEdit::setFont):
        (QTextEdit::setWritingDirection):
        (QFontMetrics::setFontDescription):
        (QFontMetrics::checkSelectionPoint):
        (FrameWin::addMessageToConsole):
        (FrameWin::shouldChangeSelection):
        (ScrollView::resizeContents):
        (ScrollView::visibleHeight):
        (ScrollView::visibleWidth):
        (ScrollView::setContentsPos):
        (ScrollView::contentsX):
        (ScrollView::contentsY):
        (ScrollView::contentsHeight):
        (ScrollView::contentsWidth):
        (ScrollView::viewportToContents):
        * platform/win/WidgetWin.cpp: Added.
        (WebCore::Widget::Widget):
        (WebCore::Widget::~Widget):
        (WebCore::Widget::windowHandle):
        (WebCore::Widget::setWindowHandle):
        (WebCore::Widget::setActiveWindow):
        (WebCore::Widget::frameGeometry):
        (WebCore::Widget::hasFocus):
        (WebCore::Widget::setFocus):
        (WebCore::Widget::clearFocus):
        (WebCore::Widget::font):
        (WebCore::Widget::setFont):
        (WebCore::Widget::setCursor):
        (WebCore::Widget::show):
        (WebCore::Widget::hide):
        (WebCore::Widget::setFrameGeometry):
        (WebCore::Widget::mapFromGlobal):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@13113 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8aab0aee
2006-03-03 Eric Seidel <eseidel@apple.com>
Reviewed by mjs.
Wire up WidgetWin, CursorWin, ScrollViewWin.
Stub out methods for selection and cursors.
* Viewer/ImageDocument.h:
* WebCore.vcproj/WebCore/WebCore.vcproj:
* bridge/win/FrameWin.cpp:
* khtml/ecma/kjs_proxy.cpp:
(WebCore::KJSProxyImpl::initScriptIfNeeded):
* platform/IntRect.h:
(WebCore::IntRect::IntRect):
* platform/Widget.h:
* platform/win/CursorWin.cpp:
(WebCore::eastResizeCursor):
(WebCore::northResizeCursor):
(WebCore::northEastResizeCursor):
(WebCore::northWestResizeCursor):
(WebCore::southResizeCursor):
(WebCore::southEastResizeCursor):
(WebCore::southWestResizeCursor):
(WebCore::westResizeCursor):
* platform/win/IntRectWin.cpp:
(WebCore::IntRect::IntRect):
(WebCore::IntRect::operator RECT):
* platform/win/MouseEventWin.cpp:
* platform/win/ScrollViewWin.cpp: Added.
(WebCore::ScrollView::updateContents):
* platform/win/TemporaryLinkStubs.cpp:
(QTextEdit::textWithHardLineBreaks):
(QLineEdit::setPlaceholderString):
(QScrollBar::scroll):
(GraphicsContext::beginTransparencyLayer):
(Widget::setIsSelected):
(QLineEdit::selectedText):
(QComboBox::sizeHint):
(KWQFileButton::focusPolicy):
(QTextEdit::focusPolicy):
(QSlider::focusPolicy):
(QListBox::focusPolicy):
(QLineEdit::focusPolicy):
(WebCore::moveCursor):
(ScrollView::scrollBy):
(KWQKCookieJar::cookieEnabled):
(WebCore::TransferJob::TransferJob):
(WebCore::screenDepth):
(WebCore::usableScreenRect):
(FrameWin::getObjectInstanceForWidget):
(FrameWin::getEmbedInstanceForWidget):
(FrameWin::getAppletInstanceForWidget):
(FrameWin::passMouseDownEventToWidget):
(FrameWin::issuePasteCommand):
(FrameWin::issueTransposeCommand):
(QSlider::setFont):
(QLineEdit::setFont):
(QListBox::setFont):
(QFontMetrics::QFontMetrics):
(QComboBox::setFont):
(QTextEdit::setFont):
(QTextEdit::setWritingDirection):
(QFontMetrics::setFontDescription):
(QFontMetrics::checkSelectionPoint):
(FrameWin::addMessageToConsole):
(FrameWin::shouldChangeSelection):
(ScrollView::resizeContents):
(ScrollView::visibleHeight):
(ScrollView::visibleWidth):
(ScrollView::setContentsPos):
(ScrollView::contentsX):
(ScrollView::contentsY):
(ScrollView::contentsHeight):
(ScrollView::contentsWidth):
(ScrollView::viewportToContents):
* platform/win/WidgetWin.cpp: Added.
(WebCore::Widget::Widget):
(WebCore::Widget::~Widget):
(WebCore::Widget::windowHandle):
(WebCore::Widget::setWindowHandle):
(WebCore::Widget::setActiveWindow):
(WebCore::Widget::frameGeometry):
(WebCore::Widget::hasFocus):
(WebCore::Widget::setFocus):
(WebCore::Widget::clearFocus):
(WebCore::Widget::font):
(WebCore::Widget::setFont):
(WebCore::Widget::setCursor):
(WebCore::Widget::show):
(WebCore::Widget::hide):
(WebCore::Widget::setFrameGeometry):
(WebCore::Widget::mapFromGlobal):
2006-03-03 Maciej Stachowiak <mjs@apple.com>
Reviewed by Eric.
......@@ -44,7 +137,6 @@
(GraphicsContext::drawText):
(GraphicsContext::drawLineForText):
>>>>>>> .r13111
2006-03-02 Maciej Stachowiak <mjs@apple.com>
Rubber stamped by Eric.
......
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// ImageDocument.h : interface of the ImageDocument class
......@@ -50,7 +50,7 @@ public:
public:
virtual void Serialize(CArchive& ar);
virtual bool shouldStopAnimation(const WebCore::Image*) { return false; }
virtual bool shouldStopAnimation(const WebCore::Image*) { return false; }
virtual void animationAdvanced(const WebCore::Image*);
WebCore::Image* image() const { return m_image; }
......
......@@ -1783,6 +1783,10 @@
<Filter
Name="win"
>
<File
RelativePath="..\..\platform\win\CursorWin.cpp"
>
</File>
<File
RelativePath="..\..\platform\win\IntPointWin.cpp"
>
......@@ -1795,6 +1799,10 @@
RelativePath="..\..\platform\win\MouseEventWin.cpp"
>
</File>
<File
RelativePath="..\..\platform\win\ScrollViewWin.cpp"
>
</File>
<File
RelativePath="..\..\platform\win\SharedTimerWin.cpp"
>
......@@ -1807,6 +1815,10 @@
RelativePath="..\..\platform\win\TemporaryLinkStubs.cpp"
>
</File>
<File
RelativePath="..\..\platform\win\WidgetWin.cpp"
>
</File>
</Filter>
<Filter
Name="image-decoders"
......
......@@ -46,4 +46,9 @@ FrameWin::~FrameWin()
{
}
QString FrameWin::userAgent() const
{
return "Mozilla/5.0 (PC; U; Intel; Windows; en) AppleWebKit/420+ (KHTML, like Gecko)";
}
}
......@@ -152,13 +152,11 @@ void KJSProxyImpl::initScriptIfNeeded()
globalObject->put(m_script->globalExec(), "debug", new TestFunctionImp(), Internal);
QString userAgent = m_frame->userAgent();
if (userAgent.find(QString::fromLatin1("Microsoft")) >= 0 ||
userAgent.find(QString::fromLatin1("MSIE")) >= 0)
if (userAgent.find("Microsoft") >= 0 || userAgent.find("MSIE") >= 0)
m_script->setCompatMode(Interpreter::IECompat);
else
// If we find "Mozilla" but not "(compatible, ...)" we are a real Netscape
if (userAgent.find(QString::fromLatin1("Mozilla")) >= 0 &&
userAgent.find(QString::fromLatin1("compatible")) == -1)
if (userAgent.find("Mozilla") >= 0 && userAgent.find("compatible") == -1)
m_script->setCompatMode(Interpreter::NetscapeCompat);
}
......
......@@ -50,9 +50,6 @@ namespace WebCore {
class IntRect {
public:
IntRect() { }
#if WIN32
IntRect(const RECT&);
#endif
IntRect(const IntPoint& location, const IntSize& size)
: m_location(location), m_size(size) { }
IntRect(int x, int y, int width, int height)
......@@ -103,6 +100,11 @@ public:
}
void inflate(int d) { inflateX(d); inflateY(d); }
#if WIN32
IntRect(const RECT&);
operator RECT() const;
#endif
#if __APPLE__
operator CGRect() const;
......
......@@ -40,6 +40,10 @@ class NSView;
#endif
#endif
#if WIN32
typedef struct HWND__ *HWND;
#endif
namespace WebCore {
class Cursor;
......@@ -116,6 +120,12 @@ namespace WebCore {
void setIsSelected(bool isSelected);
#if WIN32
Widget(HWND);
HWND windowHandle();
void setWindowHandle(HWND);
#endif
#if __APPLE__
Widget(NSView* view);
......
......@@ -23,17 +23,11 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#import "config.h"
#import "Cursor.h"
#include "config.h"
#include "Cursor.h"
namespace WebCore {
Cursor::Cursor(Image* /*image*/)
: m_impl(0)
{
// FIXME: Implement custom cursors.
}
Cursor::Cursor(const Cursor& other)
: m_impl(other.m_impl)
{
......@@ -66,12 +60,6 @@ const Cursor& handCursor()
return c;
}
const Cursor& moveCursor()
{
static Cursor c; // FIXME
return c;
}
const Cursor& iBeamCursor()
{
static Cursor c = LoadCursor(0, IDC_IBEAM);
......@@ -92,49 +80,49 @@ const Cursor& helpCursor()
const Cursor& eastResizeCursor()
{
static Cursor c; // FIXME
static Cursor c = LoadCursor(0, IDC_HELP);
return c;
}
const Cursor& northResizeCursor()
{
static Cursor c; // FIXME
static Cursor c = LoadCursor(0, IDC_HELP);
return c;
}
const Cursor& northEastResizeCursor()
{
static Cursor c; // FIXME
static Cursor c = LoadCursor(0, IDC_SIZENESW);
return c;
}
const Cursor& northWestResizeCursor()
{
static Cursor c; // FIXME
static Cursor c = LoadCursor(0, IDC_SIZENWSE);
return c;
}
const Cursor& southResizeCursor()
{
static Cursor c; // FIXME
static Cursor c = LoadCursor(0, IDC_SIZENS);
return c;
}
const Cursor& southEastResizeCursor()
{
static Cursor c; // FIXME
static Cursor c = LoadCursor(0, IDC_SIZENWSE);
return c;
}
const Cursor& southWestResizeCursor()
{
static Cursor c; // FIXME
static Cursor c = LoadCursor(0, IDC_SIZENESW);
return c;
}
const Cursor& westResizeCursor()
{
static Cursor c; // FIXME
static Cursor c = LoadCursor(0, IDC_SIZEWE);
return c;
}
......
......@@ -30,8 +30,14 @@
namespace WebCore {
IntRect::IntRect(const RECT& r)
: m_location(IntPoint(r.left, r.top)), m_size(IntSize(r.right, r.bottom))
: m_location(IntPoint(r.left, r.top)), m_size(IntSize(r.right-r.left, r.bottom-r.top))
{
}
IntRect::operator RECT() const
{
RECT rect = {m_location.x(), m_location.y(), m_location.x() + m_size.width(), m_location.y() + m_size.height()};
return rect;
}
}
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "ScrollView.h"
#include "IntRect.h"
#include <windows.h>
namespace WebCore {
void ScrollView::updateContents(const IntRect& dirtyRect, bool now)
{
RECT repaintRect = RECT(dirtyRect);
InvalidateRect(windowHandle(), &repaintRect, true);
if (now)
UpdateWindow(windowHandle());
}
}
\ No newline at end of file
This diff is collapsed.
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "Widget.h"
#include "Cursor.h"
#include "GraphicsContext.h"
#include "FrameWin.h"
#include "Font.h"
namespace WebCore {
class WidgetPrivate
{
public:
HWND windowHandle;
Font font;
};
Widget::Widget()
: data(new WidgetPrivate)
{
data->windowHandle = 0;
}
Widget::Widget(HWND hWnd)
: data(new WidgetPrivate)
{
data->windowHandle = hWnd;
}
Widget::~Widget()
{
delete data;
}
HWND Widget::windowHandle()
{
return data->windowHandle;
}
void Widget::setWindowHandle(HWND hWnd)
{
data->windowHandle = hWnd;
}
void Widget::setActiveWindow()
{
BringWindowToTop(data->windowHandle);
}
IntRect Widget::frameGeometry() const
{
RECT frame;
if (GetWindowRect(data->windowHandle, &frame))
return frame;
return IntRect();
}
bool Widget::hasFocus() const
{
return (data->windowHandle == GetForegroundWindow());
}
void Widget::setFocus()
{
SetFocus(data->windowHandle);
}
void Widget::clearFocus()
{
FrameWin::clearDocumentFocus(this);
SetFocus(0);
}
const Font& Widget::font() const
{
return data->font;
}
void Widget::setFont(const Font& font)
{
data->font = font;
}
void Widget::setCursor(const Cursor& cursor)
{
SetProp(data->windowHandle, L"PROP_CURSOR", cursor.impl());
}
void Widget::show()
{
ShowWindow(data->windowHandle, SW_SHOWNA);
}
void Widget::hide()
{
ShowWindow(data->windowHandle, SW_HIDE);
}
void Widget::setFrameGeometry(const IntRect &rect)
{
MoveWindow(data->windowHandle, rect.x(), rect.y(), rect.width(), rect.height(), false);
}
IntPoint Widget::mapFromGlobal(const IntPoint &p) const
{
POINT point = p;
ScreenToClient(data->windowHandle, &point);
return point;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment