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); }
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(); }
// FIXME: This should not be necessary. Remove this once WebKit knows to properly schedule // layouts using WebCore when objects resize. void RenderPart::updateWidgetPosition() { if (!m_widget) return; int x, y, width, height; absolutePosition(x, y); x += borderLeft() + paddingLeft(); y += borderTop() + paddingTop(); width = m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight(); height = m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom(); IntRect newBounds(x,y,width,height); bool boundsChanged = newBounds != m_widget->frameGeometry(); if (boundsChanged) { // The widget changed positions. Update the frame geometry. RenderArena *arena = ref(); element()->ref(); m_widget->setFrameGeometry(newBounds); element()->deref(); deref(arena); } // if the frame bounds got changed, or if view needs layout (possibly indicating // content size is wrong) we have to do a layout to set the right widget size if (m_widget && m_widget->isFrameView()) { FrameView* frameView = static_cast<FrameView*>(m_widget); if (boundsChanged || frameView->needsLayout()) frameView->layout(); } }
void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp) { if (!m_page) return; FrameView* view = m_page->mainFrame()->view(); context->save(); context->setCompositeOperation(compositeOp); context->clip(enclosingIntRect(dstRect)); if (compositeOp != CompositeSourceOver) context->beginTransparencyLayer(1); context->translate(dstRect.location().x(), dstRect.location().y()); context->scale(FloatSize(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height())); view->resize(size()); if (view->needsLayout()) view->layout(); view->paint(context, enclosingIntRect(srcRect)); if (compositeOp != CompositeSourceOver) context->endTransparencyLayer(); context->restore(); if (imageObserver()) imageObserver()->didDraw(this); }
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); }
void write(TextStream& ts, const RenderObject& o, int indent) { #if ENABLE(SVG) if (o.isRenderPath()) { write(ts, *toRenderPath(&o), indent); return; } if (o.isSVGContainer()) { writeSVGContainer(ts, o, indent); return; } if (o.isSVGRoot()) { write(ts, *toRenderSVGRoot(&o), indent); return; } if (o.isSVGText()) { if (!o.isText()) writeSVGText(ts, *toRenderBlock(&o), indent); else writeSVGInlineText(ts, *toRenderText(&o), indent); return; } if (o.isSVGImage()) { writeSVGImage(ts, *toRenderImage(&o), indent); return; } #endif writeIndent(ts, indent); ts << o << "\n"; if (o.isText() && !o.isBR()) { const RenderText& text = *toRenderText(&o); for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextBox()) { writeIndent(ts, indent + 1); writeTextRun(ts, text, *box); } } for (RenderObject* child = o.firstChild(); child; child = child->nextSibling()) { if (child->hasLayer()) continue; write(ts, *child, indent + 1); } if (o.isWidget()) { Widget* widget = toRenderWidget(&o)->widget(); if (widget && widget->isFrameView()) { FrameView* view = static_cast<FrameView*>(widget); RenderView* root = view->frame()->contentRenderer(); if (root) { view->layout(); RenderLayer* l = root->layer(); if (l) writeLayers(ts, l, l, IntRect(l->x(), l->y(), l->width(), l->height()), indent + 1); } } } }
// FIXME: This should not be necessary. Remove this once WebKit knows to properly schedule // layouts using WebCore when objects resize. void RenderPart::updateWidgetPosition() { if (!m_widget) return; int x, y, width, height; absolutePosition(x, y); x += borderLeft() + paddingLeft(); y += borderTop() + paddingTop(); width = m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight(); height = m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom(); IntRect newBounds(x,y,width,height); if (newBounds != m_widget->frameGeometry()) { // The widget changed positions. Update the frame geometry. RenderArena *arena = ref(); element()->ref(); m_widget->setFrameGeometry(newBounds); element()->deref(); deref(arena); FrameView* frameView = m_widget->isFrameView() ? static_cast<FrameView*>(m_widget) : 0; if (frameView && !frameView->frame()->settings()->flatFrameSetLayoutEnabled()) frameView->layout(); } }
void InspectorOverlay::update() { if (!m_highlightNode && !m_highlightRect && m_pausedInDebuggerMessage.isNull()) { m_client->hideHighlight(); return; } FrameView* view = m_page->mainFrame()->view(); FrameView* overlayView = overlayPage()->mainFrame()->view(); IntRect visibleRect = enclosingIntRect(view->visibleContentRect()); overlayView->resize(visibleRect.width(), visibleRect.height()); // Clear canvas and paint things. reset(); drawNodeHighlight(); drawRectHighlight(); drawPausedInDebuggerMessage(); // Position DOM elements. overlayPage()->mainFrame()->document()->recalcStyle(Node::Force); if (overlayView->needsLayout()) overlayView->layout(); // Kick paint. m_client->highlight(); }
void InspectorOverlay::update() { if (!m_highlightNode && !m_highlightRect && m_pausedInDebuggerMessage.isNull() && m_size.isEmpty()) { m_client->hideHighlight(); return; } FrameView* view = m_page->mainFrame()->view(); if (!view) return; FrameView* overlayView = overlayPage()->mainFrame()->view(); IntSize viewportSize = enclosingIntRect(view->visibleContentRect()).size(); IntSize frameViewFullSize = enclosingIntRect(view->visibleContentRect(true)).size(); IntSize size = m_size.isEmpty() ? frameViewFullSize : m_size; overlayView->resize(size); // Clear canvas and paint things. reset(viewportSize, m_size.isEmpty() ? IntSize() : frameViewFullSize); // Include scrollbars to avoid masking them by the gutter. drawGutter(); drawNodeHighlight(); drawRectHighlight(); drawPausedInDebuggerMessage(); // Position DOM elements. overlayPage()->mainFrame()->document()->recalcStyle(Node::Force); if (overlayView->needsLayout()) overlayView->layout(); // Kick paint. m_client->highlight(); }
void RenderWidget::updateWidgetPosition() { if (!m_widget) return; // FIXME: This doesn't work correctly with transforms. FloatPoint absPos = localToAbsolute(); absPos.move(borderLeft() + paddingLeft(), borderTop() + paddingTop()); int w = width() - borderLeft() - borderRight() - paddingLeft() - paddingRight(); int h = height() - borderTop() - borderBottom() - paddingTop() - paddingBottom(); IntRect newBounds(absPos.x(), absPos.y(), w, h); IntRect oldBounds(m_widget->frameRect()); bool boundsChanged = newBounds != oldBounds; if (boundsChanged) { RenderArena* arena = ref(); node()->ref(); m_widget->setFrameRect(newBounds); node()->deref(); deref(arena); } // if the frame bounds got changed, or if view needs layout (possibly indicating // content size is wrong) we have to do a layout to set the right widget size if (m_widget->isFrameView()) { FrameView* frameView = static_cast<FrameView*>(m_widget.get()); if (boundsChanged || frameView->needsLayout()) frameView->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); }
void DumpRenderTreeSupportGtk::layoutFrame(WebKitWebFrame* frame) { Frame* coreFrame = core(frame); if (!coreFrame) return; FrameView* view = coreFrame->view(); if (!view) return; view->layout(); }
void WebFrame::layout() { Frame* coreFrame = core(this); if (!coreFrame) return ; FrameView* view = coreFrame->view(); if (!view) return ; view->layout(); }
void webkit_web_frame_layout(WebKitWebFrame* frame) { Frame* coreFrame = core(frame); if (!coreFrame) return; FrameView* view = coreFrame->view(); if (!view) return; view->layout(); }
void QWebFrameAdapter::setCustomLayoutSize(const QSize& size) { ASSERT(pageAdapter->mainFrameAdapter() == this); FrameView* view = frame->view(); ASSERT(view); if (size.isValid()) { view->setUseFixedLayout(true); view->setFixedLayoutSize(size); } else if (view->useFixedLayout()) view->setUseFixedLayout(false); view->layout(); }
/** * dumpRenderTree: * @frame: a #WebKitWebFrame * * Return value: Non-recursive render tree dump of @frame */ CString DumpRenderTreeSupportGtk::dumpRenderTree(WebKitWebFrame* frame) { g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), CString("")); Frame* coreFrame = core(frame); if (!coreFrame) return CString(""); FrameView* view = coreFrame->view(); if (view && view->layoutPending()) view->layout(); return externalRepresentation(coreFrame).utf8(); }
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); }
void RenderWidget::updateWidgetPosition() { if (!m_widget || !node()) // Check the node in case destroy() has been called. return; bool boundsChanged = updateWidgetGeometry(); // if the frame bounds got changed, or if view needs layout (possibly indicating // content size is wrong) we have to do a layout to set the right widget size if (m_widget && m_widget->isFrameView()) { FrameView* frameView = toFrameView(m_widget.get()); // Check the frame's page to make sure that the frame isn't in the process of being destroyed. if ((boundsChanged || frameView->needsLayout()) && frameView->frame().page()) frameView->layout(); } }
/** * webkit_web_frame_get_inner_text: * @frame: a #WebKitWebFrame * * Return value: inner text of @frame */ gchar* webkit_web_frame_get_inner_text(WebKitWebFrame* frame) { g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); Frame* coreFrame = core(frame); ASSERT(coreFrame); FrameView* view = coreFrame->view(); if (view && view->layoutPending()) view->layout(); Element* documentElement = coreFrame->document()->documentElement(); String string = documentElement->innerText(); return g_strdup(string.utf8().data()); }
/** * webkit_web_frame_dump_render_tree: * @frame: a #WebKitWebFrame * * Return value: Non-recursive render tree dump of @frame */ gchar* webkit_web_frame_dump_render_tree(WebKitWebFrame* frame) { g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), NULL); Frame* coreFrame = core(frame); if (!coreFrame) return g_strdup(""); FrameView* view = coreFrame->view(); if (view && view->layoutPending()) view->layout(); String string = externalRepresentation(coreFrame->contentRenderer()); return g_strdup(string.utf8().data()); }
/** * getInnerText: * @frame: a #WebKitWebFrame * * Return value: inner text of @frame */ CString DumpRenderTreeSupportGtk::getInnerText(WebKitWebFrame* frame) { g_return_val_if_fail(WEBKIT_IS_WEB_FRAME(frame), CString("")); Frame* coreFrame = core(frame); if (!coreFrame) return CString(""); FrameView* view = coreFrame->view(); if (view && view->layoutPending()) view->layout(); Element* documentElement = coreFrame->document()->documentElement(); return documentElement->innerText().utf8(); }
void SVGImage::draw(GraphicsContext& context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode, ImageOrientationDescription) { if (!m_page) return; FrameView* view = frameView(); ASSERT(view); GraphicsContextStateSaver stateSaver(context); context.setCompositeOperation(compositeOp, blendMode); context.clip(enclosingIntRect(dstRect)); float alpha = context.alpha(); bool compositingRequiresTransparencyLayer = compositeOp != CompositeSourceOver || blendMode != BlendModeNormal || alpha < 1; if (compositingRequiresTransparencyLayer) { context.beginTransparencyLayer(alpha); context.setCompositeOperation(CompositeSourceOver, BlendModeNormal); } FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height()); // We can only draw the entire frame, clipped to the rect we want. So compute where the top left // of the image would be if we were drawing without clipping, and translate accordingly. FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect.location().y() * scale.height()); FloatPoint destOffset = dstRect.location() - topLeftOffset; context.translate(destOffset.x(), destOffset.y()); context.scale(scale); view->resize(containerSize()); if (!m_url.isEmpty()) view->scrollToFragment(m_url); if (view->needsLayout()) view->layout(); view->paint(context, intersection(context.clipBounds(), enclosingIntRect(srcRect))); if (compositingRequiresTransparencyLayer) context.endTransparencyLayer(); stateSaver.restore(); if (imageObserver()) imageObserver()->didDraw(this); }
void RenderWidget::updateWidgetPosition() { if (!m_widget || !node()) // Check the node in case destroy() has been called. return; IntRect contentBox = contentBoxRect(); IntRect absoluteContentBox = IntRect(localToAbsoluteQuad(FloatQuad(contentBox)).boundingBox()); bool boundsChanged = setWidgetGeometry(absoluteContentBox, contentBox.size()); // if the frame bounds got changed, or if view needs layout (possibly indicating // content size is wrong) we have to do a layout to set the right widget size if (m_widget && m_widget->isFrameView()) { FrameView* frameView = static_cast<FrameView*>(m_widget.get()); // Check the frame's page to make sure that the frame isn't in the process of being destroyed. if ((boundsChanged || frameView->needsLayout()) && frameView->frame()->page()) frameView->layout(); } }
void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp, blink::WebBlendMode blendMode) { if (!m_page) return; GraphicsContextStateSaver stateSaver(*context); context->setCompositeOperation(compositeOp, blendMode); context->clip(enclosingIntRect(dstRect)); bool compositingRequiresTransparencyLayer = compositeOp != CompositeSourceOver || blendMode != blink::WebBlendModeNormal; float opacity = context->getNormalizedAlpha() / 255.f; bool requiresTransparencyLayer = compositingRequiresTransparencyLayer || opacity < 1; if (requiresTransparencyLayer) { context->beginTransparencyLayer(opacity); if (compositingRequiresTransparencyLayer) context->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal); } FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height()); // We can only draw the entire frame, clipped to the rect we want. So compute where the top left // of the image would be if we were drawing without clipping, and translate accordingly. FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect.location().y() * scale.height()); FloatPoint destOffset = dstRect.location() - topLeftOffset; context->translate(destOffset.x(), destOffset.y()); context->scale(scale); FrameView* view = frameView(); view->resize(containerSize()); if (view->needsLayout()) view->layout(); view->paint(context, enclosingIntRect(srcRect)); if (requiresTransparencyLayer) context->endLayer(); stateSaver.restore(); if (imageObserver()) imageObserver()->didDraw(this); }
void RenderWidget::updateWidgetPosition() { if (!m_widget) return; WeakPtr<RenderWidget> weakThis = createWeakPtr(); bool widgetSizeChanged = updateWidgetGeometry(); if (!weakThis) return; // if the frame size got changed, or if view needs layout (possibly indicating // content size is wrong) we have to do a layout to set the right widget size. if (m_widget->isFrameView()) { FrameView* frameView = toFrameView(m_widget.get()); // Check the frame's page to make sure that the frame isn't in the process of being destroyed. if ((widgetSizeChanged || frameView->needsLayout()) && frameView->frame().page()) frameView->layout(); } }
void LayoutPart::updateWidgetGeometry() { Widget* widget = this->widget(); if (!widget || !node()) // Check the node in case destroy() has been called. return; bool boundsChanged = updateWidgetGeometryInternal(); // If the frame bounds got changed, or if view needs layout (possibly indicating // content size is wrong) we have to do a layout to set the right widget size. if (widget && widget->isFrameView()) { FrameView* frameView = toFrameView(widget); // Check the frame's page to make sure that the frame isn't in the process of being destroyed. if ((boundsChanged || frameView->needsLayout()) && frameView->frame().page()) frameView->layout(); } widget->widgetGeometryMayHaveChanged(); }
void Page::setPageScaleFactor(float scale, const IntPoint& origin) { Document* document = mainFrame()->document(); FrameView* view = document->view(); if (scale == m_pageScaleFactor) { if (view && (view->scrollPosition() != origin || view->delegatesScrolling())) { if (!m_settings->applyPageScaleFactorInCompositor()) document->updateLayoutIgnorePendingStylesheets(); view->setScrollPosition(origin); } return; } m_pageScaleFactor = scale; if (!m_settings->applyPageScaleFactorInCompositor()) { if (document->renderer()) document->renderer()->setNeedsLayout(true); document->recalcStyle(Style::Force); // Transform change on RenderView doesn't trigger repaint on non-composited contents. mainFrame()->view()->invalidateRect(IntRect(LayoutRect::infiniteRect())); } #if USE(ACCELERATED_COMPOSITING) mainFrame()->deviceOrPageScaleFactorChanged(); #endif if (view && view->fixedElementsLayoutRelativeToFrame()) view->setViewportConstrainedObjectsNeedLayout(); if (view && view->scrollPosition() != origin) { if (!m_settings->applyPageScaleFactorInCompositor() && document->renderer() && document->renderer()->needsLayout() && view->didFirstLayout()) view->layout(); view->setScrollPosition(origin); } }
void RenderWidget::updateWidgetPosition() { if (!m_widget || !node()) // Check the node in case destroy() has been called. return; // FIXME: This doesn't work correctly with transforms. FloatPoint absPos = localToAbsolute(); absPos.move(borderLeft() + paddingLeft(), borderTop() + paddingTop()); int w = width() - borderAndPaddingWidth(); int h = height() - borderAndPaddingHeight(); bool boundsChanged = setWidgetGeometry(IntRect(absPos.x(), absPos.y(), w, h)); // if the frame bounds got changed, or if view needs layout (possibly indicating // content size is wrong) we have to do a layout to set the right widget size if (m_widget && m_widget->isFrameView()) { FrameView* frameView = static_cast<FrameView*>(m_widget.get()); if (boundsChanged || frameView->needsLayout()) frameView->layout(); } }
void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp) { if (!m_page) return; FrameView* view = m_page->mainFrame()->view(); context->save(); context->setCompositeOperation(compositeOp); context->clip(enclosingIntRect(dstRect)); if (compositeOp != CompositeSourceOver) context->beginTransparencyLayer(1); FloatSize scale(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height()); // We can only draw the entire frame, clipped to the rect we want. So compute where the top left // of the image would be if we were drawing without clipping, and translate accordingly. FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect.location().y() * scale.height()); FloatPoint destOffset = dstRect.location() - topLeftOffset; context->translate(destOffset.x(), destOffset.y()); context->scale(scale); view->resize(size()); if (view->needsLayout()) view->layout(); view->paint(context, IntRect(0, 0, view->width(), view->height())); if (compositeOp != CompositeSourceOver) context->endTransparencyLayer(); context->restore(); if (imageObserver()) imageObserver()->didDraw(this); }
void InspectorOverlay::update() { if (!shouldShowOverlay()) { m_client->hideHighlight(); return; } FrameView* view = m_page.mainFrame().view(); if (!view) return; FrameView* overlayView = overlayPage()->mainFrame().view(); IntSize viewportSize = view->unscaledVisibleContentSizeIncludingObscuredArea(); IntSize frameViewFullSize = view->unscaledVisibleContentSizeIncludingObscuredArea(ScrollableArea::IncludeScrollbars); overlayPage()->setPageScaleFactor(m_page.pageScaleFactor(), IntPoint()); frameViewFullSize.scale(m_page.pageScaleFactor()); overlayView->resize(frameViewFullSize); // Clear canvas and paint things. // FIXME: Remove extra parameter? reset(viewportSize, IntSize()); // Include scrollbars to avoid masking them by the gutter. drawGutter(); drawNodeHighlight(); drawQuadHighlight(); drawPausedInDebuggerMessage(); // Position DOM elements. overlayPage()->mainFrame().document()->recalcStyle(Style::Force); if (overlayView->needsLayout()) overlayView->layout(); // Kick paint. m_client->highlight(); }