summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/Source/modules/canvas2d/TouchHitRegion.cpp
blob: 2b5ccf7f8a9f9ef7dfb48121c17d0c00408369bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "modules/canvas2d/TouchHitRegion.h"

#include "core/dom/Touch.h"
#include "core/html/HTMLCanvasElement.h"

namespace blink {

String TouchHitRegion::region(Touch& touch)
{
    if (!touch.target() || !isHTMLCanvasElement(touch.target()->toNode()))
        return String();

    HTMLCanvasElement* canvas = toHTMLCanvasElement(touch.target()->toNode());
    return regionIdFromAbsoluteLocation(*canvas, touch.absoluteLocation());
}

} // namespace blink