diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-05 14:34:32 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-05 14:34:32 -0800 |
commit | 635860845790a19bf50bbc51ba8fb66a96dde068 (patch) | |
tree | ef6ad9ff73a5b57f65249d4232a202fa77e6a140 /WebKit/win | |
parent | 8e35f3cfc7fba1d1c829dc557ebad6409cbe16a2 (diff) | |
download | external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.zip external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.tar.gz external_webkit-635860845790a19bf50bbc51ba8fb66a96dde068.tar.bz2 |
auto import from //depot/cupcake/@136594
Diffstat (limited to 'WebKit/win')
85 files changed, 4592 insertions, 971 deletions
diff --git a/WebKit/win/AccessibleBase.cpp b/WebKit/win/AccessibleBase.cpp index fdf9404..df91151 100644 --- a/WebKit/win/AccessibleBase.cpp +++ b/WebKit/win/AccessibleBase.cpp @@ -102,7 +102,7 @@ HRESULT STDMETHODCALLTYPE AccessibleBase::get_accParent(IDispatch** parent) { *parent = 0; - if (!m_object) + if (!m_object || !m_object->topDocumentFrameView()) return E_FAIL; return WebView::AccessibleObjectFromWindow(m_object->topDocumentFrameView()->hostWindow()->platformWindow(), @@ -393,6 +393,9 @@ HRESULT STDMETHODCALLTYPE AccessibleBase::accLocation(long* left, long* top, lon if (FAILED(hr)) return hr; + if (!childObj->documentFrameView()) + return E_FAIL; + IntRect screenRect(childObj->documentFrameView()->contentsToScreen(childObj->boundingBoxRect())); *left = screenRect.x(); *top = screenRect.y(); @@ -465,7 +468,7 @@ HRESULT STDMETHODCALLTYPE AccessibleBase::accHitTest(long x, long y, VARIANT* pv ::VariantInit(pvChildAtPoint); - if (!m_object) + if (!m_object || !m_object->documentFrameView()) return E_FAIL; IntPoint point = m_object->documentFrameView()->screenToContents(IntPoint(x, y)); diff --git a/WebKit/win/COMPropertyBag.h b/WebKit/win/COMPropertyBag.h index 6bec57f..ae4a7b7 100644 --- a/WebKit/win/COMPropertyBag.h +++ b/WebKit/win/COMPropertyBag.h @@ -34,10 +34,10 @@ #include "COMVariantSetter.h"
-template<typename ValueType, typename HashType = typename WebCore::StringHash>
+template<typename ValueType, typename KeyType = typename WebCore::String, typename HashType = typename WebCore::StringHash>
class COMPropertyBag : public IPropertyBag, public IPropertyBag2, Noncopyable {
public:
- typedef HashMap<WebCore::String, ValueType, HashType> HashMapType;
+ typedef HashMap<KeyType, ValueType, HashType> HashMapType;
static COMPropertyBag* createInstance(const HashMapType&);
static COMPropertyBag* adopt(HashMapType&);
@@ -77,16 +77,16 @@ private: };
// COMPropertyBag ------------------------------------------------------------------
-template<typename ValueType, typename HashType>
-COMPropertyBag<ValueType, HashType>* COMPropertyBag<typename ValueType, HashType>::createInstance(const HashMapType& hashMap)
+template<typename ValueType, typename KeyType, typename HashType>
+COMPropertyBag<ValueType, KeyType, HashType>* COMPropertyBag<typename ValueType, typename KeyType, HashType>::createInstance(const HashMapType& hashMap)
{
COMPropertyBag* instance = new COMPropertyBag(hashMap);
instance->AddRef();
return instance;
}
-template<typename ValueType, typename HashType>
-COMPropertyBag<ValueType, HashType>* COMPropertyBag<typename ValueType, HashType>::adopt(HashMapType& hashMap)
+template<typename ValueType, typename KeyType, typename HashType>
+COMPropertyBag<ValueType, KeyType, HashType>* COMPropertyBag<typename ValueType, typename KeyType, HashType>::adopt(HashMapType& hashMap)
{
COMPropertyBag* instance = new COMPropertyBag;
instance->m_hashMap.swap(hashMap);
@@ -95,8 +95,8 @@ COMPropertyBag<ValueType, HashType>* COMPropertyBag<typename ValueType, HashType }
// IUnknown ------------------------------------------------------------------------
-template<typename ValueType, typename HashType>
-HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, HashType>::QueryInterface(REFIID riid, void** ppvObject)
+template<typename ValueType, typename KeyType, typename HashType>
+HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, KeyType, HashType>::QueryInterface(REFIID riid, void** ppvObject)
{
*ppvObject = 0;
if (IsEqualGUID(riid, IID_IUnknown))
@@ -112,14 +112,14 @@ HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, HashType>::QueryInterface(RE return S_OK;
}
-template<typename ValueType, typename HashType>
-ULONG STDMETHODCALLTYPE COMPropertyBag<ValueType, HashType>::AddRef()
+template<typename ValueType, typename KeyType, typename HashType>
+ULONG STDMETHODCALLTYPE COMPropertyBag<ValueType, KeyType, HashType>::AddRef()
{
return ++m_refCount;
}
-template<typename ValueType, typename HashType>
-ULONG STDMETHODCALLTYPE COMPropertyBag<ValueType, HashType>::Release()
+template<typename ValueType, typename KeyType, typename HashType>
+ULONG STDMETHODCALLTYPE COMPropertyBag<ValueType, KeyType, HashType>::Release()
{
ULONG newRef = --m_refCount;
if (!newRef)
@@ -130,8 +130,8 @@ ULONG STDMETHODCALLTYPE COMPropertyBag<ValueType, HashType>::Release() // IPropertyBag --------------------------------------------------------------------
-template<typename ValueType, typename HashType>
-HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, HashType>::Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog* pErrorLog)
+template<typename ValueType, typename KeyType, typename HashType>
+HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, KeyType, HashType>::Read(LPCOLESTR pszPropName, VARIANT* pVar, IErrorLog* pErrorLog)
{
if (!pszPropName)
return E_POINTER;
@@ -145,32 +145,45 @@ HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, HashType>::Read(LPCOLESTR ps V_VT(pVar) = VT_EMPTY;
COMVariantSetter<ValueType>::setVariant(pVar, it->second);
- if (requestedType != COMVariantSetter<ValueType>::VariantType && requestedType != VT_EMPTY)
+ if (requestedType != COMVariantSetter<ValueType>::variantType(it->second) && requestedType != VT_EMPTY)
return ::VariantChangeType(pVar, pVar, VARIANT_NOUSEROVERRIDE | VARIANT_ALPHABOOL, requestedType);
return S_OK;
}
-template<typename ValueType, typename HashType>
-HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, HashType>::Write(LPCOLESTR pszPropName, VARIANT* pVar)
+template<typename ValueType, typename KeyType, typename HashType>
+HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, KeyType, HashType>::Write(LPCOLESTR pszPropName, VARIANT* pVar)
{
return E_FAIL;
}
-template<typename ValueType, typename HashType>
-HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, HashType>::Read(ULONG cProperties, PROPBAG2*, IErrorLog*, VARIANT* pvarValue, HRESULT* phrError)
+template<typename ValueType, typename KeyType, typename HashType>
+HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, KeyType, HashType>::Read(ULONG cProperties, PROPBAG2* pPropBag, IErrorLog* pErrorLog, VARIANT* pvarValue, HRESULT* phrError)
{
- return E_NOTIMPL;
+ if (!pPropBag || !pvarValue || !phrError)
+ return E_POINTER;
+
+ HRESULT hr = S_OK;
+
+ for (ULONG i = 0; i < cProperties; ++i) {
+ VariantInit(&pvarValue[i]);
+ pvarValue[i].vt = pPropBag[i].vt;
+ phrError[i] = Read(pPropBag[i].pstrName, &pvarValue[i], pErrorLog);
+ if (FAILED(phrError[i]))
+ hr = E_FAIL;
+ }
+
+ return hr;
}
-template<typename ValueType, typename HashType>
-HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, HashType>::Write(ULONG cProperties, PROPBAG2*, VARIANT*)
+template<typename ValueType, typename KeyType, typename HashType>
+HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, KeyType, HashType>::Write(ULONG cProperties, PROPBAG2*, VARIANT*)
{
return E_NOTIMPL;
}
-template<typename ValueType, typename HashType>
-HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, HashType>::CountProperties(ULONG* pcProperties)
+template<typename ValueType, typename KeyType, typename HashType>
+HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, KeyType, HashType>::CountProperties(ULONG* pcProperties)
{
if (!pcProperties)
return E_POINTER;
@@ -179,8 +192,8 @@ HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, HashType>::CountProperties(U return S_OK;
}
-template<typename ValueType, typename HashType>
-HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, HashType>::GetPropertyInfo(ULONG iProperty, ULONG cProperties, PROPBAG2* pPropBag, ULONG* pcProperties)
+template<typename ValueType, typename KeyType, typename HashType>
+HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, KeyType, HashType>::GetPropertyInfo(ULONG iProperty, ULONG cProperties, PROPBAG2* pPropBag, ULONG* pcProperties)
{
if (!pPropBag || !pcProperties)
return E_POINTER;
@@ -196,11 +209,11 @@ HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, HashType>::GetPropertyInfo(U ;
for (ULONG j = 0; j < cProperties && current != end; ++j, ++current) {
// FIXME: the following fields aren't filled in
- //pPropBag[j].dwType; // (DWORD) Type of property. This will be one of the PROPBAG2_TYPE values. - //pPropBag[j].cfType; // (CLIPFORMAT) Clipboard format or MIME type of the property. - //pPropBag[j].clsid; // (CLSID) CLSID of the object. This member is valid only if dwType is PROPBAG2_TYPE_OBJECT. + //pPropBag[j].cfType; // (CLIPFORMAT) Clipboard format or MIME type of the property.
+ //pPropBag[j].clsid; // (CLSID) CLSID of the object. This member is valid only if dwType is PROPBAG2_TYPE_OBJECT.
- pPropBag[j].vt = COMVariantSetter<ValueType>::VariantType;
+ pPropBag[j].dwType = PROPBAG2_TYPE_DATA;
+ pPropBag[j].vt = COMVariantSetter<ValueType>::variantType(current->second);
pPropBag[j].dwHint = iProperty + j;
pPropBag[j].pstrName = (LPOLESTR)CoTaskMemAlloc(sizeof(wchar_t)*(current->first.length()+1));
if (!pPropBag[j].pstrName)
@@ -211,8 +224,8 @@ HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, HashType>::GetPropertyInfo(U return S_OK;
}
-template<typename ValueType, typename HashType>
-HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, HashType>::LoadObject(LPCOLESTR pstrName, DWORD dwHint, IUnknown*, IErrorLog*)
+template<typename ValueType, typename KeyType, typename HashType>
+HRESULT STDMETHODCALLTYPE COMPropertyBag<ValueType, KeyType, HashType>::LoadObject(LPCOLESTR pstrName, DWORD dwHint, IUnknown*, IErrorLog*)
{
return E_NOTIMPL;
}
diff --git a/WebKit/win/COMVariantSetter.h b/WebKit/win/COMVariantSetter.h index 5c6b21c..76ca927 100644 --- a/WebKit/win/COMVariantSetter.h +++ b/WebKit/win/COMVariantSetter.h @@ -36,7 +36,15 @@ namespace WebCore { template<typename T> struct COMVariantSetter {};
-template<> struct COMVariantSetter<WebCore::String>
+template<typename T> struct COMVariantSetterBase
+{
+ static inline VARENUM variantType(const T&)
+ {
+ return COMVariantSetter<T>::VariantType;
+ }
+};
+
+template<> struct COMVariantSetter<WebCore::String> : COMVariantSetterBase<WebCore::String>
{
static const VARENUM VariantType = VT_BSTR;
@@ -49,7 +57,7 @@ template<> struct COMVariantSetter<WebCore::String> }
};
-template<> struct COMVariantSetter<unsigned long long>
+template<> struct COMVariantSetter<unsigned long long> : COMVariantSetterBase<unsigned long long>
{
static const VARENUM VariantType = VT_UI8;
@@ -62,7 +70,7 @@ template<> struct COMVariantSetter<unsigned long long> }
};
-template<> struct COMVariantSetter<int>
+template<> struct COMVariantSetter<int> : COMVariantSetterBase<int>
{
static const VARENUM VariantType = VT_I4;
@@ -75,7 +83,7 @@ template<> struct COMVariantSetter<int> }
};
-template<typename T> struct COMVariantSetter<COMPtr<T> >
+template<typename T> struct COMVariantSetter<COMPtr<T> > : COMVariantSetterBase<COMPtr<T> >
{
static const VARENUM VariantType = VT_UNKNOWN;
@@ -90,7 +98,7 @@ template<typename T> struct COMVariantSetter<COMPtr<T> > };
template<typename COMType, typename UnderlyingType>
-struct COMIUnknownVariantSetter
+struct COMIUnknownVariantSetter : COMVariantSetterBase<UnderlyingType>
{
static const VARENUM VariantType = VT_UNKNOWN;
@@ -103,4 +111,61 @@ struct COMIUnknownVariantSetter }
};
+class COMVariant {
+public:
+ COMVariant()
+ {
+ ::VariantInit(&m_variant);
+ }
+
+ template<typename UnderlyingType>
+ COMVariant(UnderlyingType value)
+ {
+ ::VariantInit(&m_variant);
+ COMVariantSetter<UnderlyingType>::setVariant(&m_variant, value);
+ }
+
+ ~COMVariant()
+ {
+ ::VariantClear(&m_variant);
+ }
+
+ COMVariant(const COMVariant& other)
+ {
+ ::VariantInit(&m_variant);
+ other.copyTo(&m_variant);
+ }
+
+ COMVariant& operator=(const COMVariant& other)
+ {
+ other.copyTo(&m_variant);
+ return *this;
+ }
+
+ void copyTo(VARIANT* dest) const
+ {
+ ::VariantCopy(dest, const_cast<VARIANT*>(&m_variant));
+ }
+
+ VARENUM variantType() const { return static_cast<VARENUM>(V_VT(&m_variant)); }
+
+private:
+ VARIANT m_variant;
+};
+
+template<> struct COMVariantSetter<COMVariant>
+{
+ static inline VARENUM variantType(const COMVariant& value)
+ {
+ return value.variantType();
+ }
+
+ static void setVariant(VARIANT* variant, const COMVariant& value)
+ {
+ ASSERT(V_VT(variant) == VT_EMPTY);
+
+ value.copyTo(variant);
+ }
+};
+
#endif // COMVariantSetter
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog index ae26480..bbafe2e 100644 --- a/WebKit/win/ChangeLog +++ b/WebKit/win/ChangeLog @@ -1,3 +1,1648 @@ +2009-02-12 Mark Rowe <mrowe@apple.com> + + Merge r40886. + + 2009-02-11 Brady Eidson <beidson@apple.com> + + Fix my last checkin for more effect. + + * WebHistoryItem.cpp: + (WebHistoryItem::initFromDictionaryRepresentation): + +2009-02-12 Mark Rowe <mrowe@apple.com> + + Merge r40882. + + 2009-02-11 Brady Eidson <beidson@apple.com> + + Reviewed by Mark Rowe + + <rdar://problem/6570573> Some visit counts in History.plist have insanely high values, can roll over to negative + + Remove the item from the date caches before registering the visit. Otherwise it might not be successfully removed + and when we add it back later it will exist in the list twice. This will cause the entry to be written out twice, + which would lead to doubling (or more!) the visit count on next launch when these multiple items are merged. + + * WebHistory.cpp: + (WebHistory::loadHistoryGutsFromURL): + (WebHistory::addItems): + (WebHistory::addItem): Add a mode that allows the entry being added to be discarded if an entry for the URL already + exists. Use that mode when reading the History.plist so only the most recent entry for a given URL will be used. + (WebHistory::visitedURL): Swap the removeItemFromDateCaches and visitedWithTitle calls. + * WebHistory.h: + + * WebHistoryItem.cpp: + (WebHistoryItem::initFromDictionaryRepresentation): Add the negative-visit-count-correction-logic as implemented + for Mac in http://trac.webkit.org/changeset/40851. + +2009-02-06 Mark Rowe <mrowe@apple.com> + + Merge r40726. + + 2009-02-06 Dan Bernstein <mitz@apple.com> + + Reviewed by Anders Carlsson. + + - fix an assertion failure in Vector::at() beneath + WebHistoryItem::dictionaryRepresentation. + + * WebHistoryItem.cpp: + (WebHistoryItem::dictionaryRepresentation): Give the numbers vector initial + size. Also reduced the inline capacity of the vector used for weekly visit + counts to 5, which is the expected maximum size. + +2009-02-06 Mark Rowe <mrowe@apple.com> + + Merge r40713. + + 2009-02-06 Maciej Stachowiak <mjs@apple.com> + + Rubber stamped by Dan Bernstein. + + - fix obvious problem in previous commit (|| used instead of &&) + + * WebHistoryItem.cpp: + (WebHistoryItem::initFromDictionaryRepresentation): + +2009-02-06 Mark Rowe <mrowe@apple.com> + + Merge r40712. + + 2009-02-05 Maciej Stachowiak <mjs@apple.com> and Brady Eidson <beidson@apple.com> + + Reviewed by Dan Bernstein and Geoff Garen.. + + - WebKit code to track per-day and per-week visit counts in history + + For now this data is only exposed via SPI for performance reasons. + + * Interfaces/IWebHistoryItemPrivate.idl: Added new interface. + * WebHistory.cpp: + (WebHistory::visitedURL): Use new recordInitialVisit method. + * WebHistoryItem.cpp: + (WebHistoryItem::initFromDictionaryRepresentation): Add parsing support + for new data. + (WebHistoryItem::dictionaryRepresentation): Add saving support for + new data. + (WebHistoryItem::getDailyVisitCounts): SPI accessor. + (WebHistoryItem::getWeeklyVisitCounts): SPI accessor. + (WebHistoryItem::recordInitialVisit): Tell WebCore to record an initial visit. + * WebHistoryItem.h: + +2009-02-04 Steve Falkenburg <sfalken@apple.com> + + Merge r40365. + + 2009-01-29 Adam Roben <aroben@apple.com> + + Build fix after r40353 + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::loadURLIntoChild): Removed the check for + FrameLoadTypeReloadAllowingStaleData. + +2009-02-04 Steve Falkenburg <sfalken@apple.com> + + Merge r40511. + + 2009-02-02 Geoffrey Garen <ggaren@apple.com> + + Build fix. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::loadURLIntoChild): + +2009-02-04 Steve Falkenburg <sfalken@apple.com> + + Merge part of r40470. + + 2009-01-31 Matt Lilek <webkit@mattlilek.com> + + Not reviewed, build fixes. + + * WebCoreSupport/WebContextMenuClient.cpp: + (WebContextMenuClient::searchWithGoogle): + +2009-02-03 Mark Rowe <mrowe@apple.com> + + Merge r40392. + + 2009-01-29 Sam Weinig <sam@webkit.org> + + Fix Windows build + + * WebHistoryItem.cpp: + (WebHistoryItem::initFromDictionaryRepresentation): + +2009-02-03 Mark Rowe <mrowe@apple.com> + + Merge r40529. + + 2009-02-03 Geoffrey Garen <ggaren@apple.com> + + Build fix. + + * WebHistory.cpp: + (WebHistory::visitedURL): + +2009-02-03 Mark Rowe <mrowe@apple.com> + + Merge r40528. + + 2009-02-02 Geoffrey Garen <ggaren@apple.com> + + Build fix. + + * WebHistory.cpp: + (WebHistory::visitedURL): + +2009-02-03 Mark Rowe <mrowe@apple.com> + + Merge r40511. + + 2009-02-02 Geoffrey Garen <ggaren@apple.com> + + Build fix. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::loadURLIntoChild): + +2009-02-03 Mark Rowe <mrowe@apple.com> + + Merge r40508. + + 2009-02-02 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Sam Weinig. + + Track redirects in global history. + + * Interfaces/IWebFramePrivate.idl: Updated for WebCore rename. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::updateGlobalHistory): + (WebFrameLoaderClient::updateGlobalHistoryForRedirectWithoutHistoryItem): + Store redirect information in global history. + + (WebFrameLoaderClient::loadURLIntoChild): Updated for extra parameter. + + * WebCoreSupport/WebFrameLoaderClient.h: See above. + + * WebFrame.cpp: + (WebFrame::loadRequest): + (WebFrame::loadData): Updated for extra parameter. + + * WebHistory.cpp: + (WebHistory::visitedURL): + (WebHistory::visitedURLForRedirectWithoutHistoryItem): Store redirect + information in global history. + + * WebHistory.h: See above. + +2009-02-03 Mark Rowe <mrowe@apple.com> + + Merge r40503. + + 2009-02-02 Brady Eidson <beidson@apple.com> + + Reviewed by Dan Bernstein + + Transition Windows WebHistory to using the same "update already existing History Items" technique that Mac does. + + * Interfaces/IWebHistoryItemPrivate.idl: + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::updateGlobalHistory): + + * WebHistory.cpp: + (WebHistory::visitedURL): + * WebHistory.h: + + * WebHistoryItem.cpp: + (WebHistoryItem::visitedWithTitle): + * WebHistoryItem.h: + +2009-02-03 Mark Rowe <mrowe@apple.com> + + Merge r40382. + + 2009-01-29 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + Second step in tracking the urls a HistoryItem was redirected through + Add SPI to access the array of redirect urls associated with a HistoryItem. + + * Interfaces/IWebHistoryItemPrivate.idl: + * WebHistoryItem.cpp: + (WebHistoryItem::dictionaryRepresentation): + (WebHistoryItem::redirectURLs): + * WebHistoryItem.h: + +2009-02-03 Mark Rowe <mrowe@apple.com> + + Merge r40380. + + 2009-01-29 Sam Weinig <sam@webkit.org> + + Reviewed by Mark Rowe. + + First step in tracking the urls a HistoryItem was redirected through. + + * WebHistoryItem.cpp: + (WebHistoryItem::initFromDictionaryRepresentation): + (WebHistoryItem::dictionaryRepresentation): + +2009-02-03 Mark Rowe <mrowe@apple.com> + + Merge r40436. + + 2009-01-30 Geoffrey Garen <ggaren@apple.com> + + Build fix. + + * Interfaces/IWebFramePrivate.idl: + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::loadURLIntoChild): + +2009-02-03 Mark Rowe <mrowe@apple.com> + + Merge r40353. + + 2009-01-28 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Sam Weinig. + + Updated for WebCore rename. + + * WebView.cpp: + (WebView::setCustomTextEncodingName): + +2009-02-03 Mark Rowe <mrowe@apple.com> + + Merge r40366. + + 2009-01-29 Adam Roben <aroben@apple.com> + + Fix Bug 23623: Windowed Flash instances aren't captured when a WebView + receives a WM_PRINTCLIENT message + + <https://bugs.webkit.org/show_bug.cgi?id=23623> + <rdar://problem/6513921> + <rdar://problem/6536874> + + Reviewed by Darin Adler. + + * WebFrame.cpp: + (WebFrame::paintDocumentRectToContext): + (WebFrame::spoolPages): + Call GraphicsContext::setShouldIncludeChildWindows so that child + windows will be painted into the GraphicsContext rather than painted + directly to the screen. + + * WebView.cpp: + (WebView::updateBackingStore): Added a windowsToPaint parameter, which + we pass along to paintIntoBackingStore. + + (WebView::paint): Tell updateBackingStore to paint child windows if + we're not painting to the screen. + + (WebView::paintIntoBackingStore): Added a windowsToPaint paramter, + which we use to tell our GraphicsContext whether or not to include + child windows. + + * WebView.h: Added windowsToPaint parameters to paintIntoBackingStore + and updateBackingStore (which I also made private). + +2009-01-27 Brady Eidson <beidson@apple.com> + + Reviewed by Dan Bernstein + + Rework FrameLoaderClient to work on a CachedFrame basis instead of CachedPage + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::savePlatformDataToCachedFrame): + (WebFrameLoaderClient::transitionToCommittedFromCachedFrame): + * WebCoreSupport/WebFrameLoaderClient.h: + + * WebFrame.cpp: + * WebFrame.h: + +2009-01-26 Adam Roben <aroben@apple.com> + + Fix an assertion failure when Safari loads an error page + + Reviewed by Alexey Proskuryakov. + + * WebFrame.cpp: + (WebFrame::loadData): Use the two-argument version of KURL and + MarshallingHelpers::BSTRToKURL, for reasons mentioned in r40248. + +2009-01-26 Adam Roben <aroben@apple.com> + + Fix an assertion on launch in KURL::KURL + + All URL strings passed in to the WebKit API need to be passed to + MarshallingHelpers::BSTRToKURL so that they may be properly parsed. + + Reviewed by Alexey Proskuryakov. + + * MarshallingHelpers.cpp: + (MarshallingHelpers::BSTRToKURL): Changed to use the two-argument + constructor for KURL so that the strings will be parsed rather than + assumed to be in the correct encoding/form. + + * WebResource.cpp: + (WebResource::initWithData): + * WebURLResponse.cpp: + (WebURLResponse::initWithURL): + * WebView.cpp: + (WebView::userAgentForURL): + (WebView::copyURL): + Changed to use MarshallingHelpers::BSTRToKURL instead of trying to do + the work manually. + +2009-01-25 Darin Adler <darin@apple.com> + + Try to fix Windows build. + + * WebView.cpp: Added FloatQuad.h. + +2009-01-23 Brent Fulgham <bfulgham@webkit.org> + + Reviewed by Darin Adler + + https://bugs.webkit.org/show_bug.cgi?id=23492 + Exclude calls to WebKitSystemInterface functions when not + using CoreGraphics. + + * WebPreferences.cpp: + (WebPreferences::setFontSmoothing): + (WebPreferences::setFontSmoothingContrast): + * WebTextRenderer.cpp: + (WebTextRenderer::registerPrivateFont): + +2009-01-23 Brady Eidson <beidson@apple.com> + + Rubberstamped by Darin Adler + + Rename CachedPagePlatformData to CachedFramePlatformData to more accurately reflect its true role. + + * WebCachedFramePlatformData.h: Copied from WebKit/win/WebCachedPagePlatformData.h. + (WebCachedFramePlatformData::WebCachedFramePlatformData): + * WebCachedPagePlatformData.h: Removed. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::savePlatformDataToCachedPage): + + * WebKit.vcproj/WebKit.vcproj: + +2009-01-22 Eric Roman <eroman@chromium.org> + + Reviewed by Eric Seidel. + + https://bugs.webkit.org/show_bug.cgi?id=20806 + Deprecate RSSFeedReferrer() and setRSSFeedReferrer(). + + * WebHistoryItem.cpp: + (WebHistoryItem::RSSFeedReferrer): + (WebHistoryItem::setRSSFeedReferrer): + +2009-01-19 Sam Weinig <sam@webkit.org> + + Rubber-stamped by Gavin Barraclough. + + Remove temporary operator-> from JSValuePtr. + + * WebScriptCallFrame.cpp: + (WebScriptCallFrame::jsValueToString): + * WebView.cpp: + (WebView::stringByEvaluatingJavaScriptFromString): + +2009-01-19 Adam Roben <aroben@apple.com> + + Windows build fix + + * DOMCoreClasses.cpp: Replaced "using namespace WebCore" with + individual using directives for each type we need from that namespace, + to avoid conflicts between DOMObject and WebCore::DOMObject. + (DOMElement::font): Added a now-needed WebCore::. + +2009-01-17 Steve Falkenburg <sfalken@apple.com> + + Build fix. + + * WebCoreSupport/WebDragClient.cpp: + (WebDragClient::createDragImageForLink): + +2009-01-17 David Hyatt <hyatt@apple.com> + + Eliminate dependencies on backslashAsCurrencySymbol from WebKit. + + Reviewed by Oliver Hunt + + * WebFrame.cpp: + (WebFrame::selectedString): + +2009-01-16 Steve Falkenburg <sfalken@apple.com> + + <rdar://problem/6502511> Safari crashes if it's running while the desktop theme is changed. + + This was caused by mismatched ENABLE definitions across WebCore and WebKit. + + Several virtual methods were added to RenderTheme.h, conditionalized by ENABLE(VIDEO). + In addition to adding ENABLE_VIDEO to WebKit, this change also adds ENABLE_DATABASE and ENABLE_ICONDATABASE + to Windows WebCore/WebKit, and adds ENABLE_WORKERS, and several ENABLE_SVG_ flags to WebKit on Windows. + Our Windows ENABLE flags now match Mac. + + Reviewed by Adele Peterson. + + * WebKit.vcproj/WebKit.vcproj: + +2009-01-15 Adele Peterson <adele@apple.com> + + Reviewed by Darin Adler. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=21799 + <rdar://problem/6310684> Crash in dumpFramesAsText() when running http/tests/security/cross-origin-xsl-BLOCKED.html + + Return S_OK or E_FAIL based on the result from CreateInstance. + This was causing DumpRenderTree to not realize it had just gotten a null documentElement. + + * DOMCoreClasses.cpp: Made all functions that return the result of CreateInstance consistent. + (DOMNode::parentNode): + (DOMNode::ownerDocument): + (DOMNodeList::item): + (DOMDocument::documentElement): + (DOMDocument::createElement): + (DOMDocument::getElementsByTagName): + (DOMDocument::getElementsByTagNameNS): + (DOMDocument::getElementById): + (DOMDocument::getComputedStyle): + (DOMDocument::createEvent): + (DOMElement::style): + +2009-01-14 Adele Peterson <adele@apple.com> + + Reviewed by Darin Adler. + + Fix for https://bugs.webkit.org/show_bug.cgi?id=23335 + <rdar://problem/6247650> Update <input type="search"> for RenderThemeWin + + Added artwork. + + * WebKit.vcproj/WebKit.rc: + * WebKit.vcproj/WebKit.vcproj: + * WebKit.vcproj/resource.h: + * WebKit.vcproj/searchCancel.png: Added. + * WebKit.vcproj/searchCancelPressed.png: Added. + * WebKit.vcproj/searchMagnifier.png: Added. + * WebKit.vcproj/searchMagnifierResults.png: Added. + * WebKitDLL.cpp:(loadResourceIntoBuffer): + +2009-01-14 Dan Bernstein <mitz@apple.com> + + Reviewed by John Sullivan. + + - update copyright + + * WebKit.resources/Info.plist: + * WebKit.vcproj/WebKit.rc: + +2009-01-13 Steve Falkenburg <sfalken@apple.com> + + Build fix. + + * WebScriptCallFrame.cpp: + (WebScriptCallFrame::jsValueToString): + +2009-01-12 Brady Eidson <beidson@apple.com> + + Reviewed by Dan Bernstein + + <rdar://problem/6490446> - Crash when going back to a cached page + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::savePlatformDataToCachedPage): ENABLE(CFNETWORK) needed to be USE(CFNETWORK) + +2009-01-12 Brady Eidson <beidson@apple.com> + + Reviewed by Darin Adler + + <rdar://problem/6468274> - Track Non-get requests in global history + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::updateGlobalHistory): + + * WebHistory.cpp: + (WebHistory::addItem): + * WebHistory.h: + + * Interfaces/IWebHistoryItemPrivate.idl: + * WebHistoryItem.cpp: + (WebHistoryItem::initFromDictionaryRepresentation): + (WebHistoryItem::dictionaryRepresentation): + (WebHistoryItem::lastVisitWasHTTPNonGet): + (WebHistoryItem::setLastVisitWasHTTPNonGet): + * WebHistoryItem.h: + +2009-01-12 Julien Chaffraix <jchaffraix@pleyo.com> + + Reviewed by Darin Adler. + + Bug 22861: Turn the FontCache into a singleton + https://bugs.webkit.org/show_bug.cgi?id=22861 + + * WebCoreStatistics.cpp: + (WebCoreStatistics::cachedFontDataCount): + (WebCoreStatistics::cachedFontDataInactiveCount): + (WebCoreStatistics::purgeInactiveFontData): + Redirected all the static calls to the global FontCache + instance. + +2009-01-11 Dmitry Titov <dimich@chromium.org> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=23207 + Moved currentTime() to from WebCore to WTF. + + * WebDownload.cpp: a different header file included. + * WebDropSource.cpp: a different header file included. + +2009-01-09 Darin Adler <darin@apple.com> + + Reviewed by Jon Honeycutt. + + Bug 22913: REGRESSION: Space bar doesn't scroll on windows + https://bugs.webkit.org/show_bug.cgi?id=22913 + rdar://problem/6479834 + + * WebView.cpp: + (WebView::keyPress): Removed code to handle space bar here; put it in + WebCore instead. + +2009-01-09 Brent Fulgham <bfulgham@gmail.com> + + Reviewed by Adam Roben. + + Fixes: http://bugs.webkit.org/show_bug.cgi?id=23092 + Separate CFNetwork-specific code in WebKit.dll into separate + implementation files. Create cURL stub files to be populated + with new implementation in a future bug report. + + * WebCookieManager.cpp: Move CFNetwork-specific routines to + the new WebCookieManagerCFNet.cpp file. + (WebCookieManager::Release): + * WebCookieManagerCFNet.cpp: Copied from WebCookieManager.cpp. + (WebCookieManager::cookieStorage): + * WebCookieManagerCurl.cpp: Added. + (WebCookieManager::cookieStorage): + (WebCookieManager::setCookieStorage): + * WebCoreSupport/WebFrameLoaderClient.cpp: Conditionalize two + methods in this file. + (WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge): + (WebFrameLoaderClient::savePlatformDataToCachedPage): + * WebDownload.cpp: Move CFNetwork-specific logic to the new + WebDownloadCFNet.cpp + (WebDownload::bundleExtension): + (WebDownload::bundleMagicNumber): + (WebDownload::bundlePathForTargetPath): + (WebDownload::extractResumeDataFromBundle): Made static class method + so it could be used in WebDownload.cpp and WebDownloadCFNet.cpp + (WebDownload::appendResumeDataToBundle): Made static class method + so it could be used in WebDownload.cpp and WebDownloadCFNet.cpp + * WebDownload.h: + * WebDownloadCFNet.cpp: Copied from WebDownload.cpp. + (WebDownload::initToResumeWithBundle): + (WebDownload::setDestination): + (didFailCallback): + * WebDownloadCurl.cpp: Added. + (WebDownload::init): + (WebDownload::initWithRequest): + (WebDownload::initToResumeWithBundle): + (WebDownload::start): + (WebDownload::cancel): + (WebDownload::cancelForResume): + (WebDownload::deletesFileUponFailure): + (WebDownload::setDeletesFileUponFailure): + (WebDownload::setDestination): + (WebDownload::cancelAuthenticationChallenge): + (WebDownload::continueWithoutCredentialForAuthenticationChallenge): + (WebDownload::useCredential): + * WebKit.vcproj/WebKit.vcproj: Modify Apple targets to exclude the + new cURL files. Modify Cairo targets to exclude CFNet files. + * WebMutableURLRequest.cpp: Conditionalize the single method + with a CFNetwork-speicic call. + (WebMutableURLRequest::mutableCopy): + * WebURLAuthenticationChallenge.cpp: Conditionalize one line that + causes build problems for cURL. This will be removed later. + (WebURLAuthenticationChallenge::initWithProtectionSpace): + * WebURLAuthenticationChallengeSender.cpp: + * WebURLAuthenticationChallengeSenderCFNet.cpp: Copied from WebURLAuthenticationChallengeSender.cpp. + (WebURLAuthenticationChallengeSender::useCredential): + * WebURLAuthenticationChallengeSenderCurl.cpp: Added. + (WebURLAuthenticationChallengeSender::cancelAuthenticationChallenge): + (WebURLAuthenticationChallengeSender::continueWithoutCredentialForAuthenticationChallenge): + (WebURLAuthenticationChallengeSender::useCredential): + * WebURLResponse.cpp: Exclude WebKitSystemInterface when compiling + for the cURL target. + +2009-01-09 Alexey Proskuryakov <ap@webkit.org> + + Reviewed by Darin Adler. + + Fix many appcache tests on Windows by making synchronous XMLHttpRequest throw on cache miss. + + * WebFrame.cpp: (WebFrame::cannotShowURLError): Implement, so that synchronous XHR can + raise exceptions, as needed for AppCache tests. I do not know why this error was not + implemented. + +2009-01-09 Darin Adler <darin@apple.com> + + Reviewed and landed by Adele Peterson. + + Bug 23160: add setMemoryCacheClientCallsEnabled SPI so Safari can be faster with activity window closed + https://bugs.webkit.org/show_bug.cgi?id=23160 + + * Interfaces/IWebViewPrivate.idl: Added setMemoryCacheDelegateCallsEnabled. + * WebView.cpp: + (WebView::setMemoryCacheDelegateCallsEnabled): Ditto. + * WebView.h: Ditto. + +2009-01-08 Dan Bernstein <mitz@apple.com> + + Reviewed by Adam Roben. + + - WebPreferences changes to support Core Graphics native glyph drawing + + * Interfaces/IWebPreferencesPrivate.idl: Added font smoothing contrast + getter and setter. + * WebPreferenceKeysPrivate.h: Added + WebKitFontSmoothingContrastPreferenceKey. + * WebPreferences.cpp: + (WebPreferences::initializeDefaultSettings): Initialized + WebKitFontSmoothingContrastPreferenceKey to 2. + (WebPreferences::setFloatValue): Added. + (WebPreferences::setFontSmoothing): Changed to map + FontSmoothingTypeWindows to FontSmoothingTypeMedium. + (WebPreferences::fontSmoothingContrast): Added. + (WebPreferences::setFontSmoothingContrast): Added. Calls + wkSetFontSmoothingContrast(). + * WebPreferences.h: + +2009-01-08 Steve Falkenburg <sfalken@apple.com> + + <rdar://problem/6474244> REGRESSION(39561-39603): Heap corruption when saving passwords? + + Reviewed by Adam Roben. + + * WebView.cpp: + (WebViewWndProc): Hold a ref to the WebView inside the WNDPROC, since it could go away in an event handler. + +2009-01-07 Jon Honeycutt <jhoneycutt@apple.com> + + Fix a crash with querying a WebView for its global history item when + its associated Page has no global history item. + + Reviewed by Dan Bernstein. + + * WebView.cpp: + (WebView::globalHistoryItem): If the Page has no global history item, + report 0. + +2009-01-06 Adam Roben <aroben@apple.com> + + Fix Bug 22262: Clicking close ("X") button in docked Web Inspector + clears Web Inspector but doesn't close it + + <https://bugs.webkit.org/show_bug.cgi?id=22262> + <rdar://problem/6371873> + + Reviewed by Darin Adler. + + * WebCoreSupport/WebInspectorClient.cpp: + (WebInspectorClient::WebInspectorClient): Initialize new member. + (WebInspectorClient::showWindow): Moved code from here to + showWindowWithoutNotifications. + (WebInspectorClient::closeWindow): Moved code from here to + closeWindowWithoutNotifications. + + (WebInspectorClient::attachWindow): + (WebInspectorClient::detachWindow): + Record whether or not we should be attached, then close and reopen the + window without notifying the InspectorController. Code that was in + these functions moved to showWindowWithoutNotifications and + closeWindowWithoutNotifications, respectively. + + (WebInspectorClient::closeWindowWithoutNotifications): Added. Code + came from closeWindow and detachWindow. + (WebInspectorClient::showWindowWithoutNotifications): Added. Code came + from showWindow and attachWindow. + + * WebCoreSupport/WebInspectorClient.h: Added + {close,show}WindowWithoutNotifications and m_shouldAttachWhenShown. + +2009-01-06 Anders Carlsson <andersca@apple.com> + + Reviewed by Sam Weinig. + + Add a way for application to provide custom, full frame, views for certain MIME types. + + * Interfaces/IWebEmbeddedView.idl: + Add loading related methods. + + * Interfaces/IWebViewPrivate.idl: + Add new registerEmbeddedViewMIMEType method. + + * WebCoreSupport/EmbeddedWidget.cpp: + (EmbeddedWidget::didReceiveResponse): + (EmbeddedWidget::didReceiveData): + (EmbeddedWidget::didFinishLoading): + (EmbeddedWidget::didFail): + Implement these and call the IEmbeddedView methods. + + * WebCoreSupport/EmbeddedWidget.h: + Inherit from PluginManualLoader. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::redirectDataToPlugin): + Handle the case where the widget is an EnbeddedWidget. + + (WebFrameLoaderClient::shouldUsePluginDocument): + Have this call WebView::shouldUseEmbeddedView. + + * WebView.cpp: + (WebView::canShowMIMEType): + Have this call WebView::shouldUseEmbeddedView. + + (WebView::registerEmbeddedViewMIMEType): + Add the MIME type to the set. + + (WebView::shouldUseEmbeddedView): + Given a MIME type, returns whether an embedded view should be used or not. + +2009-01-06 David Kilzer <ddkilzer@apple.com> + + BUILD FIX (r39641): Try to fix WebIconDatabase build errors #4 + + * WebIconDatabase.cpp: + (WebIconDatabase::isEnabled): Added 'WebIconDatabase::' to method + signature. (Another copy-paste error.) + (WebIconDatabase::setEnabled): Ditto. + * WebIconDatabase.h: + (WebIconDatabase::startUpIconDatabase): Make private again. + (WebIconDatabase::shutDownIconDatabase): Ditto. + +2009-01-06 David Kilzer <ddkilzer@apple.com> + + BUILD FIX (r39641): Try to fix build errors #3 + + Try to fix the following (more specific) build errors: + + WebIconDatabase.cpp + ..\WebIconDatabase.cpp(255) : error C2248: 'WebIconDatabase::shutDownIconDatabase' : cannot access private member declared in class 'WebIconDatabase' + ...\webkit\win\WebIconDatabase.h(61) : see declaration of 'WebIconDatabase::shutDownIconDatabase' + ...\webkit\win\WebIconDatabase.h(51) : see declaration of 'WebIconDatabase' + ..\WebIconDatabase.cpp(255) : error C2352: 'WebIconDatabase::shutDownIconDatabase' : illegal call of non-static member function + ...\webkit\win\WebIconDatabase.h(61) : see declaration of 'WebIconDatabase::shutDownIconDatabase' + ..\WebIconDatabase.cpp(258) : error C2248: 'WebIconDatabase::startUpIconDatabase' : cannot access private member declared in class 'WebIconDatabase' + ...\webkit\win\WebIconDatabase.h(60) : see declaration of 'WebIconDatabase::startUpIconDatabase' + ...\webkit\win\WebIconDatabase.h(51) : see declaration of 'WebIconDatabase' + ..\WebIconDatabase.cpp(258) : error C2352: 'WebIconDatabase::startUpIconDatabase' : illegal call of non-static member function + ...\webkit\win\WebIconDatabase.h(60) : see declaration of 'WebIconDatabase::startUpIconDatabase' + + * WebIconDatabase.cpp: + (setEnabled): Get instance of shared WebIconDatabase, then call + startUp/shutDown methods on it. + * WebIconDatabase.h: + (WebIconDatabase::startUpIconDatabase): Make protected again. + (WebIconDatabase::shutDownIconDatabase): Ditto. + +2009-01-06 David Kilzer <ddkilzer@apple.com> + + BUILD FIX (r39641): Try to fix build errors again + + Try to fix the following build errors: + + WebIconDatabase.cpp + ..\WebIconDatabase.cpp(255) : error C3861: 'shutDownIconDatabase': identifier not found + ..\WebIconDatabase.cpp(258) : error C3861: 'startUpIconDatabase': identifier not found + + * WebIconDatabase.cpp: + (setEnabled): Add class prefix to startUpIconDatabase() and + shutDownIconDatabase(). + * WebIconDatabase.h: + (WebIconDatabase::startUpIconDatabase): Make private again. + (WebIconDatabase::shutDownIconDatabase): Ditto. + +2009-01-06 David Kilzer <ddkilzer@apple.com> + + BUILD FIX (r39641): Try to fix build error + + Try to fix the following build errors: + + WebIconDatabase.cpp + ..\WebIconDatabase.cpp(255) : error C3861: 'shutDownIconDatabase': identifier not found + ..\WebIconDatabase.cpp(258) : error C3861: 'startUpIconDatabase': identifier not found + + * WebIconDatabase.h: + (WebIconDatabase::startUpIconDatabase): Make protected. + (WebIconDatabase::shutDownIconDatabase): Ditto. + +2009-01-06 David Kilzer <ddkilzer@apple.com> + + BUILD FIX (r39641): Fix more silly errors + + Fixes the following compilation errors: + + WebIconDatabase.cpp + ..\WebIconDatabase.cpp(85) : error C2065: 'standardPrefs' : undeclared identifier + ..\WebIconDatabase.cpp(85) : error C2227: left of '->iconDatabaseLocation' must point to class/struct/union/generic type + type is ''unknown-type'' + ..\WebIconDatabase.cpp(241) : error C2575: 'isEnabled' : only member functions and bases can be virtual + ..\WebIconDatabase.cpp(248) : error C2575: 'setEnabled' : only member functions and bases can be virtual + ..\WebIconDatabase.cpp(253) : error C3861: 'shutDownIconDatabase': identifier not found + ..\WebIconDatabase.cpp(256) : error C3861: 'startUpIconDatabase': identifier not found + + * WebIconDatabase.cpp: + (WebIconDatabase::startUpIconDatabase): Redeclare standardPrefs + since this was in init() but not in this method after it was + extracted from init(). + (isEnabled): Don't use "virtual" in method implementation + (silly copy-paste error). + (setEnabled): Ditto. + +2009-01-06 David Kilzer <ddkilzer@apple.com> + + BUILD FIX (r39641): Remove STDMETHODCALLTYPE from method declarations in IWebIconDatabase.idl + + * Interfaces/IWebIconDatabase.idl: Removed "STDMETHODCALLTYPE" + from silly copy-paste error in two method declarations. + +2009-01-05 David Kilzer <ddkilzer@apple.com> + + Add API to enable, disable and check state of WebIconDatabase + + Reviewed by Darin Adler & Timothy Hatcher. + + Add WebIconDatabase::isEnabled() and WebIconDatabase::setEnabled() + API to make it possible to enable, disable and check the state of + the icon database. + + * Interfaces/IWebIconDatabase.idl: Declared isEnabled() and + setEnabled() methods. + * WebIconDatabase.cpp: + (WebIconDatabase::init): Extracted code into startUpIconDatabase(). + (WebIconDatabase::startUpIconDatabase): Added. Extracted from + init(). + (WebIconDatabase::shutDownIconDatabase): Added. Method is empty + since there is nothing to do yet on Windows. + (isEnabled): Added. + (setEnabled): Added. + * WebIconDatabase.h: Added method declarations. + +2009-01-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Jon Honeycutt. + + Pass more information in the property bag passed to embeddedViewWithArguments. + + * Interfaces/IWebUIDelegatePrivate.idl: + Declare new keys. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::createPlugin): + Pass the base URL, MIME type and the containing element to embeddedViewWithArguments. + +2009-01-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Darin Adler, Jon Honeycutt. + + Add a templatized COMVariant constructor so we can make COMVariants out of + everything that has a COMVariantSetter specialization. + + Add a COMVariantSetter specialization for COMVariant. + + * COMVariantSetter.h: + (COMVariant::COMVariant): + +2009-01-05 Brent Fulgham <bfulgham@gmail.com> + + Reviewed by Oliver Hunt. + + Fixes: https://bugs.webkit.org/show_bug.cgi?id=23027 + + Removes the WebKitGraphics files from the Cairo build, as well + as excluding their link definitions. These are not used outside + of Safari, and should not be part of the 'Redistributable API.' + + * WebKit.vcproj/WebKit.vcproj: Update *_Cairo targets to exclude + the WebKitGraphics.cpp/.h files. + * WebKit.vcproj/WebKit_Cairo.def: Added. File without Safari + link definitions. + * WebKit.vcproj/WebKit_Cairo_debug.def: Added. File without Safari + link definitions. + +2009-01-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Jon Honeycutt. + + Add a simple, memory managed, wrapper around a VARIANT struuct. + + * COMVariantSetter.h: + (COMVariant::COMVariant): + (COMVariant::~COMVariant): + (COMVariant::operator=): + (COMVariant::copyTo): + (COMVariant::variantType): + +2009-01-05 Adele Peterson <adele@apple.com> + + Windows build fix. + + * WebCoreSupport/WebChromeClient.cpp: + +2009-01-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Adam Roben. + + Make it possible to have per value variant types. + + * COMPropertyBag.h: + (::Read): + Call variantType here, passing in the value. + + (::GetPropertyInfo): + Ditto. + + * COMVariantSetter.h: + (COMVariantSetterBase::variantType): + Add COMVariantSetterBase, whose variantType implementation just returns the + VariantType variable. Make all existing classes inherit from COMVariantSetterBase. + +2009-01-05 Adam Treat <adam.treat@torchmobile.com> + + Fix win build + + * WebCoreSupport/WebChromeClient.h: + +2009-01-05 Adam Treat <adam.treat@torchmobile.com> + + Reviewed by George Staikos. + + Build fix for contentsSizeChanged + + * WebCoreSupport/WebChromeClient.cpp: + (WebChromeClient::contentsSizeChanged): + * WebCoreSupport/WebChromeClient.h: + +2009-01-05 Anders Carlsson <andersca@apple.com> + + Reviewed by Kevin Decker. + + Use the ManualLoader class instead of assuming that the manual loader + is a plug-in view. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::WebFrameLoaderClient): + (WebFrameLoaderClient::setMainDocumentError): + (WebFrameLoaderClient::committedLoad): + (WebFrameLoaderClient::finishedLoading): + (WebFrameLoaderClient::redirectDataToPlugin): + * WebCoreSupport/WebFrameLoaderClient.h: + +2009-01-04 Adam Treat <adam.treat@torchmobile.com> + + Reviewed by George Staikos. + + Make the apple windows port build with the new fixedLayoutSize feature + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::transitionToCommittedForNewPage): + +2008-12-20 Dan Bernstein <mitz@apple.com> + + Reviewed by Ada Chan. + + - expose the new allItems() method via a new IWebHistoryPrivate + interface + + * Interfaces/IWebHistoryPrivate.idl: Added. + * Interfaces/WebKit.idl: Added IWebHistoryPrivate.idl. + * WebHistory.cpp: + (WebHistory::QueryInterface): Added IWebHistoryPrivate. + (WebHistory::allItems): + * WebHistory.h: + +2008-12-19 Geoffrey Garen <ggaren@apple.com> + + Build fix. + + * WebHistory.cpp: + (WebHistory::allItems): + +2008-12-19 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Darin Adler, Adele Peterson, Brady Eidson. + + Added SPI for getting an unsorted vector of all items in history. + + * WebHistory.cpp: + (WebHistory::orderedItemsLastVisitedOnDay): + (WebHistory::allItems): + * WebHistory.h: + +2008-12-18 Dan Bernstein <mitz@apple.com> + + Reviewed by Sam Weinig. + + - implement FrameLoaderClient::shouldUseCredentialStorage() by calling + a new resource load delegae method. + + * Interfaces/IWebResourceLoadDelegatePrivate.idl: Added + a ne interface, IWebResourceLoadDelegatePrivate2, including a new + method, shouldUseCredentialStorage(). + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::shouldUseCredentialStorage): Added. Calls the + delegate method. If the method is unimplemented, returns true for + backwards compatibility. + * WebCoreSupport/WebFrameLoaderClient.h: + +2008-12-18 Sam Weinig <sam@webkit.org> + + Reviewed by John Sullivan. + + Implement FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout() by calling + a new private frame load delegate method. + + * Interfaces/IWebFrameLoadDelegatePrivate.idl: + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout): + * WebCoreSupport/WebFrameLoaderClient.h: + +2008-12-16 Steve Falkenburg <sfalken@apple.com> + + Windows build fix. + + Reviewed by Stephanie Lewis. + + * COMPropertyBag.h: + (::createInstance): + (::adopt): + (::QueryInterface): + (::AddRef): + (::Release): + (::Read): + (::Write): + (::CountProperties): + (::GetPropertyInfo): + (::LoadObject): + * WebURLResponse.cpp: + (WebURLResponse::allHeaderFields): + +2008-12-16 Stephanie Lewis <slewis@apple.com> + + Another Windows Build Fix. + + * WebURLResponse.cpp: + (WebURLResponse::allHeaderFields): + +2008-12-14 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + - Windows equivalent of <rdar://problem/3258561> + WebHistoryAllItemsRemovedNotification should add items to userInfo + + * WebHistory.cpp: + (WebHistory::removeAllItems): Changed to create an array of all items + and send it in the notification. + +2008-12-12 Brent Fulgham <bfulgham@gmail.com> + + Reviewed by Oliver Hunt. + + Fixes: https://bugs.webkit.org/show_bug.cgi?id=22805 + + Provides implementation of image drag for Windows Cairo back-end. + Switch to generic PlatformGraphicsContext data type, rather than + specific use of CoreGraphics types. + + * WebCoreSupport/WebDragClient.cpp: + (WebDragClient::createDragImageForLink): Revise calls to use more + generic PlatformGraphicsContext data types and calls for better + portability. + +2008-12-12 Steve Falkenburg <sfalken@apple.com> + + Update Windows cache sizes to match recent Mac change. + + Reviewed by Stephanie Lewis, Sam Weinig. + + * WebView.cpp: + (WebView::setCacheModel): + +2008-12-12 Tor Arne Vestbø <tavestbo@trolltech.com> + + Rubber-stamped by Oliver Hunt. + + Remove mutables from EmbeddedWidget + + We can do this now that frameRectsChanged() is no longer const + + * WebCoreSupport/EmbeddedWidget.h: + +2008-12-11 Cameron Zwarich <zwarich@apple.com> + + Rubber-stamped by Mark Rowe. + + Roll out r39212 due to assertion failures during layout tests, multiple + layout test failures, memory leaks, and obvious incorrectness. + + * Interfaces/IWebPreferencesPrivate.idl: + * WebPreferenceKeysPrivate.h: + * WebPreferences.cpp: + * WebPreferences.h: + +2008-12-10 Glenn Wilson <gwilson@google.com> + + Reviewed by Adam Roben. + + Added support for overriding default preferences per-test. + https://bugs.webkit.org/show_bug.cgi?id=20534 + Two new methods were added: resetToDefaults and overridePreference. + + * Interfaces/IWebPreferencesPrivate.idl: new method signatures + * WebPreferenceKeysPrivate.h: added new key for internal state + * WebPreferences.cpp: added new methods + (WebPreferences::overridePreference): new method + (WebPreferences::resetToDefaults): new method + * WebPreferences.h: new method signatures + +2008-12-08 Tor Arne Vestbø <tavestbo@trolltech.com> + + Reviewed by Darin Adler and Holger Freyther. + + Make Widget::frameRectsChanged() and overrides non-const + + This will hopefully allow us to get rid of some of the mutables in + the classes that react to the callback by changing their own state. + + * WebCoreSupport/EmbeddedWidget.cpp: + (EmbeddedWidget::frameRectsChanged): + * WebCoreSupport/EmbeddedWidget.h: + +2008-12-09 Brett Wilson <brettw@chromium.org> + + Reviewed by Dave Hyatt. + + https://bugs.webkit.org/show_bug.cgi?id=22177 + + Add a callback on ChromeClient that the state of form elements on + the page has changed. This is to allow clients implementing session + saving to know when the current state is dirty. + + * WebCoreSupport/WebChromeClient.h: + (WebChromeClient::formStateDidChange): + +ks2008-12-08 Dan Bernstein <mitz@apple.com> + + Reviewed by Adam Roben. + + - Fix nightly builds + + * Interfaces/IWebViewPrivate.idl: Moved globalHistoryItem() to the end, + so that it comes after all methods used by Safari 3.2.1. + +2008-12-08 Dan Bernstein <mitz@apple.com> + + Reviewed by John Sullivan. + + - WebKit/win part of tracking the global history item for a WebView + + * Interfaces/IWebViewPrivate.idl: Declared globalHistoryItem() + * WebView.cpp: + (WebView::globalHistoryItem): Added. Gets the page's global history + item. + * WebView.h: + +2008-12-06 Simon Fraser <simon.fraser@apple.com> + + Reviewed by Dave Hyatt + + https://bugs.webkit.org/show_bug.cgi?id=15671 + + Renderer::caretRect() is now localCaretRect(), which needs + converting to absolute coordinates (taking transforms into account). + + * WebView.cpp: + (WebView::handleContextMenuEvent): + +2008-12-05 Darin Adler <darin@apple.com> + + Reviewed by Alexey Proskuryakov. + + - fix https://bugs.webkit.org/show_bug.cgi?id=22674 + Webkit r39005 does not start, an entry point not found + + * WebView.cpp: + (findCFNetworkModule): Added. + (findCopySharedURLCacheFunction): Added. + (WebView::setCacheModel): Call CFURLCacheCopySharedURLCache via dynamic loading + instead of compiling based on which version of CFNetwork headers are present. + +2008-12-04 Steve Falkenburg <sfalken@apple.com> + + Implement IPropertyBag2::Read. + Fill in dwType for IPropertyBag2::GetPropertyInfo (we always use PROPBAG2_TYPE_DATA). + https://bugs.webkit.org/show_bug.cgi?id=22659 + + This fixes <rdar://problem/6419127> REGRESSION: Forms autocomplete is broken for "other forms" + + Reviewed by Ada Chan, Alice Liu. + + * COMPropertyBag.h: + (::Read): Implemented. + (::GetPropertyInfo): Set dwType to PROPBAG2_TYPE_DATA. + +2008-12-02 Adam Roben <aroben@apple.com> + + Export new-ish JSCore convenience constructor functions + + Reviewed by Jon Honeycutt. + + * WebKit.vcproj/WebKit.def: + * WebKit.vcproj/WebKit_debug.def: + Export JSObjectMakeArray, JSObjectMakeDate, and JSObjectMakeRegExp. + Remove duplicate export of JSObjectMakeFunction. + +2008-12-02 Michael Moss <mmoss@chromium.org> + + Reviewed by Eric Seidel. + + - Fix http/tests/navigation/reload-subframe-*frame.html on Windows. + https://bugs.webkit.org/show_bug.cgi?id=20926 + + Change 31264 fixed this on Mac (since moved to WebCore/loader/FrameLoader.cpp), but was never ported to Windows. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::loadURLIntoChild): + +2008-12-01 Steve Falkenburg <sfalken@apple.com> + + Implement renderedImage for Windows. + https://bugs.webkit.org/show_bug.cgi?25648 + + Reviewed by Adam Roben. + + * DOMCoreClasses.cpp: + (DOMElement::renderedImage): + * DOMCoreClasses.h: + * Interfaces/DOMPrivate.idl: + +2008-12-01 Eric Seidel <eric@webkit.org> + + Reviewed by Adam Roben. + + NULL-check documentFrameView() and topDocumentFrameView() it's possible + for either of these methods to return NULL, and this was seen to cause + crashes in Chromium. + https://bugs.webkit.org/show_bug.cgi?id=22572 + + * AccessibleBase.cpp: + (AccessibleBase::get_accParent): + (AccessibleBase::accLocation): + (AccessibleBase::accHitTest): + +2008-11-30 Antti Koivisto <antti@apple.com> + + Another Windows build fix. + + * WebCoreStatistics.cpp: + (WebCoreStatistics::javaScriptObjectsCount): + +2008-11-30 Antti Koivisto <antti@apple.com> + + Windows build fix. + + * WebJavaScriptCollector.cpp: + (WebJavaScriptCollector::objectCount): + +2008-11-29 Brent Fulgham <bfulgham@gmail.com> + + Reviewed by Alexey Proskuryakov. + + Remove Visual Studio project dependencies on non-redistributable + components in the Debug_Cairo and Release_Cairo build targets. + See https://bugs.webkit.org/show_bug.cgi?id=22527 + + * WebKit.vcproj/WebKit.vcproj: + * WebKit.vcproj/WebKit.sln: Instruct Cairo builds to not bother + building the unused QuickTime support library. + +2008-11-24 Glenn Wilson <gwilson@chromium.org> + + Reviewed by Alexey Proskuryakov. + + http://bugs.webkit.org/show_bug.cgi?id=15643 + + Added API support for the "trailing whitespace" work-around. This includes an APIs + to get and set the state of this configuration variable. + + * Interfaces/IWebView.idl: + * WebCoreSupport/WebEditorClient.cpp: + (WebEditorClient::selectTrailingWhitespaceEnabled): + * WebCoreSupport/WebEditorClient.h: + * WebView.cpp: + (WebView::WebView): + (WebView::setSelectTrailingWhitespaceEnabled): + (WebView::selectTrailingWhitespaceEnabled): + * WebView.h: + +2008-11-24 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + - https://bugs.webkit.org/show_bug.cgi?id=22470 + remove unneeded URL argument from FrameLoaderClient::updateGlobalHistory + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::updateGlobalHistory): Get the URL from the + DocumentLoader, just as we do the title and the failure flag. + * WebCoreSupport/WebFrameLoaderClient.h: Remove argument. + +2008-11-24 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + - finish https://bugs.webkit.org/show_bug.cgi?id=22295 + track which history items are from page load failures + + Last time around I did this only for the back/forward list and missed the + global history list. + + * Interfaces/IWebHistoryItemPrivate.idl: Added setLastVisitWasFailure. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::updateGlobalHistory): Added code to check for failure + and pass the argument in to WebHistory. + + * WebHistory.cpp: (WebHistory::addItem): Added wasFailure argument. + Set the flag on the newly created history item. + * WebHistory.h: Ditto. + + * WebHistoryItem.cpp: + (WebHistoryItem::setLastVisitWasFailure): Added. + * WebHistoryItem.h: Ditto. + +2008-11-24 Simon Fraser <simon.fraser@apple.com> + + Fix call to Frame::selectionBounds in Windows build. + + * WebView.cpp: + (WebView::selectionRect): + +2008-11-21 Dimitri Glazkov <dglazkov@chromium.org> + + Reviewed by Alexey Proskuryakov. + + Debug WebKit crashes on launch because of threading not being initialized early enough. + + * WebKitClassFactory.cpp: (WebKitClassFactory::WebKitClassFactory): + Call JSC::InitializeThreading(). + +2008-11-19 Darin Fisher <darin@chromium.org> + + Reviewed by Geoff Garen. + + https://bugs.webkit.org/show_bug.cgi?id=22345 + Define ScriptValue as a thin container for a JSC::Value*. + + * WebView.cpp: + (WebView::stringByEvaluatingJavaScriptFromString): + +2008-11-19 Adele Peterson <adele@apple.com> + + Reviewed by Darin Adler. + + For transparent views, clear the dirty rect instead of painting it white. + + * WebView.cpp: (WebView::paintIntoBackingStore): + +2008-11-18 Adele Peterson <adele@apple.com> + + Reverting last change. I just realized it causes the view to never get cleared out. + + * WebView.cpp: (WebView::paintIntoBackingStore): + +2008-11-18 Adele Peterson <adele@apple.com> + + Reviewed by John Sullivan. + + Don't fill the view with white if its transparent. + + * WebView.cpp: (WebView::paintIntoBackingStore): + +2008-11-18 Holger Hans Peter Freyther <zecke@selfish.org> + + Try to fix the Windows build. It is view and not webView. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::transitionToCommittedForNewPage): + +2008-11-18 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Simon Hausmann. + + Attempt to share transitionToCommittedForNewPage of FrameLoaderClient with the different ports + + After Hyatt's work on Widget and ScrollView there is little difference + between the implementation of Qt, Gtk+ and Win. In fact any kind of + difference is mostly a bug. Alp has fixed two of such errors for the Gtk+ + port and the Qt port has at least one of them left. + + The only difference between the implementations is in getting the the + IntSize for the new FrameView, the background color to be applied and + eventually some post processing. + + Unify the implementations by providing a static helper function that + takes a Frame, IntSize, color and transparency bit and calling it from + the Gtk+, the Qt and the Windows port. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::transitionToCommittedForNewPage): + +2008-11-18 Holger Hans Peter Freyther <zecke@selfish.org> + + Reviewed by Simon Hausmann. + + https://bugs.webkit.org/show_bug.cgi?id=22056 + + Move setting the background color and transparency from WebKit/win + to WebCore. This allows WebKit/win, WebKit/Qt and WebKit/Gtk+ + to share this code. + + * WebFrame.cpp: + (WebFrame::updateBackground): + +2008-11-16 Geoffrey Garen <ggaren@apple.com> + + Not reviewed. + + Try to fix Windows build. + + * WebCoreSupport/WebFrameLoaderClient.cpp: + +2008-11-16 Darin Adler <darin@apple.com> + + Reviewed by Dan Bernstein. + + - https://bugs.webkit.org/show_bug.cgi?id=22295 + track which history items are from page load failures + + * Interfaces/IWebHistoryItemPrivate.idl: Added lastVisitWasFailure function. + + * WebHistoryItem.cpp: + (WebHistoryItem::initFromDictionaryRepresentation): Set the lastVisitWasFailure + flag in the history item if the dictionary had an entry for lastVisitWasFailureKey. + (WebHistoryItem::dictionaryRepresentation): Set the lastVisitWasFailureKey key + in the dictionary if the history item had the lastVisitWasFailure flag. + (WebHistoryItem::lastVisitWasFailure): Added. + + * WebHistoryItem.h: Added lastVisitWasFailure function. + +2008-11-15 Geoffrey Garen <ggaren@apple.com> + + Reviewed by Sam Weinig. + + Updated for JavaScriptCore renames. + + * WebScriptCallFrame.cpp: + (WebScriptCallFrame::valueByEvaluatingJavaScriptFromString): + +2008-11-14 Dan Bernstein <mitz@apple.com> + + - try to fix the Windows build + + * WebCoreLocalizedStrings.cpp: + (WebCore::contextMenuItemTagTextDirectionMenu): Added. + +2008-11-13 Adam Roben <aroben@apple.com> + + Fix Bug 22244: Webkit nightly builds crash with Safari 3.2 + + <https://bugs.webkit.org/show_bug.cgi?id=22244> + + r36652 added IWebViewPrivate::clearMainFrameName into the middle of + the IWebViewPrivate interface, which modifies the part of the + IWebViewPrivate vtable that Safari 3.2 relies on. + + Reviewed by Dan Bernstein. + + * Interfaces/IWebViewPrivate.idl: Move clearMainFrameName to the end + of the interface. + +2008-11-11 Dan Bernstein <mitz@apple.com> + + Reviewed by Adam Roben. + + WebKit/win part of adding a master volume control for media elements in a WebView + * Interfaces/IWebViewPrivate.idl: Added setMediaVolume() and + mediaVolume(). + * WebView.cpp: + (WebView::setMediaVolume): Added. + (WebView::mediaVolume): Added. + * WebView.h: + +2008-11-10 Adam Roben <aroben@apple.com> + + Fix Bug 22158: Would like to turn on WebCore logging channels via an + environment variable + + <https://bugs.webkit.org/show_bug.cgi?id=22158> + + Reviewed by Anders Carlsson. + + * WebView.cpp: + (WebView::initWithFrame): Call WebCore's + InitializeLoggingChannelsIfNecessary. + +2008-11-08 Dan Bernstein <mitz@apple.com> + + Reviewed by Darin Adler. + + - WebKit/win part of adding WebPreferences for controlling databases and local storage + + * Interfaces/IWebPreferencesPrivate.idl: Declared setDatabasesEnabled, + databasesEnabled, setLocalStorageEnabled and localStorageEnabled. + * WebPreferenceKeysPrivate.h: Added WebKitDatabasesEnabledPreferenceKey + and WebKitLocalStorageEnabledPreferenceKey. + * WebPreferences.cpp: + (WebPreferences::initializeDefaultSettings): Made databases and local + storage enabled by default. + (WebPreferences::setDatabasesEnabled): Added. + (WebPreferences::databasesEnabled): Added. + (WebPreferences::setLocalStorageEnabled): Added. + (WebPreferences::localStorageEnabled): Added. + * WebPreferences.h: + * WebView.cpp: + (WebView::notifyPreferencesChanged): Transfer the databases and local + storage preferences to WebCore settings. + +2008-11-06 John Sullivan <sullivan@apple.com> + + Eliminated one of the two booleans tracking whether zoom was text-only, to avoid future problems. + + Reviewed by Adam Roben + + * WebView.h: + removed m_zoomMultiplierIsTextOnly + + * WebView.cpp: + (WebView::WebView): + removed initialization of m_zoomMultiplierIsTextOnly + (WebView::setZoomMultiplier): + use m_page->settings()->setZoomsTextOnly() instead of setting m_zoomMultiplierIsTextOnly + (WebView::zoomMultiplier): + use m_page->settings()->zoomsTextOnly() instead of reading m_zoomMultiplierIsTextOnly + +2008-11-06 Adele Peterson <adele@apple.com> + + Reviewed by Adam Roben. + + Add support for a WebKitZoomsTextOnly preference. + + * Interfaces/IWebPreferences.idl: + * WebPreferenceKeysPrivate.h: + * WebPreferences.cpp: + (WebPreferences::setZoomsTextOnly): + (WebPreferences::zoomsTextOnly): + * WebPreferences.h: + + * WebView.cpp: + (WebView::canMakeTextLarger): Consider the zoomsTextOnly setting when computing this. + (WebView::makeTextLarger): ditto. + (WebView::canMakeTextSmaller): ditto. + (WebView::makeTextSmaller): ditto. + (WebView::canMakeTextStandardSize): + Don't consider the setting in this case since we need to reset both text zoom and page zoom regardless of the setting. + (WebView::makeTextStandardSize): + (WebView::notifyPreferencesChanged): Set the WebCore settings to match the WebPreference for WebKitZoomsTextOnly. + +2008-11-05 Dan Bernstein <mitz@apple.com> + + Reviewed by John Sullivan. + + - make the {protocol,proxyType} argument of + WebURLProtectionSpace::initWith{Proxy}Host actually work and fix + assertion failures. + + * WebURLProtectionSpace.cpp: + (WebURLProtectionSpace::initWithHost): The BString comparisons were + applying the BString==BSTR operator to a right hand side that was + actually a WCHAR string. Fixed by using BStrings on both sides. + (WebURLProtectionSpace::initWithProxyHost): Ditto. + 2008-11-01 Alexey Proskuryakov <ap@webkit.org> Reviewed by Darin Adler. diff --git a/WebKit/win/DOMCoreClasses.cpp b/WebKit/win/DOMCoreClasses.cpp index 713a369..2da3e28 100644 --- a/WebKit/win/DOMCoreClasses.cpp +++ b/WebKit/win/DOMCoreClasses.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -38,6 +38,7 @@ #include <WebCore/DOMWindow.h> #include <WebCore/Document.h> #include <WebCore/Element.h> +#include <WebCore/Frame.h> #include <WebCore/SimpleFontData.h> #include <WebCore/HTMLFormElement.h> #include <WebCore/HTMLInputElement.h> @@ -53,8 +54,19 @@ // {3B0C0EFF-478B-4b0b-8290-D2321E08E23E} DEFINE_GUID(IID_DOMElement, 0x3b0c0eff, 0x478b, 0x4b0b, 0x82, 0x90, 0xd2, 0x32, 0x1e, 0x8, 0xe2, 0x3e); -using namespace WebCore; -using namespace HTMLNames; +// Our normal style is just to say "using namespace WebCore" rather than having +// individual using directives for each type from that namespace. But +// "DOMObject" exists both in the WebCore namespace and unnamespaced in this +// file, which leads to ambiguities if we say "using namespace WebCore". +using namespace WebCore::HTMLNames; +using WebCore::AtomicString; +using WebCore::BString; +using WebCore::Element; +using WebCore::ExceptionCode; +using WebCore::FontDescription; +using WebCore::Frame; +using WebCore::IntRect; +using WebCore::String; // DOMObject - IUnknown ------------------------------------------------------- @@ -128,7 +140,7 @@ HRESULT STDMETHODCALLTYPE DOMNode::parentNode( if (!m_node || !m_node->parentNode()) return E_FAIL; *result = DOMNode::createInstance(m_node->parentNode()); - return S_OK; + return *result ? S_OK : E_FAIL; } HRESULT STDMETHODCALLTYPE DOMNode::childNodes( @@ -182,7 +194,7 @@ HRESULT STDMETHODCALLTYPE DOMNode::ownerDocument( if (!m_node) return E_FAIL; *result = DOMDocument::createInstance(m_node->ownerDocument()); - return S_OK; + return *result ? S_OK : E_FAIL; } HRESULT STDMETHODCALLTYPE DOMNode::insertBefore( @@ -464,9 +476,7 @@ HRESULT STDMETHODCALLTYPE DOMNodeList::item( return E_FAIL; *result = DOMNode::createInstance(itemNode); - if (!(*result)) - return E_FAIL; - return S_OK; + return *result ? S_OK : E_FAIL; } HRESULT STDMETHODCALLTYPE DOMNodeList::length( @@ -547,7 +557,7 @@ HRESULT STDMETHODCALLTYPE DOMDocument::documentElement( /* [retval][out] */ IDOMElement** result) { *result = DOMElement::createInstance(m_document->documentElement()); - return S_OK; + return *result ? S_OK : E_FAIL; } HRESULT STDMETHODCALLTYPE DOMDocument::createElement( @@ -560,9 +570,7 @@ HRESULT STDMETHODCALLTYPE DOMDocument::createElement( String tagNameString(tagName); ExceptionCode ec; *result = DOMElement::createInstance(m_document->createElement(tagNameString, ec).get()); - if (!(*result)) - return E_FAIL; - return S_OK; + return *result ? S_OK : E_FAIL; } HRESULT STDMETHODCALLTYPE DOMDocument::createDocumentFragment( @@ -630,9 +638,7 @@ HRESULT STDMETHODCALLTYPE DOMDocument::getElementsByTagName( String tagNameString(tagName); *result = DOMNodeList::createInstance(m_document->getElementsByTagName(tagNameString).get()); - if (!(*result)) - return E_FAIL; - return S_OK; + return *result ? S_OK : E_FAIL; } HRESULT STDMETHODCALLTYPE DOMDocument::importNode( @@ -673,9 +679,7 @@ HRESULT STDMETHODCALLTYPE DOMDocument::getElementsByTagNameNS( String namespaceURIString(namespaceURI); String localNameString(localName); *result = DOMNodeList::createInstance(m_document->getElementsByTagNameNS(namespaceURIString, localNameString).get()); - if (!(*result)) - return E_FAIL; - return S_OK; + return *result ? S_OK : E_FAIL; } HRESULT STDMETHODCALLTYPE DOMDocument::getElementById( @@ -687,9 +691,7 @@ HRESULT STDMETHODCALLTYPE DOMDocument::getElementById( String idString(elementId); *result = DOMElement::createInstance(m_document->getElementById(idString)); - if (!(*result)) - return E_FAIL; - return S_OK; + return *result ? S_OK : E_FAIL; } // DOMDocument - IDOMViewCSS -------------------------------------------------- @@ -715,7 +717,7 @@ HRESULT STDMETHODCALLTYPE DOMDocument::getComputedStyle( return E_FAIL; *result = DOMCSSStyleDeclaration::createInstance(dv->getComputedStyle(element, pseudoEltString.impl()).get()); - return S_OK; + return *result ? S_OK : E_FAIL; } // DOMDocument - IDOMDocumentEvent -------------------------------------------- @@ -727,7 +729,7 @@ HRESULT STDMETHODCALLTYPE DOMDocument::createEvent( String eventTypeString(eventType, SysStringLen(eventType)); WebCore::ExceptionCode ec = 0; *result = DOMEvent::createInstance(m_document->createEvent(eventTypeString, ec)); - return S_OK; + return *result ? S_OK : E_FAIL; } // DOMDocument - DOMDocument -------------------------------------------------- @@ -1061,12 +1063,33 @@ HRESULT STDMETHODCALLTYPE DOMElement::font(WebFontDescription* webFontDescriptio webFontDescription->family = family.characters(); webFontDescription->familyLength = family.length(); webFontDescription->size = fontDescription.computedSize(); - webFontDescription->bold = fontDescription.weight() >= FontWeight600; + webFontDescription->bold = fontDescription.weight() >= WebCore::FontWeight600; webFontDescription->italic = fontDescription.italic(); return S_OK; } +HRESULT STDMETHODCALLTYPE DOMElement::renderedImage(HBITMAP* image) +{ + if (!image) { + ASSERT_NOT_REACHED(); + return E_POINTER; + } + *image = 0; + + ASSERT(m_element); + + Frame* frame = m_element->document()->frame(); + if (!frame) + return E_FAIL; + + *image = frame->nodeImage(m_element); + if (!*image) + return E_FAIL; + + return S_OK; +} + // IDOMElementCSSInlineStyle -------------------------------------------------- HRESULT STDMETHODCALLTYPE DOMElement::style( @@ -1082,7 +1105,7 @@ HRESULT STDMETHODCALLTYPE DOMElement::style( return E_FAIL; *result = DOMCSSStyleDeclaration::createInstance(style); - return S_OK; + return *result ? S_OK : E_FAIL; } // IDOMElementExtensions ------------------------------------------------------ diff --git a/WebKit/win/DOMCoreClasses.h b/WebKit/win/DOMCoreClasses.h index 1278c7c..3941d13 100644 --- a/WebKit/win/DOMCoreClasses.h +++ b/WebKit/win/DOMCoreClasses.h @@ -777,6 +777,9 @@ public: virtual HRESULT STDMETHODCALLTYPE font( WebFontDescription* webFontDescription); + virtual HRESULT STDMETHODCALLTYPE renderedImage( + /* [retval][out] */ HBITMAP* image); + // IDOMElementCSSInlineStyle virtual HRESULT STDMETHODCALLTYPE style( /* [retval][out] */ IDOMCSSStyleDeclaration **result); diff --git a/WebKit/win/Interfaces/DOMPrivate.idl b/WebKit/win/Interfaces/DOMPrivate.idl index dcacac2..7210943 100644 --- a/WebKit/win/Interfaces/DOMPrivate.idl +++ b/WebKit/win/Interfaces/DOMPrivate.idl @@ -46,6 +46,7 @@ interface IDOMElementPrivate : IUnknown HRESULT isFocused([out, retval] BOOL* result); HRESULT innerText([out, retval] BSTR* result); [local] HRESULT font(WebFontDescription* webFontDescription); + HRESULT renderedImage([out, retval] HBITMAP* image); } /* diff --git a/WebKit/win/Interfaces/IWebEmbeddedView.idl b/WebKit/win/Interfaces/IWebEmbeddedView.idl index 0a65ff7..bcca2fd 100644 --- a/WebKit/win/Interfaces/IWebEmbeddedView.idl +++ b/WebKit/win/Interfaces/IWebEmbeddedView.idl @@ -38,4 +38,9 @@ import "ocidl.idl"; interface IWebEmbeddedView : IUnknown
{
HRESULT createViewWindow([in] OLE_HANDLE parentWindow, [in] LPSIZE pluginSize, [out, retval] OLE_HANDLE* window);
+
+ HRESULT didReceiveResponse([in] IWebURLResponse* response); + HRESULT didReceiveData([in] IStream* data); + HRESULT didFinishLoading(); + HRESULT didFail([in] IWebError* error);
}
diff --git a/WebKit/win/Interfaces/IWebFrameLoadDelegatePrivate.idl b/WebKit/win/Interfaces/IWebFrameLoadDelegatePrivate.idl index 79707a3..5ae91dd 100644 --- a/WebKit/win/Interfaces/IWebFrameLoadDelegatePrivate.idl +++ b/WebKit/win/Interfaces/IWebFrameLoadDelegatePrivate.idl @@ -51,3 +51,14 @@ interface IWebFrameLoadDelegatePrivate : IUnknown //- (void)webView:(WebView *)sender didHandleOnloadEventsForFrame:(WebFrame *)frame; HRESULT didHandleOnloadEventsForFrame([in] IWebView* sender, [in] IWebFrame* frame); } + +[ + object, + oleautomation, + uuid(5566CB49-6E87-4075-80CE-9BAC374C52DE), + pointer_default(unique) +] +interface IWebFrameLoadDelegatePrivate2 : IWebFrameLoadDelegatePrivate +{ + HRESULT didFirstVisuallyNonEmptyLayoutInFrame([in] IWebView* sender, [in] IWebFrame* frame); +} diff --git a/WebKit/win/Interfaces/IWebFramePrivate.idl b/WebKit/win/Interfaces/IWebFramePrivate.idl index bd7c0b6..d1f6cbf 100755 --- a/WebKit/win/Interfaces/IWebFramePrivate.idl +++ b/WebKit/win/Interfaces/IWebFramePrivate.idl @@ -41,7 +41,7 @@ typedef enum { WebFrameLoadTypeReload, WebFrameLoadTypeReloadAllowingStaleData, WebFrameLoadTypeSame, // user loads same URL again (but not reload button) - WebFrameLoadTypeRedirectWithLockedHistory, + WebFrameLoadTypeRedirectWithLockedBackForwardList, WebFrameLoadTypeReplace } WebFrameLoadType; diff --git a/WebKit/win/Interfaces/IWebHistoryItemPrivate.idl b/WebKit/win/Interfaces/IWebHistoryItemPrivate.idl index aa8c162..4922504 100644 --- a/WebKit/win/Interfaces/IWebHistoryItemPrivate.idl +++ b/WebKit/win/Interfaces/IWebHistoryItemPrivate.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -55,4 +55,15 @@ interface IWebHistoryItemPrivate : IUnknown HRESULT target([out, retval] BSTR* target); HRESULT isTargetItem([out, retval] BOOL* result); [local] HRESULT children([out] unsigned* childCount, [out, retval] SAFEARRAY** children); + HRESULT lastVisitWasFailure([out, retval] BOOL* wasFailure); + HRESULT setLastVisitWasFailure([in] BOOL wasFailure); + HRESULT lastVisitWasHTTPNonGet([out, retval] BOOL* HTTPNonGet); + HRESULT setLastVisitWasHTTPNonGet([in] BOOL wasHTTPNonGet); + + HRESULT redirectURLs([out, retval] IEnumVARIANT** result); + HRESULT visitedWithTitle([in] BSTR title); + + HRESULT getDailyVisitCounts([out] int* number, [out, retval] int** counts); + HRESULT getWeeklyVisitCounts([out] int* number, [out, retval] int** counts); + HRESULT recordInitialVisit(); } diff --git a/WebKit/win/Interfaces/IWebHistoryPrivate.idl b/WebKit/win/Interfaces/IWebHistoryPrivate.idl new file mode 100644 index 0000000..6e4754e --- /dev/null +++ b/WebKit/win/Interfaces/IWebHistoryPrivate.idl @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2008 Apple 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. + */ + +interface IWebHistoryItem; + +[ + object, + oleautomation, + hidden, + uuid(B811003B-3475-46ad-9697-91D0D181CC05), + pointer_default(unique) +] +interface IWebHistoryPrivate : IUnknown +{ + HRESULT allItems([in, out] int* count, [out, retval] IWebHistoryItem** items); +} diff --git a/WebKit/win/Interfaces/IWebIconDatabase.idl b/WebKit/win/Interfaces/IWebIconDatabase.idl index 0dfbf1a..57d6683 100644 --- a/WebKit/win/Interfaces/IWebIconDatabase.idl +++ b/WebKit/win/Interfaces/IWebIconDatabase.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -148,4 +148,20 @@ interface IWebIconDatabase : IUnknown - (NSString *)iconURLForURL:(NSString *)URL; */ HRESULT iconURLForURL([in] BSTR url, [out, retval] BSTR* iconURL); + + /*! + @method isEnabled + @discussion Returns true if the icon database is currently enabled, or false if it + is disabled. + - (BOOL)isEnabled; + */ + HRESULT isEnabled([out, retval] BOOL* result); + + /*! + @method setEnabled: + @discussion Enables or disables the icon database based on the flag passed in. + @param flag Pass true to enable the icon database, or false to disable it. + - (void)setEnabled:(BOOL)flag; + */ + HRESULT setEnabled([in] BOOL flag); } diff --git a/WebKit/win/Interfaces/IWebPreferences.idl b/WebKit/win/Interfaces/IWebPreferences.idl index 16f0d9c..9a52d7c 100644 --- a/WebKit/win/Interfaces/IWebPreferences.idl +++ b/WebKit/win/Interfaces/IWebPreferences.idl @@ -183,4 +183,7 @@ interface IWebPreferences : IUnknown HRESULT setShouldPaintCustomScrollbars(BOOL shouldPaint); HRESULT shouldPaintCustomScrollbars(BOOL *shouldPaint); + + HRESULT setZoomsTextOnly(BOOL zoomsTextOnly); + HRESULT zoomsTextOnly(BOOL *zoomsTextOnly); } diff --git a/WebKit/win/Interfaces/IWebPreferencesPrivate.idl b/WebKit/win/Interfaces/IWebPreferencesPrivate.idl index 4a71dbd..aa1073f 100644 --- a/WebKit/win/Interfaces/IWebPreferencesPrivate.idl +++ b/WebKit/win/Interfaces/IWebPreferencesPrivate.idl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -60,4 +60,13 @@ interface IWebPreferencesPrivate : IUnknown HRESULT setShouldPaintNativeControls([in] BOOL shouldPaint); HRESULT shouldPaintNativeControls([out, retval] BOOL* enabled); + + HRESULT setDatabasesEnabled([in] BOOL enabled); + HRESULT databasesEnabled([out, retval] BOOL *enabled); + + HRESULT setLocalStorageEnabled([in] BOOL enabled); + HRESULT localStorageEnabled([out, retval] BOOL* enabled); + + HRESULT setFontSmoothingContrast([in] float contrast); + HRESULT fontSmoothingContrast([out, retval] float* contrast); } diff --git a/WebKit/win/Interfaces/IWebResourceLoadDelegatePrivate.idl b/WebKit/win/Interfaces/IWebResourceLoadDelegatePrivate.idl index de2bdc0..95040bf 100644 --- a/WebKit/win/Interfaces/IWebResourceLoadDelegatePrivate.idl +++ b/WebKit/win/Interfaces/IWebResourceLoadDelegatePrivate.idl @@ -59,3 +59,14 @@ interface IWebResourceLoadDelegatePrivate : IUnknown */ HRESULT didLoadResourceFromMemoryCache([in] IWebView* webView, [in] IWebURLRequest* request, [in] IWebURLResponse* response, [in] UINT length, [in] IWebDataSource* dataSource); } + +[ + object, + oleautomation, + uuid(E7B724A4-F0E5-4e11-9AC5-5F60AC09301E), + pointer_default(unique) +] +interface IWebResourceLoadDelegatePrivate2 : IWebResourceLoadDelegatePrivate +{ + HRESULT shouldUseCredentialStorage([in] IWebView* webView, [in] unsigned long identifier, [in] IWebDataSource* dataSource, [out, retval] BOOL* shouldUse); +} diff --git a/WebKit/win/Interfaces/IWebUIDelegatePrivate.idl b/WebKit/win/Interfaces/IWebUIDelegatePrivate.idl index 85a72e7..5ef53d9 100755 --- a/WebKit/win/Interfaces/IWebUIDelegatePrivate.idl +++ b/WebKit/win/Interfaces/IWebUIDelegatePrivate.idl @@ -31,6 +31,9 @@ import "IWebView.idl"; #endif cpp_quote("#define WebEmbeddedViewAttributesKey TEXT(\"WebEmbeddedViewAttributesKey\")") +cpp_quote("#define WebEmbeddedViewBaseURLKey TEXT(\"WebEmbeddedViewBaseURLKey\")") +cpp_quote("#define WebEmbeddedViewContainingElementKey TEXT(\"WebEmbeddedViewContainingElementKey\")") +cpp_quote("#define WebEmbeddedViewMIMETypeKey TEXT(\"WebEmbeddedViewMIMETypeKey\")") interface IWebEmbeddedView; interface IWebFrame; diff --git a/WebKit/win/Interfaces/IWebView.idl b/WebKit/win/Interfaces/IWebView.idl index 92fa2b5..e38406b 100644 --- a/WebKit/win/Interfaces/IWebView.idl +++ b/WebKit/win/Interfaces/IWebView.idl @@ -1014,6 +1014,16 @@ interface IWebViewEditing : IUnknown - (void)setGrammarCheckingEnabled:(BOOL)flag */ HRESULT setGrammarCheckingEnabled(BOOL enabled); + + /* + - (void)setSelectTrailingWhitespaceEnabled:(BOOL)flag; + */ + HRESULT setSelectTrailingWhitespaceEnabled([in] BOOL flag); + + /* + - (BOOL)selectTrailingWhitespaceEnabled; + */ + HRESULT isSelectTrailingWhitespaceEnabled([out, retval] BOOL* enabled); } /* diff --git a/WebKit/win/Interfaces/IWebViewPrivate.idl b/WebKit/win/Interfaces/IWebViewPrivate.idl index b49addf..c32a20b 100644 --- a/WebKit/win/Interfaces/IWebViewPrivate.idl +++ b/WebKit/win/Interfaces/IWebViewPrivate.idl @@ -122,7 +122,6 @@ interface IWebViewPrivate : IUnknown // SPI for DumpRenderTree HRESULT executeCoreCommandByName([in] BSTR name, [in] BSTR value); - HRESULT clearMainFrameName(); HRESULT windowAncestryDidChange(); @@ -146,4 +145,16 @@ interface IWebViewPrivate : IUnknown HRESULT setCookieEnabled([in] BOOL enable); HRESULT cookieEnabled([out, retval] BOOL* enabled); + + HRESULT setMediaVolume([in] float volume); + HRESULT mediaVolume([out, retval] float* volume); + + // SPI for DumpRenderTree + HRESULT clearMainFrameName(); + + HRESULT globalHistoryItem([out, retval] IWebHistoryItem**); + + HRESULT registerEmbeddedViewMIMEType([in] BSTR mimeType); + + HRESULT setMemoryCacheDelegateCallsEnabled([in] BOOL enabled); } diff --git a/WebKit/win/Interfaces/WebKit.idl b/WebKit/win/Interfaces/WebKit.idl index fe08792..a78a5d3 100644 --- a/WebKit/win/Interfaces/WebKit.idl +++ b/WebKit/win/Interfaces/WebKit.idl @@ -90,6 +90,7 @@ import "ocidl.idl"; #include "IWebHistory.idl" #include "IWebHistoryItem.idl" #include "IWebHistoryItemPrivate.idl" +#include "IWebHistoryPrivate.idl" #include "IWebIconDatabase.idl" #include "IWebIconFetcher.idl" #include "IWebInspector.idl" diff --git a/WebKit/win/MarshallingHelpers.cpp b/WebKit/win/MarshallingHelpers.cpp index 2a3935e..60f2749 100644 --- a/WebKit/win/MarshallingHelpers.cpp +++ b/WebKit/win/MarshallingHelpers.cpp @@ -42,7 +42,7 @@ CFDictionaryValueCallBacks MarshallingHelpers::kIUnknownDictionaryValueCallBacks KURL MarshallingHelpers::BSTRToKURL(BSTR urlStr) { - return KURL(String(urlStr, SysStringLen(urlStr))); + return KURL(KURL(), String(urlStr, SysStringLen(urlStr))); } BSTR MarshallingHelpers::KURLToBSTR(const KURL& url) diff --git a/WebKit/win/WebCachedPagePlatformData.h b/WebKit/win/WebCachedFramePlatformData.h index f5a5388..ec850e3 100644 --- a/WebKit/win/WebCachedPagePlatformData.h +++ b/WebKit/win/WebCachedFramePlatformData.h @@ -25,16 +25,16 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebCachedPagePlatformData_h -#define WebCachedPagePlatformData_h +#ifndef WebCachedFramePlatformData_h +#define WebCachedFramePlatformData_h #include "WebDataSource.h" -#include <WebCore/CachedPagePlatformData.h> +#include <WebCore/CachedFramePlatformData.h> -class WebCachedPagePlatformData : public WebCore::CachedPagePlatformData { +class WebCachedFramePlatformData : public WebCore::CachedFramePlatformData { public: - WebCachedPagePlatformData(IWebDataSource* webDataSource) : m_webDataSource(webDataSource) { } + WebCachedFramePlatformData(IWebDataSource* webDataSource) : m_webDataSource(webDataSource) { } IWebDataSource* webDataSource() { return m_webDataSource.get(); } @@ -42,4 +42,4 @@ private: COMPtr<IWebDataSource> m_webDataSource; }; -#endif // CachedPagePlatformData_h +#endif // CachedFramePlatformData_h diff --git a/WebKit/win/WebCookieManager.cpp b/WebKit/win/WebCookieManager.cpp index db51fd1..499d857 100644 --- a/WebKit/win/WebCookieManager.cpp +++ b/WebKit/win/WebCookieManager.cpp @@ -27,9 +27,6 @@ #include "WebKitDLL.h" #include "WebCookieManager.h" -#include <CFNetwork/CFHTTPCookiesPriv.h> -#include <WebCore/CookieStorageWin.h> - using namespace WebCore; // WebCookieManager ------------------------------------------------------- @@ -83,22 +80,3 @@ ULONG STDMETHODCALLTYPE WebCookieManager::Release() return newRef; } - -// IWebCookieManager ------------------------------------------------------- - -HRESULT STDMETHODCALLTYPE WebCookieManager::cookieStorage( - /* [retval][out] */ CFHTTPCookieStorageRef* storage) -{ - if (!storage) - return E_POINTER; - - *storage = currentCookieStorage(); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE WebCookieManager::setCookieStorage( - /* [in] */ CFHTTPCookieStorageRef storage) -{ - setCurrentCookieStorage(storage); - return S_OK; -} diff --git a/WebKit/win/WebCookieManagerCFNet.cpp b/WebKit/win/WebCookieManagerCFNet.cpp new file mode 100644 index 0000000..415a679 --- /dev/null +++ b/WebKit/win/WebCookieManagerCFNet.cpp @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2008 Apple 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 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 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 "WebKitDLL.h" +#include "WebCookieManager.h" + +#include <CFNetwork/CFHTTPCookiesPriv.h> +#include <WebCore/CookieStorageWin.h> + +using namespace WebCore; + +// IWebCookieManager ------------------------------------------------------- + +HRESULT STDMETHODCALLTYPE WebCookieManager::cookieStorage( + /* [retval][out] */ CFHTTPCookieStorageRef* storage) +{ + if (!storage) + return E_POINTER; + + *storage = currentCookieStorage(); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebCookieManager::setCookieStorage( + /* [in] */ CFHTTPCookieStorageRef storage) +{ + setCurrentCookieStorage(storage); + return S_OK; +} diff --git a/WebKit/win/WebCookieManagerCurl.cpp b/WebKit/win/WebCookieManagerCurl.cpp new file mode 100644 index 0000000..e60d8cf --- /dev/null +++ b/WebKit/win/WebCookieManagerCurl.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2008 Brent Fulgham <bfulgham@gmail.com>. 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 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 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 "WebKitDLL.h" +#include "WebCookieManager.h" + +#include "NotImplemented.h" + +using namespace WebCore; + +// IWebCookieManager ------------------------------------------------------- + +HRESULT STDMETHODCALLTYPE WebCookieManager::cookieStorage( + /* [retval][out] */ CFHTTPCookieStorageRef* storage) +{ + notImplemented(); + return E_FAIL; +} + +HRESULT STDMETHODCALLTYPE WebCookieManager::setCookieStorage( + /* [in] */ CFHTTPCookieStorageRef storage) +{ + notImplemented(); + return E_FAIL; +} diff --git a/WebKit/win/WebCoreLocalizedStrings.cpp b/WebKit/win/WebCoreLocalizedStrings.cpp index f754a47..21dc35d 100644 --- a/WebKit/win/WebCoreLocalizedStrings.cpp +++ b/WebKit/win/WebCoreLocalizedStrings.cpp @@ -69,6 +69,7 @@ String WebCore::contextMenuItemTagItalic() { return String(LPCTSTR_UI_STRING("It String WebCore::contextMenuItemTagUnderline() { return String(LPCTSTR_UI_STRING("Underline", "Underline context menu item")); } String WebCore::contextMenuItemTagOutline() { return String(LPCTSTR_UI_STRING("Outline", "Outline context menu item")); } String WebCore::contextMenuItemTagWritingDirectionMenu() { return String(LPCTSTR_UI_STRING("Writing Direction", "Writing direction context sub-menu item")); } +String WebCore::contextMenuItemTagTextDirectionMenu() { return String(LPCTSTR_UI_STRING("Text Direction", "Text direction context sub-menu item")); } String WebCore::contextMenuItemTagDefaultDirection() { return String(LPCTSTR_UI_STRING("Default", "Default writing direction context menu item")); } String WebCore::contextMenuItemTagLeftToRight() { return String(LPCTSTR_UI_STRING("Left to Right", "Left to Right context menu item")); } String WebCore::contextMenuItemTagRightToLeft() { return String(LPCTSTR_UI_STRING("Right to Left", "Right to Left context menu item")); } diff --git a/WebKit/win/WebCoreStatistics.cpp b/WebKit/win/WebCoreStatistics.cpp index ad5af7d..3f7a14c 100644 --- a/WebKit/win/WebCoreStatistics.cpp +++ b/WebKit/win/WebCoreStatistics.cpp @@ -98,7 +98,7 @@ HRESULT STDMETHODCALLTYPE WebCoreStatistics::javaScriptObjectsCount( return E_POINTER; JSLock lock(false); - *count = (UINT)JSDOMWindow::commonJSGlobalData()->heap.size(); + *count = (UINT)JSDOMWindow::commonJSGlobalData()->heap.objectCount(); return S_OK; } @@ -192,7 +192,7 @@ HRESULT STDMETHODCALLTYPE WebCoreStatistics::cachedFontDataCount( { if (!count) return E_POINTER; - *count = (UINT) FontCache::fontDataCount(); + *count = (UINT) fontCache()->fontDataCount(); return S_OK; } @@ -201,13 +201,13 @@ HRESULT STDMETHODCALLTYPE WebCoreStatistics::cachedFontDataInactiveCount( { if (!count) return E_POINTER; - *count = (UINT) FontCache::inactiveFontDataCount(); + *count = (UINT) fontCache()->inactiveFontDataCount(); return S_OK; } HRESULT STDMETHODCALLTYPE WebCoreStatistics::purgeInactiveFontData(void) { - FontCache::purgeInactiveFontData(); + fontCache()->purgeInactiveFontData(); return S_OK; } diff --git a/WebKit/win/WebCoreSupport/EmbeddedWidget.cpp b/WebKit/win/WebCoreSupport/EmbeddedWidget.cpp index b18022b..952bc03 100644 --- a/WebKit/win/WebCoreSupport/EmbeddedWidget.cpp +++ b/WebKit/win/WebCoreSupport/EmbeddedWidget.cpp @@ -31,6 +31,10 @@ #include <WebCore/FrameView.h>
#include <WebCore/RenderObject.h>
+#include "MemoryStream.h"
+#include "WebError.h"
+#include "WebURLResponse.h"
+
using namespace WebCore;
EmbeddedWidget* EmbeddedWidget::create(IWebEmbeddedView* view, Element* element, HWND parentWindow, const IntSize& size)
@@ -84,7 +88,7 @@ void EmbeddedWidget::setFrameRect(const IntRect& rect) frameRectsChanged();
}
-void EmbeddedWidget::frameRectsChanged() const
+void EmbeddedWidget::frameRectsChanged()
{
if (!parent())
return;
@@ -207,3 +211,30 @@ void EmbeddedWidget::detachFromWindow() ShowWindow(m_window, SW_HIDE);
m_attachedToWindow = false;
}
+
+void EmbeddedWidget::didReceiveResponse(const ResourceResponse& response)
+{
+ ASSERT(m_view);
+
+ COMPtr<IWebURLResponse> urlResponse(AdoptCOM, WebURLResponse::createInstance(response));
+ m_view->didReceiveResponse(urlResponse.get());
+}
+
+void EmbeddedWidget::didReceiveData(const char* data, int length)
+{
+ RefPtr<SharedBuffer> buffer(SharedBuffer::create(data, length));
+
+ COMPtr<IStream> stream(AdoptCOM, MemoryStream::createInstance(buffer.release()));
+ m_view->didReceiveData(stream.get());
+}
+
+void EmbeddedWidget::didFinishLoading()
+{
+ m_view->didFinishLoading();
+}
+
+void EmbeddedWidget::didFail(const ResourceError& error)
+{
+ COMPtr<IWebError> webError(AdoptCOM, WebError::createInstance(error));
+ m_view->didFail(webError.get());
+}
diff --git a/WebKit/win/WebCoreSupport/EmbeddedWidget.h b/WebKit/win/WebCoreSupport/EmbeddedWidget.h index ed7c025..56cd436 100644 --- a/WebKit/win/WebCoreSupport/EmbeddedWidget.h +++ b/WebKit/win/WebCoreSupport/EmbeddedWidget.h @@ -28,7 +28,7 @@ #include <WebCore/COMPtr.h>
#include <WebCore/IntRect.h>
-#include <WebCore/Widget.h>
+#include <WebCore/PluginView.h>
namespace WebCore {
class Element;
@@ -37,7 +37,7 @@ namespace WebCore { interface IWebEmbeddedView;
-class EmbeddedWidget : public WebCore::Widget {
+class EmbeddedWidget : public WebCore::Widget, public WebCore::PluginManualLoader {
public:
static EmbeddedWidget* create(IWebEmbeddedView*, WebCore::Element* element, HWND parentWindow, const WebCore::IntSize&);
~EmbeddedWidget();
@@ -54,9 +54,14 @@ private: bool createWindow(HWND parentWindow, const WebCore::IntSize& size);
+ virtual void didReceiveResponse(const WebCore::ResourceResponse&); + virtual void didReceiveData(const char*, int); + virtual void didFinishLoading(); + virtual void didFail(const WebCore::ResourceError&); +
virtual void invalidateRect(const WebCore::IntRect&);
virtual void setFrameRect(const WebCore::IntRect&);
- virtual void frameRectsChanged() const;
+ virtual void frameRectsChanged();
virtual void setFocus();
virtual void show();
virtual void hide();
@@ -73,8 +78,8 @@ private: bool m_isVisible;
bool m_attachedToWindow;
- mutable WebCore::IntRect m_clipRect; // The clip rect to apply to an embedded view.
- mutable WebCore::IntRect m_windowRect; // Our window rect.
+ WebCore::IntRect m_clipRect; // The clip rect to apply to an embedded view.
+ WebCore::IntRect m_windowRect; // Our window rect.
};
#endif // EmbeddedWidget_h
diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.cpp b/WebKit/win/WebCoreSupport/WebChromeClient.cpp index dba87e5..9aec24b 100644 --- a/WebKit/win/WebCoreSupport/WebChromeClient.cpp +++ b/WebKit/win/WebCoreSupport/WebChromeClient.cpp @@ -40,6 +40,7 @@ #include <WebCore/FrameLoadRequest.h> #include <WebCore/FrameView.h> #include <WebCore/LocalizedStrings.h> +#include <WebCore/NotImplemented.h> #include <WebCore/Page.h> #include <WebCore/WindowFeatures.h> #pragma warning(pop) @@ -474,6 +475,11 @@ PlatformWidget WebChromeClient::platformWindow() const return viewWindow; } +void WebChromeClient::contentsSizeChanged(Frame*, const IntSize&) const +{ + notImplemented(); +} + void WebChromeClient::mouseDidMoveOverElement(const HitTestResult& result, unsigned modifierFlags) { COMPtr<IWebUIDelegate> uiDelegate; diff --git a/WebKit/win/WebCoreSupport/WebChromeClient.h b/WebKit/win/WebCoreSupport/WebChromeClient.h index 83c5a70..cb9f470 100644 --- a/WebKit/win/WebCoreSupport/WebChromeClient.h +++ b/WebKit/win/WebCoreSupport/WebChromeClient.h @@ -97,6 +97,7 @@ public: virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint& p) const; virtual WebCore::IntRect windowToScreen(const WebCore::IntRect& r) const; virtual PlatformWidget platformWindow() const; + virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const; virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags); @@ -117,6 +118,8 @@ public: WebView* webView() const { return m_webView; } + virtual void formStateDidChange(const WebCore::Node*) { } + private: COMPtr<IWebUIDelegate> uiDelegate(); COMPtr<IWebUIDelegate2> uiDelegate2(); diff --git a/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp b/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp index be7b483..deabb5c 100644 --- a/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp +++ b/WebKit/win/WebCoreSupport/WebContextMenuClient.cpp @@ -160,7 +160,7 @@ void WebContextMenuClient::searchWithGoogle(const Frame* frame) ResourceRequest request = ResourceRequest(url); if (Page* page = frame->page()) - page->mainFrame()->loader()->urlSelected(FrameLoadRequest(request), 0, false); + page->mainFrame()->loader()->urlSelected(FrameLoadRequest(request), 0, false, false); } void WebContextMenuClient::lookUpInDictionary(Frame*) diff --git a/WebKit/win/WebCoreSupport/WebDragClient.cpp b/WebKit/win/WebCoreSupport/WebDragClient.cpp index c35991f..d42f7b5 100644 --- a/WebKit/win/WebCoreSupport/WebDragClient.cpp +++ b/WebKit/win/WebCoreSupport/WebDragClient.cpp @@ -30,7 +30,6 @@ #include "WebView.h" #include <shlobj.h> -#include <CoreGraphics/CoreGraphics.h> #pragma warning(push, 0) #include <WebCore/ClipboardWin.h> @@ -46,7 +45,8 @@ #pragma warning(pop) namespace WebCore { - HBITMAP allocImage(HDC dc, IntSize size, CGContextRef *targetRef); + HBITMAP allocImage(HDC dc, IntSize size, PlatformGraphicsContext** targetRef); + void deallocContext(PlatformGraphicsContext* target); } @@ -223,7 +223,7 @@ DragImageRef WebDragClient::createDragImageForLink(KURL& url, const String& inLa return 0; } - CGContextRef contextRef; + PlatformGraphicsContext* contextRef; image = allocImage(workingDC, imageSize, &contextRef); if (!image) { DeleteDC(workingDC); @@ -237,7 +237,6 @@ DragImageRef WebDragClient::createDragImageForLink(KURL& url, const String& inLa // 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); - context.setFont(labelFont); IntRect rect(0, 0, imageSize.width(), imageSize.height()); context.fillRoundedRect(rect, radii, radii, radii, radii, backgroundColor); @@ -257,7 +256,7 @@ DragImageRef WebDragClient::createDragImageForLink(KURL& url, const String& inLa IntPoint textPos(DRAG_LABEL_BORDER_X, DRAG_LABEL_BORDER_Y + labelFont.pixelSize()); WebCoreDrawDoubledTextAtPoint(context, label, textPos, labelFont, topColor, bottomColor); - CGContextRelease(contextRef); + deallocContext(contextRef); DeleteDC(workingDC); ReleaseDC(0, dc); return image; diff --git a/WebKit/win/WebCoreSupport/WebEditorClient.cpp b/WebKit/win/WebCoreSupport/WebEditorClient.cpp index e38cd0d..985742f 100644 --- a/WebKit/win/WebCoreSupport/WebEditorClient.cpp +++ b/WebKit/win/WebCoreSupport/WebEditorClient.cpp @@ -295,6 +295,13 @@ bool WebEditorClient::smartInsertDeleteEnabled(void) return !!enabled; } +bool WebEditorClient::isSelectTrailingWhitespaceEnabled(void) +{ + BOOL enabled = FALSE; + m_webView->isSelectTrailingWhitespaceEnabled(&enabled); + return !!enabled; +} + bool WebEditorClient::shouldChangeSelectedRange(WebCore::Range*, WebCore::Range*, WebCore::EAffinity, bool) { notImplemented(); return true; } diff --git a/WebKit/win/WebCoreSupport/WebEditorClient.h b/WebKit/win/WebCoreSupport/WebEditorClient.h index 8c603f2..52cb66d 100644 --- a/WebKit/win/WebCoreSupport/WebEditorClient.h +++ b/WebKit/win/WebCoreSupport/WebEditorClient.h @@ -75,6 +75,7 @@ public: void webViewDidChangeSelection(WebNotification*); bool smartInsertDeleteEnabled(); + bool isSelectTrailingWhitespaceEnabled(); void registerCommandForUndo(PassRefPtr<WebCore::EditCommand>); void registerCommandForRedo(PassRefPtr<WebCore::EditCommand>); diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp index 17bee47..1af1673 100644 --- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp @@ -31,9 +31,11 @@ #include "CFDictionaryPropertyBag.h" #include "COMPropertyBag.h" +#include "DOMHTMLClasses.h" #include "EmbeddedWidget.h" #include "MarshallingHelpers.h" -#include "WebCachedPagePlatformData.h" +#include "NotImplemented.h" +#include "WebCachedFramePlatformData.h" #include "WebChromeClient.h" #include "WebDocumentLoader.h" #include "WebError.h" @@ -46,6 +48,7 @@ #include "WebURLResponse.h" #include "WebView.h" #pragma warning(push, 0) +#include <WebCore/CachedFrame.h> #include <WebCore/DocumentLoader.h> #include <WebCore/FrameLoader.h> #include <WebCore/FrameTree.h> @@ -71,7 +74,7 @@ static WebDataSource* getWebDataSource(DocumentLoader* loader) WebFrameLoaderClient::WebFrameLoaderClient(WebFrame* webFrame) : m_webFrame(webFrame) - , m_pluginView(0) + , m_manualLoader(0) , m_hasSentResponseToPlugin(false) { ASSERT_ARG(webFrame, webFrame); @@ -102,8 +105,27 @@ void WebFrameLoaderClient::assignIdentifierToInitialRequest(unsigned long identi resourceLoadDelegate->identifierForInitialRequest(webView, webURLRequest.get(), getWebDataSource(loader), identifier); } +bool WebFrameLoaderClient::shouldUseCredentialStorage(DocumentLoader* loader, unsigned long identifier) +{ + WebView* webView = m_webFrame->webView(); + COMPtr<IWebResourceLoadDelegate> resourceLoadDelegate; + if (FAILED(webView->resourceLoadDelegate(&resourceLoadDelegate))) + return true; + + COMPtr<IWebResourceLoadDelegatePrivate2> resourceLoadDelegatePrivate; + if (FAILED(resourceLoadDelegate->QueryInterface(IID_IWebResourceLoadDelegatePrivate2, reinterpret_cast<void**>(&resourceLoadDelegatePrivate)))) + return true; + + BOOL shouldUse; + if (SUCCEEDED(resourceLoadDelegatePrivate->shouldUseCredentialStorage(webView, identifier, getWebDataSource(loader), &shouldUse))) + return shouldUse; + + return true; +} + void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoader* loader, unsigned long identifier, const AuthenticationChallenge& challenge) { +#if USE(CFNETWORK) ASSERT(challenge.sourceHandle()); WebView* webView = m_webFrame->webView(); @@ -117,6 +139,9 @@ void WebFrameLoaderClient::dispatchDidReceiveAuthenticationChallenge(DocumentLoa // If the ResourceLoadDelegate doesn't exist or fails to handle the call, we tell the ResourceHandle // to continue without credential - this is the best approximation of Mac behavior challenge.sourceHandle()->receivedRequestToContinueWithoutCredential(challenge); +#else + notImplemented(); +#endif } void WebFrameLoaderClient::dispatchDidCancelAuthenticationChallenge(DocumentLoader* loader, unsigned long identifier, const AuthenticationChallenge& challenge) @@ -297,6 +322,17 @@ void WebFrameLoaderClient::dispatchDidFirstLayout() frameLoadDelegatePriv->didFirstLayoutInFrame(webView, m_webFrame); } +void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout() +{ + WebView* webView = m_webFrame->webView(); + COMPtr<IWebFrameLoadDelegatePrivate> frameLoadDelegatePrivate; + if (SUCCEEDED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePrivate)) && frameLoadDelegatePrivate) { + COMPtr<IWebFrameLoadDelegatePrivate2> frameLoadDelegatePrivate2(Query, frameLoadDelegatePrivate); + if (frameLoadDelegatePrivate2) + frameLoadDelegatePrivate2->didFirstVisuallyNonEmptyLayoutInFrame(webView, m_webFrame); + } +} + Frame* WebFrameLoaderClient::dispatchCreatePage() { WebView* webView = m_webFrame->webView(); @@ -331,12 +367,11 @@ void WebFrameLoaderClient::dispatchDidLoadMainResource(DocumentLoader*) void WebFrameLoaderClient::setMainDocumentError(DocumentLoader*, const ResourceError& error) { - if (!m_pluginView) + if (!m_manualLoader) return; - if (m_pluginView->status() == PluginStatusLoadedSuccessfully) - m_pluginView->didFail(error); - m_pluginView = 0; + m_manualLoader->didFail(error); + m_manualLoader = 0; m_hasSentResponseToPlugin = false; } @@ -366,22 +401,22 @@ void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* dat // FIXME: This should probably go through the data source. const String& textEncoding = loader->response().textEncodingName(); - if (!m_pluginView) + if (!m_manualLoader) receivedData(data, length, textEncoding); - if (!m_pluginView || m_pluginView->status() != PluginStatusLoadedSuccessfully) + if (!m_manualLoader) return; if (!m_hasSentResponseToPlugin) { - m_pluginView->didReceiveResponse(core(m_webFrame)->loader()->documentLoader()->response()); + m_manualLoader->didReceiveResponse(core(m_webFrame)->loader()->documentLoader()->response()); // didReceiveResponse sets up a new stream to the plug-in. on a full-page plug-in, a failure in - // setting up this stream can cause the main document load to be cancelled, setting m_pluginView + // setting up this stream can cause the main document load to be cancelled, setting m_manualLoader // to null - if (!m_pluginView) + if (!m_manualLoader) return; m_hasSentResponseToPlugin = true; } - m_pluginView->didReceiveData(data, length); + m_manualLoader->didReceiveData(data, length); } void WebFrameLoaderClient::receivedData(const char* data, int length, const String& textEncoding) @@ -405,23 +440,44 @@ void WebFrameLoaderClient::finishedLoading(DocumentLoader* loader) // Telling the frame we received some data and passing 0 as the data is our // way to get work done that is normally done when the first bit of data is // received, even for the case of a document with no data (like about:blank) - if (!m_pluginView) { + if (!m_manualLoader) { committedLoad(loader, 0, 0); return; } - if (m_pluginView->status() == PluginStatusLoadedSuccessfully) - m_pluginView->didFinishLoading(); - m_pluginView = 0; + m_manualLoader->didFinishLoading(); + m_manualLoader = 0; m_hasSentResponseToPlugin = false; } -void WebFrameLoaderClient::updateGlobalHistory(const KURL& url) +void WebFrameLoaderClient::updateGlobalHistory() { WebHistory* history = WebHistory::sharedHistory(); if (!history) return; - history->addItem(url, core(m_webFrame)->loader()->documentLoader()->title()); + + DocumentLoader* loader = core(m_webFrame)->loader()->documentLoader(); + + if (loader->urlForHistoryReflectsServerRedirect()) { + history->visitedURL(loader->urlForHistory(), loader->title(), loader->request().httpMethod(), loader->urlForHistoryReflectsFailure(), loader->url(), false); + return; + } + + if (loader->urlForHistoryReflectsClientRedirect()) { + history->visitedURL(loader->urlForHistory(), loader->title(), loader->request().httpMethod(), loader->urlForHistoryReflectsFailure(), KURL(), true); + return; + } + + history->visitedURL(loader->urlForHistory(), loader->title(), loader->request().httpMethod(), loader->urlForHistoryReflectsFailure(), KURL(), false); +} + +void WebFrameLoaderClient::updateGlobalHistoryForRedirectWithoutHistoryItem() +{ + WebHistory* history = WebHistory::sharedHistory(); + if (!history) + return; + DocumentLoader* loader = core(m_webFrame)->loader()->documentLoader(); + history->visitedURLForRedirectWithoutHistoryItem(loader->url()); } bool WebFrameLoaderClient::shouldGoToHistoryItem(HistoryItem*) const @@ -464,56 +520,35 @@ void WebFrameLoaderClient::setTitle(const String& title, const KURL& url) itemPrivate->setTitle(BString(title)); } -void WebFrameLoaderClient::savePlatformDataToCachedPage(CachedPage* cachedPage) +void WebFrameLoaderClient::savePlatformDataToCachedFrame(CachedFrame* cachedFrame) { +#if USE(CFNETWORK) Frame* coreFrame = core(m_webFrame); if (!coreFrame) return; - ASSERT(coreFrame->loader()->documentLoader() == cachedPage->documentLoader()); + ASSERT(coreFrame->loader()->documentLoader() == cachedFrame->documentLoader()); - WebCachedPagePlatformData* webPlatformData = new WebCachedPagePlatformData(static_cast<IWebDataSource*>(getWebDataSource(coreFrame->loader()->documentLoader()))); - cachedPage->setCachedPagePlatformData(webPlatformData); + WebCachedFramePlatformData* webPlatformData = new WebCachedFramePlatformData(static_cast<IWebDataSource*>(getWebDataSource(coreFrame->loader()->documentLoader()))); + cachedFrame->setCachedFramePlatformData(webPlatformData); +#else + notImplemented(); +#endif } -void WebFrameLoaderClient::transitionToCommittedForNewPage() +void WebFrameLoaderClient::transitionToCommittedFromCachedFrame(CachedFrame*) { - Frame* frame = core(m_webFrame); - ASSERT(frame); - - Page* page = frame->page(); - ASSERT(page); - - bool isMainFrame = frame == page->mainFrame(); - - if (isMainFrame && frame->view()) - frame->view()->setParentVisible(false); - - frame->setView(0); - - WebView* webView = m_webFrame->webView(); - - FrameView* frameView; - if (isMainFrame) { - RECT rect; - webView->frameRect(&rect); - frameView = new FrameView(frame, IntRect(rect).size()); - } else - frameView = new FrameView(frame); - - frame->setView(frameView); - frameView->deref(); // FrameViews are created with a ref count of 1. Release this ref since we've assigned it to frame. - - m_webFrame->updateBackground(); - - if (isMainFrame) - frameView->setParentVisible(true); +} - if (frame->ownerRenderer()) - frame->ownerRenderer()->setWidget(frameView); +void WebFrameLoaderClient::transitionToCommittedForNewPage() +{ + WebView* view = m_webFrame->webView(); - if (HTMLFrameOwnerElement* owner = frame->ownerElement()) - frame->view()->setCanHaveScrollbars(owner->scrollingMode() != ScrollbarAlwaysOff); + RECT rect; + view->frameRect(&rect); + bool transparent = view->transparent(); + Color backgroundColor = transparent ? Color::transparent : Color::white; + WebCore::FrameLoaderClient::transitionToCommittedForNewPage(core(m_webFrame), IntRect(rect).size(), backgroundColor, transparent, IntSize(), false); } bool WebFrameLoaderClient::canCachePage() const @@ -562,18 +597,14 @@ void WebFrameLoaderClient::loadURLIntoChild(const KURL& originalURL, const Strin HistoryItem* parentItem = coreFrame->loader()->currentHistoryItem(); FrameLoadType loadType = coreFrame->loader()->loadType(); - FrameLoadType childLoadType = FrameLoadTypeRedirectWithLockedHistory; + FrameLoadType childLoadType = FrameLoadTypeRedirectWithLockedBackForwardList; KURL url = originalURL; // If we're moving in the backforward list, we might want to replace the content // of this child frame with whatever was there at that point. // Reload will maintain the frame contents, LoadSame will not. - if (parentItem && parentItem->children().size() && - (isBackForwardLoadType(loadType) - || loadType == FrameLoadTypeReload - || loadType == FrameLoadTypeReloadAllowingStaleData)) - { + if (parentItem && parentItem->children().size() && isBackForwardLoadType(loadType)) { if (HistoryItem* childItem = parentItem->childItemWithName(core(childFrame)->tree()->name())) { // Use the original URL to ensure we get all the side-effects, such as // onLoad handlers, of any redirects that happened. An example of where @@ -593,7 +624,7 @@ void WebFrameLoaderClient::loadURLIntoChild(const KURL& originalURL, const Strin // FIXME: Handle loading WebArchives here String frameName = core(childFrame)->tree()->name(); - core(childFrame)->loader()->loadURL(url, referrer, frameName, childLoadType, 0, 0); + core(childFrame)->loader()->loadURL(url, referrer, frameName, false, childLoadType, 0, 0); } Widget* WebFrameLoaderClient::createPlugin(const IntSize& pluginSize, Element* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually) @@ -610,11 +641,16 @@ Widget* WebFrameLoaderClient::createPlugin(const IntSize& pluginSize, Element* e for (unsigned i = 0; i < paramNames.size(); i++) viewArguments.set(paramNames[i], paramValues[i]); COMPtr<IPropertyBag> viewArgumentsBag(AdoptCOM, COMPropertyBag<String>::adopt(viewArguments)); + COMPtr<IDOMElement> containingElement(AdoptCOM, DOMElement::createInstance(element)); + + HashMap<String, COMVariant> arguments; - // Now create a new property bag where the view arguments is the only property. - HashMap<String, COMPtr<IUnknown> > arguments; - arguments.set(WebEmbeddedViewAttributesKey, COMPtr<IUnknown>(AdoptCOM, viewArgumentsBag.releaseRef())); - COMPtr<IPropertyBag> argumentsBag(AdoptCOM, COMPropertyBag<COMPtr<IUnknown> >::adopt(arguments)); + arguments.set(WebEmbeddedViewAttributesKey, viewArgumentsBag); + arguments.set(WebEmbeddedViewBaseURLKey, url.string()); + arguments.set(WebEmbeddedViewContainingElementKey, containingElement); + arguments.set(WebEmbeddedViewMIMETypeKey, mimeType); + + COMPtr<IPropertyBag> argumentsBag(AdoptCOM, COMPropertyBag<COMVariant>::adopt(arguments)); COMPtr<IWebEmbeddedView> view; HRESULT result = uiPrivate->embeddedViewWithArguments(webView, m_webFrame, argumentsBag.get(), &view); @@ -694,7 +730,10 @@ void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget) { // Ideally, this function shouldn't be necessary, see <rdar://problem/4852889> - m_pluginView = static_cast<PluginView*>(pluginWidget); + if (pluginWidget->isPluginView()) + m_manualLoader = static_cast<PluginView*>(pluginWidget); + else + m_manualLoader = static_cast<EmbeddedWidget*>(pluginWidget); } WebHistory* WebFrameLoaderClient::webHistory() const @@ -704,3 +743,12 @@ WebHistory* WebFrameLoaderClient::webHistory() const return WebHistory::sharedHistory(); } + +bool WebFrameLoaderClient::shouldUsePluginDocument(const String& mimeType) const +{ + WebView* webView = m_webFrame->webView(); + if (!webView) + return false; + + return webView->shouldUseEmbeddedView(mimeType); +} diff --git a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h index b9fd027..3877273 100644 --- a/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h +++ b/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h @@ -34,7 +34,7 @@ #pragma warning(pop) namespace WebCore { - class PluginView; + class PluginManualLoader; } template <typename T> class COMPtr; @@ -49,6 +49,7 @@ public: virtual void assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&); virtual void dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse); + virtual bool shouldUseCredentialStorage(WebCore::DocumentLoader*, unsigned long identifier); virtual void dispatchDidReceiveAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); virtual void dispatchDidCancelAuthenticationChallenge(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::AuthenticationChallenge&); virtual void dispatchDidReceiveResponse(WebCore::DocumentLoader*, unsigned long identifier, const WebCore::ResourceResponse&); @@ -69,6 +70,7 @@ public: virtual void dispatchDidFinishDocumentLoad(); virtual void dispatchDidFinishLoad(); virtual void dispatchDidFirstLayout(); + virtual void dispatchDidFirstVisuallyNonEmptyLayout(); virtual WebCore::Frame* dispatchCreatePage(); virtual void dispatchShow(); @@ -83,13 +85,15 @@ public: virtual void committedLoad(WebCore::DocumentLoader*, const char*, int); virtual void finishedLoading(WebCore::DocumentLoader*); - virtual void updateGlobalHistory(const WebCore::KURL&); + virtual void updateGlobalHistory(); + virtual void updateGlobalHistoryForRedirectWithoutHistoryItem(); virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const; virtual PassRefPtr<WebCore::DocumentLoader> createDocumentLoader(const WebCore::ResourceRequest&, const WebCore::SubstituteData&); virtual void setTitle(const WebCore::String& title, const WebCore::KURL&); - virtual void savePlatformDataToCachedPage(WebCore::CachedPage*); + virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*); + virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); virtual void transitionToCommittedForNewPage(); virtual bool canCachePage() const; @@ -99,6 +103,8 @@ public: virtual WebCore::Widget* createPlugin(const WebCore::IntSize&, WebCore::Element*, const WebCore::KURL&, const Vector<WebCore::String>&, const Vector<WebCore::String>&, const WebCore::String&, bool loadManually); virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget); + virtual bool shouldUsePluginDocument(const WebCore::String& mimeType) const; + protected: WebFrameLoaderClient(WebFrame*); ~WebFrameLoaderClient(); @@ -111,8 +117,8 @@ private: WebFrame* m_webFrame; - // Points to the plugin view that data should be redirected to. - WebCore::PluginView* m_pluginView; + // Points to the manual loader that data should be redirected to. + WebCore::PluginManualLoader* m_manualLoader; bool m_hasSentResponseToPlugin; }; diff --git a/WebKit/win/WebCoreSupport/WebInspectorClient.cpp b/WebKit/win/WebCoreSupport/WebInspectorClient.cpp index bfbf858..56cf0df 100644 --- a/WebKit/win/WebCoreSupport/WebInspectorClient.cpp +++ b/WebKit/win/WebCoreSupport/WebInspectorClient.cpp @@ -72,6 +72,7 @@ WebInspectorClient::WebInspectorClient(WebView* webView) : m_inspectedWebView(webView) , m_hwnd(0) , m_webViewHwnd(0) + , m_shouldAttachWhenShown(false) , m_attached(false) { ASSERT(m_inspectedWebView); @@ -202,20 +203,13 @@ String WebInspectorClient::localizedStringsURL() void WebInspectorClient::showWindow() { - if (!m_hwnd) - return; - - updateWindowTitle(); - ::SetWindowPos(m_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE); + showWindowWithoutNotifications(); m_inspectedWebView->page()->inspectorController()->setWindowVisible(true); } void WebInspectorClient::closeWindow() { - if (!m_webView) - return; - - ::ShowWindow(m_hwnd, SW_HIDE); + closeWindowWithoutNotifications(); m_inspectedWebView->page()->inspectorController()->setWindowVisible(false); } @@ -226,27 +220,13 @@ bool WebInspectorClient::windowVisible() void WebInspectorClient::attachWindow() { - ASSERT(m_hwnd); - ASSERT(m_webView); - ASSERT(m_inspectedWebViewHwnd); - if (m_attached) return; - WindowMessageBroadcaster::addListener(m_inspectedWebViewHwnd, this); + m_shouldAttachWhenShown = true; - HWND hostWindow; - if (FAILED(m_inspectedWebView->hostWindow((OLE_HANDLE*)&hostWindow))) - return; - - m_webView->setHostWindow((OLE_HANDLE)(ULONG64)hostWindow); - ::ShowWindow(m_hwnd, SW_HIDE); - m_attached = true; - - ::SendMessage(hostWindow, WM_SIZE, 0, 0); - - if (m_highlight && m_highlight->isShowing()) - m_highlight->update(); + closeWindowWithoutNotifications(); + showWindowWithoutNotifications(); } void WebInspectorClient::detachWindow() @@ -254,20 +234,10 @@ void WebInspectorClient::detachWindow() if (!m_attached) return; - WindowMessageBroadcaster::removeListener(m_inspectedWebViewHwnd, this); - - m_attached = false; - - m_webView->setHostWindow((OLE_HANDLE)(ULONG64)m_hwnd); - ::ShowWindow(m_hwnd, SW_SHOW); - ::SendMessage(m_hwnd, WM_SIZE, 0, 0); + m_shouldAttachWhenShown = false; - HWND hostWindow; - if (SUCCEEDED(m_inspectedWebView->hostWindow((OLE_HANDLE*)&hostWindow))) - ::SendMessage(hostWindow, WM_SIZE, 0, 0); - - if (m_highlight && m_highlight->isShowing()) - m_highlight->update(); + closeWindowWithoutNotifications(); + showWindowWithoutNotifications(); } void WebInspectorClient::setAttachedWindowHeight(unsigned height) @@ -303,6 +273,74 @@ void WebInspectorClient::inspectedURLChanged(const String& newURL) updateWindowTitle(); } +void WebInspectorClient::closeWindowWithoutNotifications() +{ + if (!m_hwnd) + return; + + if (!m_attached) { + ShowWindow(m_hwnd, SW_HIDE); + return; + } + + ASSERT(m_webView); + ASSERT(m_inspectedWebViewHwnd); + ASSERT(!IsWindowVisible(m_hwnd)); + + // Remove the Inspector's WebView from the inspected WebView's parent window. + WindowMessageBroadcaster::removeListener(m_inspectedWebViewHwnd, this); + + m_attached = false; + + m_webView->setHostWindow(reinterpret_cast<OLE_HANDLE>(m_hwnd)); + + // Make sure everything has the right size/position. + HWND hostWindow; + if (SUCCEEDED(m_inspectedWebView->hostWindow((OLE_HANDLE*)&hostWindow))) + SendMessage(hostWindow, WM_SIZE, 0, 0); + + if (m_highlight && m_highlight->isShowing()) + m_highlight->update(); +} + +void WebInspectorClient::showWindowWithoutNotifications() +{ + if (!m_hwnd) + return; + + ASSERT(m_webView); + ASSERT(m_inspectedWebViewHwnd); + + if (!m_shouldAttachWhenShown) { + // Put the Inspector's WebView inside our window and show it. + m_webView->setHostWindow(reinterpret_cast<OLE_HANDLE>(m_hwnd)); + SendMessage(m_hwnd, WM_SIZE, 0, 0); + updateWindowTitle(); + + SetWindowPos(m_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOMOVE | SWP_NOSIZE); + return; + } + + // Put the Inspector's WebView inside the inspected WebView's parent window. + WindowMessageBroadcaster::addListener(m_inspectedWebViewHwnd, this); + + HWND hostWindow; + if (FAILED(m_inspectedWebView->hostWindow(reinterpret_cast<OLE_HANDLE*>(&hostWindow)))) + return; + + m_webView->setHostWindow(reinterpret_cast<OLE_HANDLE>(hostWindow)); + + // Then hide our own window. + ShowWindow(m_hwnd, SW_HIDE); + + m_attached = true; + + // Make sure everything has the right size/position. + SendMessage(hostWindow, WM_SIZE, 0, 0); + if (m_highlight && m_highlight->isShowing()) + m_highlight->update(); +} + void WebInspectorClient::updateWindowTitle() { // FIXME: The series of appends should be replaced with a call to String::format() diff --git a/WebKit/win/WebCoreSupport/WebInspectorClient.h b/WebKit/win/WebCoreSupport/WebInspectorClient.h index a28507a..86317f6 100644 --- a/WebKit/win/WebCoreSupport/WebInspectorClient.h +++ b/WebKit/win/WebCoreSupport/WebInspectorClient.h @@ -71,6 +71,9 @@ public: private: ~WebInspectorClient(); + void closeWindowWithoutNotifications(); + void showWindowWithoutNotifications(); + void updateWindowTitle(); LRESULT onGetMinMaxInfo(WPARAM, LPARAM); @@ -88,6 +91,7 @@ private: COMPtr<WebView> m_webView; HWND m_webViewHwnd; + bool m_shouldAttachWhenShown; bool m_attached; OwnPtr<WebNodeHighlight> m_highlight; diff --git a/WebKit/win/WebDownload.cpp b/WebKit/win/WebDownload.cpp index 8a2fe8e..0893a73 100644 --- a/WebKit/win/WebDownload.cpp +++ b/WebKit/win/WebDownload.cpp @@ -43,37 +43,29 @@ #include <sys/types.h> #pragma warning(push, 0) -#include <WebCore/AuthenticationCF.h> #include <WebCore/BString.h> #include <WebCore/NotImplemented.h> #include <WebCore/ResourceError.h> #include <WebCore/ResourceHandle.h> #include <WebCore/ResourceRequest.h> #include <WebCore/ResourceResponse.h> -#include <WebCore/SystemTime.h> +#include <wtf/CurrentTime.h> +#include <wtf/StdLibExtras.h> #pragma warning(pop) using namespace WebCore; -// CFURLDownload Callbacks ---------------------------------------------------------------- -static void didStartCallback(CFURLDownloadRef download, const void *clientInfo); -static CFURLRequestRef willSendRequestCallback(CFURLDownloadRef download, CFURLRequestRef request, CFURLResponseRef redirectionResponse, const void *clientInfo); -static void didReceiveAuthenticationChallengeCallback(CFURLDownloadRef download, CFURLAuthChallengeRef challenge, const void *clientInfo); -static void didReceiveResponseCallback(CFURLDownloadRef download, CFURLResponseRef response, const void *clientInfo); -static void willResumeWithResponseCallback(CFURLDownloadRef download, CFURLResponseRef response, UInt64 startingByte, const void *clientInfo); -static void didReceiveDataCallback(CFURLDownloadRef download, CFIndex length, const void *clientInfo); -static Boolean shouldDecodeDataOfMIMETypeCallback(CFURLDownloadRef download, CFStringRef encodingType, const void *clientInfo); -static void decideDestinationWithSuggestedObjectNameCallback(CFURLDownloadRef download, CFStringRef objectName, const void *clientInfo); -static void didCreateDestinationCallback(CFURLDownloadRef download, CFURLRef path, const void *clientInfo); -static void didFinishCallback(CFURLDownloadRef download, const void *clientInfo); -static void didFailCallback(CFURLDownloadRef download, CFErrorRef error, const void *clientInfo); - // Download Bundle file utilities ---------------------------------------------------------------- -static const String BundleExtension(".download"); -static UInt32 BundleMagicNumber = 0xDECAF4EA; +const String& WebDownload::bundleExtension() +{ + DEFINE_STATIC_LOCAL(const String, bundleExtension, (".download")); + return bundleExtension; +} -static CFDataRef extractResumeDataFromBundle(const String& bundlePath); -static HRESULT appendResumeDataToBundle(CFDataRef resumeData, const String& bundlePath); +UInt32 WebDownload::bundleMagicNumber() +{ + return 0xDECAF4EA; +} // WebDownload ---------------------------------------------------------------- @@ -84,57 +76,6 @@ WebDownload::WebDownload() gClassNameCount.add("WebDownload"); } -void WebDownload::init(ResourceHandle* handle, const ResourceRequest& request, const ResourceResponse& response, IWebDownloadDelegate* delegate) -{ - m_delegate = delegate ? delegate : DefaultDownloadDelegate::sharedInstance(); - CFURLConnectionRef connection = handle->connection(); - if (!connection) { - LOG_ERROR("WebDownload::WebDownload(ResourceHandle*,...) called with an inactive ResourceHandle"); - return; - } - - CFURLDownloadClient client = {0, this, 0, 0, 0, didStartCallback, willSendRequestCallback, didReceiveAuthenticationChallengeCallback, - didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback, - decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback}; - - m_request.adoptRef(WebMutableURLRequest::createInstance(request)); - m_download.adoptCF(CFURLDownloadCreateAndStartWithLoadingConnection(0, connection, request.cfURLRequest(), response.cfURLResponse(), &client)); - - // It is possible for CFURLDownloadCreateAndStartWithLoadingConnection() to fail if the passed in CFURLConnection is not in a "downloadable state" - // However, we should never hit that case - if (!m_download) { - ASSERT_NOT_REACHED(); - LOG_ERROR("WebDownload - Failed to create WebDownload from existing connection (%s)", request.url().string().utf8().data()); - } else - LOG(Download, "WebDownload - Created WebDownload %p from existing connection (%s)", this, request.url().string().utf8().data()); - - // The CFURLDownload either starts successfully and retains the CFURLConnection, - // or it fails to creating and we have a now-useless connection with a dangling ref. - // Either way, we need to release the connection to balance out ref counts - handle->releaseConnectionForDownload(); - CFRelease(connection); -} - -void WebDownload::init(const KURL& url, IWebDownloadDelegate* delegate) -{ - m_delegate = delegate ? delegate : DefaultDownloadDelegate::sharedInstance(); - LOG_ERROR("Delegate is %p", m_delegate.get()); - - ResourceRequest request(url); - CFURLRequestRef cfRequest = request.cfURLRequest(); - - CFURLDownloadClient client = {0, this, 0, 0, 0, didStartCallback, willSendRequestCallback, didReceiveAuthenticationChallengeCallback, - didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback, - decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback}; - m_request.adoptRef(WebMutableURLRequest::createInstance(request)); - m_download.adoptCF(CFURLDownloadCreate(0, cfRequest, &client)); - - CFURLDownloadScheduleWithCurrentMessageQueue(m_download.get()); - CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), ResourceHandle::loaderRunLoop(), kCFRunLoopDefaultMode); - - LOG(Download, "WebDownload - Initialized download of url %s in WebDownload %p", url.string().utf8().data(), this); -} - WebDownload::~WebDownload() { LOG(Download, "WebDownload - Destroying download (%p)", this); @@ -202,89 +143,6 @@ ULONG STDMETHODCALLTYPE WebDownload::Release(void) // IWebDownload ------------------------------------------------------------------- -HRESULT STDMETHODCALLTYPE WebDownload::initWithRequest( - /* [in] */ IWebURLRequest* request, - /* [in] */ IWebDownloadDelegate* delegate) -{ - COMPtr<WebMutableURLRequest> webRequest; - if (!request || FAILED(request->QueryInterface(&webRequest))) { - LOG(Download, "WebDownload - initWithRequest failed - not a WebMutableURLRequest"); - return E_FAIL; - } - - if (!delegate) - return E_FAIL; - m_delegate = delegate; - LOG(Download, "Delegate is %p", m_delegate.get()); - - RetainPtr<CFURLRequestRef> cfRequest = webRequest->resourceRequest().cfURLRequest(); - - CFURLDownloadClient client = {0, this, 0, 0, 0, didStartCallback, willSendRequestCallback, didReceiveAuthenticationChallengeCallback, - didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback, - decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback}; - m_request.adoptRef(WebMutableURLRequest::createInstance(webRequest.get())); - m_download.adoptCF(CFURLDownloadCreate(0, cfRequest.get(), &client)); - - // If for some reason the download failed to create, - // we have particular cleanup to do - if (!m_download) { - m_request = 0; - return E_FAIL; - } - - CFURLDownloadScheduleWithCurrentMessageQueue(m_download.get()); - CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), ResourceHandle::loaderRunLoop(), kCFRunLoopDefaultMode); - - LOG(Download, "WebDownload - initWithRequest complete, started download of url %s", webRequest->resourceRequest().url().string().utf8().data()); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE WebDownload::initToResumeWithBundle( - /* [in] */ BSTR bundlePath, - /* [in] */ IWebDownloadDelegate* delegate) -{ - LOG(Download, "Attempting resume of download bundle %s", String(bundlePath, SysStringLen(bundlePath)).ascii().data()); - - RetainPtr<CFDataRef> resumeData(AdoptCF, extractResumeDataFromBundle(String(bundlePath, SysStringLen(bundlePath)))); - - if (!resumeData) - return E_FAIL; - - if (!delegate) - return E_FAIL; - m_delegate = delegate; - LOG(Download, "Delegate is %p", m_delegate.get()); - - CFURLDownloadClient client = {0, this, 0, 0, 0, didStartCallback, willSendRequestCallback, didReceiveAuthenticationChallengeCallback, - didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback, - decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback}; - - RetainPtr<CFURLRef> pathURL(AdoptCF, MarshallingHelpers::PathStringToFileCFURLRef(String(bundlePath, SysStringLen(bundlePath)))); - ASSERT(pathURL); - - m_download.adoptCF(CFURLDownloadCreateWithResumeData(0, resumeData.get(), pathURL.get(), &client)); - - if (!m_download) { - LOG(Download, "Failed to create CFURLDownloadRef for resume"); - return E_FAIL; - } - - m_bundlePath = String(bundlePath, SysStringLen(bundlePath)); - // Attempt to remove the ".download" extension from the bundle for the final file destination - // Failing that, we clear m_destination and will ask the delegate later once the download starts - if (m_bundlePath.endsWith(BundleExtension, false)) { - m_destination = m_bundlePath.copy(); - m_destination.truncate(m_destination.length() - BundleExtension.length()); - } else - m_destination = String(); - - CFURLDownloadScheduleWithCurrentMessageQueue(m_download.get()); - CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), ResourceHandle::loaderRunLoop(), kCFRunLoopDefaultMode); - - LOG(Download, "WebDownload - initWithRequest complete, resumed download of bundle %s", String(bundlePath, SysStringLen(bundlePath)).ascii().data()); - return S_OK; -} - HRESULT STDMETHODCALLTYPE WebDownload::canResumeDownloadDecodedWithEncodingMIMEType( /* [in] */ BSTR, /* [out, retval] */ BOOL*) @@ -293,70 +151,6 @@ HRESULT STDMETHODCALLTYPE WebDownload::canResumeDownloadDecodedWithEncodingMIMET return E_FAIL; } -HRESULT STDMETHODCALLTYPE WebDownload::start() -{ - LOG(Download, "WebDownload - Starting download (%p)", this); - if (!m_download) - return E_FAIL; - - CFURLDownloadStart(m_download.get()); - // FIXME: 4950477 - CFURLDownload neglects to make the didStart() client call upon starting the download. - // This is a somewhat critical call, so we'll fake it for now! - didStart(); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE WebDownload::cancel() -{ - LOG(Download, "WebDownload - Cancelling download (%p)", this); - if (!m_download) - return E_FAIL; - - CFURLDownloadCancel(m_download.get()); - m_download = 0; - return S_OK; -} - -HRESULT STDMETHODCALLTYPE WebDownload::cancelForResume() -{ - LOG(Download, "WebDownload - Cancelling download (%p), writing resume information to file if possible", this); - ASSERT(m_download); - if (!m_download) - return E_FAIL; - - HRESULT hr = S_OK; - RetainPtr<CFDataRef> resumeData; - if (m_destination.isEmpty()) { - CFURLDownloadCancel(m_download.get()); - goto exit; - } - - CFURLDownloadSetDeletesUponFailure(m_download.get(), false); - CFURLDownloadCancel(m_download.get()); - - resumeData = CFURLDownloadCopyResumeData(m_download.get()); - if (!resumeData) { - LOG(Download, "WebDownload - Unable to create resume data for download (%p)", this); - goto exit; - } - - appendResumeDataToBundle(resumeData.get(), m_bundlePath); - -exit: - m_download = 0; - return hr; -} - -HRESULT STDMETHODCALLTYPE WebDownload::deletesFileUponFailure( - /* [out, retval] */ BOOL* result) -{ - if (!m_download) - return E_FAIL; - *result = CFURLDownloadDeletesUponFailure(m_download.get()); - return S_OK; -} - HRESULT STDMETHODCALLTYPE WebDownload::bundlePathForTargetPath( /* [in] */ BSTR targetPath, /* [out, retval] */ BSTR* bundlePath) @@ -371,10 +165,10 @@ HRESULT STDMETHODCALLTYPE WebDownload::bundlePathForTargetPath( if (bundle[bundle.length()-1] == '/') bundle.truncate(1); - bundle += BundleExtension; + bundle += bundleExtension(); *bundlePath = SysAllocStringLen(bundle.characters(), bundle.length()); if (!*bundlePath) - return E_FAIL; + return E_FAIL; return S_OK; } @@ -389,275 +183,9 @@ HRESULT STDMETHODCALLTYPE WebDownload::request( return S_OK; } -HRESULT STDMETHODCALLTYPE WebDownload::setDeletesFileUponFailure( - /* [in] */ BOOL deletesFileUponFailure) -{ - if (!m_download) - return E_FAIL; - CFURLDownloadSetDeletesUponFailure(m_download.get(), !!deletesFileUponFailure); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE WebDownload::setDestination( - /* [in] */ BSTR path, - /* [in] */ BOOL allowOverwrite) -{ - if (!m_download) - return E_FAIL; - - m_destination = String(path, SysStringLen(path)); - m_bundlePath = m_destination + BundleExtension; - - CFURLRef pathURL = MarshallingHelpers::PathStringToFileCFURLRef(m_bundlePath); - CFURLDownloadSetDestination(m_download.get(), pathURL, !!allowOverwrite); - CFRelease(pathURL); - - LOG(Download, "WebDownload - Set destination to %s", m_bundlePath.ascii().data()); - - return S_OK; -} - -// IWebURLAuthenticationChallengeSender ------------------------------------------------------------------- - -HRESULT STDMETHODCALLTYPE WebDownload::cancelAuthenticationChallenge( - /* [in] */ IWebURLAuthenticationChallenge*) -{ - if (m_download) { - CFURLDownloadCancel(m_download.get()); - m_download = 0; - } - - // FIXME: Do we need a URL or description for this error code? - ResourceError error(String(WebURLErrorDomain), WebURLErrorUserCancelledAuthentication, "", ""); - COMPtr<WebError> webError(AdoptCOM, WebError::createInstance(error)); - m_delegate->didFailWithError(this, webError.get()); - - return S_OK; -} - -HRESULT STDMETHODCALLTYPE WebDownload::continueWithoutCredentialForAuthenticationChallenge( - /* [in] */ IWebURLAuthenticationChallenge* challenge) -{ - COMPtr<WebURLAuthenticationChallenge> webChallenge(Query, challenge); - if (!webChallenge) - return E_NOINTERFACE; - - if (m_download) - CFURLDownloadUseCredential(m_download.get(), 0, webChallenge->authenticationChallenge().cfURLAuthChallengeRef()); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE WebDownload::useCredential( - /* [in] */ IWebURLCredential* credential, - /* [in] */ IWebURLAuthenticationChallenge* challenge) -{ - COMPtr<WebURLAuthenticationChallenge> webChallenge(Query, challenge); - if (!webChallenge) - return E_NOINTERFACE; - - COMPtr<WebURLCredential> webCredential(Query, credential); - if (!webCredential) - return E_NOINTERFACE; - - RetainPtr<CFURLCredentialRef> cfCredential(AdoptCF, createCF(webCredential->credential())); - - if (m_download) - CFURLDownloadUseCredential(m_download.get(), cfCredential.get(), webChallenge->authenticationChallenge().cfURLAuthChallengeRef()); - return S_OK; -} - -// CFURLDownload Callbacks ------------------------------------------------------------------- -void WebDownload::didStart() -{ -#ifndef NDEBUG - m_startTime = m_dataTime = currentTime(); - m_received = 0; - LOG(Download, "DOWNLOAD - Started %p at %.3f seconds", this, m_startTime); -#endif - if (FAILED(m_delegate->didBegin(this))) - LOG_ERROR("DownloadDelegate->didBegin failed"); -} - -CFURLRequestRef WebDownload::willSendRequest(CFURLRequestRef request, CFURLResponseRef response) -{ - COMPtr<WebMutableURLRequest> webRequest(AdoptCOM, WebMutableURLRequest::createInstance(ResourceRequest(request))); - COMPtr<WebURLResponse> webResponse(AdoptCOM, WebURLResponse::createInstance(ResourceResponse(response))); - COMPtr<IWebMutableURLRequest> finalRequest; - - if (FAILED(m_delegate->willSendRequest(this, webRequest.get(), webResponse.get(), &finalRequest))) - LOG_ERROR("DownloadDelegate->willSendRequest failed"); - - if (!finalRequest) - return 0; - - COMPtr<WebMutableURLRequest> finalWebRequest(AdoptCOM, WebMutableURLRequest::createInstance(finalRequest.get())); - m_request = finalWebRequest.get(); - CFURLRequestRef result = finalWebRequest->resourceRequest().cfURLRequest(); - CFRetain(result); - return result; -} - -void WebDownload::didReceiveAuthenticationChallenge(CFURLAuthChallengeRef challenge) -{ - COMPtr<IWebURLAuthenticationChallenge> webChallenge(AdoptCOM, - WebURLAuthenticationChallenge::createInstance(AuthenticationChallenge(challenge, 0), this)); - - if (SUCCEEDED(m_delegate->didReceiveAuthenticationChallenge(this, webChallenge.get()))) - return; - - cancelAuthenticationChallenge(webChallenge.get()); -} - -void WebDownload::didReceiveResponse(CFURLResponseRef response) -{ - COMPtr<WebURLResponse> webResponse(AdoptCOM, WebURLResponse::createInstance(ResourceResponse(response))); - if (FAILED(m_delegate->didReceiveResponse(this, webResponse.get()))) - LOG_ERROR("DownloadDelegate->didReceiveResponse failed"); -} - -void WebDownload::willResumeWithResponse(CFURLResponseRef response, UInt64 fromByte) -{ - COMPtr<WebURLResponse> webResponse(AdoptCOM, WebURLResponse::createInstance(ResourceResponse(response))); - if (FAILED(m_delegate->willResumeWithResponse(this, webResponse.get(), fromByte))) - LOG_ERROR("DownloadDelegate->willResumeWithResponse failed"); -} - -void WebDownload::didReceiveData(CFIndex length) -{ -#ifndef NDEBUG - m_received += length; - double current = currentTime(); - if (current - m_dataTime > 2.0) - LOG(Download, "DOWNLOAD - %p hanged for %.3f seconds - Received %i bytes for a total of %i", this, current - m_dataTime, length, m_received); - m_dataTime = current; -#endif - if (FAILED(m_delegate->didReceiveDataOfLength(this, length))) - LOG_ERROR("DownloadDelegate->didReceiveData failed"); -} - -bool WebDownload::shouldDecodeDataOfMIMEType(CFStringRef mimeType) -{ - BOOL result; - if (FAILED(m_delegate->shouldDecodeSourceDataOfMIMEType(this, BString(mimeType), &result))) { - LOG_ERROR("DownloadDelegate->shouldDecodeSourceDataOfMIMEType failed"); - return false; - } - return !!result; -} - -void WebDownload::decideDestinationWithSuggestedObjectName(CFStringRef name) -{ - if (FAILED(m_delegate->decideDestinationWithSuggestedFilename(this, BString(name)))) - LOG_ERROR("DownloadDelegate->decideDestinationWithSuggestedObjectName failed"); -} - -void WebDownload::didCreateDestination(CFURLRef destination) -{ - // The concept of the ".download bundle" is internal to the WebDownload, so therefore - // we try to mask the delegate from its existence as much as possible by telling it the final - // destination was created, when in reality the bundle was created - - String createdDestination = MarshallingHelpers::FileCFURLRefToPathString(destination); - - // At this point in receiving CFURLDownload callbacks, we should definitely have the bundle path stored locally - // and it should match with the file that CFURLDownload created - ASSERT(createdDestination == m_bundlePath); - // And we should also always have the final-destination stored - ASSERT(!m_destination.isEmpty()); - - BString path(m_destination); - if (FAILED(m_delegate->didCreateDestination(this, path))) - LOG_ERROR("DownloadDelegate->didCreateDestination failed"); -} - -void WebDownload::didFinish() -{ -#ifndef NDEBUG - LOG(Download, "DOWNLOAD - Finished %p after %i bytes and %.3f seconds", this, m_received, currentTime() - m_startTime); -#endif - - ASSERT(!m_bundlePath.isEmpty() && !m_destination.isEmpty()); - LOG(Download, "WebDownload - Moving file from bundle %s to destination %s", m_bundlePath.ascii().data(), m_destination.ascii().data()); - - // We try to rename the bundle to the final file name. If that fails, we give the delegate one more chance to chose - // the final file name, then we just leave it - if (!MoveFileEx(m_bundlePath.charactersWithNullTermination(), m_destination.charactersWithNullTermination(), 0)) { - LOG_ERROR("Failed to move bundle %s to %s on completion\nError - %i", m_bundlePath.ascii().data(), m_destination.ascii().data(), GetLastError()); - - bool reportBundlePathAsFinalPath = true; - - BString destinationBSTR(m_destination.characters(), m_destination.length()); - if (FAILED(m_delegate->decideDestinationWithSuggestedFilename(this, destinationBSTR))) - LOG_ERROR("delegate->decideDestinationWithSuggestedFilename() failed"); - - // The call to m_delegate->decideDestinationWithSuggestedFilename() should have changed our destination, so we'll try the move - // one last time. - if (!m_destination.isEmpty()) - if (MoveFileEx(m_bundlePath.charactersWithNullTermination(), m_destination.charactersWithNullTermination(), 0)) - reportBundlePathAsFinalPath = false; - - // We either need to tell the delegate our final filename is the bundle filename, or is the file name they just told us to use - if (reportBundlePathAsFinalPath) { - BString bundleBSTR(m_bundlePath); - m_delegate->didCreateDestination(this, bundleBSTR); - } else { - BString finalDestinationBSTR = BString(m_destination); - m_delegate->didCreateDestination(this, finalDestinationBSTR); - } - } - - // It's extremely likely the call to delegate->didFinish() will deref this, so lets not let that cause our destruction just yet - COMPtr<WebDownload> protect = this; - if (FAILED(m_delegate->didFinish(this))) - LOG_ERROR("DownloadDelegate->didFinish failed"); - - m_download = 0; -} - -void WebDownload::didFail(CFErrorRef error) -{ - COMPtr<WebError> webError(AdoptCOM, WebError::createInstance(ResourceError(error))); - if (FAILED(m_delegate->didFailWithError(this, webError.get()))) - LOG_ERROR("DownloadDelegate->didFailWithError failed"); -} - -// CFURLDownload Callbacks ---------------------------------------------------------------- -void didStartCallback(CFURLDownloadRef, const void *clientInfo) -{ ((WebDownload*)clientInfo)->didStart(); } - -CFURLRequestRef willSendRequestCallback(CFURLDownloadRef, CFURLRequestRef request, CFURLResponseRef redirectionResponse, const void *clientInfo) -{ return ((WebDownload*)clientInfo)->willSendRequest(request, redirectionResponse); } - -void didReceiveAuthenticationChallengeCallback(CFURLDownloadRef, CFURLAuthChallengeRef challenge, const void *clientInfo) -{ ((WebDownload*)clientInfo)->didReceiveAuthenticationChallenge(challenge); } - -void didReceiveResponseCallback(CFURLDownloadRef, CFURLResponseRef response, const void *clientInfo) -{ ((WebDownload*)clientInfo)->didReceiveResponse(response); } - -void willResumeWithResponseCallback(CFURLDownloadRef, CFURLResponseRef response, UInt64 startingByte, const void *clientInfo) -{ ((WebDownload*)clientInfo)->willResumeWithResponse(response, startingByte); } - -void didReceiveDataCallback(CFURLDownloadRef, CFIndex length, const void *clientInfo) -{ ((WebDownload*)clientInfo)->didReceiveData(length); } - -Boolean shouldDecodeDataOfMIMETypeCallback(CFURLDownloadRef, CFStringRef encodingType, const void *clientInfo) -{ return ((WebDownload*)clientInfo)->shouldDecodeDataOfMIMEType(encodingType); } - -void decideDestinationWithSuggestedObjectNameCallback(CFURLDownloadRef, CFStringRef objectName, const void *clientInfo) -{ ((WebDownload*)clientInfo)->decideDestinationWithSuggestedObjectName(objectName); } - -void didCreateDestinationCallback(CFURLDownloadRef, CFURLRef path, const void *clientInfo) -{ ((WebDownload*)clientInfo)->didCreateDestination(path); } - -void didFinishCallback(CFURLDownloadRef, const void *clientInfo) -{ ((WebDownload*)clientInfo)->didFinish(); } - -void didFailCallback(CFURLDownloadRef, CFErrorRef error, const void *clientInfo) -{ ((WebDownload*)clientInfo)->didFail(error); } - // Download Bundle file utilities ---------------------------------------------------------------- -static CFDataRef extractResumeDataFromBundle(const String& bundlePath) +CFDataRef WebDownload::extractResumeDataFromBundle(const String& bundlePath) { if (bundlePath.isEmpty()) { LOG_ERROR("Cannot create resume data from empty download bundle path"); @@ -694,8 +222,8 @@ static CFDataRef extractResumeDataFromBundle(const String& bundlePath) goto exit; } - if (footerMagicNumber != BundleMagicNumber) { - LOG_ERROR("Footer's magic number does not match 0x%X - errno(%i)", BundleMagicNumber, errno); + if (footerMagicNumber != bundleMagicNumber()) { + LOG_ERROR("Footer's magic number does not match 0x%X - errno(%i)", bundleMagicNumber(), errno); goto exit; } @@ -748,7 +276,7 @@ exit: return result; } -static HRESULT appendResumeDataToBundle(CFDataRef resumeData, const String& bundlePath) +HRESULT WebDownload::appendResumeDataToBundle(CFDataRef resumeData, const String& bundlePath) { if (!resumeData) { LOG_ERROR("Invalid resume data to write to bundle path"); @@ -788,7 +316,8 @@ static HRESULT appendResumeDataToBundle(CFDataRef resumeData, const String& bund goto exit; } - if (fwrite(&BundleMagicNumber, 4, 1, bundle) != 1) { + const UInt32& magic = bundleMagicNumber(); + if (fwrite(&magic, 4, 1, bundle) != 1) { LOG_ERROR("Failed to write footer magic number to the bundle - errno(%i)", errno); goto exit; } diff --git a/WebKit/win/WebDownload.h b/WebKit/win/WebDownload.h index 6e8e3ee..0d80b80 100644 --- a/WebKit/win/WebDownload.h +++ b/WebKit/win/WebDownload.h @@ -104,6 +104,7 @@ public: /* [in] */ IWebURLCredential* credential, /* [in] */ IWebURLAuthenticationChallenge* challenge); +#if USE(CFNETWORK) // CFURLDownload Callbacks void didStart(); CFURLRequestRef willSendRequest(CFURLRequestRef, CFURLResponseRef); @@ -116,13 +117,21 @@ public: void didCreateDestination(CFURLRef); void didFinish(); void didFail(CFErrorRef); +#endif protected: + static CFDataRef extractResumeDataFromBundle(const WebCore::String&); + static HRESULT appendResumeDataToBundle(CFDataRef, const WebCore::String&); + static const WebCore::String& bundleExtension(); + static UInt32 bundleMagicNumber(); + ULONG m_refCount; WebCore::String m_destination; WebCore::String m_bundlePath; +#if USE(CFNETWORK) RetainPtr<CFURLDownloadRef> m_download; +#endif COMPtr<IWebMutableURLRequest> m_request; COMPtr<IWebDownloadDelegate> m_delegate; diff --git a/WebKit/win/WebDownloadCFNet.cpp b/WebKit/win/WebDownloadCFNet.cpp new file mode 100644 index 0000000..12fd15b --- /dev/null +++ b/WebKit/win/WebDownloadCFNet.cpp @@ -0,0 +1,537 @@ +/* + * Copyright (C) 2007 Apple 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 "WebKitDLL.h" +#include "WebDownload.h" + +#include "CString.h" +#include "DefaultDownloadDelegate.h" +#include "MarshallingHelpers.h" +#include "WebError.h" +#include "WebKit.h" +#include "WebKitLogging.h" +#include "WebMutableURLRequest.h" +#include "WebURLAuthenticationChallenge.h" +#include "WebURLCredential.h" +#include "WebURLResponse.h" + +#include <wtf/platform.h> + +#include <io.h> +#include <sys/stat.h> +#include <sys/types.h> + +#pragma warning(push, 0) +#include <WebCore/AuthenticationCF.h> +#include <WebCore/BString.h> +#include <WebCore/NotImplemented.h> +#include <WebCore/ResourceError.h> +#include <WebCore/ResourceHandle.h> +#include <WebCore/ResourceRequest.h> +#include <WebCore/ResourceResponse.h> +#include <wtf/CurrentTime.h> +#pragma warning(pop) + +using namespace WebCore; + +// CFURLDownload Callbacks ---------------------------------------------------------------- +static void didStartCallback(CFURLDownloadRef download, const void *clientInfo); +static CFURLRequestRef willSendRequestCallback(CFURLDownloadRef download, CFURLRequestRef request, CFURLResponseRef redirectionResponse, const void *clientInfo); +static void didReceiveAuthenticationChallengeCallback(CFURLDownloadRef download, CFURLAuthChallengeRef challenge, const void *clientInfo); +static void didReceiveResponseCallback(CFURLDownloadRef download, CFURLResponseRef response, const void *clientInfo); +static void willResumeWithResponseCallback(CFURLDownloadRef download, CFURLResponseRef response, UInt64 startingByte, const void *clientInfo); +static void didReceiveDataCallback(CFURLDownloadRef download, CFIndex length, const void *clientInfo); +static Boolean shouldDecodeDataOfMIMETypeCallback(CFURLDownloadRef download, CFStringRef encodingType, const void *clientInfo); +static void decideDestinationWithSuggestedObjectNameCallback(CFURLDownloadRef download, CFStringRef objectName, const void *clientInfo); +static void didCreateDestinationCallback(CFURLDownloadRef download, CFURLRef path, const void *clientInfo); +static void didFinishCallback(CFURLDownloadRef download, const void *clientInfo); +static void didFailCallback(CFURLDownloadRef download, CFErrorRef error, const void *clientInfo); + +void WebDownload::init(ResourceHandle* handle, const ResourceRequest& request, const ResourceResponse& response, IWebDownloadDelegate* delegate) +{ + m_delegate = delegate ? delegate : DefaultDownloadDelegate::sharedInstance(); + CFURLConnectionRef connection = handle->connection(); + if (!connection) { + LOG_ERROR("WebDownload::WebDownload(ResourceHandle*,...) called with an inactive ResourceHandle"); + return; + } + + CFURLDownloadClient client = {0, this, 0, 0, 0, didStartCallback, willSendRequestCallback, didReceiveAuthenticationChallengeCallback, + didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback, + decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback}; + + m_request.adoptRef(WebMutableURLRequest::createInstance(request)); + m_download.adoptCF(CFURLDownloadCreateAndStartWithLoadingConnection(0, connection, request.cfURLRequest(), response.cfURLResponse(), &client)); + + // It is possible for CFURLDownloadCreateAndStartWithLoadingConnection() to fail if the passed in CFURLConnection is not in a "downloadable state" + // However, we should never hit that case + if (!m_download) { + ASSERT_NOT_REACHED(); + LOG_ERROR("WebDownload - Failed to create WebDownload from existing connection (%s)", request.url().string().utf8().data()); + } else + LOG(Download, "WebDownload - Created WebDownload %p from existing connection (%s)", this, request.url().string().utf8().data()); + + // The CFURLDownload either starts successfully and retains the CFURLConnection, + // or it fails to creating and we have a now-useless connection with a dangling ref. + // Either way, we need to release the connection to balance out ref counts + handle->releaseConnectionForDownload(); + CFRelease(connection); +} + +void WebDownload::init(const KURL& url, IWebDownloadDelegate* delegate) +{ + m_delegate = delegate ? delegate : DefaultDownloadDelegate::sharedInstance(); + LOG_ERROR("Delegate is %p", m_delegate.get()); + + ResourceRequest request(url); + CFURLRequestRef cfRequest = request.cfURLRequest(); + + CFURLDownloadClient client = {0, this, 0, 0, 0, didStartCallback, willSendRequestCallback, didReceiveAuthenticationChallengeCallback, + didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback, + decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback}; + m_request.adoptRef(WebMutableURLRequest::createInstance(request)); + m_download.adoptCF(CFURLDownloadCreate(0, cfRequest, &client)); + + CFURLDownloadScheduleWithCurrentMessageQueue(m_download.get()); + CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), ResourceHandle::loaderRunLoop(), kCFRunLoopDefaultMode); + + LOG(Download, "WebDownload - Initialized download of url %s in WebDownload %p", url.string().utf8().data(), this); +} + +// IWebDownload ------------------------------------------------------------------- + +HRESULT STDMETHODCALLTYPE WebDownload::initWithRequest( + /* [in] */ IWebURLRequest* request, + /* [in] */ IWebDownloadDelegate* delegate) +{ + COMPtr<WebMutableURLRequest> webRequest; + if (!request || FAILED(request->QueryInterface(&webRequest))) { + LOG(Download, "WebDownload - initWithRequest failed - not a WebMutableURLRequest"); + return E_FAIL; + } + + if (!delegate) + return E_FAIL; + m_delegate = delegate; + LOG(Download, "Delegate is %p", m_delegate.get()); + + RetainPtr<CFURLRequestRef> cfRequest = webRequest->resourceRequest().cfURLRequest(); + + CFURLDownloadClient client = {0, this, 0, 0, 0, didStartCallback, willSendRequestCallback, didReceiveAuthenticationChallengeCallback, + didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback, + decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback}; + m_request.adoptRef(WebMutableURLRequest::createInstance(webRequest.get())); + m_download.adoptCF(CFURLDownloadCreate(0, cfRequest.get(), &client)); + + // If for some reason the download failed to create, + // we have particular cleanup to do + if (!m_download) { + m_request = 0; + return E_FAIL; + } + + CFURLDownloadScheduleWithCurrentMessageQueue(m_download.get()); + CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), ResourceHandle::loaderRunLoop(), kCFRunLoopDefaultMode); + + LOG(Download, "WebDownload - initWithRequest complete, started download of url %s", webRequest->resourceRequest().url().string().utf8().data()); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebDownload::initToResumeWithBundle( + /* [in] */ BSTR bundlePath, + /* [in] */ IWebDownloadDelegate* delegate) +{ + LOG(Download, "Attempting resume of download bundle %s", String(bundlePath, SysStringLen(bundlePath)).ascii().data()); + + RetainPtr<CFDataRef> resumeData(AdoptCF, extractResumeDataFromBundle(String(bundlePath, SysStringLen(bundlePath)))); + + if (!resumeData) + return E_FAIL; + + if (!delegate) + return E_FAIL; + m_delegate = delegate; + LOG(Download, "Delegate is %p", m_delegate.get()); + + CFURLDownloadClient client = {0, this, 0, 0, 0, didStartCallback, willSendRequestCallback, didReceiveAuthenticationChallengeCallback, + didReceiveResponseCallback, willResumeWithResponseCallback, didReceiveDataCallback, shouldDecodeDataOfMIMETypeCallback, + decideDestinationWithSuggestedObjectNameCallback, didCreateDestinationCallback, didFinishCallback, didFailCallback}; + + RetainPtr<CFURLRef> pathURL(AdoptCF, MarshallingHelpers::PathStringToFileCFURLRef(String(bundlePath, SysStringLen(bundlePath)))); + ASSERT(pathURL); + + m_download.adoptCF(CFURLDownloadCreateWithResumeData(0, resumeData.get(), pathURL.get(), &client)); + + if (!m_download) { + LOG(Download, "Failed to create CFURLDownloadRef for resume"); + return E_FAIL; + } + + m_bundlePath = String(bundlePath, SysStringLen(bundlePath)); + // Attempt to remove the ".download" extension from the bundle for the final file destination + // Failing that, we clear m_destination and will ask the delegate later once the download starts + if (m_bundlePath.endsWith(bundleExtension(), false)) { + m_destination = m_bundlePath.copy(); + m_destination.truncate(m_destination.length() - bundleExtension().length()); + } else + m_destination = String(); + + CFURLDownloadScheduleWithCurrentMessageQueue(m_download.get()); + CFURLDownloadScheduleDownloadWithRunLoop(m_download.get(), ResourceHandle::loaderRunLoop(), kCFRunLoopDefaultMode); + + LOG(Download, "WebDownload - initWithRequest complete, resumed download of bundle %s", String(bundlePath, SysStringLen(bundlePath)).ascii().data()); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebDownload::start() +{ + LOG(Download, "WebDownload - Starting download (%p)", this); + if (!m_download) + return E_FAIL; + + CFURLDownloadStart(m_download.get()); + // FIXME: 4950477 - CFURLDownload neglects to make the didStart() client call upon starting the download. + // This is a somewhat critical call, so we'll fake it for now! + didStart(); + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebDownload::cancel() +{ + LOG(Download, "WebDownload - Cancelling download (%p)", this); + if (!m_download) + return E_FAIL; + + CFURLDownloadCancel(m_download.get()); + m_download = 0; + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebDownload::cancelForResume() +{ + LOG(Download, "WebDownload - Cancelling download (%p), writing resume information to file if possible", this); + ASSERT(m_download); + if (!m_download) + return E_FAIL; + + HRESULT hr = S_OK; + RetainPtr<CFDataRef> resumeData; + if (m_destination.isEmpty()) { + CFURLDownloadCancel(m_download.get()); + goto exit; + } + + CFURLDownloadSetDeletesUponFailure(m_download.get(), false); + CFURLDownloadCancel(m_download.get()); + + resumeData = CFURLDownloadCopyResumeData(m_download.get()); + if (!resumeData) { + LOG(Download, "WebDownload - Unable to create resume data for download (%p)", this); + goto exit; + } + + appendResumeDataToBundle(resumeData.get(), m_bundlePath); + +exit: + m_download = 0; + return hr; +} + +HRESULT STDMETHODCALLTYPE WebDownload::deletesFileUponFailure( + /* [out, retval] */ BOOL* result) +{ + if (!m_download) + return E_FAIL; + *result = CFURLDownloadDeletesUponFailure(m_download.get()); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebDownload::setDeletesFileUponFailure( + /* [in] */ BOOL deletesFileUponFailure) +{ + if (!m_download) + return E_FAIL; + CFURLDownloadSetDeletesUponFailure(m_download.get(), !!deletesFileUponFailure); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebDownload::setDestination( + /* [in] */ BSTR path, + /* [in] */ BOOL allowOverwrite) +{ + if (!m_download) + return E_FAIL; + + m_destination = String(path, SysStringLen(path)); + m_bundlePath = m_destination + bundleExtension(); + + CFURLRef pathURL = MarshallingHelpers::PathStringToFileCFURLRef(m_bundlePath); + CFURLDownloadSetDestination(m_download.get(), pathURL, !!allowOverwrite); + CFRelease(pathURL); + + LOG(Download, "WebDownload - Set destination to %s", m_bundlePath.ascii().data()); + + return S_OK; +} + +// IWebURLAuthenticationChallengeSender ------------------------------------------------------------------- + +HRESULT STDMETHODCALLTYPE WebDownload::cancelAuthenticationChallenge( + /* [in] */ IWebURLAuthenticationChallenge*) +{ + if (m_download) { + CFURLDownloadCancel(m_download.get()); + m_download = 0; + } + + // FIXME: Do we need a URL or description for this error code? + ResourceError error(String(WebURLErrorDomain), WebURLErrorUserCancelledAuthentication, "", ""); + COMPtr<WebError> webError(AdoptCOM, WebError::createInstance(error)); + m_delegate->didFailWithError(this, webError.get()); + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebDownload::continueWithoutCredentialForAuthenticationChallenge( + /* [in] */ IWebURLAuthenticationChallenge* challenge) +{ + COMPtr<WebURLAuthenticationChallenge> webChallenge(Query, challenge); + if (!webChallenge) + return E_NOINTERFACE; + + if (m_download) + CFURLDownloadUseCredential(m_download.get(), 0, webChallenge->authenticationChallenge().cfURLAuthChallengeRef()); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebDownload::useCredential( + /* [in] */ IWebURLCredential* credential, + /* [in] */ IWebURLAuthenticationChallenge* challenge) +{ + COMPtr<WebURLAuthenticationChallenge> webChallenge(Query, challenge); + if (!webChallenge) + return E_NOINTERFACE; + + COMPtr<WebURLCredential> webCredential(Query, credential); + if (!webCredential) + return E_NOINTERFACE; + + RetainPtr<CFURLCredentialRef> cfCredential(AdoptCF, createCF(webCredential->credential())); + + if (m_download) + CFURLDownloadUseCredential(m_download.get(), cfCredential.get(), webChallenge->authenticationChallenge().cfURLAuthChallengeRef()); + return S_OK; +} + +// CFURLDownload Callbacks ------------------------------------------------------------------- +void WebDownload::didStart() +{ +#ifndef NDEBUG + m_startTime = m_dataTime = currentTime(); + m_received = 0; + LOG(Download, "DOWNLOAD - Started %p at %.3f seconds", this, m_startTime); +#endif + if (FAILED(m_delegate->didBegin(this))) + LOG_ERROR("DownloadDelegate->didBegin failed"); +} + +CFURLRequestRef WebDownload::willSendRequest(CFURLRequestRef request, CFURLResponseRef response) +{ + COMPtr<WebMutableURLRequest> webRequest(AdoptCOM, WebMutableURLRequest::createInstance(ResourceRequest(request))); + COMPtr<WebURLResponse> webResponse(AdoptCOM, WebURLResponse::createInstance(ResourceResponse(response))); + COMPtr<IWebMutableURLRequest> finalRequest; + + if (FAILED(m_delegate->willSendRequest(this, webRequest.get(), webResponse.get(), &finalRequest))) + LOG_ERROR("DownloadDelegate->willSendRequest failed"); + + if (!finalRequest) + return 0; + + COMPtr<WebMutableURLRequest> finalWebRequest(AdoptCOM, WebMutableURLRequest::createInstance(finalRequest.get())); + m_request = finalWebRequest.get(); + CFURLRequestRef result = finalWebRequest->resourceRequest().cfURLRequest(); + CFRetain(result); + return result; +} + +void WebDownload::didReceiveAuthenticationChallenge(CFURLAuthChallengeRef challenge) +{ + COMPtr<IWebURLAuthenticationChallenge> webChallenge(AdoptCOM, + WebURLAuthenticationChallenge::createInstance(AuthenticationChallenge(challenge, 0), this)); + + if (SUCCEEDED(m_delegate->didReceiveAuthenticationChallenge(this, webChallenge.get()))) + return; + + cancelAuthenticationChallenge(webChallenge.get()); +} + +void WebDownload::didReceiveResponse(CFURLResponseRef response) +{ + COMPtr<WebURLResponse> webResponse(AdoptCOM, WebURLResponse::createInstance(ResourceResponse(response))); + if (FAILED(m_delegate->didReceiveResponse(this, webResponse.get()))) + LOG_ERROR("DownloadDelegate->didReceiveResponse failed"); +} + +void WebDownload::willResumeWithResponse(CFURLResponseRef response, UInt64 fromByte) +{ + COMPtr<WebURLResponse> webResponse(AdoptCOM, WebURLResponse::createInstance(ResourceResponse(response))); + if (FAILED(m_delegate->willResumeWithResponse(this, webResponse.get(), fromByte))) + LOG_ERROR("DownloadDelegate->willResumeWithResponse failed"); +} + +void WebDownload::didReceiveData(CFIndex length) +{ +#ifndef NDEBUG + m_received += length; + double current = currentTime(); + if (current - m_dataTime > 2.0) + LOG(Download, "DOWNLOAD - %p hanged for %.3f seconds - Received %i bytes for a total of %i", this, current - m_dataTime, length, m_received); + m_dataTime = current; +#endif + if (FAILED(m_delegate->didReceiveDataOfLength(this, length))) + LOG_ERROR("DownloadDelegate->didReceiveData failed"); +} + +bool WebDownload::shouldDecodeDataOfMIMEType(CFStringRef mimeType) +{ + BOOL result; + if (FAILED(m_delegate->shouldDecodeSourceDataOfMIMEType(this, BString(mimeType), &result))) { + LOG_ERROR("DownloadDelegate->shouldDecodeSourceDataOfMIMEType failed"); + return false; + } + return !!result; +} + +void WebDownload::decideDestinationWithSuggestedObjectName(CFStringRef name) +{ + if (FAILED(m_delegate->decideDestinationWithSuggestedFilename(this, BString(name)))) + LOG_ERROR("DownloadDelegate->decideDestinationWithSuggestedObjectName failed"); +} + +void WebDownload::didCreateDestination(CFURLRef destination) +{ + // The concept of the ".download bundle" is internal to the WebDownload, so therefore + // we try to mask the delegate from its existence as much as possible by telling it the final + // destination was created, when in reality the bundle was created + + String createdDestination = MarshallingHelpers::FileCFURLRefToPathString(destination); + + // At this point in receiving CFURLDownload callbacks, we should definitely have the bundle path stored locally + // and it should match with the file that CFURLDownload created + ASSERT(createdDestination == m_bundlePath); + // And we should also always have the final-destination stored + ASSERT(!m_destination.isEmpty()); + + BString path(m_destination); + if (FAILED(m_delegate->didCreateDestination(this, path))) + LOG_ERROR("DownloadDelegate->didCreateDestination failed"); +} + +void WebDownload::didFinish() +{ +#ifndef NDEBUG + LOG(Download, "DOWNLOAD - Finished %p after %i bytes and %.3f seconds", this, m_received, currentTime() - m_startTime); +#endif + + ASSERT(!m_bundlePath.isEmpty() && !m_destination.isEmpty()); + LOG(Download, "WebDownload - Moving file from bundle %s to destination %s", m_bundlePath.ascii().data(), m_destination.ascii().data()); + + // We try to rename the bundle to the final file name. If that fails, we give the delegate one more chance to chose + // the final file name, then we just leave it + if (!MoveFileEx(m_bundlePath.charactersWithNullTermination(), m_destination.charactersWithNullTermination(), 0)) { + LOG_ERROR("Failed to move bundle %s to %s on completion\nError - %i", m_bundlePath.ascii().data(), m_destination.ascii().data(), GetLastError()); + + bool reportBundlePathAsFinalPath = true; + + BString destinationBSTR(m_destination.characters(), m_destination.length()); + if (FAILED(m_delegate->decideDestinationWithSuggestedFilename(this, destinationBSTR))) + LOG_ERROR("delegate->decideDestinationWithSuggestedFilename() failed"); + + // The call to m_delegate->decideDestinationWithSuggestedFilename() should have changed our destination, so we'll try the move + // one last time. + if (!m_destination.isEmpty()) + if (MoveFileEx(m_bundlePath.charactersWithNullTermination(), m_destination.charactersWithNullTermination(), 0)) + reportBundlePathAsFinalPath = false; + + // We either need to tell the delegate our final filename is the bundle filename, or is the file name they just told us to use + if (reportBundlePathAsFinalPath) { + BString bundleBSTR(m_bundlePath); + m_delegate->didCreateDestination(this, bundleBSTR); + } else { + BString finalDestinationBSTR = BString(m_destination); + m_delegate->didCreateDestination(this, finalDestinationBSTR); + } + } + + // It's extremely likely the call to delegate->didFinish() will deref this, so lets not let that cause our destruction just yet + COMPtr<WebDownload> protect = this; + if (FAILED(m_delegate->didFinish(this))) + LOG_ERROR("DownloadDelegate->didFinish failed"); + + m_download = 0; +} + +void WebDownload::didFail(CFErrorRef error) +{ + COMPtr<WebError> webError(AdoptCOM, WebError::createInstance(ResourceError(error))); + if (FAILED(m_delegate->didFailWithError(this, webError.get()))) + LOG_ERROR("DownloadDelegate->didFailWithError failed"); +} + +// CFURLDownload Callbacks ---------------------------------------------------------------- +void didStartCallback(CFURLDownloadRef, const void *clientInfo) +{ ((WebDownload*)clientInfo)->didStart(); } + +CFURLRequestRef willSendRequestCallback(CFURLDownloadRef, CFURLRequestRef request, CFURLResponseRef redirectionResponse, const void *clientInfo) +{ return ((WebDownload*)clientInfo)->willSendRequest(request, redirectionResponse); } + +void didReceiveAuthenticationChallengeCallback(CFURLDownloadRef, CFURLAuthChallengeRef challenge, const void *clientInfo) +{ ((WebDownload*)clientInfo)->didReceiveAuthenticationChallenge(challenge); } + +void didReceiveResponseCallback(CFURLDownloadRef, CFURLResponseRef response, const void *clientInfo) +{ ((WebDownload*)clientInfo)->didReceiveResponse(response); } + +void willResumeWithResponseCallback(CFURLDownloadRef, CFURLResponseRef response, UInt64 startingByte, const void *clientInfo) +{ ((WebDownload*)clientInfo)->willResumeWithResponse(response, startingByte); } + +void didReceiveDataCallback(CFURLDownloadRef, CFIndex length, const void *clientInfo) +{ ((WebDownload*)clientInfo)->didReceiveData(length); } + +Boolean shouldDecodeDataOfMIMETypeCallback(CFURLDownloadRef, CFStringRef encodingType, const void *clientInfo) +{ return ((WebDownload*)clientInfo)->shouldDecodeDataOfMIMEType(encodingType); } + +void decideDestinationWithSuggestedObjectNameCallback(CFURLDownloadRef, CFStringRef objectName, const void *clientInfo) +{ ((WebDownload*)clientInfo)->decideDestinationWithSuggestedObjectName(objectName); } + +void didCreateDestinationCallback(CFURLDownloadRef, CFURLRef path, const void *clientInfo) +{ ((WebDownload*)clientInfo)->didCreateDestination(path); } + +void didFinishCallback(CFURLDownloadRef, const void *clientInfo) +{ ((WebDownload*)clientInfo)->didFinish(); } + +void didFailCallback(CFURLDownloadRef, CFErrorRef error, const void *clientInfo) +{ ((WebDownload*)clientInfo)->didFail(error); } diff --git a/WebKit/win/WebDownloadCurl.cpp b/WebKit/win/WebDownloadCurl.cpp new file mode 100644 index 0000000..608830b --- /dev/null +++ b/WebKit/win/WebDownloadCurl.cpp @@ -0,0 +1,151 @@ +/* + * Copyright (C) 2008 Brent Fulgham <bfulgham@gmail.com>. 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 "WebKitDLL.h" +#include "WebDownload.h" + +#include "CString.h" +#include "DefaultDownloadDelegate.h" +#include "MarshallingHelpers.h" +#include "WebError.h" +#include "WebKit.h" +#include "WebKitLogging.h" +#include "WebMutableURLRequest.h" +#include "WebURLAuthenticationChallenge.h" +#include "WebURLCredential.h" +#include "WebURLResponse.h" + +#include <wtf/platform.h> + +#include <io.h> +#include <sys/stat.h> +#include <sys/types.h> + +#pragma warning(push, 0) +#include <WebCore/BString.h> +#include <WebCore/NotImplemented.h> +#include <WebCore/ResourceError.h> +#include <WebCore/ResourceHandle.h> +#include <WebCore/ResourceRequest.h> +#include <WebCore/ResourceResponse.h> +#include <WebCore/SystemTime.h> +#pragma warning(pop) + +using namespace WebCore; + +// WebDownload ---------------------------------------------------------------- + +void WebDownload::init(ResourceHandle* handle, const ResourceRequest& request, const ResourceResponse& response, IWebDownloadDelegate* delegate) +{ + notImplemented(); +} + +void WebDownload::init(const KURL& url, IWebDownloadDelegate* delegate) +{ + notImplemented(); +} + +// IWebDownload ------------------------------------------------------------------- + +HRESULT STDMETHODCALLTYPE WebDownload::initWithRequest( + /* [in] */ IWebURLRequest* request, + /* [in] */ IWebDownloadDelegate* delegate) +{ + notImplemented(); + return E_FAIL; +} + +HRESULT STDMETHODCALLTYPE WebDownload::initToResumeWithBundle( + /* [in] */ BSTR bundlePath, + /* [in] */ IWebDownloadDelegate* delegate) +{ + notImplemented(); + return E_FAIL; +} + +HRESULT STDMETHODCALLTYPE WebDownload::start() +{ + notImplemented(); + return E_FAIL; +} + +HRESULT STDMETHODCALLTYPE WebDownload::cancel() +{ + notImplemented(); + return E_FAIL; +} + +HRESULT STDMETHODCALLTYPE WebDownload::cancelForResume() +{ + notImplemented(); + return E_FAIL; +} + +HRESULT STDMETHODCALLTYPE WebDownload::deletesFileUponFailure( + /* [out, retval] */ BOOL* result) +{ + notImplemented(); + return E_FAIL; +} + +HRESULT STDMETHODCALLTYPE WebDownload::setDeletesFileUponFailure( + /* [in] */ BOOL deletesFileUponFailure) +{ + notImplemented(); + return E_FAIL; +} + +HRESULT STDMETHODCALLTYPE WebDownload::setDestination( + /* [in] */ BSTR path, + /* [in] */ BOOL allowOverwrite) +{ + notImplemented(); + return E_FAIL; +} + +// IWebURLAuthenticationChallengeSender ------------------------------------------------------------------- + +HRESULT STDMETHODCALLTYPE WebDownload::cancelAuthenticationChallenge( + /* [in] */ IWebURLAuthenticationChallenge*) +{ + notImplemented(); + return E_FAIL; +} + +HRESULT STDMETHODCALLTYPE WebDownload::continueWithoutCredentialForAuthenticationChallenge( + /* [in] */ IWebURLAuthenticationChallenge* challenge) +{ + notImplemented(); + return E_FAIL; +} + +HRESULT STDMETHODCALLTYPE WebDownload::useCredential( + /* [in] */ IWebURLCredential* credential, + /* [in] */ IWebURLAuthenticationChallenge* challenge) +{ + notImplemented(); + return E_FAIL; +} diff --git a/WebKit/win/WebDropSource.cpp b/WebKit/win/WebDropSource.cpp index bc68c6c..47ffd5a 100644 --- a/WebKit/win/WebDropSource.cpp +++ b/WebKit/win/WebDropSource.cpp @@ -34,7 +34,7 @@ #include <WebCore/Frame.h> #include <WebCore/Page.h> #include <WebCore/PlatformMouseEvent.h> -#include <WebCore/SystemTime.h> +#include <wtf/CurrentTime.h> #include <Windows.h> diff --git a/WebKit/win/WebFrame.cpp b/WebKit/win/WebFrame.cpp index 701d1ab..009111a 100644 --- a/WebKit/win/WebFrame.cpp +++ b/WebKit/win/WebFrame.cpp @@ -313,6 +313,7 @@ HRESULT STDMETHODCALLTYPE WebFrame::paintDocumentRectToContext( HDC dc = (HDC)(ULONG64)deviceContext; GraphicsContext gc(dc); + gc.setShouldIncludeChildWindows(true); gc.save(); LONG width = rect.right - rect.left; LONG height = rect.bottom - rect.top; @@ -475,7 +476,7 @@ HRESULT STDMETHODCALLTYPE WebFrame::loadRequest( if (!coreFrame) return E_FAIL; - coreFrame->loader()->load(requestImpl->resourceRequest()); + coreFrame->loader()->load(requestImpl->resourceRequest(), false); return S_OK; } @@ -486,15 +487,20 @@ void WebFrame::loadData(PassRefPtr<WebCore::SharedBuffer> data, BSTR mimeType, B mimeTypeString = "text/html"; String encodingString(textEncodingName, SysStringLen(textEncodingName)); - KURL baseKURL(String(baseURL ? baseURL : L"", SysStringLen(baseURL))); - KURL failingKURL(String(failingURL, SysStringLen(failingURL))); + + // FIXME: We should really be using MarshallingHelpers::BSTRToKURL here, + // but that would turn a null BSTR into a null KURL, and we crash inside of + // WebCore if we use a null KURL in constructing the ResourceRequest. + KURL baseKURL = KURL(KURL(), String(baseURL ? baseURL : L"", SysStringLen(baseURL))); + + KURL failingKURL = MarshallingHelpers::BSTRToKURL(failingURL); ResourceRequest request(baseKURL); SubstituteData substituteData(data, mimeTypeString, encodingString, failingKURL); // This method is only called from IWebFrame methods, so don't ASSERT that the Frame pointer isn't null. if (Frame* coreFrame = core(this)) - coreFrame->loader()->load(request, substituteData); + coreFrame->loader()->load(request, substituteData, false); } @@ -910,8 +916,7 @@ HRESULT STDMETHODCALLTYPE WebFrame::selectedString( if (!coreFrame) return E_FAIL; - String text = coreFrame->selectedText(); - text.replace('\\', coreFrame->backslashAsCurrencySymbol()); + String text = coreFrame->displayStringModifiedByEncoding(coreFrame->selectedText()); *result = BString(text).release(); return S_OK; @@ -1322,10 +1327,6 @@ String WebFrame::userAgent(const KURL& url) return d->webView->userAgentForKURL(url); } -void WebFrame::transitionToCommittedFromCachedPage(CachedPage*) -{ -} - void WebFrame::saveViewStateToItem(HistoryItem*) { } @@ -1343,10 +1344,10 @@ ResourceError WebFrame::blockedError(const ResourceRequest& request) return ResourceError(String(WebKitErrorDomain), WebKitErrorCannotUseRestrictedPort, request.url().string(), String()); } -ResourceError WebFrame::cannotShowURLError(const ResourceRequest&) +ResourceError WebFrame::cannotShowURLError(const ResourceRequest& request) { - notImplemented(); - return ResourceError(); + // FIXME: Need to implement the String descriptions for errors in the WebKitErrorDomain and have them localized + return ResourceError(String(WebKitErrorDomain), WebKitErrorCannotShowURL, request.url().string(), String()); } ResourceError WebFrame::interruptForPolicyChangeError(const ResourceRequest& request) @@ -1812,6 +1813,7 @@ HRESULT STDMETHODCALLTYPE WebFrame::spoolPages( float headerHeight = 0, footerHeight = 0; headerAndFooterHeights(&headerHeight, &footerHeight); GraphicsContext spoolCtx(pctx); + spoolCtx.setShouldIncludeChildWindows(true); for (UINT ii = startPage; ii < endPage; ii++) { IntRect pageRect = m_pageRects[ii]; @@ -2036,13 +2038,10 @@ void WebFrame::updateBackground() { Color backgroundColor = webView()->transparent() ? Color::transparent : Color::white; Frame* coreFrame = core(this); - for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) { - FrameView* view = frame->view(); - if (!view) - continue; - view->setTransparent(webView()->transparent()); - view->setBaseBackgroundColor(backgroundColor); - } + if (!coreFrame || !coreFrame->view()) + return; + + coreFrame->view()->updateBackgroundRecursively(backgroundColor, webView()->transparent()); } diff --git a/WebKit/win/WebFrame.h b/WebKit/win/WebFrame.h index 1bd7478..bf234d3 100644 --- a/WebKit/win/WebFrame.h +++ b/WebKit/win/WebFrame.h @@ -260,7 +260,6 @@ public: virtual void didFinishLoad(); virtual void prepareForDataSourceReplacement(); virtual WebCore::String userAgent(const WebCore::KURL&); - virtual void transitionToCommittedFromCachedPage(WebCore::CachedPage*); virtual void saveViewStateToItem(WebCore::HistoryItem *); virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&); virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&); diff --git a/WebKit/win/WebHistory.cpp b/WebKit/win/WebHistory.cpp index d0bc07a..5ee2e32 100644 --- a/WebKit/win/WebHistory.cpp +++ b/WebKit/win/WebHistory.cpp @@ -39,6 +39,7 @@ #include <wtf/Vector.h> #include <WebCore/KURL.h> #include <WebCore/PageGroup.h> +#include <WebCore/HistoryItem.h> #pragma warning( pop ) using namespace WebCore; @@ -148,6 +149,8 @@ HRESULT STDMETHODCALLTYPE WebHistory::QueryInterface(REFIID riid, void** ppvObje *ppvObject = static_cast<IWebHistory*>(this); else if (IsEqualGUID(riid, IID_IWebHistory)) *ppvObject = static_cast<IWebHistory*>(this); + else if (IsEqualGUID(riid, IID_IWebHistoryPrivate)) + *ppvObject = static_cast<IWebHistoryPrivate*>(this); else return E_NOINTERFACE; @@ -310,8 +313,10 @@ HRESULT WebHistory::loadHistoryGutsFromURL(CFURLRef url, CFMutableArrayRef disca if (ageLimitPassed || itemLimitPassed) CFArrayAppendValue(discardedItems, item.get()); else { - addItem(item.get()); // ref is added inside addItem - ++numberOfItemsLoaded; + bool added; + addItem(item.get(), true, &added); // ref is added inside addItem + if (added) + ++numberOfItemsLoaded; if (numberOfItemsLoaded == itemCountLimit) itemLimitPassed = true; } @@ -428,7 +433,7 @@ HRESULT STDMETHODCALLTYPE WebHistory::addItems( HRESULT hr; for (int i = itemCount - 1; i >= 0; --i) { - hr = addItem(items[i]); + hr = addItem(items[i], false, 0); if (FAILED(hr)) return hr; } @@ -454,11 +459,18 @@ HRESULT STDMETHODCALLTYPE WebHistory::removeAllItems( void) { CFArrayRemoveAllValues(m_entriesByDate.get()); CFArrayRemoveAllValues(m_datesWithEntries.get()); + + CFIndex itemCount = CFDictionaryGetCount(m_entriesByURL.get()); + Vector<IWebHistoryItem*> itemsVector(itemCount); + CFDictionaryGetKeysAndValues(m_entriesByURL.get(), 0, (const void**)itemsVector.data()); + RetainPtr<CFArrayRef> allItems(AdoptCF, CFArrayCreate(kCFAllocatorDefault, (const void**)itemsVector.data(), itemCount, &MarshallingHelpers::kIUnknownArrayCallBacks)); + CFDictionaryRemoveAllValues(m_entriesByURL.get()); PageGroup::removeAllVisitedLinks(); - return postNotification(kWebHistoryAllItemsRemovedNotification); + CFDictionaryPropertyBag* userInfo = createUserInfoFromArray(getNotificationString(kWebHistoryAllItemsRemovedNotification), allItems.get()); + return postNotification(kWebHistoryAllItemsRemovedNotification, userInfo); } HRESULT STDMETHODCALLTYPE WebHistory::orderedLastVisitedDays( @@ -520,15 +532,37 @@ HRESULT STDMETHODCALLTYPE WebHistory::orderedItemsLastVisitedOnDay( *count = newCount; for (int i = 0; i < newCount; i++) { IWebHistoryItem* item = (IWebHistoryItem*)CFArrayGetValueAtIndex(entries, i); - if (!item) - return E_FAIL; item->AddRef(); - items[newCount-i-1] = item; // reverse when inserting to get the list sorted oldest to newest + items[newCount - i - 1] = item; // reverse when inserting to get the list sorted oldest to newest } return S_OK; } +HRESULT STDMETHODCALLTYPE WebHistory::allItems( + /* [out][in] */ int* count, + /* [out][retval] */ IWebHistoryItem** items) +{ + int entriesByURLCount = CFDictionaryGetCount(m_entriesByURL.get()); + + if (!items) { + *count = entriesByURLCount; + return S_OK; + } + + if (*count < entriesByURLCount) { + *count = entriesByURLCount; + return E_FAIL; + } + + *count = entriesByURLCount; + CFDictionaryGetKeysAndValues(m_entriesByURL.get(), 0, (const void**)items); + for (int i = 0; i < entriesByURLCount; i++) + items[i]->AddRef(); + + return S_OK; +} + HRESULT STDMETHODCALLTYPE WebHistory::setHistoryItemLimit( /* [in] */ int limit) { @@ -592,7 +626,7 @@ HRESULT WebHistory::removeItem(IWebHistoryItem* entry) return hr; } -HRESULT WebHistory::addItem(IWebHistoryItem* entry) +HRESULT WebHistory::addItem(IWebHistoryItem* entry, bool discardDuplicate, bool* added) { HRESULT hr = S_OK; @@ -611,6 +645,12 @@ HRESULT WebHistory::addItem(IWebHistoryItem* entry) m_entriesByURL.get(), urlString.get())); if (oldEntry) { + if (discardDuplicate) { + if (added) + *added = false; + return S_OK; + } + removeItemForURLString(urlString.get()); // If we already have an item with this URL, we need to merge info that drives the @@ -634,30 +674,82 @@ HRESULT WebHistory::addItem(IWebHistoryItem* entry) hr = postNotification(kWebHistoryItemsAddedNotification, userInfo); releaseUserInfo(userInfo); + if (added) + *added = true; + return hr; } -void WebHistory::addItem(const KURL& url, const String& title) +void WebHistory::visitedURL(const KURL& url, const String& title, const String& httpMethod, bool wasFailure, const KURL& serverRedirectURL, bool isClientRedirect) { - COMPtr<WebHistoryItem> item(AdoptCOM, WebHistoryItem::createInstance()); - if (!item) - return; + if (isClientRedirect) { + ASSERT(serverRedirectURL.isEmpty()); + if (m_lastVisitedEntry) + m_lastVisitedEntry->historyItem()->addRedirectURL(url.string()); + } - SYSTEMTIME currentTime; - GetSystemTime(¤tTime); - DATE lastVisited; - if (!SystemTimeToVariantTime(¤tTime, &lastVisited)) - return; + RetainPtr<CFStringRef> urlString(AdoptCF, url.string().createCFString()); - HRESULT hr = item->initWithURLString(BString(url.string()), BString(title), 0); - if (FAILED(hr)) - return; + IWebHistoryItem* entry = (IWebHistoryItem*) CFDictionaryGetValue(m_entriesByURL.get(), urlString.get()); - hr = item->setLastVisitedTimeInterval(lastVisited); // also increments visitedCount - if (FAILED(hr)) + if (entry) { + COMPtr<IWebHistoryItemPrivate> entryPrivate(Query, entry); + if (!entryPrivate) + return; + + // Remove the item from date caches before changing its last visited date. Otherwise we might get duplicate entries + // as seen in <rdar://problem/6570573>. + removeItemFromDateCaches(entry); + entryPrivate->visitedWithTitle(BString(title)); + } else { + COMPtr<WebHistoryItem> item(AdoptCOM, WebHistoryItem::createInstance()); + if (!item) + return; + + entry = item.get(); + + SYSTEMTIME currentTime; + GetSystemTime(¤tTime); + DATE lastVisited; + if (!SystemTimeToVariantTime(¤tTime, &lastVisited)) + return; + + if (FAILED(entry->initWithURLString(BString(url.string()), BString(title), lastVisited))) + return; + + item->recordInitialVisit(); + + CFDictionarySetValue(m_entriesByURL.get(), urlString.get(), entry); + } + + addItemToDateCaches(entry); + + m_lastVisitedEntry.query(entry); + + COMPtr<IWebHistoryItemPrivate> entryPrivate(Query, entry); + if (!entryPrivate) return; - addItem(item.get()); + entryPrivate->setLastVisitWasFailure(wasFailure); + if (!httpMethod.isEmpty()) + entryPrivate->setLastVisitWasHTTPNonGet(!equalIgnoringCase(httpMethod, "GET")); + + if (!serverRedirectURL.isEmpty()) { + ASSERT(!isClientRedirect); + COMPtr<WebHistoryItem> item(Query, entry); + item->historyItem()->addRedirectURL(serverRedirectURL); + } + + CFDictionaryPropertyBag* userInfo = createUserInfoFromHistoryItem( + getNotificationString(kWebHistoryItemsAddedNotification), entry); + postNotification(kWebHistoryItemsAddedNotification, userInfo); + releaseUserInfo(userInfo); +} + +void WebHistory::visitedURLForRedirectWithoutHistoryItem(const KURL& url) +{ + if (m_lastVisitedEntry) + m_lastVisitedEntry->historyItem()->addRedirectURL(url.string()); } HRESULT WebHistory::itemForURLString( diff --git a/WebKit/win/WebHistory.h b/WebKit/win/WebHistory.h index a49f320..111f6ae 100644 --- a/WebKit/win/WebHistory.h +++ b/WebKit/win/WebHistory.h @@ -42,7 +42,7 @@ namespace WebCore { class WebPreferences; -class WebHistory : public IWebHistory { +class WebHistory : public IWebHistory, public IWebHistoryPrivate { public: static WebHistory* createInstance(); private: @@ -107,9 +107,16 @@ public: virtual HRESULT STDMETHODCALLTYPE historyAgeInDaysLimit( /* [retval][out] */ int* limit); + // IWebHistoryPrivate + + virtual HRESULT STDMETHODCALLTYPE allItems( + /* [out][in] */ int* count, + /* [retval][out] */ IWebHistoryItem** items); + // WebHistory static WebHistory* sharedHistory(); - void addItem(const WebCore::KURL&, const WebCore::String&); + void visitedURL(const WebCore::KURL&, const WebCore::String& title, const WebCore::String& httpMethod, bool wasFailure, const WebCore::KURL& serverRedirectURL, bool isClientRedirect); + void visitedURLForRedirectWithoutHistoryItem(const WebCore::KURL&); void addVisitedLinksToPageGroup(WebCore::PageGroup&); private: @@ -127,7 +134,7 @@ private: HRESULT saveHistoryGuts(CFURLRef url, IWebError** error); HRESULT postNotification(NotificationType notifyType, IPropertyBag* userInfo = 0); HRESULT removeItem(IWebHistoryItem* entry); - HRESULT addItem(IWebHistoryItem* entry); + HRESULT addItem(IWebHistoryItem* entry, bool discardDuplicate, bool* added); HRESULT removeItemForURLString(CFStringRef urlString); HRESULT addItemToDateCaches(IWebHistoryItem* entry); HRESULT removeItemFromDateCaches(IWebHistoryItem* entry); @@ -144,6 +151,7 @@ private: RetainPtr<CFMutableArrayRef> m_datesWithEntries; RetainPtr<CFMutableArrayRef> m_entriesByDate; COMPtr<WebPreferences> m_preferences; + COMPtr<WebHistoryItem> m_lastVisitedEntry; }; #endif diff --git a/WebKit/win/WebHistoryItem.cpp b/WebKit/win/WebHistoryItem.cpp index 594309e..5866c41 100644 --- a/WebKit/win/WebHistoryItem.cpp +++ b/WebKit/win/WebHistoryItem.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,13 +27,16 @@ #include "WebKitDLL.h" #include "WebHistoryItem.h" +#include "COMEnumVariant.h" #include "COMPtr.h" #include "MarshallingHelpers.h" #include "WebKit.h" #pragma warning(push, 0) #include <WebCore/BString.h> +#include <WebCore/CString.h> #include <WebCore/HistoryItem.h> +#include <WebCore/KURL.h> #pragma warning(pop) #include <wtf/RetainPtr.h> @@ -94,51 +97,109 @@ static CFStringRef urlKey = CFSTR(""); static CFStringRef lastVisitedDateKey = CFSTR("lastVisitedDate"); static CFStringRef titleKey = CFSTR("title"); static CFStringRef visitCountKey = CFSTR("visitCount"); +static CFStringRef lastVisitWasFailureKey = CFSTR("lastVisitWasFailure"); +static CFStringRef lastVisitWasHTTPNonGetKey = CFSTR("lastVisitWasHTTPNonGet"); +static CFStringRef redirectURLsKey = CFSTR("redirectURLs"); +static CFStringRef dailyVisitCountKey = CFSTR("D"); // short key to save space +static CFStringRef weeklyVisitCountKey = CFSTR("W"); // short key to save space HRESULT STDMETHODCALLTYPE WebHistoryItem::initFromDictionaryRepresentation(void* dictionary) { CFDictionaryRef dictionaryRef = (CFDictionaryRef) dictionary; - HRESULT hr = S_OK; - int visitedCount = 0; - CFAbsoluteTime lastVisitedTime = 0.0; CFStringRef urlStringRef = (CFStringRef) CFDictionaryGetValue(dictionaryRef, urlKey); - if (urlStringRef && CFGetTypeID(urlStringRef) != CFStringGetTypeID()) { - hr = E_FAIL; - goto exit; - } + if (urlStringRef && CFGetTypeID(urlStringRef) != CFStringGetTypeID()) + return E_FAIL; CFStringRef lastVisitedRef = (CFStringRef) CFDictionaryGetValue(dictionaryRef, lastVisitedDateKey); - if (!lastVisitedRef || CFGetTypeID(lastVisitedRef) != CFStringGetTypeID()) { - hr = E_FAIL; - goto exit; - } - lastVisitedTime = CFStringGetDoubleValue(lastVisitedRef); + if (!lastVisitedRef || CFGetTypeID(lastVisitedRef) != CFStringGetTypeID()) + return E_FAIL; + CFAbsoluteTime lastVisitedTime = CFStringGetDoubleValue(lastVisitedRef); CFStringRef titleRef = (CFStringRef) CFDictionaryGetValue(dictionaryRef, titleKey); - if (titleRef && CFGetTypeID(titleRef) != CFStringGetTypeID()) { - hr = E_FAIL; - goto exit; - } + if (titleRef && CFGetTypeID(titleRef) != CFStringGetTypeID()) + return E_FAIL; CFNumberRef visitCountRef = (CFNumberRef) CFDictionaryGetValue(dictionaryRef, visitCountKey); - if (!visitCountRef || CFGetTypeID(visitCountRef) != CFNumberGetTypeID()) { - hr = E_FAIL; - goto exit; + if (!visitCountRef || CFGetTypeID(visitCountRef) != CFNumberGetTypeID()) + return E_FAIL; + int visitedCount = 0; + if (!CFNumberGetValue(visitCountRef, kCFNumberIntType, &visitedCount)) + return E_FAIL; + + // Can't trust data on disk, and we've had at least one report of this (<rdar://6572300>). + if (visitedCount < 0) { + LOG_ERROR("visit count for history item \"%s\" is negative (%d), will be reset to 1", String(urlStringRef).utf8().data(), visitedCount); + visitedCount = 1; + } + + CFBooleanRef lastVisitWasFailureRef = static_cast<CFBooleanRef>(CFDictionaryGetValue(dictionaryRef, lastVisitWasFailureKey)); + if (lastVisitWasFailureRef && CFGetTypeID(lastVisitWasFailureRef) != CFBooleanGetTypeID()) + return E_FAIL; + bool lastVisitWasFailure = lastVisitWasFailureRef && CFBooleanGetValue(lastVisitWasFailureRef); + + CFBooleanRef lastVisitWasHTTPNonGetRef = static_cast<CFBooleanRef>(CFDictionaryGetValue(dictionaryRef, lastVisitWasHTTPNonGetKey)); + if (lastVisitWasHTTPNonGetRef && CFGetTypeID(lastVisitWasHTTPNonGetRef) != CFBooleanGetTypeID()) + return E_FAIL; + bool lastVisitWasHTTPNonGet = lastVisitWasHTTPNonGetRef && CFBooleanGetValue(lastVisitWasHTTPNonGetRef); + + std::auto_ptr<Vector<String> > redirectURLsVector; + if (CFArrayRef redirectURLsRef = static_cast<CFArrayRef>(CFDictionaryGetValue(dictionaryRef, redirectURLsKey))) { + CFIndex size = CFArrayGetCount(redirectURLsRef); + redirectURLsVector.reset(new Vector<String>(size)); + for (CFIndex i = 0; i < size; ++i) + (*redirectURLsVector)[i] = String(static_cast<CFStringRef>(CFArrayGetValueAtIndex(redirectURLsRef, i))); + } + + CFArrayRef dailyCounts = static_cast<CFArrayRef>(CFDictionaryGetValue(dictionaryRef, dailyVisitCountKey)); + if (dailyCounts && CFGetTypeID(dailyCounts) != CFArrayGetTypeID()) + dailyCounts = 0; + CFArrayRef weeklyCounts = static_cast<CFArrayRef>(CFDictionaryGetValue(dictionaryRef, weeklyVisitCountKey)); + if (weeklyCounts && CFGetTypeID(weeklyCounts) != CFArrayGetTypeID()) + weeklyCounts = 0; + + std::auto_ptr<Vector<int> > dailyVector, weeklyVector; + if (dailyCounts || weeklyCounts) { + CFIndex dailySize = dailyCounts ? CFArrayGetCount(dailyCounts) : 0; + CFIndex weeklySize = weeklyCounts ? CFArrayGetCount(weeklyCounts) : 0; + dailyVector.reset(new Vector<int>(dailySize)); + weeklyVector.reset(new Vector<int>(weeklySize)); + + // Daily and weekly counts < 0 are errors in the data read from disk, so reset to 0. + for (CFIndex i = 0; i < dailySize; ++i) { + CFNumberRef dailyCount = static_cast<CFNumberRef>(CFArrayGetValueAtIndex(dailyCounts, i)); + if (CFGetTypeID(dailyCount) == CFNumberGetTypeID()) + CFNumberGetValue(dailyCount, kCFNumberIntType, &(*dailyVector)[i]); + if ((*dailyVector)[i] < 0) + (*dailyVector)[i] = 0; + } + for (CFIndex i = 0; i < weeklySize; ++i) { + CFNumberRef weeklyCount = static_cast<CFNumberRef>(CFArrayGetValueAtIndex(weeklyCounts, i)); + if (CFGetTypeID(weeklyCount) == CFNumberGetTypeID()) + CFNumberGetValue(weeklyCount, kCFNumberIntType, &(*weeklyVector)[i]); + if ((*weeklyVector)[i] < 0) + (*weeklyVector)[i] = 0; + } } historyItemWrappers().remove(m_historyItem.get()); m_historyItem = HistoryItem::create(urlStringRef, titleRef, lastVisitedTime); historyItemWrappers().set(m_historyItem.get(), this); - if (!CFNumberGetValue(visitCountRef, kCFNumberIntType, &visitedCount)) { - hr = E_FAIL; - goto exit; - } - m_historyItem->setVisitCount(visitedCount); -exit: - return hr; + if (lastVisitWasFailure) + m_historyItem->setLastVisitWasFailure(true); + + if (lastVisitWasHTTPNonGet && (protocolIs(m_historyItem->urlString(), "http") || protocolIs(m_historyItem->urlString(), "https"))) + m_historyItem->setLastVisitWasHTTPNonGet(true); + + if (redirectURLsVector.get()) + m_historyItem->setRedirectURLs(redirectURLsVector); + + if (dailyVector.get()) + m_historyItem->adoptVisitCounts(*dailyVector, *weeklyVector); + + return S_OK; } HRESULT STDMETHODCALLTYPE WebHistoryItem::dictionaryRepresentation(void** dictionary) @@ -151,8 +212,9 @@ HRESULT STDMETHODCALLTYPE WebHistoryItem::dictionaryRepresentation(void** dictio return E_FAIL; int keyCount = 0; - CFTypeRef keys[4]; - CFTypeRef values[4]; + CFTypeRef keys[9]; + CFTypeRef values[9]; + if (!m_historyItem->urlString().isEmpty()) { keys[keyCount] = urlKey; values[keyCount++] = m_historyItem->urlString().createCFString(); @@ -160,16 +222,72 @@ HRESULT STDMETHODCALLTYPE WebHistoryItem::dictionaryRepresentation(void** dictio keys[keyCount] = lastVisitedDateKey; values[keyCount++] = lastVisitedStringRef; - + if (!m_historyItem->title().isEmpty()) { keys[keyCount] = titleKey; values[keyCount++] = m_historyItem->title().createCFString(); } - - keys[keyCount] = visitCountKey; + + keys[keyCount] = visitCountKey; int visitCount = m_historyItem->visitCount(); values[keyCount++] = CFNumberCreate(0, kCFNumberIntType, &visitCount); - + + if (m_historyItem->lastVisitWasFailure()) { + keys[keyCount] = lastVisitWasFailureKey; + values[keyCount++] = CFRetain(kCFBooleanTrue); + } + + if (m_historyItem->lastVisitWasHTTPNonGet()) { + ASSERT(m_historyItem->urlString().startsWith("http:", false) || m_historyItem->urlString().startsWith("https:", false)); + keys[keyCount] = lastVisitWasHTTPNonGetKey; + values[keyCount++] = CFRetain(kCFBooleanTrue); + } + + if (Vector<String>* redirectURLs = m_historyItem->redirectURLs()) { + size_t size = redirectURLs->size(); + ASSERT(size); + CFStringRef* items = new CFStringRef[size]; + for (size_t i = 0; i < size; ++i) + items[i] = redirectURLs->at(i).createCFString(); + CFArrayRef result = CFArrayCreate(0, (const void**)items, size, &kCFTypeArrayCallBacks); + for (size_t i = 0; i < size; ++i) + CFRelease(items[i]); + delete[] items; + + keys[keyCount] = redirectURLsKey; + values[keyCount++] = result; + } + + const Vector<int>& dailyVisitCount(m_historyItem->dailyVisitCounts()); + if (size_t size = dailyVisitCount.size()) { + Vector<CFNumberRef, 13> numbers(size); + for (size_t i = 0; i < size; ++i) + numbers[i] = CFNumberCreate(0, kCFNumberIntType, &dailyVisitCount[i]); + + CFArrayRef result = CFArrayCreate(0, (const void**)numbers.data(), size, &kCFTypeArrayCallBacks); + + for (size_t i = 0; i < size; ++i) + CFRelease(numbers[i]); + + keys[keyCount] = dailyVisitCountKey; + values[keyCount++] = result; + } + + const Vector<int>& weeklyVisitCount(m_historyItem->weeklyVisitCounts()); + if (size_t size = weeklyVisitCount.size()) { + Vector<CFNumberRef, 5> numbers(size); + for (size_t i = 0; i < size; ++i) + numbers[i] = CFNumberCreate(0, kCFNumberIntType, &weeklyVisitCount[i]); + + CFArrayRef result = CFArrayCreate(0, (const void**)numbers.data(), size, &kCFTypeArrayCallBacks); + + for (size_t i = 0; i < size; ++i) + CFRelease(numbers[i]); + + keys[keyCount] = weeklyVisitCountKey; + values[keyCount++] = result; + } + *dictionaryRef = CFDictionaryCreate(0, keys, values, keyCount, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); for (int i = 0; i < keyCount; ++i) @@ -225,7 +343,7 @@ HRESULT STDMETHODCALLTYPE WebHistoryItem::setTitle(BSTR title) HRESULT STDMETHODCALLTYPE WebHistoryItem::RSSFeedReferrer(BSTR* url) { - BString str(m_historyItem->rssFeedReferrer()); + BString str(m_historyItem->referrer()); *url = str.release(); return S_OK; @@ -233,7 +351,7 @@ HRESULT STDMETHODCALLTYPE WebHistoryItem::RSSFeedReferrer(BSTR* url) HRESULT STDMETHODCALLTYPE WebHistoryItem::setRSSFeedReferrer(BSTR url) { - m_historyItem->setRSSFeedReferrer(String(url, SysStringLen(url))); + m_historyItem->setReferrer(String(url, SysStringLen(url))); return S_OK; } @@ -320,6 +438,96 @@ HRESULT STDMETHODCALLTYPE WebHistoryItem::children(unsigned* outChildCount, SAFE } +HRESULT STDMETHODCALLTYPE WebHistoryItem::lastVisitWasFailure(BOOL* wasFailure) +{ + if (!wasFailure) { + ASSERT_NOT_REACHED(); + return E_POINTER; + } + + *wasFailure = m_historyItem->lastVisitWasFailure(); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebHistoryItem::setLastVisitWasFailure(BOOL wasFailure) +{ + m_historyItem->setLastVisitWasFailure(wasFailure); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebHistoryItem::lastVisitWasHTTPNonGet(BOOL* HTTPNonGet) +{ + if (!HTTPNonGet) { + ASSERT_NOT_REACHED(); + return E_POINTER; + } + + *HTTPNonGet = m_historyItem->lastVisitWasHTTPNonGet(); + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebHistoryItem::setLastVisitWasHTTPNonGet(BOOL HTTPNonGet) +{ + m_historyItem->setLastVisitWasHTTPNonGet(HTTPNonGet); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebHistoryItem::redirectURLs(IEnumVARIANT** urls) +{ + if (!urls) { + ASSERT_NOT_REACHED(); + return E_POINTER; + } + + Vector<String>* urlVector = m_historyItem->redirectURLs(); + if (!urlVector) { + *urls = 0; + return S_OK; + } + + COMPtr<COMEnumVariant<Vector<String> > > enumVariant(AdoptCOM, COMEnumVariant<Vector<String> >::createInstance(*urlVector)); + *urls = enumVariant.releaseRef(); + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebHistoryItem::visitedWithTitle(BSTR title) +{ + m_historyItem->visited(title, CFAbsoluteTimeGetCurrent()); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebHistoryItem::getDailyVisitCounts(int* number, int** counts) +{ + if (!number || !counts) { + ASSERT_NOT_REACHED(); + return E_POINTER; + } + + *counts = const_cast<int*>(m_historyItem->dailyVisitCounts().data()); + *number = m_historyItem->dailyVisitCounts().size(); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebHistoryItem::getWeeklyVisitCounts(int* number, int** counts) +{ + if (!number || !counts) { + ASSERT_NOT_REACHED(); + return E_POINTER; + } + + *counts = const_cast<int*>(m_historyItem->weeklyVisitCounts().data()); + *number = m_historyItem->weeklyVisitCounts().size(); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebHistoryItem::recordInitialVisit() +{ + m_historyItem->recordInitialVisit(); + return S_OK; +} + // IUnknown ------------------------------------------------------------------- HRESULT STDMETHODCALLTYPE WebHistoryItem::QueryInterface(REFIID riid, void** ppvObject) @@ -438,6 +646,7 @@ HRESULT STDMETHODCALLTYPE WebHistoryItem::icon( } // WebHistoryItem ------------------------------------------------------------- + HistoryItem* WebHistoryItem::historyItem() const { return m_historyItem.get(); diff --git a/WebKit/win/WebHistoryItem.h b/WebKit/win/WebHistoryItem.h index 6734ff0..861dc6e 100644 --- a/WebKit/win/WebHistoryItem.h +++ b/WebKit/win/WebHistoryItem.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -97,9 +97,18 @@ public: virtual HRESULT STDMETHODCALLTYPE target(BSTR* target); virtual HRESULT STDMETHODCALLTYPE isTargetItem(BOOL* result); virtual HRESULT STDMETHODCALLTYPE children(unsigned* childCount, SAFEARRAY** children); - + virtual HRESULT STDMETHODCALLTYPE lastVisitWasFailure(BOOL* wasFailure); + virtual HRESULT STDMETHODCALLTYPE setLastVisitWasFailure(BOOL wasFailure); + virtual HRESULT STDMETHODCALLTYPE lastVisitWasHTTPNonGet(BOOL* HTTPNonGet); + virtual HRESULT STDMETHODCALLTYPE setLastVisitWasHTTPNonGet(BOOL HTTPNonGet); + virtual HRESULT STDMETHODCALLTYPE redirectURLs(IEnumVARIANT**); + virtual HRESULT STDMETHODCALLTYPE visitedWithTitle(BSTR title); + virtual HRESULT STDMETHODCALLTYPE getDailyVisitCounts(int* number, int** counts); + virtual HRESULT STDMETHODCALLTYPE getWeeklyVisitCounts(int* number, int** counts); + virtual HRESULT STDMETHODCALLTYPE recordInitialVisit(); // WebHistoryItem WebCore::HistoryItem* historyItem() const; + protected: ULONG m_refCount; diff --git a/WebKit/win/WebIconDatabase.cpp b/WebKit/win/WebIconDatabase.cpp index 5f9121f..237438c 100644 --- a/WebKit/win/WebIconDatabase.cpp +++ b/WebKit/win/WebIconDatabase.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -71,6 +71,15 @@ void WebIconDatabase::init() LOG_ERROR("Unable to get icon database enabled preference"); } iconDatabase()->setEnabled(!!enabled); + if (!(!!enabled)) + return; + + startUpIconDatabase(); +} + +void WebIconDatabase::startUpIconDatabase() +{ + WebPreferences* standardPrefs = WebPreferences::sharedStandardPreferences(); iconDatabase()->setClient(this); @@ -91,6 +100,10 @@ void WebIconDatabase::init() LOG_ERROR("Failed to open icon database path"); } +void WebIconDatabase::shutDownIconDatabase() +{ +} + WebIconDatabase* WebIconDatabase::createInstance() { WebIconDatabase* instance = new WebIconDatabase(); @@ -225,6 +238,28 @@ HRESULT STDMETHODCALLTYPE WebIconDatabase::iconURLForURL( return S_OK; } +HRESULT STDMETHODCALLTYPE WebIconDatabase::isEnabled( + /* [retval][out] */ BOOL *result) +{ + *result = iconDatabase()->isEnabled(); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebIconDatabase::setEnabled( + /* [in] */ BOOL flag) +{ + BOOL currentlyEnabled; + isEnabled(¤tlyEnabled); + if (currentlyEnabled && !flag) { + iconDatabase()->setEnabled(false); + shutDownIconDatabase(); + } else if (!currentlyEnabled && flag) { + iconDatabase()->setEnabled(true); + startUpIconDatabase(); + } + return S_OK; +} + HBITMAP createDIB(LPSIZE size) { HBITMAP result; diff --git a/WebKit/win/WebIconDatabase.h b/WebKit/win/WebIconDatabase.h index 85f57b7..ac42d4a 100644 --- a/WebKit/win/WebIconDatabase.h +++ b/WebKit/win/WebIconDatabase.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -57,6 +57,8 @@ private: WebIconDatabase(); ~WebIconDatabase(); void init(); + void startUpIconDatabase(); + void shutDownIconDatabase(); public: // IUnknown @@ -94,6 +96,12 @@ public: /* [in] */ BSTR url, /* [retval][out] */ BSTR *iconURL); + virtual HRESULT STDMETHODCALLTYPE isEnabled( + /* [retval][out] */ BOOL *result); + + virtual HRESULT STDMETHODCALLTYPE setEnabled( + /* [in] */ BOOL /*flag*/); + // IconDatabaseClient virtual void dispatchDidRemoveAllIcons(); virtual void dispatchDidAddIconForPageURL(const WebCore::String&); diff --git a/WebKit/win/WebJavaScriptCollector.cpp b/WebKit/win/WebJavaScriptCollector.cpp index 818fb4e..2e0d7e6 100644 --- a/WebKit/win/WebJavaScriptCollector.cpp +++ b/WebKit/win/WebJavaScriptCollector.cpp @@ -114,6 +114,6 @@ HRESULT STDMETHODCALLTYPE WebJavaScriptCollector::objectCount( } JSLock lock(false); - *count = (UINT)JSDOMWindow::commonJSGlobalData()->heap.size(); + *count = (UINT)JSDOMWindow::commonJSGlobalData()->heap.objectCount(); return S_OK; } diff --git a/WebKit/win/WebKit.resources/Info.plist b/WebKit/win/WebKit.resources/Info.plist index 859ce3d..9477472 100644 --- a/WebKit/win/WebKit.resources/Info.plist +++ b/WebKit/win/WebKit.resources/Info.plist @@ -7,7 +7,7 @@ <key>CFBundleExecutable</key> <string>WebKit</string> <key>CFBundleGetInfoString</key> - <string>522+, Copyright 2003-2007 Apple Inc.</string> + <string>522+, Copyright 2003-2009 Apple Inc.</string> <key>CFBundleIdentifier</key> <string>com.apple.WebKit</string> <key>CFBundleInfoDictionaryVersion</key> diff --git a/WebKit/win/WebKit.vcproj/WebKit.def b/WebKit/win/WebKit.vcproj/WebKit.def index a436558..fa3f2bc 100644 --- a/WebKit/win/WebKit.vcproj/WebKit.def +++ b/WebKit/win/WebKit.vcproj/WebKit.def @@ -29,10 +29,12 @@ EXPORTS JSObjectIsConstructor JSObjectIsFunction JSObjectMake + JSObjectMakeArray JSObjectMakeConstructor - JSObjectMakeFunction + JSObjectMakeDate JSObjectMakeFunction JSObjectMakeFunctionWithCallback + JSObjectMakeRegExp JSObjectSetPrivate JSObjectSetProperty JSObjectSetPropertyAtIndex diff --git a/WebKit/win/WebKit.vcproj/WebKit.rc b/WebKit/win/WebKit.vcproj/WebKit.rc index bfab23a..1c4e4f5 100644 --- a/WebKit/win/WebKit.vcproj/WebKit.rc +++ b/WebKit/win/WebKit.vcproj/WebKit.rc @@ -42,7 +42,7 @@ BEGIN VALUE "FileVersion", __VERSION_TEXT__ VALUE "CompanyName", "Apple Inc." VALUE "InternalName", "WebKit" - VALUE "LegalCopyright", "Copyright Apple Inc. 2003-2008" + VALUE "LegalCopyright", "Copyright Apple Inc. 2003-2009" VALUE "OriginalFilename", "WebKit.dll" VALUE "ProductName", " WebKit" VALUE "ProductVersion", __BUILD_NUMBER_SHORT__ @@ -77,4 +77,8 @@ IDR_PAN_SOUTH_EAST_CURSOR PNG "panSouthEastCursor.png IDR_PAN_SOUTH_WEST_CURSOR PNG "panSouthWestCursor.png" IDR_PAN_NORTH_EAST_CURSOR PNG "panNorthEastCursor.png" IDR_PAN_NORTH_WEST_CURSOR PNG "panNorthWestCursor.png" +IDR_SEARCH_CANCEL PNG "searchCancel.png" +IDR_SEARCH_CANCEL_PRESSED PNG "searchCancelPressed.png" +IDR_SEARCH_MAGNIFIER PNG "searchMagnifier.png" +IDR_SEARCH_MAGNIFIER_RESULTS PNG "searchMagnifierResults.png" diff --git a/WebKit/win/WebKit.vcproj/WebKit.sln b/WebKit/win/WebKit.vcproj/WebKit.sln index beca071..e06e650 100644 --- a/WebKit/win/WebKit.vcproj/WebKit.sln +++ b/WebKit/win/WebKit.vcproj/WebKit.sln @@ -235,13 +235,11 @@ Global {0A324352-B3B6-496C-9E5B-4C7E923E628B}.Release|Win32.ActiveCfg = Release|Win32
{0A324352-B3B6-496C-9E5B-4C7E923E628B}.Release|Win32.Build.0 = Release|Win32
{E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Debug_Cairo|Win32.ActiveCfg = Debug|Win32
- {E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Debug_Cairo|Win32.Build.0 = Debug|Win32
{E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Debug_Internal|Win32.ActiveCfg = Debug_Internal|Win32
{E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Debug_Internal|Win32.Build.0 = Debug_Internal|Win32
{E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Debug|Win32.ActiveCfg = Debug|Win32
{E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Debug|Win32.Build.0 = Debug|Win32
{E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Release_Cairo|Win32.ActiveCfg = Release|Win32
- {E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Release_Cairo|Win32.Build.0 = Release|Win32
{E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Release|Win32.ActiveCfg = Release|Win32
{E498CA9D-3BD2-4D52-8E37-C8DC76526325}.Release|Win32.Build.0 = Release|Win32
{114FCA11-216B-4C8C-957E-30A75AE80443}.Debug_Cairo|Win32.ActiveCfg = Debug|Win32
diff --git a/WebKit/win/WebKit.vcproj/WebKit.vcproj b/WebKit/win/WebKit.vcproj/WebKit.vcproj index d4d21d1..0740e8a 100644 --- a/WebKit/win/WebKit.vcproj/WebKit.vcproj +++ b/WebKit/win/WebKit.vcproj/WebKit.vcproj @@ -40,7 +40,7 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitLibrariesDir)\Include";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;ENABLE_DOM_STORAGE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SVG;ENABLE_XSLT;ENABLE_XPATH;FRAMEWORK_NAME=WebKit"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_DATABASE;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
ForcedIncludeFiles="WebKitPrefix.h"
@@ -116,7 +116,7 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitLibrariesDir)\Include";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;ENABLE_DOM_STORAGE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SVG;ENABLE_XSLT;ENABLE_XPATH;FRAMEWORK_NAME=WebKit"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_DATABASE;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
ForcedIncludeFiles="WebKitPrefix.h"
@@ -191,7 +191,7 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitLibrariesDir)\Include";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;ENABLE_DOM_STORAGE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SVG;ENABLE_XSLT;ENABLE_XPATH;FRAMEWORK_NAME=WebKit"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_DATABASE;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
Detect64BitPortabilityProblems="false"
@@ -269,7 +269,7 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitLibrariesDir)\Include";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;ENABLE_DOM_STORAGE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SVG;ENABLE_XSLT;ENABLE_XPATH;FRAMEWORK_NAME=WebKit"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_DATABASE;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
ForcedIncludeFiles="WebKitPrefix.h"
@@ -287,17 +287,18 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CoreGraphics.lib CFNetwork$(LibraryConfigSuffix).lib JavaScriptCore$(WebKitConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib WebKitSystemInterface$(WebKitConfigSuffix).lib msimg32.lib QTMovieWin$(WebKitConfigSuffix).lib crypt32.lib cairo.lib giflib.lib jpeg.lib libpng.lib libcurl_imp.lib ws2_32.lib wininet.lib Wldap32.lib iphlpapi.lib"
+ AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CFLite_Debug.lib JavaScriptCore$(WebKitConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib msimg32.lib crypt32.lib cairo.lib giflib.lib jpeg.lib libpng.lib libcurl_imp.lib ws2_32.lib wininet.lib Wldap32.lib iphlpapi.lib"
OutputFile="$(OutDir)\$(ProjectName)$(WebKitDLLConfigSuffix).dll"
AdditionalLibraryDirectories=""
- ModuleDefinitionFile="WebKit$(WebKitDLLConfigSuffix).def"
- DelayLoadDLLs="comdlg32.dll;usp10.dll;comctl32.dll;version.dll;libxslt$(LibraryConfigSuffix).dll;SQLite3$(LibraryConfigSuffix).dll;msimg32.dll;QTMovieWin$(WebKitConfigSuffix).dll;iphlpapi.dll"
+ ModuleDefinitionFile="WebKit_Cairo$(WebKitDLLConfigSuffix).def"
+ DelayLoadDLLs="comdlg32.dll;usp10.dll;comctl32.dll;version.dll;libxslt$(LibraryConfigSuffix).dll;SQLite3$(LibraryConfigSuffix).dll;msimg32.dll;iphlpapi.dll"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
+ VerboseOutput="false"
/>
<Tool
Name="VCXDCMakeTool"
@@ -347,7 +348,7 @@ <Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitLibrariesDir)\Include";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;ENABLE_DOM_STORAGE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SVG;ENABLE_XSLT;ENABLE_XPATH;FRAMEWORK_NAME=WebKit"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_DATABASE;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
ForcedIncludeFiles="WebKitPrefix.h"
@@ -365,11 +366,11 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CFNetwork$(LibraryConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib JavaScriptCore$(WebKitConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib WebKitSystemInterface$(WebKitConfigSuffix).lib msimg32.lib QTMovieWin$(WebKitConfigSuffix).lib crypt32.lib cairo.lib giflib.lib jpeg.lib libpng.lib libcurl_imp.lib ws2_32.lib wininet.lib Wldap32.lib iphlpapi.lib"
+ AdditionalDependencies="delayimp.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib usp10.lib comctl32.lib version.lib shlwapi.lib libxml2$(LibraryConfigSuffix).lib libxslt$(LibraryConfigSuffix).lib icuin$(LibraryConfigSuffix).lib icuuc$(LibraryConfigSuffix).lib SQLite3$(LibraryConfigSuffix).lib pthreadVC2$(LibraryConfigSuffix).lib CFLite.lib JavaScriptCore$(WebKitConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WebCore$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib msimg32.lib crypt32.lib cairo.lib giflib.lib jpeg.lib libpng.lib libcurl_imp.lib ws2_32.lib wininet.lib Wldap32.lib iphlpapi.lib"
OutputFile="$(OutDir)\$(ProjectName)$(WebKitDLLConfigSuffix).dll"
AdditionalLibraryDirectories=""
- ModuleDefinitionFile="WebKit$(WebKitDLLConfigSuffix).def"
- DelayLoadDLLs="comdlg32.dll;usp10.dll;comctl32.dll;version.dll;libxslt$(LibraryConfigSuffix).dll;SQLite3$(LibraryConfigSuffix).dll;msimg32.dll;QTMovieWin$(WebKitConfigSuffix).dll;iphlpapi.dll"
+ ModuleDefinitionFile="WebKit_Cairo$(WebKitDLLConfigSuffix).def"
+ DelayLoadDLLs="comdlg32.dll;usp10.dll;comctl32.dll;version.dll;libxslt$(LibraryConfigSuffix).dll;SQLite3$(LibraryConfigSuffix).dll;msimg32.dll;iphlpapi.dll"
/>
<Tool
Name="VCALinkTool"
@@ -425,7 +426,7 @@ Name="VCCLCompilerTool"
WholeProgramOptimization="false"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitLibrariesDir)\Include";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;ENABLE_DOM_STORAGE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SVG;ENABLE_XSLT;ENABLE_XPATH;FRAMEWORK_NAME=WebKit"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_DATABASE;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
ForcedIncludeFiles="WebKitPrefix.h"
@@ -504,7 +505,7 @@ Name="VCCLCompilerTool"
WholeProgramOptimization="false"
AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitLibrariesDir)\Include";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(WebKitOutputDir)\Include\icu";"$(WebKitLibrariesDir)\Include\icu";"$(WebKitLibrariesDir)\include\pthreads";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders";"$(WebKitOutputDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(WebKitLibrariesDir)\Include\CoreFoundation\OSXCompatibilityHeaders\GNUCompatibility";"$(ProjectDir)\..";"$(ProjectDir)";"$(ProjectDir)\..\WebCoreSupport";"$(IntDir)\include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources""
- PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;ENABLE_DOM_STORAGE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SVG;ENABLE_XSLT;ENABLE_XPATH;FRAMEWORK_NAME=WebKit"
+ PreprocessorDefinitions="_USRDLL;WEBKIT_EXPORTS;FRAMEWORK_NAME=WebKit;ENABLE_DATABASE;ENABLE_DOM_STORAGE;ENABLE_ICONDATABASE;ENABLE_OFFLINE_WEB_APPLICATIONS;ENABLE_SVG;ENABLE_SVG_ANIMATION;ENABLE_SVG_AS_IMAGE;ENABLE_SVG_FONTS;ENABLE_SVG_FOREIGN_OBJECT;ENABLE_SVG_USE;ENABLE_VIDEO;ENABLE_WORKERS;ENABLE_XPATH;ENABLE_XSLT"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="WebKitPrefix.h"
ForcedIncludeFiles="WebKitPrefix.h"
@@ -687,7 +688,7 @@ >
</File>
<File
- RelativePath="..\WebCachedPagePlatformData.h"
+ RelativePath="..\WebCachedFramePlatformData.h"
>
</File>
<File
@@ -773,6 +774,22 @@ <File
RelativePath="..\WebKitGraphics.h"
>
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\WebKitLogging.h"
@@ -793,6 +810,22 @@ <File
RelativePath="..\WebLocalizableStrings.h"
>
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\WebMutableURLRequest.h"
@@ -939,6 +972,70 @@ >
</File>
<File
+ RelativePath="..\WebCookieManagerCFNet.cpp"
+ >
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\WebCookieManagerCurl.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_PGOInstrument|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_PGOOptimize|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\WebCoreStatistics.cpp"
>
</File>
@@ -959,6 +1056,70 @@ >
</File>
<File
+ RelativePath="..\WebDownloadCFNet.cpp"
+ >
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\WebDownloadCurl.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_PGOInstrument|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_PGOOptimize|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\WebDropSource.cpp"
>
</File>
@@ -1067,6 +1228,70 @@ >
</File>
<File
+ RelativePath="..\WebURLAuthenticationChallengeSenderCFNet.cpp"
+ >
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\WebURLAuthenticationChallengeSenderCurl.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_PGOInstrument|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_PGOOptimize|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\WebURLCredential.cpp"
>
</File>
@@ -1095,6 +1320,22 @@ >
</File>
<File
+ RelativePath=".\searchCancel.png"
+ >
+ </File>
+ <File
+ RelativePath=".\searchCancelPressed.png"
+ >
+ </File>
+ <File
+ RelativePath=".\searchMagnifier.png"
+ >
+ </File>
+ <File
+ RelativePath=".\searchMagnifierResults.png"
+ >
+ </File>
+ <File
RelativePath=".\textAreaResizeCorner.png"
>
</File>
@@ -1185,10 +1426,34 @@ <File
RelativePath="..\WebKitGraphics.cpp"
>
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
<File
RelativePath="..\WebLocalizableStrings.cpp"
>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
</File>
</Filter>
<Filter
diff --git a/WebKit/win/WebKit.vcproj/WebKit_Cairo.def b/WebKit/win/WebKit.vcproj/WebKit_Cairo.def new file mode 100755 index 0000000..50b3675 --- /dev/null +++ b/WebKit/win/WebKit.vcproj/WebKit_Cairo.def @@ -0,0 +1,127 @@ +LIBRARY "WebKit" + +EXPORTS + DllGetClassObject PRIVATE + DllCanUnloadNow PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE + RunAsLocalServer PRIVATE + LocalServerDidDie PRIVATE + JSCheckScriptSyntax + JSClassCreate + JSClassRelease + JSClassRetain + JSContextGetGlobalObject + JSEvaluateScript + JSGarbageCollect + JSGlobalContextCreate + JSGlobalContextRelease + JSGlobalContextRetain + JSObjectCallAsConstructor + JSObjectCallAsFunction + JSObjectCopyPropertyNames + JSObjectDeleteProperty + JSObjectGetPrivate + JSObjectGetProperty + JSObjectGetPropertyAtIndex + JSObjectGetPrototype + JSObjectHasProperty + JSObjectIsConstructor + JSObjectIsFunction + JSObjectMake + JSObjectMakeArray + JSObjectMakeConstructor + JSObjectMakeDate + JSObjectMakeFunction + JSObjectMakeFunctionWithCallback + JSObjectMakeRegExp + JSObjectSetPrivate + JSObjectSetProperty + JSObjectSetPropertyAtIndex + JSObjectSetPrototype + JSPropertyNameAccumulatorAddName + JSPropertyNameArrayGetCount + JSPropertyNameArrayGetNameAtIndex + JSPropertyNameArrayRelease + JSPropertyNameArrayRetain + JSStringCopyBSTR + JSStringCopyCFString + JSStringCreateWithBSTR + JSStringCreateWithCFString + JSStringCreateWithCharacters + JSStringCreateWithUTF8CString + JSStringGetCharactersPtr + JSStringGetLength + JSStringGetMaximumUTF8CStringSize + JSStringGetUTF8CString + JSStringIsEqual + JSStringIsEqualToUTF8CString + JSStringRelease + JSStringRetain + JSValueGetType + JSValueIsBoolean + JSValueIsEqual + JSValueIsInstanceOfConstructor + JSValueIsNull + JSValueIsNumber + JSValueIsObject + JSValueIsObjectOfClass + JSValueIsStrictEqual + JSValueIsString + JSValueIsUndefined + JSValueMakeBoolean + JSValueMakeNull + JSValueMakeNumber + JSValueMakeString + JSValueMakeUndefined + JSValueProtect + JSValueToBoolean + JSValueToNumber + JSValueToObject + JSValueToStringCopy + JSValueUnprotect +; KJS_JSCreateNativeJSObject +; KJS_JSObject_JSFinalize +; KJS_JSObject_JSObjectCall +; KJS_JSObject_JSObjectEval +; KJS_JSObject_JSObjectGetMember +; KJS_JSObject_JSObjectGetSlot +; KJS_JSObject_JSObjectRemoveMember +; KJS_JSObject_JSObjectSetMember +; KJS_JSObject_JSObjectSetSlot +; KJS_JSObject_JSObjectToString + setUseOpenSourceWebKit + shutDownWebKit + progIDForClass + WebLocalizedStringUTF8 + WebLocalizedLPCTSTRUTF8 + ?fastMalloc@WTF@@YAPAXI@Z + ?fastZeroedMalloc@WTF@@YAPAXI@Z + ?fastFree@WTF@@YAXPAX@Z + ?fastCalloc@WTF@@YAPAXII@Z + ??0Mutex@WTF@@QAE@XZ + ??0ThreadCondition@WTF@@QAE@XZ + ??1Mutex@WTF@@QAE@XZ + ??1ThreadCondition@WTF@@QAE@XZ + ?broadcast@ThreadCondition@WTF@@QAEXXZ + ?callOnMainThread@WTF@@YAXP6AXPAX@Z0@Z + ?createThread@WTF@@YAIP6APAXPAX@Z0PBD@Z + ?currentThread@WTF@@YAIXZ + ?detachThread@WTF@@YAXI@Z + ?initializeMainThread@WTF@@YAXXZ + ?initializeThreading@WTF@@YAXXZ + ?isMainThread@WTF@@YA_NXZ + ?lock@Mutex@WTF@@QAEXXZ + ?lockAtomicallyInitializedStaticMutex@WTF@@YAXXZ + ?signal@ThreadCondition@WTF@@QAEXXZ + ?tryLock@Mutex@WTF@@QAE_NXZ + ?unlock@Mutex@WTF@@QAEXXZ + ?unlockAtomicallyInitializedStaticMutex@WTF@@YAXXZ + ?wait@ThreadCondition@WTF@@QAEXAAVMutex@2@@Z + ?waitForThreadCompletion@WTF@@YAHIPAPAX@Z + + ; These functions are deprecated + WebLocalizedString + WebLocalizedLPCTSTR + SetWebLocalizedStringMainBundle + ?createThread@WTF@@YAIP6APAXPAX@Z0@Z diff --git a/WebKit/win/WebKit.vcproj/WebKit_Cairo_debug.def b/WebKit/win/WebKit.vcproj/WebKit_Cairo_debug.def new file mode 100755 index 0000000..a53f027 --- /dev/null +++ b/WebKit/win/WebKit.vcproj/WebKit_Cairo_debug.def @@ -0,0 +1,133 @@ +LIBRARY "WebKit_debug" + +EXPORTS + DllGetClassObject PRIVATE + DllCanUnloadNow PRIVATE + DllRegisterServer PRIVATE + DllUnregisterServer PRIVATE + RunAsLocalServer PRIVATE + LocalServerDidDie PRIVATE + JSCheckScriptSyntax + JSClassCreate + JSClassRelease + JSClassRetain + JSContextGetGlobalObject + JSEvaluateScript + JSGarbageCollect + JSGlobalContextCreate + JSGlobalContextRelease + JSGlobalContextRetain + JSObjectCallAsConstructor + JSObjectCallAsFunction + JSObjectCopyPropertyNames + JSObjectDeleteProperty + JSObjectGetPrivate + JSObjectGetProperty + JSObjectGetPropertyAtIndex + JSObjectGetPrototype + JSObjectHasProperty + JSObjectIsConstructor + JSObjectIsFunction + JSObjectMake + JSObjectMakeArray + JSObjectMakeConstructor + JSObjectMakeDate + JSObjectMakeFunction + JSObjectMakeFunctionWithCallback + JSObjectMakeRegExp + JSObjectSetPrivate + JSObjectSetProperty + JSObjectSetPropertyAtIndex + JSObjectSetPrototype + JSPropertyNameAccumulatorAddName + JSPropertyNameArrayGetCount + JSPropertyNameArrayGetNameAtIndex + JSPropertyNameArrayRelease + JSPropertyNameArrayRetain + JSStringCopyBSTR + JSStringCopyCFString + JSStringCreateWithBSTR + JSStringCreateWithCFString + JSStringCreateWithCharacters + JSStringCreateWithUTF8CString + JSStringGetCharactersPtr + JSStringGetLength + JSStringGetMaximumUTF8CStringSize + JSStringGetUTF8CString + JSStringIsEqual + JSStringIsEqualToUTF8CString + JSStringRelease + JSStringRetain + JSValueGetType + JSValueIsBoolean + JSValueIsEqual + JSValueIsInstanceOfConstructor + JSValueIsNull + JSValueIsNumber + JSValueIsObject + JSValueIsObjectOfClass + JSValueIsStrictEqual + JSValueIsString + JSValueIsUndefined + JSValueMakeBoolean + JSValueMakeNull + JSValueMakeNumber + JSValueMakeString + JSValueMakeUndefined + JSValueProtect + JSValueToBoolean + JSValueToNumber + JSValueToObject + JSValueToStringCopy + JSValueUnprotect +; KJS_JSCreateNativeJSObject +; KJS_JSObject_JSFinalize +; KJS_JSObject_JSObjectCall +; KJS_JSObject_JSObjectEval +; KJS_JSObject_JSObjectGetMember +; KJS_JSObject_JSObjectGetSlot +; KJS_JSObject_JSObjectRemoveMember +; KJS_JSObject_JSObjectSetMember +; KJS_JSObject_JSObjectSetSlot +; KJS_JSObject_JSObjectToString + setUseOpenSourceWebKit + shutDownWebKit + progIDForClass + WebLocalizedStringUTF8 + WebLocalizedLPCTSTRUTF8 + WebDrawText + ?fastMalloc@WTF@@YAPAXI@Z + ?fastZeroedMalloc@WTF@@YAPAXI@Z + ?fastFree@WTF@@YAXPAX@Z + ?fastCalloc@WTF@@YAPAXII@Z + ??0Mutex@WTF@@QAE@XZ + ??0ThreadCondition@WTF@@QAE@XZ + ??1Mutex@WTF@@QAE@XZ + ??1ThreadCondition@WTF@@QAE@XZ + ?broadcast@ThreadCondition@WTF@@QAEXXZ + ?callOnMainThread@WTF@@YAXP6AXPAX@Z0@Z + ?createThread@WTF@@YAIP6APAXPAX@Z0PBD@Z + ?currentThread@WTF@@YAIXZ + ?detachThread@WTF@@YAXI@Z + ?initializeMainThread@WTF@@YAXXZ + ?initializeThreading@WTF@@YAXXZ + ?isMainThread@WTF@@YA_NXZ + ?lock@Mutex@WTF@@QAEXXZ + ?lockAtomicallyInitializedStaticMutex@WTF@@YAXXZ + ?signal@ThreadCondition@WTF@@QAEXXZ + ?tryLock@Mutex@WTF@@QAE_NXZ + ?unlock@Mutex@WTF@@QAEXXZ + ?unlockAtomicallyInitializedStaticMutex@WTF@@YAXXZ + ?wait@ThreadCondition@WTF@@QAEXAAVMutex@2@@Z + ?waitForThreadCompletion@WTF@@YAHIPAPAX@Z + WTFLog + WTFReportArgumentAssertionFailure + WTFReportAssertionFailure + WTFReportAssertionFailureWithMessage + WTFReportError + + ; These functions are deprecated + WebLocalizedString + WebLocalizedLPCTSTR + SetWebLocalizedStringMainBundle + ?createThread@WTF@@YAIP6APAXPAX@Z0@Z diff --git a/WebKit/win/WebKit.vcproj/WebKit_debug.def b/WebKit/win/WebKit.vcproj/WebKit_debug.def index d4fb488..6ed6a90 100644 --- a/WebKit/win/WebKit.vcproj/WebKit_debug.def +++ b/WebKit/win/WebKit.vcproj/WebKit_debug.def @@ -29,10 +29,12 @@ EXPORTS JSObjectIsConstructor JSObjectIsFunction JSObjectMake + JSObjectMakeArray JSObjectMakeConstructor - JSObjectMakeFunction + JSObjectMakeDate JSObjectMakeFunction JSObjectMakeFunctionWithCallback + JSObjectMakeRegExp JSObjectSetPrivate JSObjectSetProperty JSObjectSetPropertyAtIndex diff --git a/WebKit/win/WebKit.vcproj/resource.h b/WebKit/win/WebKit.vcproj/resource.h index 134e215..028cb3c 100644 --- a/WebKit/win/WebKit.vcproj/resource.h +++ b/WebKit/win/WebKit.vcproj/resource.h @@ -19,6 +19,10 @@ #define IDR_PAN_SOUTH_WEST_CURSOR 15 #define IDR_PAN_NORTH_EAST_CURSOR 16 #define IDR_PAN_NORTH_WEST_CURSOR 17 +#define IDR_SEARCH_CANCEL 18 +#define IDR_SEARCH_CANCEL_PRESSED 19 +#define IDR_SEARCH_MAGNIFIER 20 +#define IDR_SEARCH_MAGNIFIER_RESULTS 21 #define IDC_STATIC -1 #define BUILD_NUMBER 1 @@ -27,7 +31,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 18 +#define _APS_NEXT_RESOURCE_VALUE 22 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1000 #define _APS_NEXT_SYMED_VALUE 101 diff --git a/WebKit/win/WebKit.vcproj/searchCancel.png b/WebKit/win/WebKit.vcproj/searchCancel.png Binary files differnew file mode 100644 index 0000000..49f3f47 --- /dev/null +++ b/WebKit/win/WebKit.vcproj/searchCancel.png diff --git a/WebKit/win/WebKit.vcproj/searchCancelPressed.png b/WebKit/win/WebKit.vcproj/searchCancelPressed.png Binary files differnew file mode 100644 index 0000000..b699d81 --- /dev/null +++ b/WebKit/win/WebKit.vcproj/searchCancelPressed.png diff --git a/WebKit/win/WebKit.vcproj/searchMagnifier.png b/WebKit/win/WebKit.vcproj/searchMagnifier.png Binary files differnew file mode 100644 index 0000000..f9b8cae --- /dev/null +++ b/WebKit/win/WebKit.vcproj/searchMagnifier.png diff --git a/WebKit/win/WebKit.vcproj/searchMagnifierResults.png b/WebKit/win/WebKit.vcproj/searchMagnifierResults.png Binary files differnew file mode 100644 index 0000000..9aa1b36 --- /dev/null +++ b/WebKit/win/WebKit.vcproj/searchMagnifierResults.png diff --git a/WebKit/win/WebKitClassFactory.cpp b/WebKit/win/WebKitClassFactory.cpp index 0da303a..112dabe 100644 --- a/WebKit/win/WebKitClassFactory.cpp +++ b/WebKit/win/WebKitClassFactory.cpp @@ -54,6 +54,7 @@ #include "WebScriptDebugServer.h" #include "WebView.h" #pragma warning(push, 0) +#include <JavaScriptCore/InitializeThreading.h> #include <WebCore/FontDatabase.h> #include <WebCore/SoftLinking.h> #pragma warning(pop) @@ -82,6 +83,7 @@ WebKitClassFactory::WebKitClassFactory(CLSID targetClass) } #endif + JSC::initializeThreading(); WebCore::populateFontDatabase(); gClassCount++; diff --git a/WebKit/win/WebKitDLL.cpp b/WebKit/win/WebKitDLL.cpp index eab96b9..2df3584 100644 --- a/WebKit/win/WebKitDLL.cpp +++ b/WebKit/win/WebKitDLL.cpp @@ -167,6 +167,14 @@ PassRefPtr<WebCore::SharedBuffer> loadResourceIntoBuffer(const char* name) idr = IDR_PAN_NORTH_EAST_CURSOR; else if (!strcmp(name, "panNorthWestCursor")) idr = IDR_PAN_NORTH_WEST_CURSOR; + else if (!strcmp(name, "searchMagnifier")) + idr = IDR_SEARCH_MAGNIFIER; + else if (!strcmp(name, "searchMagnifierResults")) + idr = IDR_SEARCH_MAGNIFIER_RESULTS; + else if (!strcmp(name, "searchCancel")) + idr = IDR_SEARCH_CANCEL; + else if (!strcmp(name, "searchCancelPressed")) + idr = IDR_SEARCH_CANCEL_PRESSED; else if (!strcmp(name, "zoomInCursor")) idr = IDR_ZOOM_IN_CURSOR; else if (!strcmp(name, "zoomOutCursor")) diff --git a/WebKit/win/WebKitPrefix.cpp b/WebKit/win/WebKitPrefix.cpp index e82b88d..193e9f6 100644 --- a/WebKit/win/WebKitPrefix.cpp +++ b/WebKit/win/WebKitPrefix.cpp @@ -27,3 +27,4 @@ */ #include "WebKitPrefix.h" + diff --git a/WebKit/win/WebMutableURLRequest.cpp b/WebKit/win/WebMutableURLRequest.cpp index c4e034e..63a060e 100644 --- a/WebKit/win/WebMutableURLRequest.cpp +++ b/WebKit/win/WebMutableURLRequest.cpp @@ -35,9 +35,12 @@ #include <WebCore/BString.h> #include <WebCore/CString.h> #include <WebCore/FormData.h> +#include <WebCore/NotImplemented.h> #include <WebCore/ResourceHandle.h> #pragma warning(pop) +#include <wtf/RetainPtr.h> + using namespace WebCore; // IWebURLRequest ---------------------------------------------------------------- @@ -367,9 +370,15 @@ HRESULT STDMETHODCALLTYPE WebMutableURLRequest::mutableCopy( { if (!result) return E_POINTER; + +#if USE(CFNETWORK) RetainPtr<CFMutableURLRequestRef> mutableRequest(AdoptCF, CFURLRequestCreateMutableCopy(kCFAllocatorDefault, m_request.cfURLRequest())); *result = createInstance(ResourceRequest(mutableRequest.get())); return S_OK; +#else + notImplemented(); + return E_NOTIMPL; +#endif } // IWebMutableURLRequest ---------------------------------------------------- diff --git a/WebKit/win/WebPreferenceKeysPrivate.h b/WebKit/win/WebPreferenceKeysPrivate.h index 6f3dacd..758254e 100644 --- a/WebKit/win/WebPreferenceKeysPrivate.h +++ b/WebKit/win/WebPreferenceKeysPrivate.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -49,6 +49,8 @@ #define WebKitJavaScriptEnabledPreferenceKey "WebKitJavaScriptEnabled" #define WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey "WebKitJavaScriptCanOpenWindowsAutomatically" #define WebKitPluginsEnabledPreferenceKey "WebKitPluginsEnabled" +#define WebKitDatabasesEnabledPreferenceKey "WebKitDatabasesEnabled" +#define WebKitLocalStorageEnabledPreferenceKey "WebKitLocalStorageEnabled" #define WebKitAllowAnimatedImagesPreferenceKey "WebKitAllowAnimatedImagesPreferenceKey" #define WebKitAllowAnimatedImageLoopingPreferenceKey "WebKitAllowAnimatedImageLoopingPreferenceKey" #define WebKitDisplayImagesKey "WebKitDisplayImagesKey" @@ -89,6 +91,7 @@ // Windows-specific keys #define WebKitFontSmoothingTypePreferenceKey "WebKitFontSmoothingType" // default: FontSmoothingTypeMedium (2) +#define WebKitFontSmoothingContrastPreferenceKey "WebKitFontSmoothingContrast" // default: "2" #define WebKitCookieStorageAcceptPolicyPreferenceKey "WebKitCookieStorageAcceptPolicy" // default: WebKitCookieStorageAcceptPolicyOnlyFromMainDocumentDomain #define WebContinuousSpellCheckingEnabledPreferenceKey "WebContinuousSpellCheckingEnabled" // default: false @@ -116,3 +119,5 @@ #define WebKitPaintNativeControlsPreferenceKey "WebKitPaintNativeControls" +#define WebKitZoomsTextOnlyPreferenceKey "WebKitZoomsTextOnly" + diff --git a/WebKit/win/WebPreferences.cpp b/WebKit/win/WebPreferences.cpp index 316524a..5fcd319 100644 --- a/WebKit/win/WebPreferences.cpp +++ b/WebKit/win/WebPreferences.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -42,14 +42,17 @@ #pragma warning( pop ) #include <CoreFoundation/CoreFoundation.h> -#include <CoreGraphics/CoreGraphics.h> #include <shlobj.h> #include <shfolder.h> #include <tchar.h> -#include <WebKitSystemInterface/WebKitSystemInterface.h> #include <wtf/HashMap.h> #include <wtf/OwnArrayPtr.h> +#if PLATFORM(CG) +#include <CoreGraphics/CoreGraphics.h> +#include <WebKitSystemInterface/WebKitSystemInterface.h> +#endif + using namespace WebCore; static const String& oldPreferencesPath() @@ -202,6 +205,8 @@ void WebPreferences::initializeDefaultSettings() CFDictionaryAddValue(defaults, CFSTR(WebKitJavaScriptEnabledPreferenceKey), kCFBooleanTrue); CFDictionaryAddValue(defaults, CFSTR(WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey), kCFBooleanTrue); CFDictionaryAddValue(defaults, CFSTR(WebKitPluginsEnabledPreferenceKey), kCFBooleanTrue); + CFDictionaryAddValue(defaults, CFSTR(WebKitDatabasesEnabledPreferenceKey), kCFBooleanTrue); + CFDictionaryAddValue(defaults, CFSTR(WebKitLocalStorageEnabledPreferenceKey), kCFBooleanTrue); CFDictionaryAddValue(defaults, CFSTR(WebKitAllowAnimatedImagesPreferenceKey), kCFBooleanTrue); CFDictionaryAddValue(defaults, CFSTR(WebKitAllowAnimatedImageLoopingPreferenceKey), kCFBooleanTrue); CFDictionaryAddValue(defaults, CFSTR(WebKitDisplayImagesKey), kCFBooleanTrue); @@ -221,6 +226,7 @@ void WebPreferences::initializeDefaultSettings() CFDictionaryAddValue(defaults, CFSTR(WebKitIconDatabaseLocationKey), CFSTR("")); CFDictionaryAddValue(defaults, CFSTR(WebKitIconDatabaseEnabledPreferenceKey), kCFBooleanTrue); CFDictionaryAddValue(defaults, CFSTR(WebKitFontSmoothingTypePreferenceKey), CFSTR("2")); + CFDictionaryAddValue(defaults, CFSTR(WebKitFontSmoothingContrastPreferenceKey), CFSTR("2")); CFDictionaryAddValue(defaults, CFSTR(WebKitCookieStorageAcceptPolicyPreferenceKey), CFSTR("2")); CFDictionaryAddValue(defaults, CFSTR(WebContinuousSpellCheckingEnabledPreferenceKey), kCFBooleanFalse); CFDictionaryAddValue(defaults, CFSTR(WebGrammarCheckingEnabledPreferenceKey), kCFBooleanFalse); @@ -334,6 +340,16 @@ void WebPreferences::setIntegerValue(CFStringRef key, int value) postPreferencesChangesNotification(); } +void WebPreferences::setFloatValue(CFStringRef key, float value) +{ + if (floatValueForKey(key) == value) + return; + + setValueForKey(key, cfNumber(value).get()); + + postPreferencesChangesNotification(); +} + void WebPreferences::setBoolValue(CFStringRef key, BOOL value) { if (boolValueForKey(key) == value) @@ -963,8 +979,27 @@ HRESULT STDMETHODCALLTYPE WebPreferences::setFontSmoothing( { setIntegerValue(CFSTR(WebKitFontSmoothingTypePreferenceKey), smoothingType); if (smoothingType == FontSmoothingTypeWindows) - smoothingType = FontSmoothingTypeStandard; + smoothingType = FontSmoothingTypeMedium; +#if PLATFORM(CG) wkSetFontSmoothingLevel((int)smoothingType); +#endif + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebPreferences::fontSmoothingContrast( + /* [retval][out] */ float* contrast) +{ + *contrast = floatValueForKey(CFSTR(WebKitFontSmoothingContrastPreferenceKey)); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebPreferences::setFontSmoothingContrast( + /* [in] */ float contrast) +{ + setFloatValue(CFSTR(WebKitFontSmoothingContrastPreferenceKey), contrast); +#if PLATFORM(CG) + wkSetFontSmoothingContrast(contrast); +#endif return S_OK; } @@ -1173,6 +1208,30 @@ HRESULT STDMETHODCALLTYPE WebPreferences::offlineWebApplicationCacheEnabled(BOOL return S_OK; } +HRESULT STDMETHODCALLTYPE WebPreferences::setDatabasesEnabled(BOOL enabled) +{ + setBoolValue(CFSTR(WebKitDatabasesEnabledPreferenceKey), enabled); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebPreferences::databasesEnabled(BOOL* enabled) +{ + *enabled = boolValueForKey(CFSTR(WebKitDatabasesEnabledPreferenceKey)); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebPreferences::setLocalStorageEnabled(BOOL enabled) +{ + setBoolValue(CFSTR(WebKitLocalStorageEnabledPreferenceKey), enabled); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebPreferences::localStorageEnabled(BOOL* enabled) +{ + *enabled = boolValueForKey(CFSTR(WebKitLocalStorageEnabledPreferenceKey)); + return S_OK; +} + HRESULT STDMETHODCALLTYPE WebPreferences::localStorageDatabasePath(BSTR* location) { *location = stringValueForKey(CFSTR(WebKitLocalStorageDatabasePathPreferenceKey)); @@ -1185,6 +1244,18 @@ HRESULT STDMETHODCALLTYPE WebPreferences::setLocalStorageDatabasePath(BSTR locat return S_OK; } +HRESULT WebPreferences::setZoomsTextOnly(BOOL zoomsTextOnly) +{ + setBoolValue(CFSTR(WebKitZoomsTextOnlyPreferenceKey), zoomsTextOnly); + return S_OK; +} + +HRESULT WebPreferences::zoomsTextOnly(BOOL* zoomsTextOnly) +{ + *zoomsTextOnly = boolValueForKey(CFSTR(WebKitZoomsTextOnlyPreferenceKey)); + return S_OK; +} + void WebPreferences::willAddToWebView() { ++m_numWebViews; diff --git a/WebKit/win/WebPreferences.h b/WebKit/win/WebPreferences.h index 46df0a2..6ab3dcb 100644 --- a/WebKit/win/WebPreferences.h +++ b/WebKit/win/WebPreferences.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -308,6 +308,18 @@ public: virtual HRESULT STDMETHODCALLTYPE offlineWebApplicationCacheEnabled( /* [retval][out] */ BOOL *enabled); + virtual HRESULT STDMETHODCALLTYPE setDatabasesEnabled( + /* [in] */ BOOL enabled); + + virtual HRESULT STDMETHODCALLTYPE databasesEnabled( + /* [retval][out] */ BOOL *enabled); + + virtual HRESULT STDMETHODCALLTYPE setLocalStorageEnabled( + /* [in] */ BOOL enabled); + + virtual HRESULT STDMETHODCALLTYPE localStorageEnabled( + /* [retval][out] */ BOOL *enabled); + virtual HRESULT STDMETHODCALLTYPE localStorageDatabasePath( /* [out, retval] */ BSTR* location); @@ -320,6 +332,18 @@ public: virtual HRESULT STDMETHODCALLTYPE shouldPaintNativeControls( /* [retval][out] */ BOOL *shouldPaint); + virtual HRESULT STDMETHODCALLTYPE setZoomsTextOnly( + /* [retval][out] */ BOOL zoomsTextOnly); + + virtual HRESULT STDMETHODCALLTYPE zoomsTextOnly( + /* [retval][out] */ BOOL *zoomsTextOnly); + + virtual HRESULT STDMETHODCALLTYPE fontSmoothingContrast( + /* [retval][out] */ float* contrast); + + virtual HRESULT STDMETHODCALLTYPE setFontSmoothingContrast( + /* [in] */ float contrast); + // WebPreferences // This method accesses a different preference key than developerExtrasEnabled. @@ -355,6 +379,7 @@ protected: void setStringValue(CFStringRef key, LPCTSTR value); void setIntegerValue(CFStringRef key, int value); void setBoolValue(CFStringRef key, BOOL value); + void setFloatValue(CFStringRef key, float value); void setLongLongValue(CFStringRef key, LONGLONG value); static WebPreferences* getInstanceForIdentifier(BSTR identifier); static void initializeDefaultSettings(); diff --git a/WebKit/win/WebResource.cpp b/WebKit/win/WebResource.cpp index 9374aec..3c2087f 100644 --- a/WebKit/win/WebResource.cpp +++ b/WebKit/win/WebResource.cpp @@ -27,6 +27,7 @@ #include "WebKitDLL.h" #include "WebResource.h" +#include "MarshallingHelpers.h" #include "MemoryStream.h" #pragma warning(push, 0) @@ -105,7 +106,7 @@ HRESULT STDMETHODCALLTYPE WebResource::initWithData( /* [in] */ BSTR frameName) { m_data = data; - m_url = KURL(String(url)); + m_url = MarshallingHelpers::BSTRToKURL(url); m_mimeType = String(mimeType); m_textEncodingName = String(textEncodingName); m_frameName = String(frameName); diff --git a/WebKit/win/WebScriptCallFrame.cpp b/WebKit/win/WebScriptCallFrame.cpp index a831565..fa76fe9 100644 --- a/WebKit/win/WebScriptCallFrame.cpp +++ b/WebKit/win/WebScriptCallFrame.cpp @@ -32,7 +32,7 @@ #include "COMEnumVariant.h" #include "WebKitDLL.h" -#include <JavaScriptCore/Interpreter.h> +#include <JavaScriptCore/Completion.h> #include <JavaScriptCore/JSFunction.h> #include <JavaScriptCore/JSGlobalObject.h> #include <JavaScriptCore/JSLock.h> @@ -49,20 +49,20 @@ using namespace JSC; -UString WebScriptCallFrame::jsValueToString(JSC::ExecState* state, JSValue* jsvalue) +UString WebScriptCallFrame::jsValueToString(JSC::ExecState* state, JSValuePtr jsvalue) { if (!jsvalue) return "undefined"; - if (jsvalue->isString()) - return jsvalue->getString(); - else if (jsvalue->isNumber()) - return UString::from(jsvalue->getNumber()); - else if (jsvalue->isBoolean()) - return jsvalue->getBoolean() ? "True" : "False"; - else if (jsvalue->isObject()) { - jsvalue = jsvalue->getObject()->defaultValue(state, PreferString); - return jsvalue->getString(); + if (jsvalue.isString()) + return jsvalue.getString(); + else if (jsvalue.isNumber()) + return UString::from(jsvalue.uncheckedGetNumber()); + else if (jsvalue.isBoolean()) + return jsvalue.getBoolean() ? "True" : "False"; + else if (jsvalue.isObject()) { + jsvalue = jsvalue.getObject()->defaultValue(state, PreferString); + return jsvalue.getString(); } return "undefined"; @@ -182,7 +182,7 @@ HRESULT STDMETHODCALLTYPE WebScriptCallFrame::stringByEvaluatingJavaScriptFromSt JSLock lock(false); - JSValue* scriptExecutionResult = valueByEvaluatingJavaScriptFromString(script); + JSValuePtr scriptExecutionResult = valueByEvaluatingJavaScriptFromString(script); *result = WebCore::BString(jsValueToString(m_state, scriptExecutionResult)).release(); return S_OK; @@ -221,7 +221,7 @@ HRESULT STDMETHODCALLTYPE WebScriptCallFrame::valueForVariable( Identifier identKey(m_state, reinterpret_cast<UChar*>(key), SysStringLen(key)); #if 0 - JSValue* jsvalue = noValue(); + JSValuePtr jsvalue = noValue(); ScopeChain scopeChain = m_state->scopeChain(); for (ScopeChainIterator it = scopeChain.begin(); it != scopeChain.end() && !jsvalue; ++it) jsvalue = (*it)->get(m_state, identKey); @@ -231,7 +231,7 @@ HRESULT STDMETHODCALLTYPE WebScriptCallFrame::valueForVariable( return S_OK; } -JSValue* WebScriptCallFrame::valueByEvaluatingJavaScriptFromString(BSTR script) +JSValuePtr WebScriptCallFrame::valueByEvaluatingJavaScriptFromString(BSTR script) { #if 0 ExecState* state = m_state; @@ -240,7 +240,7 @@ JSValue* WebScriptCallFrame::valueByEvaluatingJavaScriptFromString(BSTR script) // find "eval" JSObject* eval = 0; if (state->scopeNode()) { // "eval" won't work without context (i.e. at global scope) - JSValue* v = globObj->get(state, "eval"); + JSValuePtr v = globObj->get(state, "eval"); if (v->isObject() && asObject(v)->implementsCall()) eval = asObject(v); else @@ -248,20 +248,20 @@ JSValue* WebScriptCallFrame::valueByEvaluatingJavaScriptFromString(BSTR script) state = globObj->globalExec(); } - JSValue* savedException = state->exception(); + JSValuePtr savedException = state->exception(); state->clearException(); UString code(reinterpret_cast<UChar*>(script), SysStringLen(script)); // evaluate - JSValue* scriptExecutionResult; + JSValuePtr scriptExecutionResult; if (eval) { ArgList args; args.append(jsString(state, code)); scriptExecutionResult = eval->call(state, 0, args); } else // no "eval", or no context (i.e. global scope) - use global fallback - scriptExecutionResult = Interpreter::evaluate(state, UString(), 0, code.data(), code.size(), globObj).value(); + scriptExecutionResult = JSC::evaluate(state, UString(), 0, code.data(), code.size(), globObj).value(); if (state->hadException()) scriptExecutionResult = state->exception(); // (may be redundant depending on which eval path was used) diff --git a/WebKit/win/WebScriptCallFrame.h b/WebKit/win/WebScriptCallFrame.h index d3cc4f8..d3c3243 100644 --- a/WebKit/win/WebScriptCallFrame.h +++ b/WebKit/win/WebScriptCallFrame.h @@ -74,10 +74,10 @@ public: /* [out, retval] */ BSTR* value); // Helper and accessors - virtual JSC::JSValue* valueByEvaluatingJavaScriptFromString(BSTR script); + virtual JSC::JSValuePtr valueByEvaluatingJavaScriptFromString(BSTR script); virtual JSC::ExecState* state() const { return m_state; } - static JSC::UString jsValueToString(JSC::ExecState*, JSC::JSValue*); + static JSC::UString jsValueToString(JSC::ExecState*, JSC::JSValuePtr); private: ULONG m_refCount; diff --git a/WebKit/win/WebTextRenderer.cpp b/WebKit/win/WebTextRenderer.cpp index 38fa544..7ff2ff3 100644 --- a/WebKit/win/WebTextRenderer.cpp +++ b/WebKit/win/WebTextRenderer.cpp @@ -32,7 +32,9 @@ #include "WebKitDLL.h" #include <CoreFoundation/CFString.h> +#if PLATFORM(CG) #include <WebKitSystemInterface/WebKitSystemInterface.h> +#endif #include <wtf/RetainPtr.h> WebTextRenderer* WebTextRenderer::createInstance() @@ -90,6 +92,8 @@ HRESULT STDMETHODCALLTYPE WebTextRenderer::registerPrivateFont( return E_FAIL; RetainPtr<CFStringRef> string(AdoptCF, CFStringCreateWithCharacters(0, reinterpret_cast<const UniChar*>(fontFilePath), static_cast<CFIndex>(wcslen(fontFilePath)))); +#if PLATFORM(CG) wkAddFontsAtPath(string.get()); +#endif return S_OK; } diff --git a/WebKit/win/WebURLAuthenticationChallenge.cpp b/WebKit/win/WebURLAuthenticationChallenge.cpp index e0923d5..7c37501 100644 --- a/WebKit/win/WebURLAuthenticationChallenge.cpp +++ b/WebKit/win/WebURLAuthenticationChallenge.cpp @@ -149,9 +149,10 @@ HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallenge::initWithProtectionSpace // FIXME: After we change AuthenticationChallenge to use "ResourceHandle" as the abstract "Sender" or "Source of this Auth Challenge", then we'll // construct the AuthenticationChallenge with that as obtained from the webSender - +#if USE(CFNETWORK) m_authenticationChallenge = AuthenticationChallenge(webSpace->protectionSpace(), webCredential->credential(), previousFailureCount, webResponse->resourceResponse(), webError->resourceError()); +#endif return S_OK; } diff --git a/WebKit/win/WebURLAuthenticationChallengeSender.cpp b/WebKit/win/WebURLAuthenticationChallengeSender.cpp index dfd2689..c80e33f 100644 --- a/WebKit/win/WebURLAuthenticationChallengeSender.cpp +++ b/WebKit/win/WebURLAuthenticationChallengeSender.cpp @@ -29,6 +29,7 @@ #include "WebURLAuthenticationChallengeSender.h" #include "COMPtr.h" +#include "NotImplemented.h" #include "WebKit.h" #include "WebURLAuthenticationChallenge.h" #include "WebURLCredential.h" @@ -95,46 +96,6 @@ ULONG STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::Release(void) return newRef; } -// IWebURLAuthenticationChallengeSender ------------------------------------------------------------------- - -HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::cancelAuthenticationChallenge( - /* [in] */ IWebURLAuthenticationChallenge* challenge) -{ - COMPtr<WebURLAuthenticationChallenge> webChallenge(Query, challenge); - if (!webChallenge) - return E_FAIL; - - m_handle->receivedCancellation(webChallenge->authenticationChallenge()); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::continueWithoutCredentialForAuthenticationChallenge( - /* [in] */ IWebURLAuthenticationChallenge* challenge) -{ - COMPtr<WebURLAuthenticationChallenge> webChallenge(Query, challenge); - if (!webChallenge) - return E_FAIL; - - m_handle->receivedRequestToContinueWithoutCredential(webChallenge->authenticationChallenge()); - return S_OK; -} - -HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::useCredential( - /* [in] */ IWebURLCredential* credential, - /* [in] */ IWebURLAuthenticationChallenge* challenge) -{ - COMPtr<WebURLAuthenticationChallenge> webChallenge(Query, challenge); - if (!webChallenge) - return E_FAIL; - - COMPtr<WebURLCredential> webCredential; - if (!credential || FAILED(credential->QueryInterface(__uuidof(WebURLCredential), (void**)&webCredential))) - return E_FAIL; - - m_handle->receivedCredential(webChallenge->authenticationChallenge(), webCredential->credential()); - return S_OK; -} - // WebURLAuthenticationChallengeSender ---------------------------------------------------------------- ResourceHandle* WebURLAuthenticationChallengeSender::resourceHandle() const diff --git a/WebKit/win/WebURLAuthenticationChallengeSenderCFNet.cpp b/WebKit/win/WebURLAuthenticationChallengeSenderCFNet.cpp new file mode 100644 index 0000000..21f79e0 --- /dev/null +++ b/WebKit/win/WebURLAuthenticationChallengeSenderCFNet.cpp @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2007 Apple 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 "WebKitDLL.h" +#include <initguid.h> +#include "WebURLAuthenticationChallengeSender.h" + +#include "COMPtr.h" +#include "WebKit.h" +#include "WebURLAuthenticationChallenge.h" +#include "WebURLCredential.h" + +#pragma warning(push, 0) +#include <WebCore/ResourceHandle.h> +#pragma warning(pop) + +using namespace WebCore; + +// IWebURLAuthenticationChallengeSender ------------------------------------------------------------------- + +HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::cancelAuthenticationChallenge( + /* [in] */ IWebURLAuthenticationChallenge* challenge) +{ + COMPtr<WebURLAuthenticationChallenge> webChallenge(Query, challenge); + if (!webChallenge) + return E_FAIL; + + m_handle->receivedCancellation(webChallenge->authenticationChallenge()); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::continueWithoutCredentialForAuthenticationChallenge( + /* [in] */ IWebURLAuthenticationChallenge* challenge) +{ + COMPtr<WebURLAuthenticationChallenge> webChallenge(Query, challenge); + if (!webChallenge) + return E_FAIL; + + m_handle->receivedRequestToContinueWithoutCredential(webChallenge->authenticationChallenge()); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::useCredential( + /* [in] */ IWebURLCredential* credential, + /* [in] */ IWebURLAuthenticationChallenge* challenge) +{ + COMPtr<WebURLAuthenticationChallenge> webChallenge(Query, challenge); + if (!webChallenge) + return E_FAIL; + + COMPtr<WebURLCredential> webCredential; + if (!credential || FAILED(credential->QueryInterface(__uuidof(WebURLCredential), (void**)&webCredential))) + return E_FAIL; + + m_handle->receivedCredential(webChallenge->authenticationChallenge(), webCredential->credential()); + return S_OK; +} diff --git a/WebKit/win/WebURLAuthenticationChallengeSenderCurl.cpp b/WebKit/win/WebURLAuthenticationChallengeSenderCurl.cpp new file mode 100644 index 0000000..2cf9a75 --- /dev/null +++ b/WebKit/win/WebURLAuthenticationChallengeSenderCurl.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2008 Brent Fulgham <bfulgham@gmail.com>. 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 "WebKitDLL.h" +#include <initguid.h> +#include "WebURLAuthenticationChallengeSender.h" + +#include "COMPtr.h" +#include "NotImplemented.h" +#include "WebKit.h" +#include "WebURLAuthenticationChallenge.h" +#include "WebURLCredential.h" + +#pragma warning(push, 0) +#include <WebCore/ResourceHandle.h> +#pragma warning(pop) + +using namespace WebCore; + +// IWebURLAuthenticationChallengeSender ------------------------------------------------------------------- + +HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::cancelAuthenticationChallenge( + /* [in] */ IWebURLAuthenticationChallenge* challenge) +{ + notImplemented(); + return E_FAIL; +} + +HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::continueWithoutCredentialForAuthenticationChallenge( + /* [in] */ IWebURLAuthenticationChallenge* challenge) +{ + notImplemented(); + return E_FAIL; +} + +HRESULT STDMETHODCALLTYPE WebURLAuthenticationChallengeSender::useCredential( + /* [in] */ IWebURLCredential* credential, + /* [in] */ IWebURLAuthenticationChallenge* challenge) +{ + notImplemented(); + return E_FAIL; +} diff --git a/WebKit/win/WebURLProtectionSpace.cpp b/WebKit/win/WebURLProtectionSpace.cpp index dc40704..c3d78bb 100644 --- a/WebKit/win/WebURLProtectionSpace.cpp +++ b/WebKit/win/WebURLProtectionSpace.cpp @@ -152,14 +152,19 @@ HRESULT STDMETHODCALLTYPE WebURLProtectionSpace::initWithHost( /* [in] */ BSTR realm, /* [in] */ BSTR authenticationMethod) { + static BString& webURLProtectionSpaceHTTPBString = *new BString(WebURLProtectionSpaceHTTP); + static BString& webURLProtectionSpaceHTTPSBString = *new BString(WebURLProtectionSpaceHTTPS); + static BString& webURLProtectionSpaceFTPBString = *new BString(WebURLProtectionSpaceFTP); + static BString& webURLProtectionSpaceFTPSBString = *new BString(WebURLProtectionSpaceFTPS); + ProtectionSpaceServerType serverType = ProtectionSpaceServerHTTP; - if (BString(protocol) == WebURLProtectionSpaceHTTP) + if (BString(protocol) == webURLProtectionSpaceHTTPBString) serverType = ProtectionSpaceServerHTTP; - else if (BString(protocol) == WebURLProtectionSpaceHTTPS) + else if (BString(protocol) == webURLProtectionSpaceHTTPSBString) serverType = ProtectionSpaceServerHTTPS; - else if (BString(protocol) == WebURLProtectionSpaceFTP) + else if (BString(protocol) == webURLProtectionSpaceFTPBString) serverType = ProtectionSpaceServerFTP; - else if (BString(protocol) == WebURLProtectionSpaceFTPS) + else if (BString(protocol) == webURLProtectionSpaceFTPSBString) serverType = ProtectionSpaceServerFTPS; else ASSERT_NOT_REACHED(); @@ -177,14 +182,19 @@ HRESULT STDMETHODCALLTYPE WebURLProtectionSpace::initWithProxyHost( /* [in] */ BSTR realm, /* [in] */ BSTR authenticationMethod) { + static BString& webURLProtectionSpaceHTTPProxyBString = *new BString(WebURLProtectionSpaceHTTPProxy); + static BString& webURLProtectionSpaceHTTPSProxyBString = *new BString(WebURLProtectionSpaceHTTPSProxy); + static BString& webURLProtectionSpaceFTPProxyBString = *new BString(WebURLProtectionSpaceFTPProxy); + static BString& webURLProtectionSpaceSOCKSProxyBString = *new BString(WebURLProtectionSpaceSOCKSProxy); + ProtectionSpaceServerType serverType = ProtectionSpaceProxyHTTP; - if (BString(proxyType) == WebURLProtectionSpaceHTTPProxy) + if (BString(proxyType) == webURLProtectionSpaceHTTPProxyBString) serverType = ProtectionSpaceProxyHTTP; - else if (BString(proxyType) == WebURLProtectionSpaceHTTPSProxy) + else if (BString(proxyType) == webURLProtectionSpaceHTTPSProxyBString) serverType = ProtectionSpaceProxyHTTPS; - else if (BString(proxyType) == WebURLProtectionSpaceFTPProxy) + else if (BString(proxyType) == webURLProtectionSpaceFTPProxyBString) serverType = ProtectionSpaceProxyFTP; - else if (BString(proxyType) == WebURLProtectionSpaceSOCKSProxy) + else if (BString(proxyType) == webURLProtectionSpaceSOCKSProxyBString) serverType = ProtectionSpaceProxySOCKS; else ASSERT_NOT_REACHED(); diff --git a/WebKit/win/WebURLResponse.cpp b/WebKit/win/WebURLResponse.cpp index 7f2c795..b1f4488 100644 --- a/WebKit/win/WebURLResponse.cpp +++ b/WebKit/win/WebURLResponse.cpp @@ -33,7 +33,10 @@ #include "MarshallingHelpers.h" #include "WebLocalizableStrings.h" +#if USE(CFNETWORK) #include <WebKitSystemInterface/WebKitSystemInterface.h> +#endif + #include <wtf/platform.h> #pragma warning( push, 0 ) #include <WebCore/BString.h> @@ -293,7 +296,7 @@ HRESULT STDMETHODCALLTYPE WebURLResponse::initWithURL( /* [in] */ int expectedContentLength, /* [in] */ BSTR textEncodingName) { - m_response = ResourceResponse(KURL(url), String(mimeType), expectedContentLength, String(textEncodingName), String()); + m_response = ResourceResponse(MarshallingHelpers::BSTRToKURL(url), String(mimeType), expectedContentLength, String(textEncodingName), String()); return S_OK; } @@ -360,7 +363,7 @@ HRESULT STDMETHODCALLTYPE WebURLResponse::allHeaderFields( { ASSERT(m_response.isHTTP()); - *headerFields = COMPropertyBag<String, CaseFoldingHash>::createInstance(m_response.httpHeaderFields()); + *headerFields = COMPropertyBag<String, AtomicString, CaseFoldingHash>::createInstance(m_response.httpHeaderFields()); return S_OK; } diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp index 273d626..eb176dc 100644 --- a/WebKit/win/WebView.cpp +++ b/WebKit/win/WebView.cpp @@ -29,6 +29,7 @@ #include "CFDictionaryPropertyBag.h" #include "DOMCoreClasses.h" +#include "MarshallingHelpers.h" #include "WebDatabaseManager.h" #include "WebDocumentLoader.h" #include "WebEditorClient.h" @@ -67,6 +68,7 @@ #include <WebCore/EventNames.h> #include <WebCore/FileSystem.h> #include <WebCore/FocusController.h> +#include <WebCore/FloatQuad.h> #include <WebCore/FrameLoader.h> #include <WebCore/FrameTree.h> #include <WebCore/FrameView.h> @@ -92,6 +94,7 @@ #include <WebCore/RenderTheme.h> #include <WebCore/ResourceHandle.h> #include <WebCore/ResourceHandleClient.h> +#include <WebCore/ScriptValue.h> #include <WebCore/ScrollbarTheme.h> #include <WebCore/SelectionController.h> #include <WebCore/Settings.h> @@ -124,6 +127,20 @@ static HashSet<WebView*> pendingDeleteBackingStoreSet; static String osVersion(); static String webKitVersion(); +typedef CFURLCacheRef (*CopySharedURLCacheFunction)(); + +static HMODULE findCFNetworkModule() +{ + if (HMODULE module = GetModuleHandleA("CFNetwork")) + return module; + return GetModuleHandleA("CFNetwork_debug"); +} + +static CopySharedURLCacheFunction findCopySharedURLCacheFunction() +{ + return reinterpret_cast<CopySharedURLCacheFunction>(GetProcAddress(findCFNetworkModule(), "CFURLCacheCopySharedURLCache")); +} + WebView* kit(Page* page) { return page ? static_cast<WebChromeClient*>(page->chrome()->client())->webView() : 0; @@ -268,7 +285,6 @@ WebView::WebView() , m_useBackForwardList(true) , m_userAgentOverridden(false) , m_zoomMultiplier(1.0f) -, m_zoomMultiplierIsTextOnly(true) , m_mouseActivated(false) , m_dragData(0) , m_currentCharacterCode(0) @@ -283,6 +299,7 @@ WebView::WebView() , m_topLevelParent(0) , m_deleteBackingStoreTimerActive(false) , m_transparent(false) +, m_selectTrailingWhitespaceEnabled(false) { JSC::initializeThreading(); @@ -366,11 +383,14 @@ void WebView::setCacheModel(WebCacheModel cacheModel) if (s_didSetCacheModel && cacheModel == s_cacheModel) return; -#ifdef CFURLCacheCopySharedURLCachePresent - RetainPtr<CFURLCacheRef> cfurlCache(AdoptCF, CFURLCacheCopySharedURLCache()); -#else - RetainPtr<CFURLCacheRef> cfurlCache = CFURLCacheSharedURLCache(); -#endif + // Once we require a newer version of CFNetwork with the CFURLCacheCopySharedURLCache function, + // we can call CFURLCacheCopySharedURLCache directly and eliminate copySharedURLCache. + static CopySharedURLCacheFunction copySharedURLCache = findCopySharedURLCacheFunction(); + RetainPtr<CFURLCacheRef> cfurlCache; + if (copySharedURLCache) + cfurlCache.adoptCF(copySharedURLCache()); + else + cfurlCache = CFURLCacheSharedURLCache(); RetainPtr<CFStringRef> cfurlCacheDirectory(AdoptCF, wkCopyFoundationCacheDirectory()); if (!cfurlCacheDirectory) @@ -398,14 +418,12 @@ void WebView::setCacheModel(WebCacheModel cacheModel) // Object cache capacities (in bytes) if (memSize >= 2048) - cacheTotalCapacity = 128 * 1024 * 1024; + cacheTotalCapacity = 96 * 1024 * 1024; else if (memSize >= 1536) - cacheTotalCapacity = 86 * 1024 * 1024; - else if (memSize >= 1024) cacheTotalCapacity = 64 * 1024 * 1024; - else if (memSize >= 512) + else if (memSize >= 1024) cacheTotalCapacity = 32 * 1024 * 1024; - else if (memSize >= 256) + else if (memSize >= 512) cacheTotalCapacity = 16 * 1024 * 1024; cacheMinDeadCapacity = 0; @@ -432,14 +450,12 @@ void WebView::setCacheModel(WebCacheModel cacheModel) // Object cache capacities (in bytes) if (memSize >= 2048) - cacheTotalCapacity = 128 * 1024 * 1024; + cacheTotalCapacity = 96 * 1024 * 1024; else if (memSize >= 1536) - cacheTotalCapacity = 86 * 1024 * 1024; - else if (memSize >= 1024) cacheTotalCapacity = 64 * 1024 * 1024; - else if (memSize >= 512) + else if (memSize >= 1024) cacheTotalCapacity = 32 * 1024 * 1024; - else if (memSize >= 256) + else if (memSize >= 512) cacheTotalCapacity = 16 * 1024 * 1024; cacheMinDeadCapacity = cacheTotalCapacity / 8; @@ -486,14 +502,12 @@ void WebView::setCacheModel(WebCacheModel cacheModel) // browsing pattern. Even growth above 128MB can have substantial // value / MB for some content / browsing patterns.) if (memSize >= 2048) - cacheTotalCapacity = 256 * 1024 * 1024; + cacheTotalCapacity = 128 * 1024 * 1024; else if (memSize >= 1536) - cacheTotalCapacity = 172 * 1024 * 1024; + cacheTotalCapacity = 96 * 1024 * 1024; else if (memSize >= 1024) - cacheTotalCapacity = 128 * 1024 * 1024; - else if (memSize >= 512) cacheTotalCapacity = 64 * 1024 * 1024; - else if (memSize >= 256) + else if (memSize >= 512) cacheTotalCapacity = 32 * 1024 * 1024; cacheMinDeadCapacity = cacheTotalCapacity / 4; @@ -805,7 +819,7 @@ static void getUpdateRects(HRGN region, const IntRect& dirtyRect, Vector<IntRect rects.append(*rect); } -void WebView::updateBackingStore(FrameView* frameView, HDC dc, bool backingStoreCompletelyDirty) +void WebView::updateBackingStore(FrameView* frameView, HDC dc, bool backingStoreCompletelyDirty, WindowsToPaint windowsToPaint) { LOCAL_GDI_COUNTER(0, __FUNCTION__); @@ -835,7 +849,7 @@ void WebView::updateBackingStore(FrameView* frameView, HDC dc, bool backingStore } for (unsigned i = 0; i < paintRects.size(); ++i) - paintIntoBackingStore(frameView, bitmapDC, paintRects[i]); + paintIntoBackingStore(frameView, bitmapDC, paintRects[i], windowsToPaint); if (m_uiDelegatePrivate) { COMPtr<IWebUIDelegatePrivate2> uiDelegatePrivate2(Query, m_uiDelegatePrivate); @@ -870,16 +884,23 @@ void WebView::paint(HDC dc, LPARAM options) OwnPtr<HRGN> region; int regionType = NULLREGION; PAINTSTRUCT ps; + WindowsToPaint windowsToPaint; if (!dc) { region.set(CreateRectRgn(0,0,0,0)); regionType = GetUpdateRgn(m_viewWindow, region.get(), false); hdc = BeginPaint(m_viewWindow, &ps); rcPaint = ps.rcPaint; + // We're painting to the screen, and our child windows can handle + // painting themselves to the screen. + windowsToPaint = PaintWebViewOnly; } else { hdc = dc; ::GetClientRect(m_viewWindow, &rcPaint); if (options & PRF_ERASEBKGND) ::FillRect(hdc, &rcPaint, (HBRUSH)GetStockObject(WHITE_BRUSH)); + // Since we aren't painting to the screen, we want to paint all our + // children into the HDC. + windowsToPaint = PaintWebViewAndChildren; } HDC bitmapDC = ::CreateCompatibleDC(hdc); @@ -887,7 +908,7 @@ void WebView::paint(HDC dc, LPARAM options) ::SelectObject(bitmapDC, m_backingStoreBitmap.get()); // Update our backing store if needed. - updateBackingStore(frameView, bitmapDC, backingStoreCompletelyDirty); + updateBackingStore(frameView, bitmapDC, backingStoreCompletelyDirty, windowsToPaint); // Now we blit the updated backing store IntRect windowDirtyRect = rcPaint; @@ -928,7 +949,7 @@ void WebView::paint(HDC dc, LPARAM options) deleteBackingStoreSoon(); } -void WebView::paintIntoBackingStore(FrameView* frameView, HDC bitmapDC, const IntRect& dirtyRect) +void WebView::paintIntoBackingStore(FrameView* frameView, HDC bitmapDC, const IntRect& dirtyRect, WindowsToPaint windowsToPaint) { LOCAL_GDI_COUNTER(0, __FUNCTION__); @@ -944,14 +965,18 @@ void WebView::paintIntoBackingStore(FrameView* frameView, HDC bitmapDC, const In ::ReleaseDC(m_viewWindow, dc); #endif - FillRect(bitmapDC, &rect, (HBRUSH)GetStockObject(WHITE_BRUSH)); + GraphicsContext gc(bitmapDC, m_transparent); + gc.setShouldIncludeChildWindows(windowsToPaint == PaintWebViewAndChildren); + gc.save(); + if (m_transparent) + gc.clearRect(dirtyRect); + else + FillRect(bitmapDC, &rect, (HBRUSH)GetStockObject(WHITE_BRUSH)); if (frameView && frameView->frame() && frameView->frame()->contentRenderer()) { - GraphicsContext gc(bitmapDC, m_transparent); - gc.save(); gc.clip(dirtyRect); frameView->paint(&gc, dirtyRect); - gc.restore(); } + gc.restore(); } void WebView::paintIntoWindow(HDC bitmapDC, HDC windowDC, const IntRect& dirtyRect) @@ -1053,18 +1078,23 @@ bool WebView::handleContextMenuEvent(WPARAM wParam, LPARAM lParam) if (!renderer) return false; - // Calculate the rect of the first line of the selection (cribbed from -[WebCoreFrameBridge firstRectForDOMRange:]). + // Calculate the rect of the first line of the selection (cribbed from -[WebCoreFrameBridge firstRectForDOMRange:], + // now Frame::firstRectForRange(), which perhaps this should call). int extraWidthToEndOfLine = 0; InlineBox* startInlineBox; int startCaretOffset; start.getInlineBoxAndOffset(DOWNSTREAM, startInlineBox, startCaretOffset); - IntRect startCaretRect = renderer->caretRect(startInlineBox, startCaretOffset, &extraWidthToEndOfLine); + IntRect startCaretRect = renderer->localCaretRect(startInlineBox, startCaretOffset, &extraWidthToEndOfLine); + if (startCaretRect != IntRect()) + startCaretRect = renderer->localToAbsoluteQuad(FloatRect(startCaretRect)).enclosingBoundingBox(); InlineBox* endInlineBox; int endCaretOffset; end.getInlineBoxAndOffset(UPSTREAM, endInlineBox, endCaretOffset); - IntRect endCaretRect = renderer->caretRect(endInlineBox, endCaretOffset); + IntRect endCaretRect = renderer->localCaretRect(endInlineBox, endCaretOffset); + if (endCaretRect != IntRect()) + endCaretRect = renderer->localToAbsoluteQuad(FloatRect(endCaretRect)).enclosingBoundingBox(); IntRect firstRect; if (startCaretRect.y() == endCaretRect.y()) @@ -1586,17 +1616,7 @@ bool WebView::keyPress(WPARAM charCode, LPARAM keyData, bool systemKeyDown) // IE does not dispatch keypress event for WM_SYSCHAR. if (systemKeyDown) return frame->eventHandler()->handleAccessKey(keyEvent); - if (frame->eventHandler()->keyEvent(keyEvent)) - return true; - - // Need to scroll the page if space is hit. - if (charCode == ' ') { - ScrollDirection direction = keyEvent.shiftKey() ? ScrollUp : ScrollDown; - if (!frame->eventHandler()->scrollOverflow(direction, ScrollByPage)) - frame->view()->scroll(direction, ScrollByPage); - return true; - } - return false; + return frame->eventHandler()->keyEvent(keyEvent); } bool WebView::inResizer(LPARAM lParam) @@ -1662,7 +1682,7 @@ static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, L { LRESULT lResult = 0; LONG_PTR longPtr = GetWindowLongPtr(hWnd, 0); - WebView* webView = reinterpret_cast<WebView*>(longPtr); + COMPtr<WebView> webView = reinterpret_cast<WebView*>(longPtr); // hold a ref, since the WebView could go away in an event handler. WebFrame* mainFrameImpl = webView ? webView->topLevelFrame() : 0; if (!mainFrameImpl || webView->isBeingDestroyed()) return DefWindowProc(hWnd, message, wParam, lParam); @@ -1758,7 +1778,7 @@ static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, L COMPtr<IWebUIDelegatePrivate> uiDelegatePrivate; if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate && SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate) - uiDelegatePrivate->webViewReceivedFocus(webView); + uiDelegatePrivate->webViewReceivedFocus(webView.get()); FocusController* focusController = webView->page()->focusController(); if (Frame* frame = focusController->focusedFrame()) { @@ -1776,7 +1796,7 @@ static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, L HWND newFocusWnd = reinterpret_cast<HWND>(wParam); if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate && SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate) - uiDelegatePrivate->webViewLostFocus(webView, (OLE_HANDLE)(ULONG64)newFocusWnd); + uiDelegatePrivate->webViewLostFocus(webView.get(), (OLE_HANDLE)(ULONG64)newFocusWnd); FocusController* focusController = webView->page()->focusController(); Frame* frame = focusController->focusedOrMainFrame(); @@ -1852,7 +1872,7 @@ static LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, L } if (SUCCEEDED(webView->uiDelegate(&uiDelegate)) && uiDelegate && SUCCEEDED(uiDelegate->QueryInterface(IID_IWebUIDelegatePrivate, (void**) &uiDelegatePrivate)) && uiDelegatePrivate && - SUCCEEDED(uiDelegatePrivate->webViewGetDlgCode(webView, keyCode, &dlgCode))) + SUCCEEDED(uiDelegatePrivate->webViewGetDlgCode(webView.get(), keyCode, &dlgCode))) return dlgCode; handled = false; break; @@ -2060,7 +2080,8 @@ HRESULT STDMETHODCALLTYPE WebView::canShowMIMEType( *canShow = MIMETypeRegistry::isSupportedImageMIMEType(mimeTypeStr) || MIMETypeRegistry::isSupportedNonImageMIMEType(mimeTypeStr) || - PluginInfoStore::supportsMIMEType(mimeTypeStr); + PluginInfoStore::supportsMIMEType(mimeTypeStr) || + shouldUseEmbeddedView(mimeTypeStr); return S_OK; } @@ -2147,6 +2168,7 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame( sharedPreferences->willAddToWebView(); m_preferences = sharedPreferences; + InitializeLoggingChannelsIfNecessary(); WebKitSetWebDatabasesPathIfNecessary(); WebKitSetApplicationCachePathIfNecessary(); @@ -2497,7 +2519,7 @@ HRESULT STDMETHODCALLTYPE WebView::setPageSizeMultiplier( void WebView::setZoomMultiplier(float multiplier, bool isTextOnly) { m_zoomMultiplier = multiplier; - m_zoomMultiplierIsTextOnly = isTextOnly; + m_page->settings()->setZoomsTextOnly(isTextOnly); if (Frame* coreFrame = core(m_mainFrame)) coreFrame->setZoomFactor(multiplier, isTextOnly); } @@ -2518,7 +2540,7 @@ HRESULT STDMETHODCALLTYPE WebView::pageSizeMultiplier( float WebView::zoomMultiplier(bool isTextOnly) { - if (isTextOnly != m_zoomMultiplierIsTextOnly) + if (isTextOnly != m_page->settings()->zoomsTextOnly()) return 1.0f; return m_zoomMultiplier; } @@ -2564,8 +2586,7 @@ HRESULT STDMETHODCALLTYPE WebView::userAgentForURL( /* [in] */ BSTR url, /* [retval][out] */ BSTR* userAgent) { - String urlStr(url, SysStringLen(url)); - String userAgentString = this->userAgentForKURL(KURL(urlStr)); + String userAgentString = userAgentForKURL(MarshallingHelpers::BSTRToKURL(url)); *userAgent = SysAllocStringLen(userAgentString.characters(), userAgentString.length()); if (!*userAgent && userAgentString.length()) return E_OUTOFMEMORY; @@ -2593,7 +2614,7 @@ HRESULT STDMETHODCALLTYPE WebView::setCustomTextEncodingName( if (oldEncoding != encodingName && (!oldEncoding || !encodingName || _tcscmp(oldEncoding, encodingName))) { if (Frame* coreFrame = core(m_mainFrame)) - coreFrame->loader()->reloadAllowingStaleData(String(encodingName, SysStringLen(encodingName))); + coreFrame->loader()->reloadWithOverrideEncoding(String(encodingName, SysStringLen(encodingName))); } return S_OK; @@ -2662,12 +2683,12 @@ HRESULT STDMETHODCALLTYPE WebView::stringByEvaluatingJavaScriptFromString( if (!coreFrame) return E_FAIL; - JSC::JSValue* scriptExecutionResult = coreFrame->loader()->executeScript(WebCore::String(script), true); - if(!scriptExecutionResult) + JSC::JSValuePtr scriptExecutionResult = coreFrame->loader()->executeScript(WebCore::String(script), true).jsValue(); + if (!scriptExecutionResult) return E_FAIL; - else if (scriptExecutionResult->isString()) { + else if (scriptExecutionResult.isString()) { JSLock lock(false); - *result = BString(String(scriptExecutionResult->getString())); + *result = BString(String(scriptExecutionResult.getString())); } return S_OK; @@ -2951,7 +2972,7 @@ HRESULT STDMETHODCALLTYPE WebView::selectionRect(RECT* rc) WebCore::Frame* frame = m_page->focusController()->focusedOrMainFrame(); if (frame) { - IntRect ir = enclosingIntRect(frame->selectionRect()); + IntRect ir = enclosingIntRect(frame->selectionBounds()); ir = frame->view()->convertToContainingWindow(ir); ir.move(-frame->view()->scrollOffset().width(), -frame->view()->scrollOffset().height()); rc->left = ir.x(); @@ -3255,7 +3276,7 @@ HRESULT STDMETHODCALLTYPE WebView::canMakeTextLarger( /* [in] */ IUnknown* /*sender*/, /* [retval][out] */ BOOL* result) { - bool canGrowMore = canZoomIn(true); + bool canGrowMore = canZoomIn(m_page->settings()->zoomsTextOnly()); *result = canGrowMore ? TRUE : FALSE; return S_OK; } @@ -3277,7 +3298,7 @@ bool WebView::canZoomIn(bool isTextOnly) HRESULT STDMETHODCALLTYPE WebView::makeTextLarger( /* [in] */ IUnknown* /*sender*/) { - return zoomIn(true); + return zoomIn(m_page->settings()->zoomsTextOnly()); } HRESULT STDMETHODCALLTYPE WebView::zoomPageIn( @@ -3298,7 +3319,7 @@ HRESULT STDMETHODCALLTYPE WebView::canMakeTextSmaller( /* [in] */ IUnknown* /*sender*/, /* [retval][out] */ BOOL* result) { - bool canShrinkMore = canZoomOut(true); + bool canShrinkMore = canZoomOut(m_page->settings()->zoomsTextOnly()); *result = canShrinkMore ? TRUE : FALSE; return S_OK; } @@ -3320,7 +3341,7 @@ bool WebView::canZoomOut(bool isTextOnly) HRESULT STDMETHODCALLTYPE WebView::makeTextSmaller( /* [in] */ IUnknown* /*sender*/) { - return zoomOut(true); + return zoomOut(m_page->settings()->zoomsTextOnly()); } HRESULT STDMETHODCALLTYPE WebView::zoomPageOut( @@ -3341,6 +3362,7 @@ HRESULT STDMETHODCALLTYPE WebView::canMakeTextStandardSize( /* [in] */ IUnknown* /*sender*/, /* [retval][out] */ BOOL* result) { + // Since we always reset text zoom and page zoom together, this should continue to return an answer about text zoom even if its not enabled. bool notAlreadyStandard = canResetZoom(true); *result = notAlreadyStandard ? TRUE : FALSE; return S_OK; @@ -3487,6 +3509,8 @@ HRESULT STDMETHODCALLTYPE WebView::setSmartInsertDeleteEnabled( /* [in] */ BOOL flag) { m_smartInsertDeleteEnabled = !!flag; + if (m_smartInsertDeleteEnabled) + setSelectTrailingWhitespaceEnabled(false); return S_OK; } @@ -3496,7 +3520,23 @@ HRESULT STDMETHODCALLTYPE WebView::smartInsertDeleteEnabled( *enabled = m_smartInsertDeleteEnabled ? TRUE : FALSE; return S_OK; } + +HRESULT STDMETHODCALLTYPE WebView::setSelectTrailingWhitespaceEnabled( + /* [in] */ BOOL flag) +{ + m_selectTrailingWhitespaceEnabled = !!flag; + if (m_selectTrailingWhitespaceEnabled) + setSmartInsertDeleteEnabled(false); + return S_OK; +} +HRESULT STDMETHODCALLTYPE WebView::isSelectTrailingWhitespaceEnabled( + /* [retval][out] */ BOOL* enabled) +{ + *enabled = m_selectTrailingWhitespaceEnabled ? TRUE : FALSE; + return S_OK; +} + HRESULT STDMETHODCALLTYPE WebView::setContinuousSpellCheckingEnabled( /* [in] */ BOOL flag) { @@ -3774,8 +3814,7 @@ HRESULT STDMETHODCALLTYPE WebView::paste( HRESULT STDMETHODCALLTYPE WebView::copyURL( /* [in] */ BSTR url) { - String temp(url, SysStringLen(url)); - m_page->focusController()->focusedOrMainFrame()->editor()->copyURL(KURL(temp), ""); + m_page->focusController()->focusedOrMainFrame()->editor()->copyURL(MarshallingHelpers::BSTRToKURL(url), ""); return S_OK; } @@ -4121,6 +4160,11 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification) return hr; settings->setShouldPaintCustomScrollbars(!!enabled); + hr = preferences->zoomsTextOnly(&enabled); + if (FAILED(hr)) + return hr; + settings->setZoomsTextOnly(!!enabled); + settings->setShowsURLsInToolTips(false); settings->setForceFTPDirectoryListings(true); settings->setDeveloperExtrasEnabled(developerExtrasEnabled()); @@ -4150,6 +4194,16 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification) return hr; settings->setOfflineWebApplicationCacheEnabled(enabled); + hr = prefsPrivate->databasesEnabled(&enabled); + if (FAILED(hr)) + return hr; + settings->setDatabasesEnabled(enabled); + + hr = prefsPrivate->localStorageEnabled(&enabled); + if (FAILED(hr)) + return hr; + settings->setLocalStorageEnabled(enabled); + #if USE(SAFARI_THEME) hr = prefsPrivate->shouldPaintNativeControls(&enabled); if (FAILED(hr)) @@ -4963,6 +5017,27 @@ HRESULT STDMETHODCALLTYPE WebView::cookieEnabled(BOOL* enabled) return S_OK; } +HRESULT STDMETHODCALLTYPE WebView::setMediaVolume(float volume) +{ + if (!m_page) + return E_FAIL; + + m_page->setMediaVolume(volume); + return S_OK; +} + +HRESULT STDMETHODCALLTYPE WebView::mediaVolume(float* volume) +{ + if (!volume) + return E_POINTER; + + if (!m_page) + return E_FAIL; + + *volume = m_page->mediaVolume(); + return S_OK; +} + HRESULT STDMETHODCALLTYPE WebView::setDefersCallbacks(BOOL defersCallbacks) { if (!m_page) @@ -4984,6 +5059,23 @@ HRESULT STDMETHODCALLTYPE WebView::defersCallbacks(BOOL* defersCallbacks) return S_OK; } +HRESULT STDMETHODCALLTYPE WebView::globalHistoryItem(IWebHistoryItem** item) +{ + if (!item) + return E_POINTER; + + if (!m_page) + return E_FAIL; + + if (!m_page->globalHistoryItem()) { + *item = 0; + return S_OK; + } + + *item = WebHistoryItem::createInstance(m_page->globalHistoryItem()); + return S_OK; +} + HRESULT STDMETHODCALLTYPE WebView::setAlwaysUsesComplexTextCodePath(BOOL complex) { WebCoreSetAlwaysUsesComplexTextCodePath(complex); @@ -5000,6 +5092,26 @@ HRESULT STDMETHODCALLTYPE WebView::alwaysUsesComplexTextCodePath(BOOL* complex) return S_OK; } +HRESULT STDMETHODCALLTYPE WebView::registerEmbeddedViewMIMEType(BSTR mimeType) +{ + if (!mimeType) + return E_POINTER; + + if (!m_embeddedViewMIMETypes) + m_embeddedViewMIMETypes.set(new HashSet<String>); + + m_embeddedViewMIMETypes->add(String(mimeType, ::SysStringLen(mimeType))); + return S_OK; +} + +bool WebView::shouldUseEmbeddedView(const WebCore::String& mimeType) const +{ + if (!m_embeddedViewMIMETypes) + return false; + + return m_embeddedViewMIMETypes->contains(mimeType); +} + bool WebView::onGetObject(WPARAM wParam, LPARAM lParam, LRESULT& lResult) const { lResult = 0; @@ -5042,6 +5154,12 @@ STDMETHODIMP WebView::AccessibleObjectFromWindow(HWND hwnd, DWORD objectID, REFI return procPtr(hwnd, objectID, riid, ppObject); } +HRESULT WebView::setMemoryCacheDelegateCallsEnabled(BOOL enabled) +{ + m_page->setMemoryCacheClientCallsEnabled(enabled); + return S_OK; +} + class EnumTextMatches : public IEnumTextMatches { long m_ref; diff --git a/WebKit/win/WebView.h b/WebKit/win/WebView.h index c64bc59..281defd 100644 --- a/WebKit/win/WebView.h +++ b/WebKit/win/WebView.h @@ -34,6 +34,7 @@ #include <WebCore/IntRect.h> #include <WebCore/Timer.h> #include <WebCore/WindowMessageListener.h> +#include <wtf/HashSet.h> #include <wtf/OwnPtr.h> class WebFrame; @@ -390,7 +391,13 @@ public: virtual HRESULT STDMETHODCALLTYPE smartInsertDeleteEnabled( /* [in] */ BOOL *enabled); + + virtual HRESULT STDMETHODCALLTYPE setSelectTrailingWhitespaceEnabled( + /* [in] */ BOOL flag); + virtual HRESULT STDMETHODCALLTYPE isSelectTrailingWhitespaceEnabled( + /* [in] */ BOOL *enabled); + virtual HRESULT STDMETHODCALLTYPE setContinuousSpellCheckingEnabled( /* [in] */ BOOL flag); @@ -690,6 +697,9 @@ public: virtual HRESULT STDMETHODCALLTYPE defersCallbacks( /* [out, retval] */ BOOL* defersCallbacks); + virtual HRESULT STDMETHODCALLTYPE globalHistoryItem( + /* [out, retval] */ IWebHistoryItem** item); + virtual HRESULT STDMETHODCALLTYPE setAlwaysUsesComplexTextCodePath( /* [in] */ BOOL complex); @@ -702,7 +712,21 @@ public: virtual HRESULT STDMETHODCALLTYPE cookieEnabled( /* [out, retval] */ BOOL* enabled); + virtual HRESULT STDMETHODCALLTYPE setMediaVolume( + /* [in] */ float volume); + + virtual HRESULT STDMETHODCALLTYPE mediaVolume( + /* [out, retval] */ float* volume); + + virtual HRESULT STDMETHODCALLTYPE registerEmbeddedViewMIMEType( + /* [in] */ BSTR mimeType); + + virtual HRESULT STDMETHODCALLTYPE setMemoryCacheDelegateCallsEnabled( + /* [in] */ BOOL enabled); + // WebView + bool shouldUseEmbeddedView(const WebCore::String& mimeType) const; + WebCore::Page* page(); bool handleMouseEvent(UINT, WPARAM, LPARAM); void setMouseActivated(bool flag) { m_mouseActivated = flag; } @@ -719,13 +743,11 @@ public: bool keyPress(WPARAM, LPARAM, bool systemKeyDown = false); bool inResizer(LPARAM lParam); void paint(HDC, LPARAM); - void paintIntoBackingStore(WebCore::FrameView*, HDC bitmapDC, const WebCore::IntRect& dirtyRect); void paintIntoWindow(HDC bitmapDC, HDC windowDC, const WebCore::IntRect& dirtyRect); bool ensureBackingStore(); void addToDirtyRegion(const WebCore::IntRect&); void addToDirtyRegion(HRGN); void scrollBackingStore(WebCore::FrameView*, int dx, int dy, const WebCore::IntRect& scrollViewRect, const WebCore::IntRect& clipRect); - void updateBackingStore(WebCore::FrameView*, HDC = 0, bool backingStoreCompletelyDirty = false); void deleteBackingStore(); void repaint(const WebCore::IntRect&, bool contentChanged, bool immediate = false, bool repaintContentOnly = false); void frameRect(RECT* rect); @@ -802,6 +824,10 @@ private: HRESULT resetZoom(bool isTextOnly); bool active(); + enum WindowsToPaint { PaintWebViewOnly, PaintWebViewAndChildren }; + void paintIntoBackingStore(WebCore::FrameView*, HDC bitmapDC, const WebCore::IntRect& dirtyRect, WindowsToPaint); + void updateBackingStore(WebCore::FrameView*, HDC = 0, bool backingStoreCompletelyDirty = false, WindowsToPaint = PaintWebViewOnly); + protected: HIMC getIMMContext(); void releaseIMMContext(HIMC); @@ -849,7 +875,6 @@ protected: WebCore::String m_userAgentCustom; WebCore::String m_userAgentStandard; float m_zoomMultiplier; - bool m_zoomMultiplierIsTextOnly; WebCore::String m_overrideEncoding; WebCore::String m_applicationName; bool m_mouseActivated; @@ -862,6 +887,7 @@ protected: unsigned m_paintCount; bool m_hasSpellCheckerDocumentTag; bool m_smartInsertDeleteEnabled; + bool m_selectTrailingWhitespaceEnabled; bool m_didClose; bool m_hasCustomDropTarget; unsigned m_inIMEComposition; @@ -877,6 +903,8 @@ protected: OwnPtr<TRACKMOUSEEVENT> m_mouseOutTracker; HWND m_topLevelParent; + + OwnPtr<HashSet<WebCore::String> > m_embeddedViewMIMETypes; }; #endif |