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 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 QWebFrameAdapter::setViewportSize(const QSize& size) { ASSERT(pageAdapter->mainFrameAdapter() == this); FrameView* view = frame->view(); ASSERT(view); view->resize(size); view->adjustViewSize(); }
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 SVGImage::setContainerSize(const IntSize& size) { SVGSVGElement* rootElement = svgRootElement(m_page.get()); if (!rootElement) return; FrameView* view = frameView(); view->resize(this->containerSize()); LayoutSVGRoot* layoutObject = toLayoutSVGRoot(rootElement->layoutObject()); if (!layoutObject) return; layoutObject->setContainerSize(size); }
void SVGImage::draw(SkCanvas* canvas, const SkPaint& paint, const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, ImageClampingMode) { if (!m_page) return; FrameView* view = frameView(); view->resize(containerSize()); // Always call processUrlFragment, even if the url is empty, because // there may have been a previous url/fragment that needs to be reset. view->processUrlFragment(m_url); SkPictureBuilder imagePicture(dstRect); { ClipRecorder clipRecorder(imagePicture.context(), *this, DisplayItem::ClipNodeImage, LayoutRect(enclosingIntRect(dstRect))); // 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 scale(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height()); FloatSize topLeftOffset(srcRect.location().x() * scale.width(), srcRect.location().y() * scale.height()); FloatPoint destOffset = dstRect.location() - topLeftOffset; AffineTransform transform = AffineTransform::translation(destOffset.x(), destOffset.y()); transform.scale(scale.width(), scale.height()); TransformRecorder transformRecorder(imagePicture.context(), *this, transform); view->updateAllLifecyclePhases(); view->paint(&imagePicture.context(), enclosingIntRect(srcRect)); ASSERT(!view->needsLayout()); } { SkAutoCanvasRestore ar(canvas, false); if (drawNeedsLayer(paint)) { SkRect layerRect = dstRect; canvas->saveLayer(&layerRect, &paint); } RefPtr<const SkPicture> recording = imagePicture.endRecording(); canvas->drawPicture(recording.get()); } if (imageObserver()) imageObserver()->didDraw(this); // Start any (SMIL) animations if needed. This will restart or continue // animations if preceded by calls to resetAnimation or stopAnimation // respectively. startAnimation(); }
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 SVGImage::setContainerSize(const FloatSize& size) { if (!usesContainerSize()) return; SVGSVGElement* rootElement = this->rootElement(); if (!rootElement) return; auto* renderer = downcast<RenderSVGRoot>(rootElement->renderer()); if (!renderer) return; FrameView* view = frameView(); view->resize(this->containerSize()); renderer->setContainerSize(IntSize(size)); }
void SVGImage::setContainerSize(const FloatSize& size) { if (!m_page || !usesContainerSize()) return; SVGSVGElement* rootElement = toSVGDocument(m_page->mainFrame().document())->rootElement(); if (!rootElement) return; RenderSVGRoot* renderer = toRenderSVGRoot(rootElement->renderer()); if (!renderer) return; FrameView* view = frameView(); view->resize(this->containerSize()); renderer->setContainerSize(IntSize(size)); }
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 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(); }
void InspectorOverlay::update() { if (isEmpty()) { m_client->hideHighlight(); return; } FrameView* view = m_page->mainFrame()->view(); if (!view) return; IntRect viewRect = view->visibleContentRect(); FrameView* overlayView = overlayPage()->mainFrame()->view(); IntSize frameViewFullSize = view->visibleContentRect(ScrollableArea::IncludeScrollbars).size(); IntSize size = m_size.isEmpty() ? frameViewFullSize : m_size; size.scale(m_page->pageScaleFactor()); overlayView->resize(size); // Clear canvas and paint things. reset(size, m_size.isEmpty() ? IntSize() : frameViewFullSize, viewRect.x(), viewRect.y()); // Include scrollbars to avoid masking them by the gutter. drawGutter(); drawNodeHighlight(); drawQuadHighlight(); if (!m_inspectModeEnabled) drawPausedInDebuggerMessage(); drawViewSize(); // Position DOM elements. overlayPage()->mainFrame()->document()->recalcStyle(Node::Force); if (overlayView->needsLayout()) overlayView->layout(); // Kick paint. m_client->highlight(); }
FrameGdk::FrameGdk(GdkDrawable* gdkdrawable) : Frame(new Page, 0), m_drawable(gdkdrawable) { d->m_extension = new BrowserExtensionGdk(this); Settings* settings = new Settings; settings->setAutoLoadImages(true); settings->setMinFontSize(5); settings->setMinLogicalFontSize(5); settings->setShouldPrintBackgrounds(true); settings->setMediumFixedFontSize(14); settings->setMediumFontSize(14); settings->setSerifFontName("Times New Roman"); settings->setSansSerifFontName("Arial"); settings->setFixedFontName("Courier"); settings->setStdFontName("Arial"); setSettings(settings); page()->setMainFrame(this); FrameView* view = new FrameView(this); setView(view); IntRect geom = frameGeometry(); view->resize(geom.width(), geom.height()); view->ScrollView::setDrawable(gdkdrawable); }
void RenderPartObject::layout() { ASSERT(needsLayout()); #ifdef FLATTEN_IFRAME RenderPart::calcWidth(); RenderPart::calcHeight(); // Calculate the styled dimensions by subtracting the border and padding. int extraWidth = paddingLeft() + paddingRight() + borderLeft() + borderRight(); int extraHeight = paddingTop() + paddingBottom() + borderTop() + borderBottom(); int styleWidth = width() - extraWidth; int styleHeight = height() - extraHeight; // Some IFrames have a width and/or height of 1 when they are meant to be // hidden. If that is the case, do not try to expand. if (node()->hasTagName(iframeTag) && widget() && widget()->isFrameView() && styleWidth > 1 && styleHeight > 1) { HTMLIFrameElement* element = static_cast<HTMLIFrameElement*>(node()); bool scrolling = element->scrollingMode() != ScrollbarAlwaysOff; bool widthIsFixed = style()->width().isFixed(); bool heightIsFixed = style()->height().isFixed(); // If an iframe has a fixed dimension and suppresses scrollbars, it // will disrupt layout if we force it to expand. Plus on a desktop, // the extra content is not accessible. if (scrolling || !widthIsFixed || !heightIsFixed) { FrameView* view = static_cast<FrameView*>(widget()); RenderView* root = view ? view->frame()->contentRenderer() : NULL; if (root && style()->visibility() != HIDDEN) { // Update the dimensions to get the correct minimum preferred // width updateWidgetPosition(); // Use the preferred width if it is larger and only if // scrollbars are visible or the width style is not fixed. if (scrolling || !widthIsFixed) setWidth(max(width(), root->minPrefWidth()) + extraWidth); // Resize the view to recalc the height. int h = height() - extraHeight; int w = width() - extraWidth; if (w > view->width()) h = 0; if (w != view->width() || h != view->height()) { view->resize(w, h); } // Layout the view. //SAMSUNG CHANGE >> // Browser freeze issue in http://www.enuri.com/ /* do { view->layout(); } while (view->layoutPending() || root->needsLayout()); */ node()->document()->page()->mainFrame()->view()->layoutIfNeededRecursive(); //SAMSUNG CHANGE << int contentHeight = view->contentsHeight(); int contentWidth = view->contentsWidth(); // Only change the width or height if scrollbars are visible or // if the style is not a fixed value. Use the maximum value so // that iframes never shrink. if (scrolling || !heightIsFixed) setHeight(max(height(), contentHeight + extraHeight)); if (scrolling || !widthIsFixed) setWidth(max(width(), contentWidth + extraWidth)); // Update one last time updateWidgetPosition(); // Layout one more time to ensure all objects have the correct // height. view->layout(); #if !ASSERT_DISABLED ASSERT(!view->layoutPending()); ASSERT(!root->needsLayout()); // Sanity check when assertions are enabled. RenderObject* c = root->nextInPreOrder(); while (c) { ASSERT(!c->needsLayout()); c = c->nextInPreOrder(); } #endif } } } #else calcWidth(); calcHeight(); #endif RenderPart::layout(); m_overflow.clear(); addShadowOverflow(); setNeedsLayout(false); }