本文整理汇总了C++中webcore::FrameView类的典型用法代码示例。如果您正苦于以下问题:C++ FrameView类的具体用法?C++ FrameView怎么用?C++ FrameView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FrameView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renderTreeDump
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);
}
示例2: layoutFrame
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();
}
示例3: restore
void restore()
{
WebCore::FrameView* view = frameView();
if (!view)
return;
m_webView->setZoomLevel(false, 0);
m_webView->setEmulatedTextZoomFactor(1);
view->setHorizontalScrollbarLock(false);
view->setVerticalScrollbarLock(false);
view->setScrollbarModes(ScrollbarAuto, ScrollbarAuto, false, false);
view->resize(IntSize(m_webView->size()));
m_webView->sendResizeEventAndRepaint();
}
示例4: setDeviceMetrics
void setDeviceMetrics(int width, int height, float textZoomFactor, bool fitWindow)
{
WebCore::FrameView* view = frameView();
if (!view)
return;
m_emulatedFrameSize = WebSize(width, height);
m_fitWindow = fitWindow;
m_originalZoomFactor = 0;
m_webView->setEmulatedTextZoomFactor(textZoomFactor);
applySizeOverrideInternal(view, FitWindowAllowed);
autoZoomPageToFitWidth(view->frame());
m_webView->sendResizeEventAndRepaint();
}
示例5: strdup
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());
}
示例6: renderFromTiledBackingStore
bool QWebFrameAdapter::renderFromTiledBackingStore(QPainter* painter, const QRegion& clip)
{
// No tiled backing store? Tell the caller to fall back to regular rendering.
if (!frame->tiledBackingStore())
return false;
// FIXME: We should set the backing store viewport earlier than in paint
frame->tiledBackingStore()->coverWithTilesIfNeeded();
if (!frame->view() || !frame->contentRenderer())
return true;
QVector<QRect> vector = clip.rects();
if (vector.isEmpty())
return true;
GraphicsContext context(painter);
WebCore::FrameView* view = frame->view();
int scrollX = view->scrollX();
int scrollY = view->scrollY();
context.translate(-scrollX, -scrollY);
for (int i = 0; i < vector.size(); ++i) {
const QRect& clipRect = vector.at(i);
painter->save();
QRect rect = clipRect.translated(scrollX, scrollY);
painter->setClipRect(rect, Qt::IntersectClip);
frame->tiledBackingStore()->paint(&context, rect);
painter->restore();
}
#if USE(ACCELERATED_COMPOSITING)
renderCompositedLayers(&context, IntRect(clip.boundingRect()));
renderFrameExtras(&context, QWebFrameAdapter::ScrollBarLayer | QWebFrameAdapter::PanIconLayer, clip);
#endif
return true;
}
示例7: renderPrivate
void QWebFramePrivate::renderPrivate(QPainter *painter, const QRegion &clip, bool contents)
{
if (!frame->view() || !frame->contentRenderer())
return;
QVector<QRect> vector = clip.rects();
if (vector.isEmpty())
return;
WebCore::FrameView* view = frame->view();
view->layoutIfNeededRecursive();
GraphicsContext context(painter);
if (!contents)
view->paint(&context, vector.first());
else
view->paintContents(&context, vector.first());
for (int i = 1; i < vector.size(); ++i) {
const QRect& clipRect = vector.at(i);
painter->save();
painter->setClipRect(clipRect, Qt::IntersectClip);
if (!contents)
view->paint(&context, clipRect);
else
view->paintContents(&context, clipRect);
painter->restore();
}
}
示例8: printFrames
static void printFrames(const WebCore::Frame& frame, const WebCore::Frame* targetFrame, int indent)
{
if (&frame == targetFrame) {
printf("--> ");
printIndent(indent - 1);
} else
printIndent(indent);
WebCore::FrameView* view = frame.view();
printf("Frame %p %dx%d\n", &frame, view ? view->width() : 0, view ? view->height() : 0);
printIndent(indent);
printf(" ownerElement=%p\n", frame.ownerElement());
printIndent(indent);
printf(" frameView=%p\n", view);
printIndent(indent);
printf(" document=%p\n", frame.document());
printIndent(indent);
printf(" uri=%s\n\n", frame.document()->documentURI().utf8().data());
for (WebCore::Frame* child = frame.tree().firstChild(); child; child = child->tree().nextSibling())
printFrames(*child, targetFrame, indent + 1);
}
示例9: imageRect
WebCore::IntRect InjectedBundleHitTestResult::imageRect() const
{
WebCore::IntRect imageRect = m_hitTestResult.imageRect();
if (imageRect.isEmpty())
return imageRect;
// The image rect in WebCore::HitTestResult is in frame coordinates, but we need it in WKView
// coordinates since WebKit2 clients don't have enough context to do the conversion themselves.
WebFrame* webFrame = frame();
if (!webFrame)
return imageRect;
WebCore::Frame* coreFrame = webFrame->coreFrame();
if (!coreFrame)
return imageRect;
WebCore::FrameView* view = coreFrame->view();
if (!view)
return imageRect;
return view->contentsToRootView(imageRect);
}
示例10: render
/*!
Render the frame into \a painter clipping to \a clip.
\sa print()
*/
void QWebFrame::render(QPainter *painter, const QRegion &clip)
{
if (!d->frame->view() || !d->frame->contentRenderer())
return;
d->frame->view()->layoutIfNeededRecursive();
GraphicsContext ctx(painter);
QVector<QRect> vector = clip.rects();
WebCore::FrameView* view = d->frame->view();
for (int i = 0; i < vector.size(); ++i) {
if (i > 0) {
painter->save();
painter->setClipRect(vector.at(i), Qt::IntersectClip);
}
view->paint(&ctx, vector.at(i));
if (i > 0)
painter->restore();
}
}
示例11: renderFrameExtras
void QWebFrameAdapter::renderFrameExtras(WebCore::GraphicsContext* context, int layers, const QRegion& clip)
{
if (!(layers & (PanIconLayer | ScrollBarLayer)))
return;
QPainter* painter = context->platformContext();
WebCore::FrameView* view = frame->view();
QVector<QRect> vector = clip.rects();
for (int i = 0; i < vector.size(); ++i) {
const QRect& clipRect = vector.at(i);
QRect intersectedRect = clipRect.intersected(view->frameRect());
painter->save();
painter->setClipRect(clipRect, Qt::IntersectClip);
int x = view->x();
int y = view->y();
if (layers & ScrollBarLayer
&& !view->scrollbarsSuppressed()
&& (view->horizontalScrollbar() || view->verticalScrollbar())) {
QRect rect = intersectedRect;
context->translate(x, y);
rect.translate(-x, -y);
view->paintScrollbars(context, rect);
context->translate(-x, -y);
}
#if ENABLE(PAN_SCROLLING)
if (layers & PanIconLayer)
view->paintPanScrollIcon(context);
#endif
painter->restore();
}
}
示例12: renderRelativeCoords
void QWebFramePrivate::renderRelativeCoords(GraphicsContext* context, QWebFrame::RenderLayer layer, const QRegion& clip)
{
if (!frame->view() || !frame->contentRenderer())
return;
QVector<QRect> vector = clip.rects();
if (vector.isEmpty())
return;
QPainter* painter = context->platformContext();
WebCore::FrameView* view = frame->view();
view->layoutIfNeededRecursive();
for (int i = 0; i < vector.size(); ++i) {
const QRect& clipRect = vector.at(i);
QRect intersectedRect = clipRect.intersected(view->frameRect());
painter->save();
painter->setClipRect(clipRect, Qt::IntersectClip);
int x = view->x();
int y = view->y();
if (layer & QWebFrame::ContentsLayer) {
context->save();
int scrollX = view->scrollX();
int scrollY = view->scrollY();
QRect rect = intersectedRect;
context->translate(x, y);
rect.translate(-x, -y);
context->translate(-scrollX, -scrollY);
rect.translate(scrollX, scrollY);
context->clip(view->visibleContentRect());
view->paintContents(context, rect);
context->restore();
}
if (layer & QWebFrame::ScrollBarLayer
&& !view->scrollbarsSuppressed()
&& (view->horizontalScrollbar() || view->verticalScrollbar())) {
context->save();
QRect rect = intersectedRect;
context->translate(x, y);
rect.translate(-x, -y);
view->paintScrollbars(context, rect);
context->restore();
}
#if ENABLE(PAN_SCROLLING)
if (layer & QWebFrame::PanIconLayer)
view->paintPanScrollIcon(context);
#endif
painter->restore();
}
}
示例13: JumpToNearestElement
//.........这里部分代码省略.........
break;
case EA::WebKit::JumpUp:
if (GetFixedString(mCachedNavigationUpId)->compare(""))
{
if (!GetFixedString(mCachedNavigationUpId)->compare("ignore"))
{
return false;
}
if (JumpToId(GetFixedString(mCachedNavigationUpId)->c_str()))
{
return true;
}
}
break;
default:
EAW_FAIL_MSG("Should not have got here\n");
}
// Iterate over all the frames and find the closest element in any of all the frames.
WebCore::Frame* pFrame = mView->GetFrame();
float currentRadialDistance = FLT_MAX; // A high value to start with so that the max distance between any two elements in the surface is under it.
WebCore::Node* currentBestNode = NULL;
while(pFrame)
{
WebCore::Document* document = pFrame->document();
EAW_ASSERT(document);
if(document)
{
WebCore::FrameView* pFrameView = document->view();
WebCore::IntPoint scrollOffset;
if(pFrameView)
{
scrollOffset.setX(pFrameView->scrollOffset().width());
scrollOffset.setY(pFrameView->scrollOffset().height());
}
// We figure out the start position(It is center of the currently hovered element almost all the time but can be slightly different
// due to scroll sometimes).
mCentreX = lastX + scrollOffset.x();
mCentreY = lastY + scrollOffset.y();
DocumentNavigator navigator(mView, document, direction, WebCore::IntPoint(mCentreX, mCentreY), mBestNodeX, mBestNodeY, mBestNodeWidth, mBestNodeHeight, mJumpNavigationParams.mNavigationTheta, mJumpNavigationParams.mStrictAxesCheck, currentRadialDistance);
navigator.FindBestNode(document);
if(navigator.GetBestNode())
{
currentBestNode = navigator.GetBestNode();
currentRadialDistance = navigator.GetBestNodeRadialDistance();
}
}
pFrame = pFrame->tree()->traverseNext();
}
bool foundSomething = false;
if (currentBestNode) //We found the node to navigate. Move the cursor and we are done.
{
foundSomething = true;
MoveMouseCursorToNode(currentBestNode, false);
}
示例14: MoveMouseCursorToNode
void ViewNavigationDelegate::MoveMouseCursorToNode(WebCore::Node* node, bool scrollIfNecessary)
{
if (node)
{
WebCore::HTMLElement* element = (WebCore::HTMLElement*)node;
WebCore::IntRect rect = element->getRect();
WebCore::IntPoint frameOffset;
WebCore::IntPoint scrollOffset;
WebCore::FrameView* pFrameView = element->document()->view(); //Can be NULL
if(pFrameView)
{
//Use move here instead of setX/setY as it results in 1 call instead of two and takes advantage that ctor sets x,y to 0.
frameOffset.move(pFrameView->x(), pFrameView->y());
scrollOffset.move(pFrameView->scrollOffset().width(), pFrameView->scrollOffset().height());
}
int width = mView->GetSize().mWidth;
int height = mView->GetSize().mHeight;
// This will be true if this function is called from anywhere except JumpToNearestElement(). This enables us to not lose the cursor during
// arbitrary jumping of elements from either code or webpage using the Navigation APIs.
if(scrollIfNecessary)
{
int cursorX, cursorY;
mView->GetCursorPosition(cursorX, cursorY);
WebCore::IntPoint targetCursorLocation(frameOffset.x()+rect.x()+rect.width()/2 - scrollOffset.x(), frameOffset.y()+rect.y()+rect.height()/2 - scrollOffset.y());
// Added 1 in all the line delta below resulting in a better visual behavior when the element happens to be at the edge.
if(targetCursorLocation.y() > height)
{
float numLinesDelta = (((targetCursorLocation.y() - cursorY)/WebCore::Scrollbar::pixelsPerLineStep())+1);
ScrollOnJump(true, -120, numLinesDelta);
}
if(targetCursorLocation.y()< 0.0f)
{
float numLinesDelta = (((cursorY - targetCursorLocation.y())/WebCore::Scrollbar::pixelsPerLineStep())+1);
ScrollOnJump(true, 120, numLinesDelta);
}
if(targetCursorLocation.x() > width)
{
float numLinesDelta = (((targetCursorLocation.x() - cursorX)/WebCore::Scrollbar::pixelsPerLineStep())+1);
ScrollOnJump(false, -120, numLinesDelta);
}
if(targetCursorLocation.x()< 0.0f)
{
float numLinesDelta = (((cursorX - targetCursorLocation.x())/WebCore::Scrollbar::pixelsPerLineStep())+1);
ScrollOnJump(false, 120, numLinesDelta);
}
// Read the scroll offset again as it may have changed.
if(pFrameView)
{
scrollOffset.setX(pFrameView->scrollOffset().width());
scrollOffset.setY(pFrameView->scrollOffset().height());
}
}
mBestNodeFrame = element->document()->frame(); //Can be NULL
mBestNodeX = frameOffset.x() + rect.x();
mBestNodeY = frameOffset.y() + rect.y();
mBestNodeWidth = rect.width();
mBestNodeHeight = rect.height();
int lastX, lastY;
mView->GetCursorPosition(lastX, lastY);
int newX = mBestNodeX + rect.width()/2 - scrollOffset.x();
int newY = mBestNodeY + rect.height()/2 - scrollOffset.y();
EA::WebKit::MouseMoveEvent moveEvent;
memset( &moveEvent, 0, sizeof(moveEvent) );
const int cursorInset = 5;// Make cursor stay inside 5 pixels from boundaries. No known issues but added this as a safety measure so that we do not lose cursor ever.
moveEvent.mX = Clamp( cursorInset, newX, width - cursorInset );
moveEvent.mY = Clamp( cursorInset, newY, height - cursorInset );
mView->OnMouseMoveEvent( moveEvent );
if(EAWebKitClient* const pClient = GetEAWebKitClient())
{
CursorMovedInfo cmInfo(mView, mView->GetUserData(), moveEvent.mX, moveEvent.mY);
pClient->CursorMoved(cmInfo);
}
UpdateCachedHints(node);
}
}
示例15: FindBestNode
void DocumentNavigator::FindBestNode(WebCore::Node* rootNode)
{
// Note by Arpit Baldeva - Changed the recursive algorithm to an iterative algorithm. This results in 25% to 40% increase in efficiency.
while (rootNode)
{
IsNodeNavigableDelegate nodeNavigableDelegate(mView);
// As it turns out, getRect on HTMLElement is pretty expensive. So we don't do it inside the delegate as we require getRect here too. We do that check here.
// It is at least ~15% more efficient and can be up to ~25% more efficient (depends on the page layout and current node you are at).
nodeNavigableDelegate(rootNode,false);
if (nodeNavigableDelegate.FoundNode())
{
WebCore::HTMLElement* htmlElement = (WebCore::HTMLElement*) rootNode;
WebCore::IntRect rectAbsolute = htmlElement->getRect();
// Adjust the rectangle position based on the frame offset so that we have absolute geometrical position.
WebCore::FrameView* pFrameView = htmlElement->document()->view(); //Can be NULL
if(pFrameView)
{
rectAbsolute.setX(rectAbsolute.x() + pFrameView->x());
rectAbsolute.setY(rectAbsolute.y() + pFrameView->y());
}
/* printf("Looking at ELEMENT_NODE : nodeName=%S (%d,%d)->(%d,%d) ThetaRange(%f,%f)\n\n%S\n-----------------------------------\n",
htmlElement->tagName().charactersWithNullTermination(),
rect.topLeft().x(),rect.topLeft().y(),
rect.bottomRight().x(), rect.bottomRight().y(),
mMinThetaRange,mMaxThetaRange,
htmlElement->innerHTML().charactersWithNullTermination()
);
*/
if (!WouldBeTrappedInElement(rectAbsolute,mStartingPosition,mDirection))
{
if (!TryingToDoPerpendicularJump(rectAbsolute,mPreviousNodeRect,mDirection))
{
if(rectAbsolute.width()>=1 && rectAbsolute.height() >= 1) //Avoid 0 size elements
{
if (doAxisCheck(rectAbsolute))
{
PolarRegion pr(rectAbsolute, mStartingPosition);
if (pr.minR < mMinR )
{
if (areAnglesInRange(pr.minTheta,pr.maxTheta))
{
mMinR = pr.minR;
EAW_ASSERT( *(uint32_t*)rootNode > 10000000u );
//mBestNode = rootNode; //We don't assign it here since we do the Z-layer testing later on.
FoundNodeInfo foundNodeInfo = {rootNode, mMinR};
mNodeListContainer->mFoundNodes.push_back(foundNodeInfo);
/*printf("Found ELEMENT_NODE : nodeName=%s (%d,%d)->(%d,%d) polar: R(%f,%f) Theta(%f,%f) ThetaRange(%f,%f) \n",
(char*)htmlElement->nodeName().characters(),
rect.topLeft().x(),rect.topLeft().y(),
rect.bottomRight().x(), rect.bottomRight().y(),
pr.minR,pr.maxR,pr.minTheta,pr.maxTheta,
mMinThetaRange,mMaxThetaRange
);*/
}
else
{
#if EAWEBKIT_ENABLE_JUMP_NAVIGATION_DEBUGGING
mNodeListContainer->mRejectedByAngleNodes.push_back(rootNode);
#endif
/*printf("RejectedA ELEMENT_NODE : nodeName=%s (%d,%d)->(%d,%d) polar: R(%f,%f) Theta(%f,%f) ThetaRange(%f,%f) \n",
(char*)htmlElement->nodeName().characters(),
rect.topLeft().x(),rect.topLeft().y(),
rect.bottomRight().x(), rect.bottomRight().y(),
pr.minR,pr.maxR,pr.minTheta,pr.maxTheta,
mMinThetaRange,mMaxThetaRange
);*/
}
}
else
{
#if EAWEBKIT_ENABLE_JUMP_NAVIGATION_DEBUGGING
mNodeListContainer->mRejectedByRadiusNodes.push_back(rootNode);
#endif
/*printf("RejectedR ELEMENT_NODE : nodeName=%s (%d,%d)->(%d,%d) polar: R(%f,%f) Theta(%f,%f) ThetaRange(%f,%f) \n",
(char*)htmlElement->nodeName().characters(),
rect.topLeft().x(),rect.topLeft().y(),
rect.bottomRight().x(), rect.bottomRight().y(),
pr.minR,pr.maxR,pr.minTheta,pr.maxTheta,
mMinThetaRange,mMaxThetaRange
);*/
}
}
else
{
//printf(" - failed axis check\n");
}
}
else
{
//printf(" - too small\n");
}
//.........这里部分代码省略.........