本文整理汇总了C++中HTMLFrameElementBase类的典型用法代码示例。如果您正苦于以下问题:C++ HTMLFrameElementBase类的具体用法?C++ HTMLFrameElementBase怎么用?C++ HTMLFrameElementBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTMLFrameElementBase类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateWidgetPosition
void RenderFrame::layout()
{
FrameView* view = static_cast<FrameView*>(widget());
RenderView* root = view ? view->frame()->contentRenderer() : 0;
// Do not expand frames which has zero width or height
if (!width() || !height() || !root) {
updateWidgetPosition();
if (view)
view->layout();
setNeedsLayout(false);
return;
}
HTMLFrameElementBase* element = static_cast<HTMLFrameElementBase*>(node());
if (element->scrollingMode() == ScrollbarAlwaysOff && !root->isFrameSet()) {
setNeedsLayout(false);
return;
}
// Update the dimensions to get the correct width and height
updateWidgetPosition();
if (root->preferredLogicalWidthsDirty())
root->computePreferredLogicalWidths();
// Expand the frame by setting frame height = content height
setWidth(max(view->contentsWidth() + borderAndPaddingWidth(), width()));
setHeight(max(view->contentsHeight() + borderAndPaddingHeight(), height()));
// Update one more time
updateWidgetPosition();
setNeedsLayout(false);
}
示例2: document
void HTMLBodyElement::insertedIntoDocument()
{
HTMLElement::insertedIntoDocument();
// FIXME: Perhaps this code should be in attach() instead of here.
Element* ownerElement = document()->ownerElement();
if (ownerElement && (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag))) {
HTMLFrameElementBase* ownerFrameElement = static_cast<HTMLFrameElementBase*>(ownerElement);
int marginWidth = ownerFrameElement->marginWidth();
if (marginWidth != -1)
setAttribute(marginwidthAttr, String::number(marginWidth));
int marginHeight = ownerFrameElement->marginHeight();
if (marginHeight != -1)
setAttribute(marginheightAttr, String::number(marginHeight));
}
// FIXME: This call to scheduleRelayout should not be needed here.
// But without it we hang during WebKit tests; need to fix that and remove this.
if (FrameView* view = document()->view())
view->scheduleRelayout();
if (document() && document()->page())
document()->page()->updateViewportArguments();
if (m_linkDecl)
m_linkDecl->setParent(document()->elementSheet());
}
示例3: protect
Frame* SubframeLoader::loadSubframe(HTMLFrameOwnerElement* ownerElement, const KURL& url, const String& name, const String& referrer)
{
RefPtr<Frame> protect(m_frame);
bool allowsScrolling = true;
int marginWidth = -1;
int marginHeight = -1;
if (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag)) {
HTMLFrameElementBase* o = static_cast<HTMLFrameElementBase*>(ownerElement);
allowsScrolling = o->scrollingMode() != ScrollbarAlwaysOff;
marginWidth = o->marginWidth();
marginHeight = o->marginHeight();
}
if (!ownerElement->document()->securityOrigin()->canDisplay(url)) {
FrameLoader::reportLocalLoadFailed(m_frame, url.string());
return 0;
}
if (!ownerElement->document()->contentSecurityPolicy()->allowChildFrameFromSource(url))
return 0;
String referrerToUse = SecurityPolicy::generateReferrerHeader(ownerElement->document()->referrerPolicy(), url, referrer);
RefPtr<Frame> frame = m_frame->loader()->client()->createFrame(url, name, ownerElement, referrerToUse, allowsScrolling, marginWidth, marginHeight);
if (!frame) {
m_frame->loader()->checkCallImplicitClose();
return 0;
}
// All new frames will have m_isComplete set to true at this point due to synchronously loading
// an empty document in FrameLoader::init(). But many frames will now be starting an
// asynchronous load of url, so we set m_isComplete to false and then check if the load is
// actually completed below. (Note that we set m_isComplete to false even for synchronous
// loads, so that checkCompleted() below won't bail early.)
// FIXME: Can we remove this entirely? m_isComplete normally gets set to false when a load is committed.
frame->loader()->started();
RenderObject* renderer = ownerElement->renderer();
FrameView* view = frame->view();
if (renderer && renderer->isWidget() && view)
toRenderWidget(renderer)->setWidget(view);
m_frame->loader()->checkCallImplicitClose();
// Some loads are performed synchronously (e.g., about:blank and loads
// cancelled by returning a null ResourceRequest from requestFromDelegate).
// In these cases, the synchronous load would have finished
// before we could connect the signals, so make sure to send the
// completed() signal for the child by hand and mark the load as being
// complete.
// FIXME: In this case the Frame will have finished loading before
// it's being added to the child list. It would be a good idea to
// create the child first, then invoke the loader separately.
if (frame->loader()->state() == FrameStateComplete && !frame->loader()->policyDocumentLoader())
frame->loader()->checkCompleted();
return frame.get();
}
示例4: allowSettingSrcToJavascriptURL
static inline bool allowSettingSrcToJavascriptURL(ExecState* exec, Element* element, const String& name, const String& value)
{
if ((element->hasTagName(iframeTag) || element->hasTagName(frameTag)) && equalIgnoringCase(name, "src") && protocolIs(parseURL(value), "javascript")) {
HTMLFrameElementBase* frame = static_cast<HTMLFrameElementBase*>(element);
if (!checkNodeSecurity(exec, frame->contentDocument()))
return false;
}
return true;
}
示例5: updateWidgetPosition
void RenderFrameBase::layoutWithFlattening(bool fixedWidth, bool fixedHeight)
{
FrameView* childFrameView = static_cast<FrameView*>(widget());
RenderView* childRoot = childFrameView ? static_cast<RenderView*>(childFrameView->frame()->contentRenderer()) : 0;
// Do not expand frames which has zero width or height
if (!width() || !height() || !childRoot) {
updateWidgetPosition();
if (childFrameView)
childFrameView->layout();
setNeedsLayout(false);
return;
}
// need to update to calculate min/max correctly
updateWidgetPosition();
if (childRoot->preferredLogicalWidthsDirty())
childRoot->computePreferredLogicalWidths();
// if scrollbars are off, and the width or height are fixed
// we obey them and do not expand. With frame flattening
// no subframe much ever become scrollable.
HTMLFrameElementBase* element = static_cast<HTMLFrameElementBase*>(node());
bool isScrollable = element->scrollingMode() != ScrollbarAlwaysOff;
// consider iframe inset border
int hBorder = borderLeft() + borderRight();
int vBorder = borderTop() + borderBottom();
// make sure minimum preferred width is enforced
if (isScrollable || !fixedWidth) {
setWidth(max(width(), childRoot->minPreferredLogicalWidth() + hBorder));
// update again to pass the new width to the child frame
updateWidgetPosition();
childFrameView->layout();
}
// expand the frame by setting frame height = content height
if (isScrollable || !fixedHeight || childRoot->isFrameSet())
setHeight(max(height(), childFrameView->contentsHeight() + vBorder));
if (isScrollable || !fixedWidth || childRoot->isFrameSet())
setWidth(max(width(), childFrameView->contentsWidth() + hBorder));
updateWidgetPosition();
ASSERT(!childFrameView->layoutPending());
ASSERT(!childRoot->needsLayout());
ASSERT(!childRoot->firstChild() || !childRoot->firstChild()->firstChild() || !childRoot->firstChild()->firstChild()->needsLayout());
setNeedsLayout(false);
}
示例6: document
Node::InsertionNotificationRequest HTMLBodyElement::insertedInto(ContainerNode* insertionPoint)
{
HTMLElement::insertedInto(insertionPoint);
if (insertionPoint->inDocument()) {
// FIXME: It's surprising this is web compatible since it means a marginwidth
// and marginheight attribute can magically appear on the <body> of all documents
// embedded through <iframe> or <frame>.
Element* ownerElement = document().ownerElement();
if (ownerElement && ownerElement->isFrameElementBase()) {
HTMLFrameElementBase* ownerFrameElement = toHTMLFrameElementBase(ownerElement);
int marginWidth = ownerFrameElement->marginWidth();
if (marginWidth != -1)
setIntegralAttribute(marginwidthAttr, marginWidth);
int marginHeight = ownerFrameElement->marginHeight();
if (marginHeight != -1)
setIntegralAttribute(marginheightAttr, marginHeight);
}
}
return InsertionDone;
}
示例7: ASSERT_UNUSED
void HTMLBodyElement::didNotifySubtreeInsertions(ContainerNode* insertionPoint)
{
ASSERT_UNUSED(insertionPoint, insertionPoint->inDocument());
ASSERT(document());
// FIXME: Perhaps this code should be in attach() instead of here.
Element* ownerElement = document()->ownerElement();
if (ownerElement && (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag))) {
HTMLFrameElementBase* ownerFrameElement = static_cast<HTMLFrameElementBase*>(ownerElement);
int marginWidth = ownerFrameElement->marginWidth();
if (marginWidth != -1)
setAttribute(marginwidthAttr, String::number(marginWidth));
int marginHeight = ownerFrameElement->marginHeight();
if (marginHeight != -1)
setAttribute(marginheightAttr, String::number(marginHeight));
}
// FIXME: This call to scheduleRelayout should not be needed here.
// But without it we hang during WebKit tests; need to fix that and remove this.
if (FrameView* view = document()->view())
view->scheduleRelayout();
}
示例8: document
void HTMLBodyElement::insertedIntoDocument()
{
HTMLElement::insertedIntoDocument();
// FIXME: Perhaps this code should be in attach() instead of here.
Element* ownerElement = document()->ownerElement();
if (ownerElement && (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag))) {
HTMLFrameElementBase* ownerFrameElement = static_cast<HTMLFrameElementBase*>(ownerElement);
int marginWidth = ownerFrameElement->getMarginWidth();
if (marginWidth != -1)
setAttribute(marginwidthAttr, String::number(marginWidth));
int marginHeight = ownerFrameElement->getMarginHeight();
if (marginHeight != -1)
setAttribute(marginheightAttr, String::number(marginHeight));
}
#ifdef ANDROID_META_SUPPORT
Settings * settings = document()->settings();
if (settings) {
String host = document()->baseURI().host().lower();
if (settings->viewportWidth() == -1 && (host.startsWith("m.") || host.startsWith("mobile.")
|| host.contains(".m.") || host.contains(".mobile."))) {
// fit mobile sites directly in the screen
settings->setMetadataSettings("width", "device-width");
// update the meta data if it is the top document
if (!ownerElement) {
FrameView* view = document()->view();
if (view)
android::WebViewCore::getWebViewCore(view)->updateViewport();
}
}
}
#endif
// FIXME: This call to scheduleRelayout should not be needed here.
// But without it we hang during WebKit tests; need to fix that and remove this.
if (FrameView* view = document()->view())
view->scheduleRelayout();
}