Browse Source

Fixs for VC2005

km74
roytam1 4 years ago
parent
commit
fac6ea75c2
  1. 2
      k-meleon/BrowserWindow.h
  2. 528
      k-meleon/FavIconList.cpp
  3. 13
      k-meleon/FavIconList.h
  4. 457
      k-meleon/JSBridge/JSBridge.vcproj
  5. 4
      k-meleon/JSBridge/genidl.cmd
  6. 2
      k-meleon/JSBridge/jscomp.h
  7. 150
      k-meleon/JSBridge/nsGenericFactory.h
  8. 544
      k-meleon/KMeleon.sln
  9. 2476
      k-meleon/KMeleon.vcproj
  10. 4
      k-meleon/KmAppInfo.cpp
  11. 31
      k-meleon/MozUtils.h
  12. 4
      k-meleon/NSSDialogs.cpp
  13. 2
      k-meleon/ReBarEx.cpp
  14. 8
      k-meleon/StdAfx.h
  15. 2
      k-meleon/TabReBar.cpp
  16. 7
      k-meleon/UnknownContentTypeHandler.cpp
  17. 524
      k-meleon/bmp_menu/bmp_menu.vcproj
  18. 488
      k-meleon/external/external.vcproj
  19. 514
      k-meleon/fullscreen/fullscreen.vcproj
  20. 344
      k-meleon/gestures/gestures.vcproj
  21. 4
      k-meleon/history/AutoComplete.h
  22. 497
      k-meleon/history/history.vcproj
  23. 412
      k-meleon/ie_favorites/favorites2.vcproj
  24. 488
      k-meleon/layers/Layers.vcproj
  25. 2
      k-meleon/layers/layers.rc
  26. 554
      k-meleon/loader/loader.vcproj
  27. 4
      k-meleon/login/genidl.cmd
  28. 2
      k-meleon/macros/macros.rc
  29. 505
      k-meleon/macros/macros.vcproj
  30. 487
      k-meleon/macros2/macros2.vcproj
  31. 208
      k-meleon/nsGenericFactory.cpp
  32. 150
      k-meleon/nsGenericFactory.h
  33. 1384
      k-meleon/ns_bookmarks/ns_bookmarks.vcproj
  34. 8
      k-meleon/ns_bookmarks/ns_bookmarks_edit.cpp
  35. 690
      k-meleon/op_hotlist/op_hotlist.vcproj
  36. 377
      k-meleon/privacy/privacy.vcproj
  37. 2
      k-meleon/rebar_menu/rebar_menu.cpp
  38. 556
      k-meleon/rebar_menu/rebar_menu.vcproj
  39. 4
      k-meleon/resource.h
  40. 766
      k-meleon/sessions/sessions.vcproj
  41. 488
      k-meleon/toolbars/toolbars.vcproj

2
k-meleon/BrowserWindow.h

@ -270,7 +270,7 @@ public:
{
nsIDOMWindow* dom = nullptr;
if (mWebBrowser) mWebBrowser->GetContentDOMWindow(&dom);
return (decltype(nullptr))dom;
return dom;
}
NS_IMETHODIMP GetWebBrowser(nsIWebBrowser **aWebBrowser) const

528
k-meleon/FavIconList.cpp

