本文整理汇总了C++中FrameView::contentsWidth方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameView::contentsWidth方法的具体用法?C++ FrameView::contentsWidth怎么用?C++ FrameView::contentsWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameView
的用法示例。
在下文中一共展示了FrameView::contentsWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: layout
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: contentsSize
/*!
\property QWebFrame::contentsSize
\brief the size of the contents in this frame
*/
QSize QWebFrame::contentsSize() const
{
FrameView *view = d->frame->view();
if (!view)
return QSize();
return QSize(view->contentsWidth(), view->contentsHeight());
}
示例3: scrollWidth
int HTMLBodyElement::scrollWidth() const
{
// Update the document's layout.
Document* document = this->document();
document->updateLayoutIgnorePendingStylesheets();
FrameView* view = document->view();
return view ? adjustForZoom(view->contentsWidth(), document) : 0;
}
示例4: scrollWidth
int HTMLBodyElement::scrollWidth() const
{
// Update the document's layout.
Document* doc = document();
doc->updateLayoutIgnorePendingStylesheets();
FrameView* view = doc->view();
return view ? view->contentsWidth() : 0;
}
示例5: webkit_web_view_popup_menu_handler
static gboolean webkit_web_view_popup_menu_handler(GtkWidget* widget)
{
static const int contextMenuMargin = 1;
// The context menu event was generated from the keyboard, so show the context menu by the current selection.
Page* page = core(webView_s);
FrameView* view = page->mainFrame()->view();
Position start = page->mainFrame()->selection()->selection().start();
Position end = page->mainFrame()->selection()->selection().end();
int rightAligned = FALSE;
IntPoint location;
if (!start.node() || !end.node())
location = IntPoint(rightAligned ? view->contentsWidth() - contextMenuMargin : contextMenuMargin, contextMenuMargin);
else {
RenderObject* renderer = start.node()->renderer();
if (!renderer)
return FALSE;
// Calculate the rect of the first line of the selection (cribbed from -[WebCoreFrameBridge firstRectForDOMRange:]).
int extraWidthToEndOfLine = 0;
InlineBox* startInlineBox;
int startCaretOffset;
start.getInlineBoxAndOffset(DOWNSTREAM, startInlineBox, startCaretOffset);
IntRect startCaretRect = renderer->localCaretRect(startInlineBox, startCaretOffset, &extraWidthToEndOfLine);
InlineBox* endInlineBox;
int endCaretOffset;
end.getInlineBoxAndOffset(UPSTREAM, endInlineBox, endCaretOffset);
IntRect endCaretRect = renderer->localCaretRect(endInlineBox, endCaretOffset);
IntRect firstRect;
if (startCaretRect.y() == endCaretRect.y())
firstRect = IntRect(MIN(startCaretRect.x(), endCaretRect.x()),
startCaretRect.y(),
abs(endCaretRect.x() - startCaretRect.x()),
MAX(startCaretRect.height(), endCaretRect.height()));
else
firstRect = IntRect(startCaretRect.x(),
startCaretRect.y(),
startCaretRect.width() + extraWidthToEndOfLine,
startCaretRect.height());
location = IntPoint(rightAligned ? firstRect.right() : firstRect.x(), firstRect.bottom());
}
int x, y;
gdk_window_get_origin(GTK_WIDGET(view->root()->hostWindow()->platformWindow())->window, &x, &y);
// FIXME: The IntSize(0, -1) is a hack to get the hit-testing to result in the selected element.
// Ideally we'd have the position of a context menu event be separate from its target node.
location = view->contentsToWindow(location) + IntSize(0, -1);
IntPoint global = location + IntSize(x, y);
PlatformMouseEvent event(location, global, NoButton, MouseEventPressed, 0, false, false, false, false, gtk_get_current_event_time());
return false;//webkit_web_view_forward_context_menu_event(WEBKIT_WEB_VIEW(widget), event);
}
示例6: ASSERT
InRegionScrollableArea::InRegionScrollableArea(WebPagePrivate* webPage, RenderLayer* layer)
: m_webPage(webPage)
, m_layer(layer)
{
ASSERT(webPage);
ASSERT(layer);
m_isNull = false;
// FIXME: Add an ASSERT here as the 'layer' must be scrollable.
RenderObject* layerRenderer = layer->renderer();
ASSERT(layerRenderer);
if (layerRenderer->isRenderView()) { // #document case
FrameView* view = toRenderView(layerRenderer)->frameView();
ASSERT(view);
Frame* frame = view->frame();
ASSERT_UNUSED(frame, frame);
m_scrollPosition = m_webPage->mapToTransformed(view->scrollPosition());
m_contentsSize = m_webPage->mapToTransformed(view->contentsSize());
m_viewportSize = m_webPage->mapToTransformed(view->visibleContentRect(false /*includeScrollbars*/)).size();
m_visibleWindowRect = m_webPage->mapToTransformed(m_webPage->getRecursiveVisibleWindowRect(view));
IntRect transformedWindowRect = IntRect(IntPoint::zero(), m_webPage->transformedViewportSize());
m_visibleWindowRect.intersect(transformedWindowRect);
m_scrollsHorizontally = view->contentsWidth() > view->visibleWidth();
m_scrollsVertically = view->contentsHeight() > view->visibleHeight();
m_overscrollLimitFactor = 0.0; // FIXME eventually support overscroll
} else { // RenderBox-based elements case (scrollable boxes (div's, p's, textarea's, etc)).
RenderBox* box = m_layer->renderBox();
ASSERT(box);
ASSERT(box->canBeScrolledAndHasScrollableArea());
ScrollableArea* scrollableArea = static_cast<ScrollableArea*>(m_layer);
m_scrollPosition = m_webPage->mapToTransformed(scrollableArea->scrollPosition());
m_contentsSize = m_webPage->mapToTransformed(scrollableArea->contentsSize());
m_viewportSize = m_webPage->mapToTransformed(scrollableArea->visibleContentRect(false /*includeScrollbars*/)).size();
m_visibleWindowRect = m_layer->renderer()->absoluteClippedOverflowRect();
m_visibleWindowRect = m_layer->renderer()->frame()->view()->contentsToWindow(m_visibleWindowRect);
IntRect visibleFrameWindowRect = m_webPage->getRecursiveVisibleWindowRect(m_layer->renderer()->frame()->view());
m_visibleWindowRect.intersect(visibleFrameWindowRect);
m_visibleWindowRect = m_webPage->mapToTransformed(m_visibleWindowRect);
IntRect transformedWindowRect = IntRect(IntPoint::zero(), m_webPage->transformedViewportSize());
m_visibleWindowRect.intersect(transformedWindowRect);
m_scrollsHorizontally = box->scrollWidth() != box->clientWidth() && box->scrollsOverflowX();
m_scrollsVertically = box->scrollHeight() != box->clientHeight() && box->scrollsOverflowY();
m_overscrollLimitFactor = 0.0; // FIXME eventually support overscroll
}
}
示例7: layout
void RenderPartObject::layout()
{
ASSERT(needsLayout());
calcWidth();
calcHeight();
#ifdef FLATTEN_IFRAME
// Some IFrames have a width and/or height of 1 when they are meant to be
// hidden. If that is the case, don't try to expand.
if (m_widget && m_widget->isFrameView() &&
m_width > 1 && m_height > 1) {
FrameView* view = static_cast<FrameView*>(m_widget);
RenderView* root = NULL;
if (view->frame() && view->frame()->document() &&
view->frame()->document()->renderer() && view->frame()->document()->renderer()->isRenderView())
root = static_cast<RenderView*>(view->frame()->document()->renderer());
if (root) {
// Update the dimensions to get the correct minimum preferred width
updateWidgetPosition();
// Use the preferred width if it is larger.
m_width = max(m_width, root->minPrefWidth());
int extraWidth = paddingLeft() + paddingRight() + borderLeft() + borderRight();
int extraHeight = paddingTop() + paddingBottom() + borderTop() + borderBottom();
// Resize the view to recalc the height.
int height = m_height - extraHeight;
int width = m_width - extraWidth;
if (width > view->width())
height = 0;
if (width != view->width() || height != view->height()) {
view->resize(width, height);
root->setNeedsLayout(true, false);
}
// Layout the view.
if (view->needsLayout())
view->layout();
int contentHeight = view->contentsHeight();
int contentWidth = view->contentsWidth();
// Do not shrink iframes with specified sizes
if (contentHeight > m_height || style()->height().isAuto())
m_height = contentHeight;
m_width = std::min(contentWidth, 800);
}
}
#endif
adjustOverflowForBoxShadow();
RenderPart::layout();
if (!m_widget && m_view)
m_view->addWidgetToUpdate(this);
setNeedsLayout(false);
}
示例8: contentBounds
IntRect WebFrame::contentBounds() const
{
if (!m_coreFrame)
return IntRect();
FrameView* view = m_coreFrame->view();
if (!view)
return IntRect();
return IntRect(0, 0, view->contentsWidth(), view->contentsHeight());
}
示例9: contentBounds
IntRect WebFrame::contentBounds()
{
Frame* coreFrame = core(this);
if (!coreFrame)
return IntRect();
FrameView* view = coreFrame->view();
if (!view)
return IntRect();
return IntRect(0, 0, view->contentsWidth(), view->contentsHeight());
}
示例10: scrollWidth
int HTMLBodyElement::scrollWidth()
{
// Update the document's layout.
document().updateLayoutIgnorePendingStylesheets();
Frame* frame = document().frame();
if (!frame)
return 0;
FrameView* view = frame->view();
if (!view)
return 0;
return adjustForZoom(view->contentsWidth(), *frame);
}
示例11: layoutWithFlattening
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);
}
示例12: hasScrollBars
bool WebFrame::hasScrollBars()
{
Frame* coreFrame = core(this);
if (!coreFrame)
return false;
FrameView* view = coreFrame->view();
if (!view)
return false;
if (view->vScrollbarMode() == ScrollbarAlwaysOn || view->visibleHeight() < view->contentsHeight() ||
view->hScrollbarMode() == ScrollbarAlwaysOn || view->visibleWidth() < view->contentsWidth())
return true;
return false;
}
示例13: calcWidth
void RenderPartObject::calcWidth()
{
RenderPart::calcWidth();
if (!flattenFrame())
return;
HTMLIFrameElement* frame = static_cast<HTMLIFrameElement*>(node());
bool isScrollable = frame->scrollingMode() != ScrollbarAlwaysOff;
if (isScrollable || !style()->width().isFixed()) {
FrameView* view = static_cast<FrameView*>(widget());
int border = borderLeft() + borderRight();
setWidth(max(width(), view->contentsWidth() + border));
}
}
示例14: layoutWithFlattening
void RenderFrameBase::layoutWithFlattening(bool hasFixedWidth, bool hasFixedHeight)
{
FrameView* childFrameView = toFrameView(widget());
RenderView* childRoot = childFrameView ? childFrameView->frame().contentRenderer() : 0;
if (!childRoot || !shouldExpandFrame(width(), height(), hasFixedWidth, hasFixedHeight)) {
updateWidgetPosition();
if (childFrameView)
childFrameView->layout();
clearNeedsLayout();
return;
}
// need to update to calculate min/max correctly
updateWidgetPosition();
// 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.
bool isScrollable = frameOwnerElement().scrollingMode() != ScrollbarAlwaysOff;
// consider iframe inset border
int hBorder = borderLeft() + borderRight();
int vBorder = borderTop() + borderBottom();
// make sure minimum preferred width is enforced
if (isScrollable || !hasFixedWidth) {
setWidth(std::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 || !hasFixedHeight || childRoot->isFrameSet())
setHeight(std::max<LayoutUnit>(height(), childFrameView->contentsHeight() + vBorder));
if (isScrollable || !hasFixedWidth || childRoot->isFrameSet())
setWidth(std::max<LayoutUnit>(width(), childFrameView->contentsWidth() + hBorder));
updateWidgetPosition();
ASSERT(!childFrameView->layoutPending());
ASSERT(!childRoot->needsLayout());
ASSERT(!childRoot->firstChild() || !childRoot->firstChild()->firstChildSlow() || !childRoot->firstChild()->firstChildSlow()->needsLayout());
clearNeedsLayout();
}
示例15: layout
void RenderPartObject::layout()
{
ASSERT(needsLayout());
ASSERT(minMaxKnown());
FrameView* childFrameView = static_cast<FrameView*>(m_widget);
RenderView* childRoot = 0;
bool flatten = m_widget && element()->hasTagName(iframeTag) && element() && element()->document()->frame() &&
element()->document()->frame()->settings()->flatFrameSetLayoutEnabled() &&
(static_cast<HTMLIFrameElement*>(element())->scrollingMode() != ScrollBarAlwaysOff || !style()->width().isFixed() || !style()->height().isFixed()) &&
(childRoot = childFrameView ? static_cast<RenderView*>(childFrameView->frame()->renderer()) : 0);
if (flatten) {
if (!childRoot->minMaxKnown())
childRoot->calcMinMaxWidth();
calcWidth();
calcHeight();
bool scrolling = static_cast<HTMLIFrameElement*>(element())->scrollingMode() != ScrollBarAlwaysOff;
if (scrolling || !style()->width().isFixed())
m_width = max(m_width, childRoot->minWidth());
updateWidgetPosition();
do
childFrameView->layout();
while (childFrameView->layoutPending() || childRoot->needsLayout());
if (scrolling || !style()->height().isFixed())
m_height = max(m_height, childFrameView->contentsHeight());
if (scrolling || !style()->width().isFixed())
m_width = max(m_width, childFrameView->contentsWidth());
updateWidgetPosition();
ASSERT(!childFrameView->layoutPending());
ASSERT(!childRoot->needsLayout());
ASSERT(!childRoot->firstChild() || !childRoot->firstChild()->firstChild() || !childRoot->firstChild()->firstChild()->needsLayout());
} else {
calcWidth();
calcHeight();
RenderPart::layout();
}
setNeedsLayout(false);
}