예제 #1
0
void
lo_UnblockLayout(MWContext *context, lo_TopState *top_state)
{
    XP_ASSERT(top_state && top_state->doc_state);
    if (!top_state || !top_state->doc_state)
        return;

    top_state->layout_blocking_element = NULL;
    lo_FlushBlockage(context, top_state->doc_state, top_state->doc_state);
}
예제 #2
0
void
LO_ClearJavaAppBlock(MWContext *context, LO_JavaAppStruct *java_app)
{
	int32 doc_id;
	lo_TopState *top_state;
	lo_DocState *main_doc_state;
	lo_DocState *state;

	/*
	 * Get the unique document ID, and retreive this
	 * documents layout state.
	 */
	doc_id = XP_DOCID(context);
	top_state = lo_FetchTopState(doc_id);
	if ((top_state == NULL)||(top_state->doc_state == NULL))
	{
		return;
	}

	if (top_state->layout_blocking_element == (LO_Element *)java_app)
	{
		if (java_app->width == 0)
		{
			java_app->width = JAVA_DEF_DIM;
		}
		if (java_app->height == 0)
		{
			java_app->height = JAVA_DEF_DIM;
		}

		main_doc_state = top_state->doc_state;
		state = lo_CurrentSubState(main_doc_state);

		lo_FinishJavaApp(context, state, java_app);
		lo_FlushBlockage(context, state, main_doc_state);
	}
}
예제 #3
0
/*
 * A script has just completed.  If we are blocked on that script
 *   free the blockage
 */
static void
lo_unblock_script_tag(MWContext * context, Bool messWithParser)
{
    lo_TopState *top_state;
    lo_DocState *state;
    LO_Element * block_ele;
    LO_Element * current_script;
    PA_Tag * tag;
	NET_StreamClass stream;

    top_state = lo_FetchTopState(XP_DOCID(context));
    if (!top_state || !top_state->doc_state)
        return;
    state = top_state->doc_state;
    
    /* 
     * Remember the fake element we created but clear the current
     *   script flag of the top_state since the FlushBlockage call
     *   might just turn around and block us on another script
     */
    current_script = top_state->current_script;
    top_state->current_script = NULL;

    /* 
     * if we are finishing a nested script make sure the current_script
     *   points to our parent script
     */
    for (tag = top_state->tags; tag; tag = tag->next) {
        if (tag->type == P_NSCP_REBLOCK) {
	    top_state->current_script = tag->lo_data;
	    break;
        }
    }


    /* Flush tags blocked by this <SCRIPT SRC="URL"> tag. */
    block_ele = top_state->layout_blocking_element;

    /* no longer in a script */
    top_state->in_script = SCRIPT_TYPE_NOT;

    /* 
     * we must be blocked on something either the script that just ended or
     *   some other object
     */
    if (!block_ele)
        goto done;

    if (messWithParser && top_state->doc_data &&
        SCRIPT_EXEC_OK(top_state, state, block_ele->type, LO_SCRIPT)) {
	  top_state->doc_data->overflow_depth --;
	XP_ASSERT(top_state->doc_data->overflow_depth >= 0);
    }

	lo_FlushLineBuffer(context, top_state->doc_state);

    /* 
     * unblock on UNKNOWN's as well since that's the type for
     * style attribute scripts
     */
    if (block_ele->type == LO_SCRIPT || block_ele->type == LO_UNKNOWN) {
        lo_UnblockLayout(context, top_state);
    }
    else {
        /* 
         * we're still blocked on something else - make sure
         *   there are no reblock tags that are going to hose
         *   us.  Find the reblock tags that point to our script
         *   tag and render them hermless
         */
        PA_Tag * tag;
        for (tag = top_state->tags; tag; tag = tag->next) {
            if (tag->type == P_NSCP_REBLOCK) {
                LO_Element * lo_ele = tag->lo_data;
                if (lo_ele == current_script) {
                    tag->lo_data = NULL;
                }
            }
        }
    }

    /* free the fake element we created earlier */
    lo_FreeElement(context, current_script, FALSE);

done:
    
    /* the parser is now able to receive new data from netlib */
	stream.data_object=(pa_DocData *)top_state->doc_data;
    pa_FlushOverflow(&stream);

    /*
     * The initial call to lo_UnblockLayout() might have not torn
     *   everything down because we were waiting for the last
     *   chunk of data to come out of the doc_data->overflow_buf
     * We need to get to lo_FlushedBlockedTags() and lo_FinishLayout()
     *   at the bottom of lo_FlushBlockage().
     */
    if (!top_state->layout_blocking_element)
	lo_FlushBlockage(context, top_state->doc_state, top_state->doc_state);

}