mirror of
https://gitee.com/openharmony/accessibility
synced 2024-11-27 00:51:07 +00:00
新增clip节点属性
Signed-off-by: 13359243081 <lanshulei@huawei.com>
This commit is contained in:
parent
7b48f82407
commit
93a602eac9
@ -169,6 +169,7 @@ bool AccessibilityElementInfoParcel::ReadFromParcelFourthPart(Parcel &parcel)
|
||||
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, isActive_);
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, accessibilityVisible_);
|
||||
READ_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, clip_);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -288,6 +289,7 @@ bool AccessibilityElementInfoParcel::MarshallingThirdPart(Parcel &parcel) const
|
||||
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, isActive_);
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, accessibilityVisible_);
|
||||
WRITE_PARCEL_AND_RETURN_FALSE_IF_FAIL(Bool, parcel, clip_);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -947,7 +947,11 @@ const std::string &AccessibilityElementInfo::GetBackgroundColor() const
|
||||
|
||||
void AccessibilityElementInfo::SetBackgroundImage(const std::string &backgroundImage)
|
||||
{
|
||||
backgroundImage_ = backgroundImage;
|
||||
if (backgroundImage.length() > backgroundImageMaxLength) {
|
||||
backgroundImage_ = "true";
|
||||
} else {
|
||||
backgroundImage_ = backgroundImage;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string &AccessibilityElementInfo::GetBackgroundImage() const
|
||||
@ -1087,5 +1091,15 @@ void AccessibilityElementInfo::SetAccessibilityVisible(const bool accessibilityV
|
||||
{
|
||||
accessibilityVisible_ = accessibilityVisible;
|
||||
}
|
||||
|
||||
bool AccessibilityElementInfo::GetClip() const
|
||||
{
|
||||
return clip_;
|
||||
}
|
||||
|
||||
void AccessibilityElementInfo::SetClip(const bool clip)
|
||||
{
|
||||
clip_ = clip;
|
||||
}
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
@ -1736,6 +1736,20 @@ public:
|
||||
* @sysCap Accessibility
|
||||
*/
|
||||
void SetAccessibilityVisible(const bool accessibilityVisible);
|
||||
|
||||
/**
|
||||
* @brief Get the clip to the element info.
|
||||
* @return clip status.
|
||||
* @sysCap Accessibility
|
||||
*/
|
||||
bool GetClip() const;
|
||||
|
||||
/**
|
||||
* @brief Set the clip to the element info.
|
||||
* @param clip The clip of node.
|
||||
* @sysCap Accessibility
|
||||
*/
|
||||
void SetClip(const bool clip);
|
||||
protected:
|
||||
int32_t pageId_ = -1;
|
||||
int32_t windowId_ = -1;
|
||||
@ -1813,6 +1827,8 @@ protected:
|
||||
std::vector<SpanInfo> spanList_ {};
|
||||
bool isActive_ = true;
|
||||
bool accessibilityVisible_ = true;
|
||||
bool clip_ = false;
|
||||
static const int backgroundImageMaxLength = 20;
|
||||
};
|
||||
} // namespace Accessibility
|
||||
} // namespace OHOS
|
||||
|
@ -140,6 +140,7 @@ public:
|
||||
static void GetElementInfoSpan(NAccessibilityElementData *callbackInfo, napi_value &value);
|
||||
static void GetElementInfoIsActive(NAccessibilityElementData *callbackInfo, napi_value &value);
|
||||
static void GetElementInfoAccessibilityVisible(NAccessibilityElementData *callbackInfo, napi_value &value);
|
||||
static void GetElementInfoClip(NAccessibilityElementData *callbackInfo, napi_value &value);
|
||||
|
||||
// Window info
|
||||
static void GetWindowInfoIsActive(NAccessibilityElementData *callbackInfo, napi_value &value);
|
||||
|
@ -41,7 +41,7 @@ namespace {
|
||||
"error", "isHint", "pageId", "valueMax", "valueMin", "valueNow", "windowId", "accessibilityText",
|
||||
"textType", "offset", "currentItem", "accessibilityGroup", "accessibilityLevel", "checkboxGroupSelectedStatus",
|
||||
"row", "column", "listItemIndex", "sideBarContainerStates", "span", "isActive", "accessibilityVisible",
|
||||
"allAttribute"};
|
||||
"allAttribute", "clip"};
|
||||
const std::vector<std::string> WINDOW_INFO_ATTRIBUTE_NAMES = {"isActive", "screenRect", "layer", "type",
|
||||
"rootElement", "isFocused", "windowId"};
|
||||
|
||||
@ -105,6 +105,7 @@ namespace {
|
||||
{"isActive", &NAccessibilityElement::GetElementInfoIsActive},
|
||||
{"accessibilityVisible", &NAccessibilityElement::GetElementInfoAccessibilityVisible},
|
||||
{"allAttribute", &NAccessibilityElement::GetElementInfoAllAttribute},
|
||||
{"clip", &NAccessibilityElement::GetElementInfoClip},
|
||||
};
|
||||
std::map<std::string, AttributeNamesFunc> windowInfoCompleteMap = {
|
||||
{"isActive", &NAccessibilityElement::GetWindowInfoIsActive},
|
||||
@ -1097,6 +1098,15 @@ void NAccessibilityElement::GetElementInfoAccessibilityVisible(
|
||||
callbackInfo->accessibilityElement_.elementInfo_->GetAccessibilityVisible(), &value));
|
||||
}
|
||||
|
||||
void NAccessibilityElement::GetElementInfoClip(NAccessibilityElementData *callbackInfo, napi_value &value)
|
||||
{
|
||||
if (!CheckElementInfoParameter(callbackInfo, value)) {
|
||||
return;
|
||||
}
|
||||
NAPI_CALL_RETURN_VOID(callbackInfo->env_, napi_create_int64(callbackInfo->env_,
|
||||
callbackInfo->accessibilityElement_.elementInfo_->GetClip(), &value));
|
||||
}
|
||||
|
||||
void NAccessibilityElement::GetElementInfoAllAttribute(NAccessibilityElementData *callbackInfo, napi_value &value)
|
||||
{
|
||||
NAPI_CALL_RETURN_VOID(callbackInfo->env_, napi_create_object(callbackInfo->env_, &value));
|
||||
@ -1357,6 +1367,10 @@ void NAccessibilityElement::GetElementInfoAllAttribute5(NAccessibilityElementDat
|
||||
napi_value accessibilityVisible = nullptr;
|
||||
GetElementInfoAccessibilityVisible(callbackInfo, accessibilityVisible);
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, value, "accessibilityVisible", accessibilityVisible));
|
||||
|
||||
napi_value clip = nullptr;
|
||||
GetElementInfoClip(callbackInfo, isActive);
|
||||
NAPI_CALL_RETURN_VOID(env, napi_set_named_property(env, value, "clip", clip));
|
||||
}
|
||||
|
||||
void NAccessibilityElement::GetWindowInfoAllAttribute(NAccessibilityElementData *callbackInfo, napi_value &value)
|
||||
|
Loading…
Reference in New Issue
Block a user