WML在chromium中实现的补充

本文详细介绍了在Chromium中WML文本字段的处理,包括如何判断选择是否在WML文本字段中,以及在事件处理中如何考虑WML文本字段的选择。涉及到的关键函数包括`isSelectionInWMLTextField`、`enclosingFormControl`和`selectionForCommand`等,揭示了Chromium在WML文档中处理编辑操作的内部逻辑。
摘要由CSDN通过智能技术生成

忘记了,还有几个小的修改
Source/core/editing/Editor.cpp
bool isSelectionInTextField(const VisibleSelection& selection)
{
HTMLTextFormControlElement* textControl = enclosingTextFormControl(selection.start());
return textControl && textControl->hasTagName(inputTag) && toHTMLInputElement(textControl)->isTextField();
}

#if ENABLE(WML)
bool isSelectionInWMLTextField(const VisibleSelection& selection)
{
WMLFormControlElement* textControl = enclosingFormControl(selection.start());
return textControl && textControl->hasTagName(WMLNames::inputTag) && toWMLInputElement(textControl)->isTextField();

}
#endif

} // namespace

// When an event handler has moved the selection outside of a text control
// we should use the target control’s selection for this editing operation.
VisibleSelection Editor::selectionForCommand(Event* event)
{
VisibleSelection selection = m_frame->selection()->selection();
if (!event)
return selection;
// If the target is a text control, and the current selection is outside of its shadow tree,
// then use the saved selection for that text control.
#if ENABLE(WML)
if (m_frame->document()->isWMLDocument()) {
WMLFormControlElement* textFormControlOfSelectionStart = enclosingFormControl(selection.start());
WMLFormControlElement* textFromControlOfTarget = isWMLFormControlElement(event->target()->toNode()) ? toWMLFormControlElement(event->target()->toNode()) : 0;
if (textFromControlOfTarget && (selection.start().isNull() || textF

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值