First pass implementation of safe list for ENDER multi-part mime output.

All safe list related changes are ifdef'd MOZ_ENDER_MIME.

Files modified this round:

  cmd/xfe/forms.c
  include/edt.h
  lib/layout/Makefile.in
  lib/layout/Makefile
  lib/layout/editor.cpp
  lib/layout/layfree.c
  lib/layout/layform.c
  lib/layout/edtbuf.cpp
  lib/layout/editor.h
  lib/layout/edtlist.h
  lib/layout/edtlist.cpp
This commit is contained in:
kin%netscape.com 1998-10-09 22:14:45 +00:00
Родитель c8264eae7b
Коммит fae8fde001
8 изменённых файлов: 114 добавлений и 3 удалений

Просмотреть файл

@ -2466,6 +2466,8 @@ htmlarea_create_widget(FEFormData *fed, LO_FormElementStruct *form)
XFE_GetEmbeddedEditorContext(ha_fed->form_data.widget,
context);
EDT_SetEmbeddedEditorData(ha_fed->editor_context, (void *)form_data);
/* Can't register a XmNfocusCallback or XmNlosingFocusCallback on
* a DrawingArea so we register an event handler.
*/

Просмотреть файл

@ -84,6 +84,7 @@ CPPSRCS = streams.cpp \
edtcmd.cpp \
edtele.cpp \
edtjava.cpp \
edtlist.cpp \
edtsave.cpp \
edtutil.cpp \
$(NULL)

Просмотреть файл

@ -90,6 +90,7 @@ CPPSRCS = streams.cpp \
edtcmd.cpp \
edtele.cpp \
edtjava.cpp \
edtlist.cpp \
edtsave.cpp \
edtutil.cpp \
$(NULL)

Просмотреть файл

