예제 #1
0
bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const HitTestRequest& request, const HitTestLocation& locationInContainer, const FloatRect& rect)
{
    // If it is not a rect-based hit test, this method has to be no-op.
    // Return false, so the hit test stops.
    if (!isRectBasedTest())
        return false;

    // If node is null, return true so the hit test can continue.
    if (!node)
        return true;

    if (!request.allowsShadowContent())
        node = node->deprecatedShadowAncestorNode();

    mutableRectBasedTestResult().add(node);

    bool regionFilled = rect.contains(locationInContainer.boundingBox());
    return !regionFilled;
}
예제 #2
0
bool LayoutSVGShape::nodeAtFloatPointInternal(const HitTestRequest& request,
                                              const FloatPoint& localPoint,
                                              PointerEventsHitRules hitRules) {
  bool isVisible = (style()->visibility() == EVisibility::Visible);
  if (isVisible || !hitRules.requireVisible) {
    const SVGComputedStyle& svgStyle = style()->svgStyle();
    WindRule fillRule = svgStyle.fillRule();
    if (request.svgClipContent())
      fillRule = svgStyle.clipRule();
    if ((hitRules.canHitBoundingBox &&
         objectBoundingBox().contains(localPoint)) ||
        (hitRules.canHitStroke &&
         (svgStyle.hasStroke() || !hitRules.requireStroke) &&
         strokeContains(localPoint, hitRules.requireStroke)) ||
        (hitRules.canHitFill && (svgStyle.hasFill() || !hitRules.requireFill) &&
         fillContains(localPoint, hitRules.requireFill, fillRule)))
      return true;
  }
  return false;
}