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); } } } }
void CCTouchDispatcher::SetInputUser(InputUser* user) { if (user == m_InputUser) return; if (m_InputUser) { m_InputUser->channel()->unbind(0, this); } m_InputUser = user; if (user) { user->channel()->bind(nit::EVT::POINTER_ON, this, &CCTouchDispatcher::OnPointerOn); user->channel()->bind(nit::EVT::POINTER_DRAG, this, &CCTouchDispatcher::OnPointerDrag); user->channel()->bind(nit::EVT::POINTER_OFF, this, &CCTouchDispatcher::OnPointerOff); user->channel()->bind(nit::EVT::POINTER_CANCEL, this, &CCTouchDispatcher::OnPointerCancel); } RenderView* view = CCDirector::sharedDirector()->GetRenderView(); if (view && user) { user->acquire(view->getInputDevice()); } }
DragImageRef createDragImageForRange(Frame& frame, Range& range, bool forceBlackText) { frame.document()->updateLayout(); RenderView* view = frame.contentRenderer(); if (!view) return nullptr; // To snapshot the range, temporarily select it and take selection snapshot. Position start = range.startPosition(); Position candidate = start.downstream(); if (candidate.deprecatedNode() && candidate.deprecatedNode()->renderer()) start = candidate; Position end = range.endPosition(); candidate = end.upstream(); if (candidate.deprecatedNode() && candidate.deprecatedNode()->renderer()) end = candidate; if (start.isNull() || end.isNull() || start == end) return nullptr; const ScopedFrameSelectionState selectionState(frame); RenderObject* startRenderer = start.deprecatedNode()->renderer(); RenderObject* endRenderer = end.deprecatedNode()->renderer(); if (!startRenderer || !endRenderer) return nullptr; SnapshotOptions options = forceBlackText ? SnapshotOptionsForceBlackText : SnapshotOptionsNone; view->setSelection(startRenderer, start.deprecatedEditingOffset(), endRenderer, end.deprecatedEditingOffset(), RenderView::RepaintNothing); std::unique_ptr<ImageBuffer> snapshot = snapshotSelection(frame, options); return createDragImageFromSnapshot(std::move(snapshot), nullptr); }
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()); if (newBounds != oldBounds) { // The widget changed positions. Update the frame geometry. if (checkForRepaintDuringLayout()) { RenderView* v = view(); if (!v->printing()) { // FIXME: do container-relative repaint v->repaintRectangleInViewAndCompositedLayers(oldBounds); v->repaintRectangleInViewAndCompositedLayers(newBounds); } } RenderArena* arena = ref(); element()->ref(); m_widget->setFrameRect(newBounds); element()->deref(); deref(arena); } }
virtual void handleEvent(Event* event) { if (event->type() != eventNames().clickEvent) return; Frame* frame = m_parent->page()->mainFrame(); while (frame) { RenderView* view = frame->contentRenderer(); const HashSet<RenderWidget*> widgets = view->widgets(); HashSet<RenderWidget*>::const_iterator it = widgets.begin(); HashSet<RenderWidget*>::const_iterator end = widgets.end(); for (; it != end; ++it) { Widget* widget = (*it)->widget(); // PluginWidget is used only with PluginToggleWidget if (widget && widget->isPluginWidget()) { /*SAMSUNG FIX*/ PluginToggleWidget* ptw = static_cast<PluginToggleWidget*>(widget); //SanJose++ ptw->swapPlugin(*it,((widget == this)?true:false)); //SanJose-- } } frame = frame->tree()->traverseNext(); } }
bool RenderPart::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action) { if (!widget() || !widget()->isFrameView() || !request.allowsChildFrameContent()) return RenderWidget::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, action); FrameView* childFrameView = toFrameView(widget()); RenderView* childRoot = childFrameView->renderView(); if (childRoot) { LayoutPoint adjustedLocation = accumulatedOffset + location(); LayoutPoint contentOffset = LayoutPoint(borderLeft() + paddingLeft(), borderTop() + paddingTop()) - childFrameView->scrollOffset(); HitTestLocation newHitTestLocation(locationInContainer, -adjustedLocation - contentOffset); HitTestRequest newHitTestRequest(request.type() | HitTestRequest::ChildFrameHitTest); HitTestResult childFrameResult(newHitTestLocation); bool isInsideChildFrame = childRoot->hitTest(newHitTestRequest, newHitTestLocation, childFrameResult); if (newHitTestLocation.isRectBasedTest()) result.append(childFrameResult); else if (isInsideChildFrame) result = childFrameResult; if (isInsideChildFrame) return true; } return RenderWidget::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, action); }
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 ScrollView::scrollTo(const IntSize& newOffset) { IntSize scrollDelta = newOffset - m_scrollOffset; if (scrollDelta == IntSize()) return; m_scrollOffset = newOffset; #if PLATFORM(ANDROID) if (parent()) { FrameView* frameView = this->frameView(); // IFrames are composited on a layer, we do not need to repaint them // when scrolling if (frameView) { RenderView* renderer = frameView->frame()->contentRenderer(); if (renderer) { RenderLayer* layer = renderer->layer(); if (layer->backing()) { GraphicsLayerAndroid* backing = static_cast<GraphicsLayerAndroid*>( layer->backing()->graphicsLayer()); backing->updateScrollOffset(); } } return; } } #endif if (scrollbarsSuppressed()) return; repaintFixedElementsAfterScrolling(); scrollContents(scrollDelta); }
ClipRect RenderLayerClipper::backgroundClipRect(const ClipRectsContext& clipRectsContext) const { ASSERT(m_renderer.layer()->parent()); if (clipRectsContext.clipRectsType == CompositingClipRects) const_cast<RenderLayerClipper*>(this)->clearClipRectsIncludingDescendants(CompositingClipRects); ClipRects parentRects; // If we cross into a different pagination context, then we can't rely on the cache. // Just switch over to using TemporaryClipRects. if (clipRectsContext.clipRectsType != TemporaryClipRects && m_renderer.layer()->parent()->enclosingPaginationLayer() != m_renderer.layer()->enclosingPaginationLayer()) { ClipRectsContext tempContext(clipRectsContext); tempContext.clipRectsType = TemporaryClipRects; parentClipRects(tempContext, parentRects); } else { parentClipRects(clipRectsContext, parentRects); } ClipRect backgroundClipRect = backgroundClipRectForPosition(parentRects, m_renderer.style()->position()); RenderView* view = m_renderer.view(); ASSERT(view); // Note: infinite clipRects should not be scrolled here, otherwise they will accidentally no longer be considered infinite. if (parentRects.fixed() && clipRectsContext.rootLayer->renderer() == view && backgroundClipRect != PaintInfo::infiniteRect()) backgroundClipRect.move(view->frameView()->scrollOffsetForFixedPosition()); return backgroundClipRect; }
bool FrameView::needsLayout() const { RenderView* renderView = this->renderView(); return layoutPending() || (renderView && renderView->needsLayout()) || isSubtreeLayout(); }
IntPoint RenderListBox::currentMousePosition() const { RenderView* view = this->view(); if (!view) return IntPoint(); return view->frameView()->currentMousePosition(); }
IntRect RenderReplaced::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) { if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent()) return IntRect(); // The selectionRect can project outside of the overflowRect, so take their union // for repainting to avoid selection painting glitches. IntRect r = unionRect(localSelectionRect(false), visualOverflowRect()); RenderView* v = view(); if (v) { // FIXME: layoutDelta needs to be applied in parts before/after transforms and // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 r.move(v->layoutDelta()); } if (style()) { if (style()->hasAppearance()) // The theme may wish to inflate the rect used when repainting. theme()->adjustRepaintRect(this, r); if (v) r.inflate(style()->outlineSize()); } computeRectForRepaint(repaintContainer, r); return r; }
void RenderWidget::updateWidgetPosition() { if (!m_widget) return; int x; int y; absolutePosition(x, y); x += borderLeft() + paddingLeft(); y += borderTop() + paddingTop(); int width = m_width - borderLeft() - borderRight() - paddingLeft() - paddingRight(); int height = m_height - borderTop() - borderBottom() - paddingTop() - paddingBottom(); IntRect newBounds(x, y, width, height); IntRect oldBounds(m_widget->frameGeometry()); if (newBounds != oldBounds) { // The widget changed positions. Update the frame geometry. if (checkForRepaintDuringLayout()) { RenderView* v = view(); if (!v->printing()) { v->repaintViewRectangle(oldBounds); v->repaintViewRectangle(newBounds); } } RenderArena* arena = ref(); element()->ref(); m_widget->setFrameGeometry(newBounds); element()->deref(); deref(arena); } }
CurrentRenderFlowThreadMaintainer(RenderFlowThread* renderFlowThread) : m_renderFlowThread(renderFlowThread) { RenderView* view = m_renderFlowThread->view(); ASSERT(!view->currentRenderFlowThread()); view->setCurrentRenderFlowThread(m_renderFlowThread); }
void PrintContext::computePageRects(const FloatRect& printRect, float headerHeight, float footerHeight, float userScaleFactor, float& outPageHeight) { m_pageRects.clear(); outPageHeight = 0; if (!m_frame->document() || !m_frame->view() || !m_frame->document()->renderView()) return; if (userScaleFactor <= 0) { WTF_LOG_ERROR("userScaleFactor has bad value %.2f", userScaleFactor); return; } RenderView* view = m_frame->document()->renderView(); const IntRect& documentRect = view->documentRect(); FloatSize pageSize = m_frame->resizePageRectsKeepingRatio(FloatSize(printRect.width(), printRect.height()), FloatSize(documentRect.width(), documentRect.height())); float pageWidth = pageSize.width(); float pageHeight = pageSize.height(); outPageHeight = pageHeight; // this is the height of the page adjusted by margins pageHeight -= headerHeight + footerHeight; if (pageHeight <= 0) { WTF_LOG_ERROR("pageHeight has bad value %.2f", pageHeight); return; } computePageRectsWithPageSizeInternal(FloatSize(pageWidth / userScaleFactor, pageHeight / userScaleFactor), false); }
bool RenderWidget::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction action) { if (request.allowsChildFrameContent() && widget() && widget()->isFrameView() && toFrameView(widget())->renderView()) { FrameView* childFrameView = toFrameView(widget()); RenderView* childRoot = childFrameView->renderView(); LayoutPoint adjustedLocation = accumulatedOffset + location(); LayoutPoint contentOffset = LayoutPoint(borderLeft() + paddingLeft(), borderTop() + paddingTop()) - childFrameView->scrollOffset(); HitTestLocation newHitTestLocation(locationInContainer, -adjustedLocation - contentOffset); HitTestRequest newHitTestRequest(request.type() | HitTestRequest::ChildFrameHitTest); HitTestResult childFrameResult(newHitTestLocation); bool isInsideChildFrame = childRoot->hitTest(newHitTestRequest, newHitTestLocation, childFrameResult); if (newHitTestLocation.isRectBasedTest()) result.append(childFrameResult); else if (isInsideChildFrame) result = childFrameResult; if (isInsideChildFrame) return true; } bool hadResult = result.innerNode(); bool inside = RenderReplaced::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, action); // Check to see if we are really over the widget itself (and not just in the border/padding area). if ((inside || result.isRectBasedTest()) && !hadResult && result.innerNode() == &frameOwnerElement()) result.setIsOverWidget(contentBoxRect().contains(result.localPoint())); return inside; }
bool RenderListBox::shouldSuspendScrollAnimations() const { RenderView* view = this->view(); if (!view) return true; return view->frameView()->shouldSuspendScrollAnimations(); }
void FrameView::adjustViewSize() { ASSERT(m_frame->view() == this); RenderView* root = m_frame->contentRenderer(); if (!root) return; resizeContents(root->overflowWidth(), root->overflowHeight()); }
CurrentRenderFlowThreadMaintainer::~CurrentRenderFlowThreadMaintainer() { if (!m_renderFlowThread) return; RenderView* view = m_renderFlowThread->view(); ASSERT(view->flowThreadController()->currentRenderFlowThread() == m_renderFlowThread); view->flowThreadController()->setCurrentRenderFlowThread(0); }
RenderView* RenderTarget::createView() { RenderView* renderView = AllocateThis(RenderView); renderView->setRenderTarget(this); renderView->setSize(getSettings().getSize()); views.pushBack(renderView); return renderView; }
void FrameView::recalcOverflowAfterStyleChange() { RenderView* renderView = this->renderView(); RELEASE_ASSERT(renderView); if (!renderView->needsOverflowRecalcAfterStyleChange()) return; renderView->recalcOverflowAfterStyleChange(); }
CurrentRenderFlowThreadMaintainer::CurrentRenderFlowThreadMaintainer(RenderFlowThread* renderFlowThread) : m_renderFlowThread(renderFlowThread) { if (!m_renderFlowThread) return; RenderView* view = m_renderFlowThread->view(); ASSERT(!view->flowThreadController()->currentRenderFlowThread()); view->flowThreadController()->setCurrentRenderFlowThread(m_renderFlowThread); }
void Frame::deviceOrPageScaleFactorChanged() { for (Frame* child = tree()->firstChild(); child; child = child->tree()->nextSibling()) child->deviceOrPageScaleFactorChanged(); RenderView* root = contentRenderer(); if (root && root->compositor()) root->compositor()->deviceOrPageScaleFactorChanged(); }
int ShadowMapStage::End() { // free renderviews RenderView * view = 0; int Size = RenderViews.Size(); while (Size--) { view = RenderViews.PopBack(); view->Recycle(); } return 0; }
IntRect RenderLayerScrollableArea::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntRect& parentRect) const { RenderView* view = box().view(); if (!view) return parentRect; IntRect rect = view->frameView()->convertToRenderer(box(), parentRect); rect.move(-scrollbarOffset(scrollbar)); return rect; }
IntPoint RenderLayerScrollableArea::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntPoint& scrollbarPoint) const { RenderView* view = box().view(); if (!view) return scrollbarPoint; IntPoint point = scrollbarPoint; point.move(scrollbarOffset(scrollbar)); return view->frameView()->convertFromRenderer(box(), point); }
void RenderTableCell::computeRectForRepaint(RenderBoxModelObject* repaintContainer, IntRect& r, bool fixed) { if (repaintContainer == this) return; r.setY(r.y()); RenderView* v = view(); if ((!v || !v->layoutStateEnabled() || repaintContainer) && parent()) r.move(-parentBox()->x(), -parentBox()->y()); // Rows are in the same coordinate space, so don't add their offset in. RenderBlock::computeRectForRepaint(repaintContainer, r, fixed); }
void RenderTarget::handleResize() { for( size_t i = 0; i < views.size(); i++ ) { RenderView* view = views[i]; view->handleRenderTargetResize(); } onTargetResize( getSettings() ); }
CurrentRenderFlowThreadMaintainer::CurrentRenderFlowThreadMaintainer(RenderFlowThread* renderFlowThread) : m_renderFlowThread(renderFlowThread) , m_previousRenderFlowThread(0) { if (!m_renderFlowThread) return; RenderView* view = m_renderFlowThread->view(); m_previousRenderFlowThread = view->flowThreadController()->currentRenderFlowThread(); view->flowThreadController()->setCurrentRenderFlowThread(m_renderFlowThread); }
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); }