本文整理汇总了C++中TextControlInnerTextElement类的典型用法代码示例。如果您正苦于以下问题:C++ TextControlInnerTextElement类的具体用法?C++ TextControlInnerTextElement怎么用?C++ TextControlInnerTextElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextControlInnerTextElement类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: innerTextElement
void HTMLTextFormControlElement::setInnerTextValue(const String& value)
{
TextControlInnerTextElement* innerText = innerTextElement();
if (!innerText)
return;
ASSERT(isTextFormControl());
String previousValue = innerTextValueFrom(*innerText);
bool textIsChanged = value != previousValue;
if (textIsChanged || !innerText->hasChildNodes()) {
#if HAVE(ACCESSIBILITY) && !PLATFORM(COCOA)
if (textIsChanged && renderer()) {
if (AXObjectCache* cache = document().existingAXObjectCache())
cache->postNotification(this, AXObjectCache::AXValueChanged, TargetObservableParent);
}
#endif
innerText->setInnerText(value, ASSERT_NO_EXCEPTION);
if (value.endsWith('\n') || value.endsWith('\r'))
innerText->appendChild(HTMLBRElement::create(document()), ASSERT_NO_EXCEPTION);
#if HAVE(ACCESSIBILITY) && PLATFORM(COCOA)
if (textIsChanged && renderer()) {
if (AXObjectCache* cache = document().existingAXObjectCache())
cache->postTextReplacementNotification(this, AXTextEditTypeDelete, previousValue, AXTextEditTypeInsert, value, VisiblePosition(Position(this, Position::PositionIsBeforeAnchor)));
}
#endif
}
setFormControlValueMatchesRenderer(true);
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:31,代码来源:HTMLTextFormControlElement.cpp
示例2: innerTextElement
int RenderTextControl::textBlockLogicalWidth() const
{
TextControlInnerTextElement* innerText = innerTextElement();
ASSERT(innerText);
LayoutUnit unitWidth = logicalWidth() - borderAndPaddingLogicalWidth();
if (innerText->renderer())
unitWidth -= innerText->renderBox()->paddingStart() + innerText->renderBox()->paddingEnd();
return unitWidth;
}
开发者ID:rhythmkay,项目名称:webkit,代码行数:11,代码来源:RenderTextControl.cpp
示例3: value
String HTMLTextFormControlElement::valueWithHardLineBreaks() const
{
// FIXME: It's not acceptable to ignore the HardWrap setting when there is no renderer.
// While we have no evidence this has ever been a practical problem, it would be best to fix it some day.
if (!isTextFormControl())
return value();
TextControlInnerTextElement* innerText = innerTextElement();
if (!innerText)
return value();
RenderTextControlInnerBlock* renderer = innerText->renderer();
if (!renderer)
return value();
Node* breakNode;
unsigned breakOffset;
RootInlineBox* line = renderer->firstRootBox();
if (!line)
return value();
getNextSoftBreak(line, breakNode, breakOffset);
StringBuilder result;
for (Node* node = innerText->firstChild(); node; node = NodeTraversal::next(*node, innerText)) {
if (is<HTMLBRElement>(*node))
result.append(newlineCharacter);
else if (is<Text>(*node)) {
String data = downcast<Text>(*node).data();
unsigned length = data.length();
unsigned position = 0;
while (breakNode == node && breakOffset <= length) {
if (breakOffset > position) {
result.append(data, position, breakOffset - position);
position = breakOffset;
result.append(newlineCharacter);
}
getNextSoftBreak(line, breakNode, breakOffset);
}
result.append(data, position, length - position);
}
while (breakNode == node)
getNextSoftBreak(line, breakNode, breakOffset);
}
stripTrailingNewline(result);
return result.toString();
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:47,代码来源:HTMLTextFormControlElement.cpp
示例4: innerTextValueFrom
static String innerTextValueFrom(TextControlInnerTextElement& innerText)
{
StringBuilder result;
for (Node* node = innerText.firstChild(); node; node = NodeTraversal::next(*node, &innerText)) {
if (is<HTMLBRElement>(*node))
result.append(newlineCharacter);
else if (is<Text>(*node))
result.append(downcast<Text>(*node).data());
}
stripTrailingNewline(result);
return result.toString();
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:12,代码来源:HTMLTextFormControlElement.cpp
示例5: ASSERT
PassRefPtr<Range> HTMLTextFormControlElement::selection() const
{
if (!renderer() || !isTextFormControl() || !hasCachedSelection())
return nullptr;
int start = m_cachedSelectionStart;
int end = m_cachedSelectionEnd;
ASSERT(start <= end);
TextControlInnerTextElement* innerText = innerTextElement();
if (!innerText)
return nullptr;
if (!innerText->firstChild())
return Range::create(document(), innerText, 0, innerText, 0);
int offset = 0;
Node* startNode = nullptr;
Node* endNode = nullptr;
for (Node* node = innerText->firstChild(); node; node = NodeTraversal::next(*node, innerText)) {
ASSERT(!node->firstChild());
ASSERT(node->isTextNode() || node->hasTagName(brTag));
int length = node->isTextNode() ? lastOffsetInNode(node) : 1;
if (offset <= start && start <= offset + length)
setContainerAndOffsetForRange(node, start - offset, startNode, start);
if (offset <= end && end <= offset + length) {
setContainerAndOffsetForRange(node, end - offset, endNode, end);
break;
}
offset += length;
}
if (!startNode || !endNode)
return nullptr;
return Range::create(document(), startNode, start, endNode, end);
}
开发者ID:clbr,项目名称:webkitfltk,代码行数:40,代码来源:HTMLTextFormControlElement.cpp
示例6: innerTextElement
void RenderTextControl::updateFromElement()
{
TextControlInnerTextElement* innerText = innerTextElement();
if (innerText && innerText->renderer())
updateUserModifyProperty(textFormControlElement(), &innerText->renderer()->style());
}
开发者ID:,项目名称:,代码行数:6,代码来源:
注:本文中的TextControlInnerTextElement类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论