@ -34,6 +34,11 @@ Bug: Changing skin need to delete the iconcache.
#include "nscWebBrowserPersist.h"
#include "imgILoader.h"
#if GECKO_VERSION>191
#else
#include "gfxIImageFrame.h"
#include "nsIImage.h"
#endif
#include "imgIContainer.h"
@ -67,41 +72,6 @@ Bug: Changing skin need to delete the iconcache.
#define FAVICON_CACHE_FILE _T("IconCache.dat")
HBITMAP ResizeIcon32(HDC hDC, HBITMAP hBitmap, LONG w, LONG h)
{
IWICImagingFactory *pImgFac;
HRESULT hr = CoCreateInstance(CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pImgFac));
if (!SUCCEEDED(hr)) return NULL;
IWICBitmap* NewBmp;
hr = pImgFac->CreateBitmapFromHBITMAP(hBitmap,0,WICBitmapUseAlpha,&NewBmp);
if (!SUCCEEDED(hr)) return NULL;
BITMAPINFO bmi = {};
bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
bmi.bmiHeader.biWidth = 16;
bmi.bmiHeader.biHeight = -16;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
BYTE *pBits;
HBITMAP hbmp = CreateDIBSection(NULL, &bmi, DIB_RGB_COLORS, (void**)&pBits, NULL, 0);
IWICBitmapScaler* pIScaler;
hr = pImgFac->CreateBitmapScaler(&pIScaler);
hr = pIScaler->Initialize(NewBmp,16,16,WICBitmapInterpolationModeFant);
WICRect rect = {0, 0, 16, 16};
hr = pIScaler->CopyPixels(&rect, 16 * 4, 16 * 16 * 4, pBits);
if (!SUCCEEDED(hr)) return NULL;
pIScaler->Release();
NewBmp->Release();
pImgFac->Release();
return hbmp;
}
// Used to resize the icon if it's not 16x16
HBITMAP ResizeIcon(HDC hDC, HBITMAP hBitmap, LONG w, LONG h)
{
@ -116,8 +86,7 @@ HBITMAP ResizeIcon(HDC hDC, HBITMAP hBitmap, LONG w, LONG h)
HDC hdcScaled = CreateCompatibleDC(hDCs);
HBITMAP hbmSized = CreateCompatibleBitmap(hDCs, 16, 16);
HGDIOBJ old2 = SelectObject(hdcScaled, hbmSized);
SetStretchBltMode(hdcScaled, HALFTONE);
SetStretchBltMode(hDCs, HALFTONE);
StretchBlt(hdcScaled,0,0,16,16,hDCs,0,0,w,h,SRCCOPY);
SelectObject(hdcScaled, old2);
DeleteDC(hdcScaled);
@ -130,7 +99,6 @@ CFavIconList::CFavIconList()
{
m_iDefaultIcon = 0;
m_iOffset = 0;
//mIconObserver = new IconObserver(this);
}
CFavIconList::~CFavIconList()
@ -299,12 +267,10 @@ BOOL CFavIconList::Create(int cx, int cy, UINT nFlags, int nInitial, int nGrow)
extern nsresult NewURI(nsIURI **result, const nsAString &spec);
extern nsresult NewURI(nsIURI **result, const nsACString &spec);
void CFavIconList::AddMap(const char *uri, int index, const char* pageUri)
void CFavIconList::AddMap(const char *uri, int index)
{
// This function is called from another thread
// if the moz image loader is used.
if (index == -1) return;
USES_CONVERSION;
m_urlMap[A2CT(uri)] = index - m_iOffset;
@ -314,42 +280,37 @@ void CFavIconList::AddMap(const char *uri, int index, const char* pageUri)
// have several different icons.
nsCOMPtr<nsIURI> URI;
nsEmbedCString nsUri;
nsUri.Assign(pageUri && pageUri[0] ? pageUri : uri);
nsUri.Assign(uri);
nsresult rv = NewURI(getter_AddRefs(URI), nsUri);
if (NS_SUCCEEDED(rv)) {
bool ishttps, ishttp;
URI->SchemeIs("http", &ishttp);
URI->SchemeIs("https", &ishttps);
if (ishttp || ishttps) {
URI->GetHost(nsUri);
nsUri.Insert("http://", 0, 7);
m_urlMap[A2CT(nsUri.get())] = index - m_iOffset;
}
URI->GetHost(nsUri);
nsUri.Insert("http://", 0, 7);
m_urlMap[A2CT(nsUri.get())] = index - m_iOffset;
}
// If it's not really efficient, at least I don't have
// to mess with synchronisation.
theApp.BroadcastMessage(UWM_NEWSITEICON, (WPARAM)0, index);
theApp.BroadcastMessage(UWM_NEWSITEICON, (WPARAM)uri, index);
}
int CFavIconList::AddIcon(const char* uri, CBitmap* icon, COLORREF cr, const char* pageUri)
int CFavIconList::AddIcon(const char* uri, CBitmap* icon, COLORREF cr)
{
int index = Add(icon, cr);
AddMap(uri, index, pageUri);
AddMap(uri, index);
return index;
}
int CFavIconList::AddIcon(const char* uri, CBitmap* icon, CBitmap* mask, const char* pageUri)
int CFavIconList::AddIcon(const char* uri, CBitmap* icon, CBitmap* mask)
{
int index = Add(icon, mask);
AddMap(uri, index, pageUri);
AddMap(uri, index);
return index;
}
int CFavIconList::AddIcon(const char* uri, HICON icon, const char* pageUri)
int CFavIconList::AddIcon(const char* uri, HICON icon)
{
int index = Add(icon);
AddMap(uri, index, pageUri);
AddMap(uri, index);
return index;
}
@ -426,7 +387,6 @@ int CFavIconList::GetIcon(const TCHAR* aUrl)
int CFavIconList::GetHostIcon(const TCHAR* aUrl)
{
int index = GetDefaultIcon();
const char* url;
#ifdef _UNICODE
nsEmbedCString _str;
@ -488,7 +448,7 @@ void CFavIconList::RefreshIcon(nsIURI* aURI)
if (index==GetDefaultIcon())
return;
Remove(index + m_iOffset);
Remove(index);
// We have to remove all url with this icon.
POSITION pos = m_urlMap.GetStartPosition();
@ -515,82 +475,81 @@ void CFavIconList::ResetCache()
theApp.BroadcastMessage(UWM_NEWSITEICON, 0, -1);
}
BOOL CFavIconList::DwnFavIcon(nsIURI* iconURI, nsIURI* pageURI)
{
#ifndef PNG_SUPPORT
// Borked way to get the favicon.
imgIRequest* request = nullptr;
IconObserver* observer = new IconObserver(this);
if (NS_FAILED(observer->LoadIcon(iconURI, pageURI))) {
delete observer;
return FALSE;
}
return TRUE;
//if (NS_FAILED(mIconObserver->LoadIcon(iconURI, pageURI))) {
// return FALSE;
// }
#else
// Currently the favicon is downloaded like any other file
// which is bad. A nsStreamListener have to be
// implemented.
nsCOMPtr<nsIWebBrowserPersist> persist(do_CreateInstance(NS_WEBBROWSERPERSIST_CONTRACTID));
if(!persist) return FALSE;
TCHAR tempPath[MAX_PATH];
GetTempPath(MAX_PATH, tempPath);
GetTempFileName(tempPath, _T("kme"), 0, tempPath);
nsCOMPtr<nsILocalFile> file;
#ifdef _UNICODE
NS_NewLocalFile(nsDependentString(tempPath), TRUE, getter_AddRefs(file));
#else
NS_NewNativeLocalFile(nsDependentCString(tempPath), TRUE, getter_AddRefs(file));
#endif
CProgressDialog *progress = new CProgressDialog(FALSE);
//persist->SetProgressListener(progress);
progress->InitPersist(iconURI, file, persist, FALSE);
progress->SetCallBack(CFavIconList::DwnCall, this);
persist->SetPersistFlags(
nsIWebBrowserPersist::PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION|
nsIWebBrowserPersist::PERSIST_FLAGS_REPLACE_EXISTING_FILES);
nsresult rv = persist->SaveURI(iconURI, nullptr, nullptr, nullptr, nullptr, file);
if (NS_FAILED(rv)) {
persist->SetProgressListener(nullptr);
return FALSE;
}
#endif
return TRUE;
}
BOOL CFavIconList::DwnFavIcon(nsIURI* iconURI, nsIURI* pageURI)
{
#ifndef PNG_SUPPORT
// Borked way to get the favicon.
imgIRequest* request = nullptr;
IconObserver* observer = new IconObserver(this);
if (NS_FAILED(observer->LoadIcon(iconURI, pageURI))) {
delete observer;
return FALSE;
}
return TRUE;
//if (NS_FAILED(mIconObserver->LoadIcon(iconURI, pageURI))) {
// return FALSE;
// }
#else
// Currently the favicon is downloaded like any other file
// which is bad. A nsStreamListener have to be
// implemented.
nsCOMPtr<nsIWebBrowserPersist> persist(do_CreateInstance(NS_WEBBROWSERPERSIST_CONTRACTID));
if(!persist) return FALSE;
TCHAR tempPath[MAX_PATH];
GetTempPath(MAX_PATH, tempPath);
GetTempFileName(tempPath, _T("kme"), 0, tempPath);
nsCOMPtr<nsILocalFile> file;
#ifdef _UNICODE
NS_NewLocalFile(nsDependentString(tempPath), TRUE, getter_AddRefs(file));
#else
NS_NewNativeLocalFile(nsDependentCString(tempPath), TRUE, getter_AddRefs(file));
#endif
CProgressDialog *progress = new CProgressDialog(FALSE);
//persist->SetProgressListener(progress);
progress->InitPersist(iconURI, file, persist, FALSE);
progress->SetCallBack(CFavIconList::DwnCall, this);
persist->SetPersistFlags(
nsIWebBrowserPersist::PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION|
nsIWebBrowserPersist::PERSIST_FLAGS_REPLACE_EXISTING_FILES);
nsresult rv = persist->SaveURI(iconURI, nullptr, nullptr, nullptr, nullptr, file);
if (NS_FAILED(rv)) {
persist->SetProgressListener(nullptr);
return FALSE;
}
#endif
return TRUE;
}
void CFavIconList::DwnCall(char* uri, TCHAR* file, nsresult status, void* param)
{
((CFavIconList*)param)->AddDownloadedIcon(uri,file,status);
}
NS_IMPL_ISUPPORTS1(IconObserver, imgINotificationObserver)
NS_IMETHODIMP IconObserver::Notify(imgIRequest *aProxy, int32_t aType, const nsIntRect *aRect)
{
if (aType == imgINotificationObserver::LOAD_COMPLETE)
{
if (!NS_SUCCEEDED(aProxy->StartDecoding()))
aProxy->Cancel(NS_OK);
}
else if (aType == imgINotificationObserver::DECODE_COMPLETE)
{
CreateDIB(aProxy);
aProxy->Cancel(NS_OK);
//mRequest = nullptr;
//NS_RELEASE_THIS();
}
return NS_OK;
}
NS_IMPL_ISUPPORTS1(IconObserver, imgINotificationObserver)
NS_IMETHODIMP IconObserver::Notify(imgIRequest *aProxy, int32_t aType, const nsIntRect *aRect)
{
if (aType == imgINotificationObserver::LOAD_COMPLETE)
{
if (!NS_SUCCEEDED(aProxy->StartDecoding()))
aProxy->Cancel(NS_OK);
}
else if (aType == imgINotificationObserver::DECODE_COMPLETE)
{
CreateDIB(aProxy);
aProxy->Cancel(NS_OK);
//mRequest = nullptr;
//NS_RELEASE_THIS();
}
return NS_OK;
}
struct ALPHABITMAPINFO {
BITMAPINFOHEADER bmiHeader;
@ -620,6 +579,7 @@ struct ALPHABITMAPINFO {
}
};
#if GECKO_VERSION > 18
static HBITMAP DataToBitmap(PRUint8* aImageData,
PRUint32 aWidth,
PRUint32 aHeight,
@ -687,147 +647,72 @@ static HBITMAP DataToBitmap(PRUint8* aImageData,
return bmp;
}
uint8_t* Data32BitTo1Bit(uint8_t* aImageData,
uint32_t aWidth, uint32_t aHeight)
{
// We need (aWidth + 7) / 8 bytes plus zero-padding up to a multiple of
// 4 bytes for each row (HBITMAP requirement). Bug 353553.
uint32_t outBpr = ((aWidth + 31) / 8) & ~3;
// Allocate and clear mask buffer
uint8_t* outData = (uint8_t*)calloc(outBpr, aHeight);
if (!outData)
return nullptr;
int32_t *imageRow = (int32_t*)aImageData;
for (uint32_t curRow = 0; curRow < aHeight; curRow++) {
uint8_t *outRow = outData + curRow * outBpr;
uint8_t mask = 0x80;
for (uint32_t curCol = 0; curCol < aWidth; curCol++) {
// Use sign bit to test for transparency, as alpha byte is highest byte
if (*imageRow++ < 0)
*outRow |= mask;
mask >>= 1;
if (!mask) {
outRow ++;
mask = 0x80;
}
}
}
return outData;
}
HBITMAP CreateIcon(imgIContainer *aContainer, gfxIntSize aScaledSize) {
// Get the image data
nsRefPtr<gfxASurface> surface;
aContainer->GetFrame(imgIContainer::FRAME_CURRENT,
imgIContainer::FLAG_SYNC_DECODE,
getter_AddRefs(surface));
NS_ENSURE_TRUE(surface, NULL);
nsRefPtr<gfxImageSurface> frame(surface->GetAsReadableARGB32ImageSurface());
NS_ENSURE_TRUE(frame, NULL);
int32_t width = frame->Width();
int32_t height = frame->Height();
if (!width || !height)
return NULL;
uint8_t *data;
nsRefPtr<gfxImageSurface> dest;
data = frame->Data();
/*
if ((aScaledSize.width == 0 && aScaledSize.height == 0) ||
(aScaledSize.width == width && aScaledSize.height == height)) {
// We're not scaling the image. The data is simply what's in the frame.
}
else {
NS_ENSURE_TRUE(aScaledSize.width > 0, NULL);
NS_ENSURE_TRUE(aScaledSize.height > 0, NULL);
// Draw a scaled version of the image to a temporary surface
dest = new gfxImageSurface(aScaledSize, gfxImageFormatARGB32);
if (!dest)
return NULL;
gfxContext ctx(dest);
// Set scaling
gfxFloat sw = (double) aScaledSize.width / width;
gfxFloat sh = (double) aScaledSize.height / height;
ctx.Scale(sw, sh);
// Paint a scaled image
ctx.SetOperator(gfxContext::OPERATOR_SOURCE);
ctx.SetSource(frame);
ctx.Paint();
data = dest->Data();
width = aScaledSize.width;
height = aScaledSize.height;
}*/
HBITMAP bmp = DataToBitmap(data, width, -height, 32);
return bmp;/*
uint8_t* a1data = Data32BitTo1Bit(data, width, height);
if (!a1data) {
return NS_ERROR_FAILURE;
}
HBITMAP mbmp = DataToBitmap(a1data, width, -height, 1);
free(a1data);
ICONINFO info = {0};
info.fIcon = !aIsCursor;
info.xHotspot = aHotspotX;
info.yHotspot = aHotspotY;
info.hbmMask = mbmp;
info.hbmColor = bmp;
HCURSOR icon = ::CreateIconIndirect(&info);
::DeleteObject(mbmp);
::DeleteObject(bmp);
if (!icon)
return NS_ERROR_FAILURE;
*aIcon = icon;
return NS_OK;*/
}
#endif
NS_IMETHODIMP IconObserver::CreateDIB(imgIRequest *aRequest)
{
#if GECKO_VERSION > 192
// FIXME : currently crash so do nothing
return NS_ERROR_NOT_IMPLEMENTED;
#else
nsresult rv;
nsCOMPtr<imgIContainer> image;
rv = aRequest->GetImage(getter_AddRefs(image));
NS_ENSURE_SUCCESS(rv, rv);
gfxIntSize s(16,16);
HBITMAP hBitmap = CreateIcon(image, s);
int32_t w;
int32_t h;
PRUint8 *bits;
PRInt32 w,h;
PRUint32 bpr;
#if GECKO_VERSION > 191
gfxImageSurface* frame;
#if GECKO_VERSION > 192
rv = image->CopyFrame(imgIContainer::FRAME_FIRST, imgIContainer::FLAG_SYNC_DECODE, &frame);
NS_ENSURE_TRUE(frame, rv);
image->GetWidth(&w);
image->GetHeight(&h);
if (w!=16 && h!=16) {
HDC hDC = GetDC(NULL);
HBITMAP hbmSized = ResizeIcon32(hDC, hBitmap, w, h);
if (!hbmSized) hbmSized = ResizeIcon(hDC, hBitmap, w, h);
if (hbmSized) {
DeleteObject(hBitmap);
hBitmap = hbmSized;
}
ReleaseDC(NULL, hDC);
}
#else
rv = image->CopyCurrentFrame(&frame);
NS_ENSURE_TRUE(frame, rv);
w = frame->Width();
h = frame->Height();
bpr = frame->Stride();
#endif
CBitmap bitmap;
bitmap.Attach(hBitmap);
bits = frame->Data();
#else
nsCOMPtr<gfxIImageFrame> frame;
rv = image->GetFrameAt(0, getter_AddRefs(frame));
NS_ENSURE_TRUE(frame, rv);
PRUint32 length;
frame->LockImageData();
rv = frame->GetImageData(&bits, &length);
NS_ENSURE_SUCCESS(rv, rv);
frame->GetWidth(&w);
frame->GetHeight(&h);
frame->GetImageBytesPerRow(&bpr);
#endif
/* PRUint32 alphaLength;
PRUint8 *alphaBits;
frame->GetAlphaData(&alphaBits, &alphaLength);
PRUint32 alphaBpr;
frame->GetAlphaBytesPerRow(&alphaBpr);
PRUint32* fBits = new PRUint32[w*h];
PRUint32 offset = 0;
for (int y = 0; y < w*h; y++) {
fBits[y] = alphaBits[y];
fBits[y] = (fBits[y]<<8) + bits[offset+2];
fBits[y] = (fBits[y]<<8) + bits[offset+1];
fBits[y] = (fBits[y]<<8) + bits[offset];
offset +=3;
}*/
CString uri;
nsCOMPtr<nsIURI> URI;
@ -836,23 +721,118 @@ NS_IMETHODIMP IconObserver::CreateDIB(imgIRequest *aRequest)
NS_ENSURE_SUCCESS(rv, rv);
URI->GetSpec(nsuri);
nsEmbedCString nsPageuri;
if (mPageUri) mPageUri->GetSpec(nsPageuri);
mFavList->AddIcon(nsuri.get(),&bitmap, (CBitmap*)NULL, nsPageuri.get());
return NS_OK;
}
CBitmap bitmap;
HDC hDC = GetDC(NULL);
NS_IMETHODIMP IconObserver::LoadIcon(nsIURI *iconUri, nsIURI* pageUri)
{
nsresult rv;
nsCOMPtr<imgILoader> loader = do_GetService("@mozilla.org/image/loader;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
mPageUri = pageUri;
#if GECKO_VERSION > 18
HBITMAP hBitmap = DataToBitmap(bits, w, -h, (bpr/w)*8);
#else
BITMAPINFO binfo;
binfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
binfo.bmiHeader.biWidth = w;
binfo.bmiHeader.biHeight = h;
binfo.bmiHeader.biPlanes = 1;
binfo.bmiHeader.biBitCount = (bpr/w)*8;
binfo.bmiHeader.biCompression = BI_RGB;
binfo.bmiHeader.biSizeImage = length;
binfo.bmiHeader.biXPelsPerMeter = 0;
binfo.bmiHeader.biYPelsPerMeter = 0;
binfo.bmiHeader.biClrUsed = 0;
binfo.bmiHeader.biClrImportant = 0;
HBITMAP hBitmap = ::CreateDIBitmap(hDC,&binfo.bmiHeader,CBM_INIT,bits,&binfo,DIB_RGB_COLORS);
#endif
if (w!=16 && h!=16) {
if (HBITMAP hbmSized = ResizeIcon(hDC, hBitmap, w, h)) {
DeleteObject(hBitmap);
hBitmap = hbmSized;
}
}
bitmap.Attach(hBitmap);
ReleaseDC(NULL,hDC);
#if GECKO_VERSION > 18
mFavList->AddIcon(nsuri.get(),&bitmap, (CBitmap*)NULL);
#else
gfx_color bkgColor = 0;
rv = frame->GetBackgroundColor(&bkgColor);
if (NS_FAILED(frame->GetBackgroundColor(&bkgColor)))
{
CBitmap maskbitmap;
PRUint32 alphaLength;
PRUint8 *alphaBits;
PRUint8 *alphaBits2 = 0;
if (NS_SUCCEEDED(frame->GetAlphaData(&alphaBits, &alphaLength)))
{
PRUint32 alphaBpr;
frame->GetAlphaBytesPerRow(&alphaBpr); // Return a false value??
alphaBpr = (8 * alphaLength) / (w*h);
if (alphaBpr<=8) {
// XXX: if alphaBpr == 2, must convert to 4
/*if (alphaBpr == 2)
{
alphaBits2 = alphaBits;
alphaBits = new PRUint8[alphaLength*4];
for (int i=0;i<alphaLength;i++) {
int ii = i*4;
alphaBits[ii] = (alphaBits2[i] & 0xC0) ? 0x0f : 0xf0;
alphaBits[ii+1] = (alphaBits2[i] & 0x03) ? 0x0f : 0xf0;
alphaBits[ii+2] = (alphaBits2[i] & 0x0C) ? 0x0f : 0xf0;
alphaBits[ii+3] = (alphaBits2[i] & 0x03) ? 0x0f : 0xf0;
//alphaBits[i*2+1] = ((alphaBits2[i] & 0x0C)<<4) + ((alphaBits2[i] & 0x0C)<<2) + ((alphaBits2[i] & 0x03)<<2) + (alphaBits2[i] & 0x03);
}
alphaBpr = 8;
}*/
ALPHABITMAPINFO binfo(w, h, alphaBpr);
HDC hDC = GetDC(NULL);
HBITMAP hBitmap = ::CreateDIBitmap(hDC,&binfo.bmiHeader,CBM_INIT,alphaBits,(BITMAPINFO*)&binfo,DIB_RGB_COLORS);
if (w!=16 && h!=16) {
if (HBITMAP hbmSized = ResizeIcon(hDC, hBitmap, w, h)) {
DeleteObject(hBitmap);
hBitmap = hbmSized;
}
}
ReleaseDC(NULL,hDC);
maskbitmap.Attach(hBitmap);
if (alphaBits2) delete alphaBits;
}
}
return loader->LoadImageXPCOM(iconUri, pageUri, nullptr,
nullptr, nullptr, this, this, nsIRequest::LOAD_BYPASS_CACHE,
nullptr, nullptr, getter_AddRefs(mRequest));
mFavList->AddIcon(nsuri.get(),&bitmap, &maskbitmap);
maskbitmap.DeleteObject();
} else {
mFavList->AddIcon(nsuri.get(),&bitmap, bkgColor);
}
#endif
#if GECKO_VERSION > 191
delete frame;
#else
frame->UnlockImageData();
#endif
bitmap.DeleteObject();
return NS_OK;
#endif
}
NS_IMETHODIMP IconObserver::LoadIcon(nsIURI *iconUri, nsIURI* pageUri)
{
nsresult rv;
nsCOMPtr<imgILoader> loader = do_GetService("@mozilla.org/image/loader;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);
mPageUri = pageUri;
return loader->LoadImageXPCOM(iconUri, pageUri, nullptr,
nullptr, nullptr, this, this, nsIRequest::LOAD_BYPASS_CACHE,
nullptr, nullptr, getter_AddRefs(mRequest));
}
#endif // INTERNAL_SITEICONS

13
k-meleon/FavIconList.h

@ -21,9 +21,8 @@
#pragma once
#include "afxtempl.h"
#include "imgIRequest.h"
#include "imgINotificationObserver.h"
#include "imgIRequest.h"
class CFavIconList;
@ -53,21 +52,19 @@ private:
int m_iDefaultIcon;
int m_iLoadingIcon;
int m_iOffset;
//nsCOMPtr<IconObserver> mIconObserver;
void AddMap(const char *uri, int index, const char* pageUri = nullptr);
void AddMap(const char *uri, int index);
int AddDownloadedIcon(char* uri, TCHAR* file, nsresult aStatus);
BOOL LoadCache();
public:
CFavIconList();
virtual ~CFavIconList();
BOOL WriteCache();
int AddIcon(const char* uri, CBitmap*, CBitmap*, const char* pageUri = nullptr);
int AddIcon(const char* uri, CBitmap*, COLORREF, const char* pageUri = nullptr);
int AddIcon(const char* uri, HICON icon, const char* pageUri = nullptr);
int AddIcon(const char* uri, CBitmap*, CBitmap*);
int AddIcon(const char* uri, CBitmap*, COLORREF);
int AddIcon(const char* uri, HICON icon);
int GetHostIcon(const TCHAR* aUri);
int GetIcon(const TCHAR* uri);

457
k-meleon/JSBridge/JSBridge.vcproj

@ -1,188 +1,269 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="JSBridge"
ProjectGUID="{5F7A1684-E791-4F70-A24F-FC6726273512}"
RootNamespace="JSBridge"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\mozilla\mozilla\dist\include\dom;..\..\mozilla\mozilla\dist\include\xpcom;..\..\mozilla\mozilla\dist\include\nspr;..\..\mozilla\mozilla\dist\include\windowwatcher;..\..\mozilla\mozilla\dist\include\webbrwsr"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;JSBRIDGE_EXPORTS"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="xpcom.lib xpcomglue_s.lib"
OutputFile="..\..\debug\kplugins\JSBridge.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\mozilla\mozilla\dist\lib_debug"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/JSBridge.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/JSBridge.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy js_bridge.xpt ..\..\debug\components\"/>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(ProjectDir)genidl.cmd"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\mozilla\mozilla\dist\include\dom;..\..\mozilla\mozilla\dist\include\xpcom;..\..\mozilla\mozilla\dist\include\nspr;..\..\mozilla\mozilla\dist\include\windowwatcher;..\..\mozilla\mozilla\dist\include\webbrwsr"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;JSBRIDGE_EXPORTS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="xpcom.lib xpcomglue_s.lib"
OutputFile="..\..\release\kplugins\JSBridge.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\mozilla\mozilla\dist\lib"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/JSBridge.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy js_bridge.xpt ..\..\release\components\"/>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(ProjectDir)genidl.cmd"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\jscomp.cpp">
</File>
<File
RelativePath=".\jsplugin.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;../../mozilla/mozilla/dist/include/js&quot;;&quot;../../mozilla/mozilla/dist/include/xpconnect&quot;;&quot;../../mozilla/mozilla/dist/include/caps&quot;;&quot;../../mozilla/mozilla/dist/include/mimetype&quot;;&quot;../../mozilla/mozilla/dist/include/imglib2&quot;;&quot;../../mozilla/mozilla/dist/include/content&quot;;&quot;../../mozilla/mozilla/dist/include/locale&quot;;&quot;../../mozilla/mozilla/dist/include/pippki&quot;;&quot;../../mozilla/mozilla/dist/include/pipnss&quot;;&quot;../../mozilla/mozilla/dist/include/cookie&quot;;&quot;../../mozilla/mozilla/dist/include/xpcom_obsolete&quot;;&quot;../../mozilla/mozilla/dist/include/typeaheadfind&quot;;&quot;../../mozilla/mozilla/dist/include/appcomps&quot;;&quot;../../mozilla/mozilla/dist/include/history&quot;;&quot;../../mozilla/mozilla/dist/include/rdf&quot;;&quot;../../mozilla/mozilla/dist/include/docshell&quot;;&quot;../../mozilla/mozilla/dist/include/dom&quot;;&quot;../../mozilla/mozilla/dist/include/embed_base&quot;;&quot;../../mozilla/mozilla/dist/include/exthandler&quot;;&quot;../../mozilla/mozilla/dist/include/find&quot;;&quot;../../mozilla/mozilla/dist/include/gfx&quot;;&quot;../../mozilla/mozilla/dist/include/helperAppDlg&quot;;&quot;../../mozilla/mozilla/dist/include/intl&quot;;&quot;../../mozilla/mozilla/dist/include/layout&quot;;&quot;../../mozilla/mozilla/dist/include/necko&quot;;&quot;../../mozilla/mozilla/dist/include/nkcache&quot;;&quot;../../mozilla/mozilla/dist/include/pref&quot;;&quot;../../mozilla/mozilla/dist/include/profile&quot;;&quot;../../mozilla/mozilla/dist/include/shistory&quot;;&quot;../../mozilla/mozilla/dist/include/string&quot;;&quot;../../mozilla/mozilla/dist/include/uriloader&quot;;&quot;../../mozilla/mozilla/dist/include/wallet&quot;;&quot;../../mozilla/mozilla/dist/include/webBrowser_core&quot;;&quot;../../mozilla/mozilla/dist/include/webbrowserpersist&quot;;&quot;../../mozilla/mozilla/dist/include/webshell&quot;;&quot;../../mozilla/mozilla/dist/include/widget&quot;;&quot;../../mozilla/mozilla/dist/include/windowwatcher&quot;;&quot;../../mozilla/mozilla/dist/include/xpcom&quot;;&quot;../../mozilla/mozilla/dist/include/nspr&quot;;&quot;../../mozilla/mozilla/dist/include/webbrwsr&quot;;&quot;../../mozilla/mozilla/dist/include/commandhandler&quot;;&quot;../../mozilla/mozilla/dist/include/plugin&quot;"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;../../mozilla/mozilla/dist/include/js&quot;;&quot;../../mozilla/mozilla/dist/include/xpconnect&quot;;&quot;../../mozilla/mozilla/dist/include/caps&quot;;&quot;../../mozilla/mozilla/dist/include/mimetype&quot;;&quot;../../mozilla/mozilla/dist/include/imglib2&quot;;&quot;../../mozilla/mozilla/dist/include/content&quot;;&quot;../../mozilla/mozilla/dist/include/locale&quot;;&quot;../../mozilla/mozilla/dist/include/pippki&quot;;&quot;../../mozilla/mozilla/dist/include/pipnss&quot;;&quot;../../mozilla/mozilla/dist/include/cookie&quot;;&quot;../../mozilla/mozilla/dist/include/xpcom_obsolete&quot;;&quot;../../mozilla/mozilla/dist/include/typeaheadfind&quot;;&quot;../../mozilla/mozilla/dist/include/appcomps&quot;;&quot;../../mozilla/mozilla/dist/include/history&quot;;&quot;../../mozilla/mozilla/dist/include/rdf&quot;;&quot;../../mozilla/mozilla/dist/include/docshell&quot;;&quot;../../mozilla/mozilla/dist/include/dom&quot;;&quot;../../mozilla/mozilla/dist/include/embed_base&quot;;&quot;../../mozilla/mozilla/dist/include/exthandler&quot;;&quot;../../mozilla/mozilla/dist/include/find&quot;;&quot;../../mozilla/mozilla/dist/include/gfx&quot;;&quot;../../mozilla/mozilla/dist/include/helperAppDlg&quot;;&quot;../../mozilla/mozilla/dist/include/intl&quot;;&quot;../../mozilla/mozilla/dist/include/layout&quot;;&quot;../../mozilla/mozilla/dist/include/necko&quot;;&quot;../../mozilla/mozilla/dist/include/nkcache&quot;;&quot;../../mozilla/mozilla/dist/include/pref&quot;;&quot;../../mozilla/mozilla/dist/include/profile&quot;;&quot;../../mozilla/mozilla/dist/include/shistory&quot;;&quot;../../mozilla/mozilla/dist/include/string&quot;;&quot;../../mozilla/mozilla/dist/include/uriloader&quot;;&quot;../../mozilla/mozilla/dist/include/wallet&quot;;&quot;../../mozilla/mozilla/dist/include/webBrowser_core&quot;;&quot;../../mozilla/mozilla/dist/include/webbrowserpersist&quot;;&quot;../../mozilla/mozilla/dist/include/webshell&quot;;&quot;../../mozilla/mozilla/dist/include/widget&quot;;&quot;../../mozilla/mozilla/dist/include/windowwatcher&quot;;&quot;../../mozilla/mozilla/dist/include/xpcom&quot;;&quot;../../mozilla/mozilla/dist/include/nspr&quot;;&quot;../../mozilla/mozilla/dist/include/webbrwsr&quot;;&quot;../../mozilla/mozilla/dist/include/commandhandler&quot;;&quot;../../mozilla/mozilla/dist/include/plugin&quot;"/>
</FileConfiguration>
</File>
<File
RelativePath=".\nsGenericFactory.cpp">
</File>
<File
RelativePath=".\nsIJSBridge.idl">
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCustomBuildTool"
CommandLine="..\..\mozilla\mozilla\dist\bin\xpidl.exe -m header
"
AdditionalDependencies="..\..\mozilla\mozilla\dist\idl\"
Outputs="-e nsIJSBridge.h $(InputFileName)"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCMIDLTool"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath=".\jscomp.h">
</File>
<File
RelativePath=".\nsIJSBridge.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="JSBridge"
ProjectGUID="{5F7A1684-E791-4F70-A24F-FC6726273512}"
RootNamespace="JSBridge"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(ProjectDir)genidl.cmd"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\mozilla\mozilla\dist\include\dom;..\..\mozilla\mozilla\dist\include\xpcom;..\..\mozilla\mozilla\dist\include\nspr;..\..\mozilla\mozilla\dist\include\windowwatcher;..\..\mozilla\mozilla\dist\include\webbrwsr"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;JSBRIDGE_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="xpcom.lib xpcomglue_s.lib"
OutputFile="..\..\debug\kplugins\JSBridge.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\mozilla\mozilla\dist\lib_debug"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(OutDir)/JSBridge.pdb"
SubSystem="2"
ImportLibrary="$(OutDir)/JSBridge.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy js_bridge.xpt ..\..\debug\components\"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="2"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
CommandLine="$(ProjectDir)genidl.cmd"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/wd4996"
AdditionalIncludeDirectories="..\..\mozilla\mozilla\dist\include;..\..\mozilla\mozilla\dist\include\dom;..\..\mozilla\mozilla\dist\include\xpcom;..\..\mozilla\mozilla\dist\include\nspr;..\..\mozilla\mozilla\dist\include\windowwatcher;..\..\mozilla\mozilla\dist\include\webbrwsr"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;JSBRIDGE_EXPORTS;XP_WIN"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="nss3.lib xul.lib mozalloc.lib mozjs.lib xpcomglue_s.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"
OutputFile="..\..\release\kplugins\JSBridge.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\mozilla\mozilla\dist\lib"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
ImportLibrary="$(OutDir)/JSBridge.lib"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="copy jsbridge.xpt ..\..\release\components\"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\jscomp.cpp"
>
</File>
<File
RelativePath=".\jsplugin.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;../../mozilla/mozilla/dist/include/js&quot;;&quot;../../mozilla/mozilla/dist/include/xpconnect&quot;;&quot;../../mozilla/mozilla/dist/include/caps&quot;;&quot;../../mozilla/mozilla/dist/include/mimetype&quot;;&quot;../../mozilla/mozilla/dist/include/imglib2&quot;;&quot;../../mozilla/mozilla/dist/include/content&quot;;&quot;../../mozilla/mozilla/dist/include/locale&quot;;&quot;../../mozilla/mozilla/dist/include/pippki&quot;;&quot;../../mozilla/mozilla/dist/include/pipnss&quot;;&quot;../../mozilla/mozilla/dist/include/cookie&quot;;&quot;../../mozilla/mozilla/dist/include/xpcom_obsolete&quot;;&quot;../../mozilla/mozilla/dist/include/typeaheadfind&quot;;&quot;../../mozilla/mozilla/dist/include/appcomps&quot;;&quot;../../mozilla/mozilla/dist/include/history&quot;;&quot;../../mozilla/mozilla/dist/include/rdf&quot;;&quot;../../mozilla/mozilla/dist/include/docshell&quot;;&quot;../../mozilla/mozilla/dist/include/dom&quot;;&quot;../../mozilla/mozilla/dist/include/embed_base&quot;;&quot;../../mozilla/mozilla/dist/include/exthandler&quot;;&quot;../../mozilla/mozilla/dist/include/find&quot;;&quot;../../mozilla/mozilla/dist/include/gfx&quot;;&quot;../../mozilla/mozilla/dist/include/helperAppDlg&quot;;&quot;../../mozilla/mozilla/dist/include/intl&quot;;&quot;../../mozilla/mozilla/dist/include/layout&quot;;&quot;../../mozilla/mozilla/dist/include/necko&quot;;&quot;../../mozilla/mozilla/dist/include/nkcache&quot;;&quot;../../mozilla/mozilla/dist/include/pref&quot;;&quot;../../mozilla/mozilla/dist/include/profile&quot;;&quot;../../mozilla/mozilla/dist/include/shistory&quot;;&quot;../../mozilla/mozilla/dist/include/string&quot;;&quot;../../mozilla/mozilla/dist/include/uriloader&quot;;&quot;../../mozilla/mozilla/dist/include/wallet&quot;;&quot;../../mozilla/mozilla/dist/include/webBrowser_core&quot;;&quot;../../mozilla/mozilla/dist/include/webbrowserpersist&quot;;&quot;../../mozilla/mozilla/dist/include/webshell&quot;;&quot;../../mozilla/mozilla/dist/include/widget&quot;;&quot;../../mozilla/mozilla/dist/include/windowwatcher&quot;;&quot;../../mozilla/mozilla/dist/include/xpcom&quot;;&quot;../../mozilla/mozilla/dist/include/nspr&quot;;&quot;../../mozilla/mozilla/dist/include/webbrwsr&quot;;&quot;../../mozilla/mozilla/dist/include/commandhandler&quot;;&quot;../../mozilla/mozilla/dist/include/plugin&quot;"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="&quot;../../mozilla/mozilla/dist/include/js&quot;;&quot;../../mozilla/mozilla/dist/include/xpconnect&quot;;&quot;../../mozilla/mozilla/dist/include/caps&quot;;&quot;../../mozilla/mozilla/dist/include/mimetype&quot;;&quot;../../mozilla/mozilla/dist/include/imglib2&quot;;&quot;../../mozilla/mozilla/dist/include/content&quot;;&quot;../../mozilla/mozilla/dist/include/locale&quot;;&quot;../../mozilla/mozilla/dist/include/pippki&quot;;&quot;../../mozilla/mozilla/dist/include/pipnss&quot;;&quot;../../mozilla/mozilla/dist/include/cookie&quot;;&quot;../../mozilla/mozilla/dist/include/xpcom_obsolete&quot;;&quot;../../mozilla/mozilla/dist/include/typeaheadfind&quot;;&quot;../../mozilla/mozilla/dist/include/appcomps&quot;;&quot;../../mozilla/mozilla/dist/include/history&quot;;&quot;../../mozilla/mozilla/dist/include/rdf&quot;;&quot;../../mozilla/mozilla/dist/include/docshell&quot;;&quot;../../mozilla/mozilla/dist/include/dom&quot;;&quot;../../mozilla/mozilla/dist/include/embed_base&quot;;&quot;../../mozilla/mozilla/dist/include/exthandler&quot;;&quot;../../mozilla/mozilla/dist/include/find&quot;;&quot;../../mozilla/mozilla/dist/include/gfx&quot;;&quot;../../mozilla/mozilla/dist/include/helperAppDlg&quot;;&quot;../../mozilla/mozilla/dist/include/intl&quot;;&quot;../../mozilla/mozilla/dist/include/layout&quot;;&quot;../../mozilla/mozilla/dist/include/necko&quot;;&quot;../../mozilla/mozilla/dist/include/nkcache&quot;;&quot;../../mozilla/mozilla/dist/include/pref&quot;;&quot;../../mozilla/mozilla/dist/include/profile&quot;;&quot;../../mozilla/mozilla/dist/include/shistory&quot;;&quot;../../mozilla/mozilla/dist/include/string&quot;;&quot;../../mozilla/mozilla/dist/include/uriloader&quot;;&quot;../../mozilla/mozilla/dist/include/wallet&quot;;&quot;../../mozilla/mozilla/dist/include/webBrowser_core&quot;;&quot;../../mozilla/mozilla/dist/include/webbrowserpersist&quot;;&quot;../../mozilla/mozilla/dist/include/webshell&quot;;&quot;../../mozilla/mozilla/dist/include/widget&quot;;&quot;../../mozilla/mozilla/dist/include/windowwatcher&quot;;&quot;../../mozilla/mozilla/dist/include/xpcom&quot;;&quot;../../mozilla/mozilla/dist/include/nspr&quot;;&quot;../../mozilla/mozilla/dist/include/webbrwsr&quot;;&quot;../../mozilla/mozilla/dist/include/commandhandler&quot;;&quot;../../mozilla/mozilla/dist/include/plugin&quot;"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\nsGenericFactory.cpp"
>
</File>
<File
RelativePath=".\nsIJSBridge.idl"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
CommandLine="..\..\mozilla\mozilla\dist\bin\xpidl.exe -m header&#x0D;&#x0A;"
AdditionalDependencies="..\..\mozilla\mozilla\dist\idl\"
Outputs="-e nsIJSBridge.h $(InputFileName)"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCMIDLTool"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\jscomp.h"
>
</File>
<File
RelativePath=".\nsIJSBridge.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

4
k-meleon/JSBridge/genidl.cmd

@ -1,2 +1,2 @@
@..\..\xulrunner-sdk-dbg\bin\header.py -I ../../xulrunner-sdk-dbg/idl -o nsIJSBridge.h nsIJSBridge.idl
@..\..\xulrunner-sdk-dbg\bin\typelib.py -I ../../xulrunner-sdk-dbg/idl -o jsbridge.xpt nsIJSBridge.idl
c:\python27\python ..\..\xulrunner-sdk-dbg\bin\header.py -I ../../xulrunner-sdk-dbg/idl -o nsIJSBridge.h nsIJSBridge.idl
c:\python27\python ..\..\xulrunner-sdk-dbg\bin\typelib.py -I ../../xulrunner-sdk-dbg/idl -o jsbridge.xpt nsIJSBridge.idl

2
k-meleon/JSBridge/jscomp.h

@ -18,7 +18,7 @@ public:
cmdMap.insert(std::pair<UINT,nsICommandFunction*>(id, command));
}
bool Run(UINT command, UINT mode) {
auto iter = cmdMap.find(command);
std::map<UINT, nsCOMPtr<nsICommandFunction>>::iterator iter = cmdMap.find(command);
if (iter != cmdMap.end() && iter->second) {
iter->second->OnCommand(mode);
return true;

150
k-meleon/JSBridge/nsGenericFactory.h

@ -0,0 +1,150 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsCOMPtr.h"
#include "nsIFactory.h"
#include "nsIClassInfo.h"
#include "mozilla/ModuleUtils.h"
struct nsModuleComponentInfo {
const char* mDescription;
nsCID mCID;
const char* mContractID;
mozilla::Module::ConstructorProcPtr mConstructor;
};
// {3bc97f01-ccdf-11d2-bab8-b548654461fc}
#define NS_GENERICFACTORY_CID \
{ 0x3bc97f01, 0xccdf, 0x11d2, \
{ 0xba, 0xb8, 0xb5, 0x48, 0x65, 0x44, 0x61, 0xfc } }
// {3bc97f00-ccdf-11d2-bab8-b548654461fc}
#define NS_IGENERICFACTORY_IID \
{ 0x3bc97f00, 0xccdf, 0x11d2, \
{ 0xba, 0xb8, 0xb5, 0x48, 0x65, 0x44, 0x61, 0xfc } }
class nsIGenericFactory : public nsIFactory {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IGENERICFACTORY_IID)
NS_IMETHOD SetComponentInfo(const nsModuleComponentInfo *info) = 0;
NS_IMETHOD GetComponentInfo(const nsModuleComponentInfo **infop) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIGenericFactory, NS_IGENERICFACTORY_IID);
/**
* Most factories follow this simple pattern, so why not just use a function
* pointer for most creation operations?
*/
class nsGenericFactory : public nsIGenericFactory, public nsIClassInfo {
public:
NS_DEFINE_STATIC_CID_ACCESSOR(NS_GENERICFACTORY_CID)
nsGenericFactory(const nsModuleComponentInfo *info = NULL);
NS_DECL_ISUPPORTS
NS_DECL_NSICLASSINFO
/* nsIGenericFactory methods */
NS_IMETHOD SetComponentInfo(const nsModuleComponentInfo *info);
NS_IMETHOD GetComponentInfo(const nsModuleComponentInfo **infop);
NS_IMETHOD CreateInstance(nsISupports *aOuter, REFNSIID aIID, void **aResult);
NS_IMETHOD LockFactory(bool aLock);
static NS_METHOD Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
private:
~nsGenericFactory();
const nsModuleComponentInfo *mInfo;
};
////////////////////////////////////////////////////////////////////////////////
#include "nsIModule.h"
#include "plhash.h"
class nsGenericModule : public nsIModule
{
public:
nsGenericModule(const char* moduleName,
PRUint32 componentCount,
const nsModuleComponentInfo* components,
mozilla::Module::ConstructorProcPtr ctor);
private:
~nsGenericModule();
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIMODULE
struct FactoryNode
{
FactoryNode(nsIFactory* fact, FactoryNode* next)
{
mFactory = fact;
mNext = next;
}
~FactoryNode(){}
nsCOMPtr<nsIFactory> mFactory;
FactoryNode* mNext;
};
protected:
nsresult Initialize(nsIComponentManager* compMgr);
void Shutdown();
nsresult AddFactoryNode(nsIFactory* fact);
PRBool mInitialized;
const char* mModuleName;
PRUint32 mComponentCount;
const nsModuleComponentInfo* mComponents;
FactoryNode* mFactoriesNotToBeRegistered;
mozilla::Module::ConstructorProcPtr mCtor;
//nsModuleDestructorProc mDtor;
};

544
k-meleon/KMeleon.sln

@ -1,293 +1,251 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "k-meleon", "KMeleon.vcproj", "{A1E2BBD2-452C-41F6-A64A-9476398A17DA}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Layers", "layers\Layers.vcproj", "{A893706A-93AF-4905-B9B9-125F9F961CF2}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bmpmenu", "bmp_menu\bmp_menu.vcproj", "{F2E464B0-F87F-4482-B32D-031B63E681E2}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "external", "External\external.vcproj", "{802755E1-6059-4C25-BB24-48CC17D12254}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fullscreen", "fullscreen\fullscreen.vcproj", "{014A6ED5-5295-44BF-97B1-5569A8C2A7F3}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "history", "history\history.vcproj", "{9C40A520-37BA-4997-BC72-4EE98E32513A}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "loader", "loader\loader.vcproj", "{DF7D017C-AE43-428E-A575-A329D951529F}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "macros", "macros\macros.vcproj", "{8E2AA109-176D-4DCC-81B3-078AFD3A5138}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bookmarks", "ns_bookmarks\ns_bookmarks.vcproj", "{E32EA49A-59D4-4898-805F-1732B2F4D302}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hotlist", "op_hotlist\op_hotlist.vcproj", "{553F5B8A-CB70-4766-9EFC-222748AAA006}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rebarmenu", "rebar_menu\rebar_menu.vcproj", "{839F0F46-8C0A-425D-B70A-40A1D8ACBE90}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "toolbars", "toolbars\toolbars.vcproj", "{97C153A5-A4F6-4AD7-971B-F6C747558AC4}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "privacy", "privacy\privacy.vcproj", "{F80DCDF9-D001-47F7-97D5-26EF62BF91AF}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gestures", "gestures\gestures.vcproj", "{2E6C70BF-E9CA-416A-B341-2B8550919D9E}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "favorites", "ie_favorites\favorites2.vcproj", "{3632B1A3-8D3C-468B-8AA7-1BAC8A367ED5}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sessions", "sessions\sessions.vcproj", "{43FF5741-2BA4-4191-A0E3-DB8BC27685CB}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "macros2", "macros2\macros2.vcproj", "{CE210F14-2644-487C-86CA-1E2CB2E04490}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JSBridge", "JSBridge\JSBridge.vcproj", "{5F7A1684-E791-4F70-A24F-FC6726273512}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global