@ -40,6 +40,12 @@ extern "C" {
#include "msgcom.h"
#include "intl_csi.h"
#if defined(ENDER) && defined(MOZ_ENDER_MIME)
extern "C" {
#include "edtlist.h"
}
#endif /* ENDER && MOZ_ENDER_MIME */
//extern "C" int XP_EDT_HEAD_FAILED;
CBitArray *edt_setNoEndTag = 0;
@ -1924,6 +1930,16 @@ EDT_ClipboardResult EDT_SetDefaultHTML( MWContext *pContext, char *pHTML ) {
}
return EDT_COP_DOCUMENT_BUSY;
}
void EDT_SetEmbeddedEditorData( MWContext *pContext, void *pData ) {
CEditBuffer* pEditBuffer = LO_GetEDBuffer( pContext );
if (pEditBuffer)
{
pEditBuffer->m_bEmbedded = TRUE;
pEditBuffer->m_pEmbeddedData = pData;
}
}
#endif //ENDER
EDT_ClipboardResult EDT_PasteQuoteBegin( MWContext *pContext, XP_Bool bHTML ) {
@ -1997,6 +2013,12 @@ void EDT_ConvertTableToText(MWContext *pMWContext)
pEditBuffer->ConvertTableToText();
}
/* Save the character and paragraph style of selection or at caret */
/* TODO: REMOVE AFTER CONFIRMING ITS NOT BEING USED ON ALL PLATFORMS */
void EDT_CopyStyle(MWContext * /* pMWContext */)
{
}
/* TRUE if there is global style data available */
XP_Bool EDT_CanPasteStyle(MWContext *pMWContext)
{
@ -2329,6 +2351,10 @@ void EDT_InsertImage( MWContext *pContext, EDT_ImageData *pData, XP_Bool bKeepIm
pEditBuffer->BeginBatchChanges(kInsertImageCommandID);
pEditBuffer->LoadImage( pData, bKeepImagesWithDoc, FALSE );
pEditBuffer->EndBatchChanges();
#if defined(ENDER) && defined(MOZ_ENDER_MIME)
if (bKeepImagesWithDoc && pEditBuffer->m_bEmbedded)
EDT_AddURLToSafeList(pEditBuffer->m_pEmbeddedData, pData->pSrc);
#endif /* ENDER && MOZ_ENDER_MIME */
}
void EDT_ImageLoadCancel( MWContext *pContext ){

Просмотреть файл

@ -3075,6 +3075,8 @@ public:
char *m_pBaseTarget;
char *m_pBodyExtra;
#ifdef ENDER
XP_Bool m_bEmbedded;
void *m_pEmbeddedData;
char *m_pImportedStream; //dont forget to XP_FREE this memory //ENDER
char *m_pImportedHTMLStream; //dont forget to XP_FREE this memory //ENDER
#endif //ENDER
@ -3217,6 +3219,10 @@ public:
XP_Bool IsComposeWindow(){ return m_pContext->bIsComposeWindow; }
#if defined(ENDER) && defined(MOZ_ENDER_MIME)
void AddImagesToSafeList( CEditElement* pElement );
#endif /* ENDER && MOZ_ENDER_MIME */
void PrintTree( CEditElement* m_pRoot );
void DebugPrintTree( CEditElement* m_pRoot );
XP_HUGE_CHAR_PTR GetPositionalText();

Просмотреть файл

@ -42,6 +42,12 @@ const int32 MAX_POSITIONAL_TEXT =0x7FFFFFF0;
#include "prefapi.h"
#if defined(ENDER) && defined(MOZ_ENDER_MIME)
extern "C" {
#include "edtlist.h"
}
#endif /* ENDER && MOZ_ENDER_MIME */
#define GET_COL TRUE
#define GET_ROW FALSE
@ -1531,6 +1537,8 @@ CEditBuffer::CEditBuffer(MWContext *pContext, XP_Bool bImportText):
m_bBackgroundNoSave(FALSE),
m_pBodyExtra(0),
#ifdef ENDER
m_bEmbedded(FALSE), //ENDER
m_pEmbeddedData(0), //ENDER
m_pImportedStream(0), //ENDER
m_pImportedHTMLStream(0), //ENDER
#endif //ENDER
@ -10124,6 +10132,11 @@ void CEditBuffer::ReadFromBuffer(XP_HUGE_CHAR_PTR pBuffer){
NET_StreamClass *stream =
NET_StreamBuilder(FO_PRESENT, url_s, m_pContext);
if(stream) {
#ifdef ENDER
XP_Bool bEmbedded = m_bEmbedded;
void *pEmbeddedData = m_pEmbeddedData;
MWContext *pContext = m_pContext;
#endif /* ENDER */
delete m_pRoot;
m_pRoot = 0;
m_pCurrent = 0;
@ -10163,6 +10176,11 @@ void CEditBuffer::ReadFromBuffer(XP_HUGE_CHAR_PTR pBuffer){
(*stream->complete)(stream);
XP_FREE(stream);
XP_FREEIF(pChunk);
#ifdef ENDER
if (bEmbedded)
EDT_SetEmbeddedEditorData(pContext, pEmbeddedData);
#endif /* ENDER */
}
NET_FreeURLStruct(url_s);
}
@ -13821,6 +13839,13 @@ NORMAL_PASTE:
bAtStartOfParagraph = TRUE;
}
#if defined(ENDER) && defined(MOZ_ENDER_MIME)
if( m_bEmbedded )
AddImagesToSafeList(pElement);
#endif /* ENDER && MOZ_ENDER_MIME */
#ifdef DEBUG
m_pRoot->ValidateTree();
#endif
@ -18077,6 +18102,38 @@ void CEditBuffer::SelectNextNonTextObject()
}
#if defined(ENDER) && defined(MOZ_ENDER_MIME)
void CEditBuffer::AddImagesToSafeList(CEditElement *pElement)
{
CEditElement* pChild;
if ( !m_bEmbedded )
return;
while ( pElement )
{
if (pElement->IsImage())
{
CEditImageElement *pImageElement = (CEditImageElement *)pElement;
EDT_ImageData *pData = pImageElement->GetImageData();
if (pData)
{
if (pData->pSrc)
EDT_AddURLToSafeList(m_pEmbeddedData, pData->pSrc);
edt_FreeImageData(pData);
}
}
if ( (pChild = pElement->GetChild()) )
this->AddImagesToSafeList(pChild);
pElement = pElement->GetNextSibling();
}
}
#endif /* ENDER && MOZ_ENDER_MIME */
XP_Bool EDT_ScrollToTarget(MWContext *pMWContext, char *pTargetURL)
{
if( !pTargetURL || !*pTargetURL )

Просмотреть файл

@ -58,6 +58,10 @@
#include "lm_dom.h"
#endif
#if defined(ENDER) && defined(MOZ_ENDER_MIME)
#include "edtlist.h"
#endif /* ENDER && MOZ_ENDER_MIME */
#ifndef XP_TRACE
# define XP_TRACE(X) fprintf X
#endif
@ -3604,6 +3608,10 @@ form_reset_closure(MWContext * context, LO_Element * ele, int32 event,
(form_ele->element_data->type != FORM_TYPE_READONLY)&&
(form_ele->element_data->type != FORM_TYPE_BUTTON))
{
#if defined(ENDER) && defined(MOZ_ENDER_MIME)
if (form_ele->element_data->type == FORM_TYPE_HTMLAREA)
EDT_RemoveIDFromSafeList((void *)form_ele->element_data);
#endif /* ENDER && MOZ_ENDER_MIME */
FE_ResetFormElement(context, form_ele);
}
}

Просмотреть файл

@ -30,6 +30,10 @@
#define IL_CLIENT /* XXXM12N Defined by Image Library clients */
#include "libimg.h" /* Image Library public API. */
#if defined(ENDER) && defined(MOZ_ENDER_MIME)
#include "edtlist.h"
#endif /* ENDER && MOZ_ENDER_MIME */
extern void NPL_DeleteSessionData(MWContext*, void*);
#ifdef PROFILE
@ -142,10 +146,16 @@ lo_FreeFormElementData(LO_FormElementData *element_data)
}
}
break;
case FORM_TYPE_TEXTAREA:
#ifdef ENDER
case FORM_TYPE_HTMLAREA :
#if defined(MOZ_ENDER_MIME)
{
EDT_RemoveIDFromSafeList((void *)element_data);
}
#endif /* MOZ_ENDER_MIME */
/* no break */
#endif /*ENDER*/
case FORM_TYPE_TEXTAREA:
{
lo_FormElementTextareaData *form_data;