1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef WEB_HIT_TESTRESULT_H 17 #define WEB_HIT_TESTRESULT_H 18 19 #include <string> 20 21 #include "nweb_export.h" 22 23 namespace OHOS::NWeb { 24 25 class OHOS_NWEB_EXPORT HitTestResult { 26 public: 27 virtual ~HitTestResult() = default; 28 29 /** 30 * Default HitTestResult, where the target is unknown. 31 */ 32 static const int UNKNOWN_TYPE = 0; 33 /** 34 * This type is no longer used. 35 */ 36 static const int ANCHOR_TYPE = 1; 37 /** 38 * HitTestResult for hitting a phone number. 39 */ 40 static const int PHONE_TYPE = 2; 41 /** 42 * HitTestResult for hitting a map address. 43 */ 44 static const int GEO_TYPE = 3; 45 /** 46 * HitTestResult for hitting an email address. 47 */ 48 static const int EMAIL_TYPE = 4; 49 /** 50 * HitTestResult for hitting an HTML::img tag. 51 */ 52 static const int IMAGE_TYPE = 5; 53 /** 54 * This type is no longer used. 55 */ 56 static const int IMAGE_ANCHOR_TYPE = 6; 57 /** 58 * HitTestResult for hitting a HTML::a tag with src=http. 59 */ 60 static const int SRC_ANCHOR_TYPE = 7; 61 /** 62 * HitTestResult for hitting a HTML::a tag with src=http + HTML::img. 63 */ 64 static const int SRC_IMAGE_ANCHOR_TYPE = 8; 65 /** 66 * HitTestResult for hitting an edit text area. 67 */ 68 static const int EDIT_TEXT_TYPE = 9; 69 70 virtual void SetType(int type) = 0; 71 72 virtual int GetType() = 0; 73 74 virtual std::string GetExtra() = 0; 75 }; 76 77 } // namespace OHOS::NWeb 78 79 #endif // WEB_HIT_TESTRESULT_H 80