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 RenderWidget::requiresAcceleratedCompositing() const { // If this is a renderer with a contentDocument and that document needs a layer, then we need a layer. if (Document* contentDocument = frameOwnerElement().contentDocument()) { if (RenderView* view = contentDocument->renderView()) return view->usesCompositing(); } return false; }
void RenderFrameBase::peformLayoutWithFlattening(bool hasFixedWidth, bool hasFixedHeight) { if (!childRenderView()) return; if (!shouldExpandFrame(width(), height(), hasFixedWidth, hasFixedHeight)) { if (updateWidgetPosition() == ChildWidgetState::Destroyed) return; childView()->layout(); return; } // need to update to calculate min/max correctly if (updateWidgetPosition() == ChildWidgetState::Destroyed) return; // 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) { ASSERT(childRenderView()); setWidth(std::max(width(), childRenderView()->minPreferredLogicalWidth() + hBorder)); // update again to pass the new width to the child frame if (updateWidgetPosition() == ChildWidgetState::Destroyed) return; childView()->layout(); } ASSERT(childView()); // expand the frame by setting frame height = content height if (isScrollable || !hasFixedHeight || childRenderView()->isFrameSet()) setHeight(std::max<LayoutUnit>(height(), childView()->contentsHeight() + vBorder)); if (isScrollable || !hasFixedWidth || childRenderView()->isFrameSet()) setWidth(std::max<LayoutUnit>(width(), childView()->contentsWidth() + hBorder)); if (updateWidgetPosition() == ChildWidgetState::Destroyed) return; ASSERT(!childView()->layoutPending()); ASSERT(!childRenderView()->needsLayout()); ASSERT(!childRenderView()->firstChild() || !childRenderView()->firstChild()->firstChildSlow() || !childRenderView()->firstChild()->firstChildSlow()->needsLayout()); }