зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
c8264eae7b
Коммит
fae8fde001
|
@ -2466,6 +2466,8 @@ htmlarea_create_widget(FEFormData *fed, LO_FormElementStruct *form)
|
||||||
XFE_GetEmbeddedEditorContext(ha_fed->form_data.widget,
|
XFE_GetEmbeddedEditorContext(ha_fed->form_data.widget,
|
||||||
context);
|
context);
|
||||||
|
|
||||||
|
EDT_SetEmbeddedEditorData(ha_fed->editor_context, (void *)form_data);
|
||||||
|
|
||||||
/* Can't register a XmNfocusCallback or XmNlosingFocusCallback on
|
/* Can't register a XmNfocusCallback or XmNlosingFocusCallback on
|
||||||
* a DrawingArea so we register an event handler.
|
* a DrawingArea so we register an event handler.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -84,6 +84,7 @@ CPPSRCS = streams.cpp \
|
||||||
edtcmd.cpp \
|
edtcmd.cpp \
|
||||||
edtele.cpp \
|
edtele.cpp \
|
||||||
edtjava.cpp \
|
edtjava.cpp \
|
||||||
|
edtlist.cpp \
|
||||||
edtsave.cpp \
|
edtsave.cpp \
|
||||||
edtutil.cpp \
|
edtutil.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
|
@ -90,6 +90,7 @@ CPPSRCS = streams.cpp \
|
||||||
edtcmd.cpp \
|
edtcmd.cpp \
|
||||||
edtele.cpp \
|
edtele.cpp \
|
||||||
edtjava.cpp \
|
edtjava.cpp \
|
||||||
|
edtlist.cpp \
|
||||||
edtsave.cpp \
|
edtsave.cpp \
|
||||||
edtutil.cpp \
|
edtutil.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
|
@ -40,6 +40,12 @@ extern "C" {
|
||||||
#include "msgcom.h"
|
#include "msgcom.h"
|
||||||
#include "intl_csi.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;
|
//extern "C" int XP_EDT_HEAD_FAILED;
|
||||||
|
|
||||||
CBitArray *edt_setNoEndTag = 0;
|
CBitArray *edt_setNoEndTag = 0;
|
||||||
|
@ -1924,6 +1930,16 @@ EDT_ClipboardResult EDT_SetDefaultHTML( MWContext *pContext, char *pHTML ) {
|
||||||
}
|
}
|
||||||
return EDT_COP_DOCUMENT_BUSY;
|
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
|
#endif //ENDER
|
||||||
|
|
||||||
EDT_ClipboardResult EDT_PasteQuoteBegin( MWContext *pContext, XP_Bool bHTML ) {
|
EDT_ClipboardResult EDT_PasteQuoteBegin( MWContext *pContext, XP_Bool bHTML ) {
|
||||||
|
@ -1997,6 +2013,12 @@ void EDT_ConvertTableToText(MWContext *pMWContext)
|
||||||
pEditBuffer->ConvertTableToText();
|
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 */
|
/* TRUE if there is global style data available */
|
||||||
XP_Bool EDT_CanPasteStyle(MWContext *pMWContext)
|
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->BeginBatchChanges(kInsertImageCommandID);
|
||||||
pEditBuffer->LoadImage( pData, bKeepImagesWithDoc, FALSE );
|
pEditBuffer->LoadImage( pData, bKeepImagesWithDoc, FALSE );
|
||||||
pEditBuffer->EndBatchChanges();
|
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 ){
|
void EDT_ImageLoadCancel( MWContext *pContext ){
|
||||||
|
|
|
@ -3075,6 +3075,8 @@ public:
|
||||||
char *m_pBaseTarget;
|
char *m_pBaseTarget;
|
||||||
char *m_pBodyExtra;
|
char *m_pBodyExtra;
|
||||||
#ifdef ENDER
|
#ifdef ENDER
|
||||||
|
XP_Bool m_bEmbedded;
|
||||||
|
void *m_pEmbeddedData;
|
||||||
char *m_pImportedStream; //dont forget to XP_FREE this memory //ENDER
|
char *m_pImportedStream; //dont forget to XP_FREE this memory //ENDER
|
||||||
char *m_pImportedHTMLStream; //dont forget to XP_FREE this memory //ENDER
|
char *m_pImportedHTMLStream; //dont forget to XP_FREE this memory //ENDER
|
||||||
#endif //ENDER
|
#endif //ENDER
|
||||||
|
@ -3217,6 +3219,10 @@ public:
|
||||||
|
|
||||||
XP_Bool IsComposeWindow(){ return m_pContext->bIsComposeWindow; }
|
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 PrintTree( CEditElement* m_pRoot );
|
||||||
void DebugPrintTree( CEditElement* m_pRoot );
|
void DebugPrintTree( CEditElement* m_pRoot );
|
||||||
XP_HUGE_CHAR_PTR GetPositionalText();
|
XP_HUGE_CHAR_PTR GetPositionalText();
|
||||||
|
|
|
@ -42,6 +42,12 @@ const int32 MAX_POSITIONAL_TEXT =0x7FFFFFF0;
|
||||||
|
|
||||||
#include "prefapi.h"
|
#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_COL TRUE
|
||||||
#define GET_ROW FALSE
|
#define GET_ROW FALSE
|
||||||
|
|
||||||
|
@ -1531,7 +1537,9 @@ CEditBuffer::CEditBuffer(MWContext *pContext, XP_Bool bImportText):
|
||||||
m_bBackgroundNoSave(FALSE),
|
m_bBackgroundNoSave(FALSE),
|
||||||
m_pBodyExtra(0),
|
m_pBodyExtra(0),
|
||||||
#ifdef ENDER
|
#ifdef ENDER
|
||||||
m_pImportedStream(0), //ENDER
|
m_bEmbedded(FALSE), //ENDER
|
||||||
|
m_pEmbeddedData(0), //ENDER
|
||||||
|
m_pImportedStream(0), //ENDER
|
||||||
m_pImportedHTMLStream(0), //ENDER
|
m_pImportedHTMLStream(0), //ENDER
|
||||||
#endif //ENDER
|
#endif //ENDER
|
||||||
m_pLoadingImage(0),
|
m_pLoadingImage(0),
|
||||||
|
@ -10124,6 +10132,11 @@ void CEditBuffer::ReadFromBuffer(XP_HUGE_CHAR_PTR pBuffer){
|
||||||
NET_StreamClass *stream =
|
NET_StreamClass *stream =
|
||||||
NET_StreamBuilder(FO_PRESENT, url_s, m_pContext);
|
NET_StreamBuilder(FO_PRESENT, url_s, m_pContext);
|
||||||
if(stream) {
|
if(stream) {
|
||||||
|
#ifdef ENDER
|
||||||
|
XP_Bool bEmbedded = m_bEmbedded;
|
||||||
|
void *pEmbeddedData = m_pEmbeddedData;
|
||||||
|
MWContext *pContext = m_pContext;
|
||||||
|
#endif /* ENDER */
|
||||||
delete m_pRoot;
|
delete m_pRoot;
|
||||||
m_pRoot = 0;
|
m_pRoot = 0;
|
||||||
m_pCurrent = 0;
|
m_pCurrent = 0;
|
||||||
|
@ -10163,6 +10176,11 @@ void CEditBuffer::ReadFromBuffer(XP_HUGE_CHAR_PTR pBuffer){
|
||||||
(*stream->complete)(stream);
|
(*stream->complete)(stream);
|
||||||
XP_FREE(stream);
|
XP_FREE(stream);
|
||||||
XP_FREEIF(pChunk);
|
XP_FREEIF(pChunk);
|
||||||
|
|
||||||
|
#ifdef ENDER
|
||||||
|
if (bEmbedded)
|
||||||
|
EDT_SetEmbeddedEditorData(pContext, pEmbeddedData);
|
||||||
|
#endif /* ENDER */
|
||||||
}
|
}
|
||||||
NET_FreeURLStruct(url_s);
|
NET_FreeURLStruct(url_s);
|
||||||
}
|
}
|
||||||
|
@ -13821,6 +13839,13 @@ NORMAL_PASTE:
|
||||||
bAtStartOfParagraph = TRUE;
|
bAtStartOfParagraph = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(ENDER) && defined(MOZ_ENDER_MIME)
|
||||||
|
|
||||||
|
if( m_bEmbedded )
|
||||||
|
AddImagesToSafeList(pElement);
|
||||||
|
|
||||||
|
#endif /* ENDER && MOZ_ENDER_MIME */
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
m_pRoot->ValidateTree();
|
m_pRoot->ValidateTree();
|
||||||
#endif
|
#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)
|
XP_Bool EDT_ScrollToTarget(MWContext *pMWContext, char *pTargetURL)
|
||||||
{
|
{
|
||||||
if( !pTargetURL || !*pTargetURL )
|
if( !pTargetURL || !*pTargetURL )
|
||||||
|
|
|
@ -58,6 +58,10 @@
|
||||||
#include "lm_dom.h"
|
#include "lm_dom.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(ENDER) && defined(MOZ_ENDER_MIME)
|
||||||
|
#include "edtlist.h"
|
||||||
|
#endif /* ENDER && MOZ_ENDER_MIME */
|
||||||
|
|
||||||
#ifndef XP_TRACE
|
#ifndef XP_TRACE
|
||||||
# define XP_TRACE(X) fprintf X
|
# define XP_TRACE(X) fprintf X
|
||||||
#endif
|
#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_READONLY)&&
|
||||||
(form_ele->element_data->type != FORM_TYPE_BUTTON))
|
(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);
|
FE_ResetFormElement(context, form_ele);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,10 @@
|
||||||
#define IL_CLIENT /* XXXM12N Defined by Image Library clients */
|
#define IL_CLIENT /* XXXM12N Defined by Image Library clients */
|
||||||
#include "libimg.h" /* Image Library public API. */
|
#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*);
|
extern void NPL_DeleteSessionData(MWContext*, void*);
|
||||||
|
|
||||||
#ifdef PROFILE
|
#ifdef PROFILE
|
||||||
|
@ -142,10 +146,16 @@ lo_FreeFormElementData(LO_FormElementData *element_data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FORM_TYPE_TEXTAREA:
|
|
||||||
#ifdef ENDER
|
#ifdef ENDER
|
||||||
case FORM_TYPE_HTMLAREA :
|
case FORM_TYPE_HTMLAREA :
|
||||||
|
#if defined(MOZ_ENDER_MIME)
|
||||||
|
{
|
||||||
|
EDT_RemoveIDFromSafeList((void *)element_data);
|
||||||
|
}
|
||||||
|
#endif /* MOZ_ENDER_MIME */
|
||||||
|
/* no break */
|
||||||
#endif /*ENDER*/
|
#endif /*ENDER*/
|
||||||
|
case FORM_TYPE_TEXTAREA:
|
||||||
{
|
{
|
||||||
lo_FormElementTextareaData *form_data;
|
lo_FormElementTextareaData *form_data;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче