Beispiel #1
0
static char*
_dumpFramesAsText(LayoutTestController* controller, WebCore::Frame* in_core_frame, bool is_main_frame)
{
    WTF::String result("");

    // Add header for all but the main frame.

    WebCore::FrameView* view = in_core_frame->view();

    if (view && view->layoutPending())
        view->layout();

    WebCore::Element* document_element = in_core_frame->document()->documentElement();
    WTF::String inner_text = document_element->innerText();

    if (!is_main_frame) {
        WTF::String frame_name(in_core_frame->tree().name());
        result.append("\n--------\nFrame: '");
        result.append(frame_name);
        result.append("'\n--------\n");
    }
    result.append(inner_text);
    result.append("\n");

    if (controller->dumpChildFramesAsText()) {
        for (WebCore::Frame* child = in_core_frame->tree().firstChild(); child; child = child->tree().nextSibling()) {
            char* tmp = _dumpFramesAsText(controller, child, false);
            result.append(tmp);
            free(tmp);
        }
    }

    return strdup(result.utf8().data());
}
Beispiel #2
0
void DumpRenderTreeSupportQt::setMediaType(QWebFrame* frame, const QString& type)
{
    WebCore::Frame* coreFrame = QWebFramePrivate::core(frame);
    WebCore::FrameView* view = coreFrame->view();
    view->setMediaType(type);
    coreFrame->document()->styleSelectorChanged(RecalcStyleImmediately);
    view->layout();
}
Beispiel #3
0
void BWebPage::scroll(int xOffset, int yOffset, const BRect& rectToScroll,
	const BRect& clipRect)
{
    if (!fWebView->LockLooper())
        return;
    BBitmap* bitmap = fWebView->OffscreenBitmap();
    BView* offscreenView = fWebView->OffscreenView();

    // Lock the offscreen bitmap while we still have the
    // window locked. This cannot deadlock and makes sure
    // the window is not deleting the offscreen view right
    // after we unlock it and before locking the bitmap.
    if (!bitmap->Lock()) {
    	fWebView->UnlockLooper();
    	return;
    }
    fWebView->UnlockLooper();

	BRect clip = offscreenView->Bounds();
	if (clipRect.IsValid())
		clip = clip & clipRect;
	BRect rectAtSrc = rectToScroll;
	BRect rectAtDst = rectAtSrc.OffsetByCopy(xOffset, yOffset);
	BRegion repaintRegion(rectAtSrc);
	if (clip.Intersects(rectAtSrc) && clip.Intersects(rectAtDst)) {
		// clip source rect
		rectAtSrc = rectAtSrc & clip;
		// clip dest rect
		rectAtDst = rectAtDst & clip;
		// move dest back over source and clip source to dest
		rectAtDst.OffsetBy(-xOffset, -yOffset);
		rectAtSrc = rectAtSrc & rectAtDst;
		// remember the part that will be clean
		rectAtDst.OffsetBy(xOffset, yOffset);
		repaintRegion.Exclude(rectAtDst);

		offscreenView->CopyBits(rectAtSrc, rectAtDst);
	}

	if (repaintRegion.Frame().IsValid()) {
        WebCore::Frame* frame = fMainFrame->Frame();
        WebCore::FrameView* view = frame->view();
        // Make sure the view is layouted, since it will refuse to paint
        // otherwise.
        fLayoutingView = true;
        view->layout(true);
        fLayoutingView = false;

		internalPaint(offscreenView, view, &repaintRegion);
	}

    bitmap->Unlock();

    // Notify the view that it can now pull the bitmap in its own thread
    fWebView->SetOffscreenViewClean(rectToScroll, false);
}
Beispiel #4
0
void BWebPage::paint(BRect rect, bool immediate)
{
	if (fLayoutingView || !rect.IsValid())
		return;
    // Block any drawing as long as the BWebView is hidden
    // (should be extended to when the containing BWebWindow is not
    // currently on screen either...)
    if (!fPageVisible) {
        fPageDirty = true;
        return;
    }

    // NOTE: fMainFrame can be 0 because init() eventually ends up calling
    // paint()! BWebFrame seems to cause an initial page to be loaded, maybe
    // this ought to be avoided also for start-up speed reasons!
    if (!fMainFrame)
        return;
    WebCore::Frame* frame = fMainFrame->Frame();
    WebCore::FrameView* view = frame->view();

    if (!view || !frame->contentRenderer())
        return;

	// Since calling layoutIfNeededRecursive can cycle back into paint(),
	// call this method before locking the window and before holding the
	// offscreen view lock.
	fLayoutingView = true;
	view->layout(true);
	fLayoutingView = false;

    if (!fWebView->LockLooper())
        return;
    BView* offscreenView = fWebView->OffscreenView();

    // Lock the offscreen bitmap while we still have the
    // window locked. This cannot deadlock and makes sure
    // the window is not deleting the offscreen view right
    // after we unlock it and before locking the bitmap.
    if (!offscreenView->LockLooper()) {
    	fWebView->UnlockLooper();
    	return;
    }
    fWebView->UnlockLooper();

    if (!rect.IsValid())
        rect = offscreenView->Bounds();
    BRegion region(rect);
    internalPaint(offscreenView, view, &region);

    offscreenView->UnlockLooper();

    fPageDirty = false;

    // Notify the window that it can now pull the bitmap in its own thread
    fWebView->SetOffscreenViewClean(rect, immediate);
}
Beispiel #5
0
String DumpRenderTreeSupportEfl::renderTreeDump(Evas_Object* ewkFrame)
{
    DRT_SUPPORT_FRAME_GET_OR_RETURN(ewkFrame, frame, String());

    WebCore::FrameView *frameView = frame->view();

    if (frameView && frameView->layoutPending())
        frameView->layout();

    return WebCore::externalRepresentation(frame);
}
Beispiel #6
0
String DumpRenderTreeSupportEfl::renderTreeDump(Evas_Object* ewkFrame)
{
    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);

    if (!frame)
        return String();

    WebCore::FrameView *frameView = frame->view();

    if (frameView && frameView->layoutPending())
        frameView->layout();

    return WebCore::externalRepresentation(frame);
}
Beispiel #7
0
void DumpRenderTreeSupportEfl::layoutFrame(Evas_Object* ewkFrame)
{
    WebCore::Frame* frame = EWKPrivate::coreFrame(ewkFrame);

    if (!frame)
        return;

    WebCore::FrameView* frameView = frame->view();

    if (!frameView)
        return;

    frameView->layout();
}
Beispiel #8
0
char*
DumpRenderTreeWKC::dumpRenderTree(WKC::WKCWebFrame* frame)
{
    WKC::Frame* wkcframe = frame->core();
    WebCore::Frame* core_frame= wkcframe->priv().webcore();
    if (!core_frame)
        return strdup("");

    WebCore::FrameView* view = core_frame->view();

    if (view && view->layoutPending())
        view->layout();

    WTF::String string = WebCore::externalRepresentation(core_frame);
    return strdup(string.utf8().data());
}