Checking in changes made for the Layout Probe API project by Ori Kravitz
(orik@mercury.co.il) and Andrei Romanov (aromanov@segue.com). git-svn-id: svn://10.0.0.236/trunk@10622 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -36,6 +36,9 @@
|
||||
#define Z_CELL_BACKGROUND_LAYER -1000 /* Table cell backgrounds */
|
||||
#define Z_BACKGROUND_LAYER -1001 /* Layer/document backgrounds */
|
||||
|
||||
#ifdef LAYPROBE_API
|
||||
#include "layprobe.h"
|
||||
#endif
|
||||
|
||||
#ifdef PROFILE
|
||||
#pragma profile on
|
||||
@@ -522,6 +525,15 @@ lo_html_event_handler_func(CL_Layer *layer,
|
||||
XP_MEMCPY(event_closure->event->fe_event, event->fe_event, event->fe_event_size);
|
||||
}
|
||||
|
||||
#ifdef LAYPROBE_API
|
||||
{
|
||||
LAPIEventInfo ei;
|
||||
LAPI_COPY_JS2API_EVENT(&ei,jsevent);
|
||||
ei.Context = closure->context;
|
||||
LAPINotificationHandler(&ei);
|
||||
}
|
||||
#endif /* LAYPROBE_API */
|
||||
|
||||
ET_SendEvent(closure->context, pElement, jsevent, lo_html_event_callback, event_closure);
|
||||
|
||||
return PR_TRUE;
|
||||
|
||||
@@ -45,6 +45,11 @@
|
||||
#include "plvector.h"
|
||||
#include "htrdf.h"
|
||||
|
||||
#ifdef LAYPROBE_API
|
||||
#include "layprobe.h"
|
||||
#endif
|
||||
|
||||
|
||||
/* WEBFONTS are defined only in laytags.c and layout.c */
|
||||
#define WEBFONTS
|
||||
|
||||
@@ -430,6 +435,7 @@ lo_NewTopState(MWContext *context, char *url)
|
||||
top_state->wedged_on_mocha = FALSE;
|
||||
top_state->in_cell_relayout = FALSE; /* Used for resize without reload stuff */
|
||||
top_state->metaTags = NULL;
|
||||
top_state->LAPIprobe = NULL;
|
||||
|
||||
return(top_state);
|
||||
}
|
||||
@@ -3718,13 +3724,29 @@ lo_FinishLayout(MWContext *context, lo_DocState *state, int32 mocha_event)
|
||||
lo_use_default_doc_background(context, state);
|
||||
}
|
||||
|
||||
if (state && state->top_state)
|
||||
ET_SendLoadEvent(context, mocha_event, NULL, NULL,
|
||||
LO_DOCUMENT_LAYER_ID,
|
||||
state->top_state->resize_reload);
|
||||
else
|
||||
ET_SendLoadEvent(context, mocha_event, NULL, NULL,
|
||||
LO_DOCUMENT_LAYER_ID, FALSE);
|
||||
#ifdef LAYPROBE_API
|
||||
{
|
||||
/* Send a notification when a frame has finished loading */
|
||||
XP_List* pList = GetCallbackFuncList((int32)FRAME_DOCUMENT_COMPLETE);
|
||||
|
||||
if (pList)
|
||||
{
|
||||
while (pList = pList->next)
|
||||
{
|
||||
if (pList->object)
|
||||
(*((ID_NOTIFY_PT)(pList->object)))((void*)context);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* LAYPROBE_API */
|
||||
|
||||
if (state && state->top_state)
|
||||
ET_SendLoadEvent(context, mocha_event, NULL, NULL,
|
||||
LO_DOCUMENT_LAYER_ID,
|
||||
state->top_state->resize_reload);
|
||||
else
|
||||
ET_SendLoadEvent(context, mocha_event, NULL, NULL,
|
||||
LO_DOCUMENT_LAYER_ID, FALSE);
|
||||
|
||||
/* Reset state for force loading images. */
|
||||
LO_SetForceLoadImage(NULL, FALSE);
|
||||
@@ -6063,6 +6085,29 @@ lo_InternalDiscardDocument(MWContext *context, lo_DocState *state,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LAYPROBE_API
|
||||
{
|
||||
/* Send a notification when a frame unloads */
|
||||
XP_List * pList = GetCallbackFuncList((int32)FRAME_ON_UNLOAD);
|
||||
|
||||
if (pList)
|
||||
{
|
||||
while (pList = pList->next)
|
||||
{
|
||||
if (pList->object)
|
||||
(*((ID_NOTIFY_PT)pList->object))((void*)context);
|
||||
}
|
||||
}
|
||||
|
||||
/* clean up allocated memory */
|
||||
if (state->top_state->LAPIprobe)
|
||||
{
|
||||
LAPIDestroyProbe(state->top_state->LAPIprobe);
|
||||
state->top_state->LAPIprobe = NULL;
|
||||
}
|
||||
}
|
||||
#endif /* LAYPROBE_API */
|
||||
|
||||
if ( state->top_state->trash != NULL)
|
||||
{
|
||||
lo_RecycleElements(context, state,
|
||||
|
||||
@@ -855,6 +855,7 @@ struct lo_TopState_struct {
|
||||
void /*DOM_Node*/ *top_node; /* top of the DOM_Node tree */
|
||||
void /*DOM_Node*/ *current_node; /* active node (only during tree gen) */
|
||||
#endif
|
||||
void* LAPIprobe;
|
||||
};
|
||||
|
||||
/* Script type codes, stored in top_state->in_script. */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,8 +25,117 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef layprobe_h__
|
||||
#define layprobe_h__
|
||||
|
||||
#include "structs.h"
|
||||
|
||||
/* API Element types */
|
||||
#define LAPI_UNKNOWN -1
|
||||
#define LAPI_TEXTLINK 0
|
||||
#define LAPI_TEXT 1
|
||||
#define LAPI_HRULE 2
|
||||
#define LAPI_IMAGE 3
|
||||
#define LAPI_BULLET 4
|
||||
#define LAPI_TABLE 5
|
||||
#define LAPI_CELL 6
|
||||
#define LAPI_EMBED 7
|
||||
#define LAPI_JAVA 8
|
||||
#define LAPI_OBJECT 9
|
||||
|
||||
|
||||
#define LAPI_FIRST_FE 30
|
||||
#define LAPI_FE_TEXT 30
|
||||
#define LAPI_FE_RADIOBUTTON 31
|
||||
#define LAPI_FE_CHECKBOX 32
|
||||
#define LAPI_FE_BUTTON 33
|
||||
#define LAPI_FE_COMBOBOX 34
|
||||
#define LAPI_FE_LISTBOX 35
|
||||
#define LAPI_LAST_FE 35
|
||||
|
||||
#define LAPI_FRAME 50
|
||||
|
||||
/* API Error codes */
|
||||
#define LAPI_E_NOTIMPL -1000
|
||||
#define LAPI_E_UNEXPECTED -1001
|
||||
#define LAPI_E_INVALIDARG -1002
|
||||
#define LAPI_E_INVALIDBROWSER -1003
|
||||
#define LAPI_E_INVALIDFRAME -1004
|
||||
#define LAPI_E_INVALIDELEMENT -1005
|
||||
#define LAPI_E_NOTSUPPORTED -1006
|
||||
#define LAPI_E_NOELEMENTS -1007
|
||||
#define LAPI_E_OUTOFBOUNDS -1008
|
||||
#define LAPI_E_INVALIDPROP -1009
|
||||
#define LAPI_E_LIB_LOAD_FAILED -1010
|
||||
#define LAPI_E_INIT_TEST_LIB_FAILED -1011
|
||||
#define LAPI_E_GENERAL_ERROR -1012
|
||||
|
||||
#define LAPI_INVALID_NUM -1
|
||||
|
||||
/* Callback function types and constatnts */
|
||||
typedef void (*ID_NOTIFY_PT)(void*);
|
||||
typedef void (*ELEMENT_NOTIFY_PT)(MWContext* FrameID, void* ElementID,
|
||||
int32 xPos, int32 yPos, int32 KeysState);
|
||||
|
||||
#define BROWSER_NAVIGATION_COMPLETE 0
|
||||
#define BROWSER_ON_QUIT 1
|
||||
#define FRAME_DOCUMENT_COMPLETE 2
|
||||
#define FRAME_ON_UNLOAD 3
|
||||
|
||||
#define ELEMENT_MOUSE_DOWN 4
|
||||
#define ELEMENT_MOUSE_UP 5
|
||||
#define ELEMENT_MOUSE_OVER 6
|
||||
#define ELEMENT_MOUSE_OUT 7
|
||||
#define ELEMENT_CLICK 8
|
||||
#define ELEMENT_KILL_FOCUS 9
|
||||
#define ELEMENT_SET_FOCUS 10
|
||||
#define ELEMENT_CHANGE 11
|
||||
|
||||
#define MAX_CALLBACKS 15
|
||||
|
||||
/* Notification Events (same as JSEvent values) */
|
||||
#define EVENT_MOUSEDOWN 0x00000001
|
||||
#define EVENT_MOUSEUP 0x00000002
|
||||
#define EVENT_MOUSEOVER 0x00000004 /* user is mousing over a link */
|
||||
#define EVENT_MOUSEOUT 0x00000008 /* user is mousing out of a link */
|
||||
#define EVENT_MOUSEMOVE 0x00000010
|
||||
#define EVENT_MOUSEDRAG 0x00000020
|
||||
#define EVENT_CLICK 0x00000040 /* input element click in progress */
|
||||
#define EVENT_DBLCLICK 0x00000080
|
||||
#define EVENT_KEYDOWN 0x00000100
|
||||
#define EVENT_KEYUP 0x00000200
|
||||
#define EVENT_KEYPRESS 0x00000400
|
||||
#define EVENT_DRAGDROP 0x00000800 /* not yet implemented */
|
||||
#define EVENT_FOCUS 0x00001000 /* input focus event in progress */
|
||||
#define EVENT_BLUR 0x00002000 /* loss of focus event in progress */
|
||||
#define EVENT_SELECT 0x00004000 /* input field selection in progress */
|
||||
#define EVENT_CHANGE 0x00008000 /* field value change in progress */
|
||||
#define EVENT_RESET 0x00010000 /* form submit in progress */
|
||||
#define EVENT_SUBMIT 0x00020000 /* form submit in progress */
|
||||
#define EVENT_SCROLL 0x00040000 /* window is being scrolled */
|
||||
#define EVENT_LOAD 0x00080000 /* layout parsed a loaded document */
|
||||
#define EVENT_UNLOAD 0x00100000
|
||||
#define EVENT_XFER_DONE 0x00200000 /* document has loaded */
|
||||
#define EVENT_ABORT 0x00400000
|
||||
#define EVENT_ERROR 0x00800000
|
||||
#define EVENT_LOCATE 0x01000000
|
||||
#define EVENT_MOVE 0x02000000
|
||||
#define EVENT_RESIZE 0x04000000
|
||||
#define EVENT_FORWARD 0x08000000
|
||||
#define EVENT_HELP 0x10000000 /* for handling of help events */
|
||||
#define EVENT_BACK 0x20000000
|
||||
|
||||
|
||||
typedef struct {
|
||||
int32 type;
|
||||
MWContext* Context;
|
||||
LO_Element* lo_element;
|
||||
int32 x,y;
|
||||
int32 docx,docy;
|
||||
int32 screenx,screeny;
|
||||
} LAPIEventInfo;
|
||||
|
||||
|
||||
/* The different types of layout elements */
|
||||
#define LO_TEXT 1
|
||||
#define LO_HRULE 3
|
||||
@@ -38,6 +147,7 @@
|
||||
#define LO_EMBED 10
|
||||
#define LO_JAVA 12
|
||||
#define LO_OBJECT 14
|
||||
#define LO_FLOAT 18
|
||||
|
||||
typedef enum _ColorType {
|
||||
LO_QA_BACKGROUND_COLOR,
|
||||
@@ -126,6 +236,7 @@ Bool LO_QA_HasParent( long probeID, Bool *hasParent );
|
||||
|
||||
Bool LO_QA_GetTextLength( long probeID, long *length);
|
||||
Bool LO_QA_GetText( long probeID, char *text, long length);
|
||||
Bool LO_QA_GetTextAttributes( long probeID, void *attributes);
|
||||
|
||||
/* Color Type Elements containing the color type
|
||||
---------- ----------------------------------
|
||||
@@ -137,4 +248,155 @@ Bool LO_QA_GetText( long probeID, char *text, long length);
|
||||
at which the probe is currently positioned. Returns TRUE if successful,
|
||||
FALSE if not.
|
||||
*/
|
||||
Bool LO_QA_GetColor( long probeID, long *color, ColorType type);
|
||||
Bool LO_QA_GetColor( long probeID, long *color, ColorType type);
|
||||
|
||||
/**********************************************************
|
||||
********* Queries API ********
|
||||
**********************************************************/
|
||||
|
||||
int32 LAPIGetLastError();
|
||||
|
||||
Bool LAPIGetFrames(
|
||||
XP_List** lppContextList
|
||||
);
|
||||
|
||||
|
||||
Bool LAPIFrameGetStringProperty(
|
||||
MWContext* FrameID,
|
||||
char* PropertyName,
|
||||
char** lpszPropVal
|
||||
);
|
||||
|
||||
Bool LAPIFrameGetNumProperty(
|
||||
MWContext* FrameID,
|
||||
char* PropertyName,
|
||||
int32* lpPropVal
|
||||
);
|
||||
|
||||
|
||||
Bool LAPIFrameGetElements(
|
||||
XP_List* lpList,
|
||||
MWContext* FrameID,
|
||||
int16 ElementLAPIType,
|
||||
char* ElementName
|
||||
);
|
||||
|
||||
|
||||
LO_Element* LAPIFrameGetElementFromPoint(
|
||||
MWContext * FrameID,
|
||||
int xPos,
|
||||
int yPos
|
||||
);
|
||||
|
||||
|
||||
LO_Element* LAPIGetFirstElement (
|
||||
MWContext * FrameID
|
||||
);
|
||||
|
||||
|
||||
LO_Element* LAPIGetNextElement (
|
||||
MWContext * FrameID,
|
||||
LO_Element* ElementID
|
||||
);
|
||||
|
||||
|
||||
LO_Element* LAPIGetPrevElement (
|
||||
MWContext * FrameID,
|
||||
LO_Element* ElementID
|
||||
);
|
||||
|
||||
|
||||
LO_Element* LAPIGetChildElement (
|
||||
MWContext * FrameID,
|
||||
LO_Element* ElementID
|
||||
);
|
||||
|
||||
|
||||
LO_Element* LAPIGetParentElement (
|
||||
MWContext * FrameID,
|
||||
LO_Element* ElementID
|
||||
);
|
||||
|
||||
|
||||
Bool LAPIElementGetStringProperty(
|
||||
MWContext* FrameID,
|
||||
LO_Element* ElementID,
|
||||
char* PropertyName,
|
||||
char** lpszPropVal
|
||||
);
|
||||
|
||||
|
||||
Bool LAPIElementGetNumProperty(
|
||||
MWContext* FrameID,
|
||||
LO_Element* ElementID,
|
||||
char* PropertyName,
|
||||
int32* lpPropVal
|
||||
);
|
||||
|
||||
|
||||
|
||||
void LAPIDestroyProbe(
|
||||
void* ProbeID
|
||||
);
|
||||
|
||||
/**********************************************************
|
||||
********* Manipulation API ********
|
||||
**********************************************************/
|
||||
|
||||
|
||||
Bool LAPIElementClick(
|
||||
MWContext* FrameID,
|
||||
void* ElementID,
|
||||
int16 MouseButton
|
||||
);
|
||||
|
||||
|
||||
Bool LAPIElementSetText (
|
||||
MWContext* FrameID,
|
||||
void* ElementID,
|
||||
char* Text
|
||||
);
|
||||
|
||||
|
||||
Bool LAPIElementSetState (
|
||||
MWContext* FrameID,
|
||||
void* ElementID,
|
||||
int8 Value
|
||||
);
|
||||
|
||||
|
||||
Bool LAPIElementScrollIntoView (
|
||||
MWContext* FrameID,
|
||||
void* ElementID,
|
||||
int xPos,
|
||||
int yPos
|
||||
);
|
||||
|
||||
|
||||
/**********************************************************
|
||||
********* API Callback regisration ********
|
||||
**********************************************************/
|
||||
|
||||
int32 LAPIRegisterNotifyCallback(
|
||||
ID_NOTIFY_PT* lpFunc,
|
||||
int32 EventID
|
||||
);
|
||||
|
||||
int32 LAPIRegisterElementCallback(
|
||||
ELEMENT_NOTIFY_PT* lpFunc,
|
||||
int32 EventID
|
||||
);
|
||||
|
||||
Bool LAPIUnregisterCallbackFunction(
|
||||
void* CallbackID
|
||||
);
|
||||
|
||||
XP_List* GetCallbackFuncList(
|
||||
int32 EventID
|
||||
);
|
||||
|
||||
Bool LAPINotificationHandler(
|
||||
LAPIEventInfo* pEvent
|
||||
);
|
||||
|
||||
#endif /* layprobe_h__ */
|
||||
Reference in New Issue
Block a user