bool hitTestFlow(const RenderBlockFlow& flow, const Layout& layout, const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) { if (hitTestAction != HitTestForeground) return false; if (!layout.runCount()) return false; RenderStyle& style = flow.style(); if (style.visibility() != VISIBLE || style.pointerEvents() == PE_NONE) return false; RenderObject& renderer = *flow.firstChild(); LayoutRect rangeRect = locationInContainer.boundingBox(); rangeRect.moveBy(-accumulatedOffset); auto resolver = lineResolver(flow, layout); for (FloatRect lineRect : resolver.rangeForRect(rangeRect)) { lineRect.moveBy(accumulatedOffset); if (!locationInContainer.intersects(lineRect)) continue; renderer.updateHitTestResult(result, locationInContainer.point() - toLayoutSize(accumulatedOffset)); if (!result.addNodeToRectBasedTestResult(renderer.node(), request, locationInContainer, lineRect)) return true; } return false; }
IntRect computeTextBoundingBox(const RenderText& textRenderer, const Layout& layout) { auto resolver = lineResolver(toRenderBlockFlow(*textRenderer.parent()), layout); auto it = resolver.begin(); auto end = resolver.end(); if (it == end) return IntRect(); auto firstLineRect = *it; float left = firstLineRect.x(); float right = firstLineRect.maxX(); float bottom = firstLineRect.maxY(); for (++it; it != end; ++it) { auto rect = *it; if (rect.x() < left) left = rect.x(); if (rect.maxX() > right) right = rect.maxX(); if (rect.maxY() > bottom) bottom = rect.maxY(); } float x = left; float y = firstLineRect.y(); float width = right - left; float height = bottom - y; return enclosingIntRect(FloatRect(x, y, width, height)); }
void collectFlowOverflow(RenderBlockFlow& flow, const Layout& layout) { auto resolver = lineResolver(flow, layout); for (auto it = resolver.begin(), end = resolver.end(); it != end; ++it) { auto rect = *it; flow.addLayoutOverflow(rect); flow.addVisualOverflow(rect); } }
void collectFlowOverflow(RenderBlockFlow& flow, const Layout& layout) { float strokeOverflow = std::ceil(flow.style().textStrokeWidth()); for (FloatRect lineRect : lineResolver(flow, layout)) { LayoutRect inflatedLineRect(lineRect); inflatedLineRect.inflate(strokeOverflow); flow.addLayoutOverflow(inflatedLineRect); flow.addVisualOverflow(inflatedLineRect); } }
void collectFlowOverflow(RenderBlockFlow& flow, const Layout& layout) { auto resolver = lineResolver(flow, layout); float strokeOverflow = ceilf(flow.style().textStrokeWidth()); for (auto it = resolver.begin(), end = resolver.end(); it != end; ++it) { auto rect = LayoutRect(*it); rect.inflate(strokeOverflow); flow.addLayoutOverflow(rect); flow.addVisualOverflow(rect); } }