本文整理汇总了C++中HTMLInputElement类的典型用法代码示例。如果您正苦于以下问题:C++ HTMLInputElement类的具体用法?C++ HTMLInputElement怎么用?C++ HTMLInputElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTMLInputElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: protector
void SearchFieldCancelButtonElement::defaultEventHandler(Event* event)
{
// If the element is visible, on mouseup, clear the value, and set selection
HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode());
if (event->type() == eventNames().mousedownEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
if (renderer() && renderer()->visibleToHitTesting()) {
if (Frame* frame = document()->frame()) {
frame->eventHandler()->setCapturingMouseEventsNode(this);
m_capturing = true;
}
}
input->focus();
input->select();
event->setDefaultHandled();
}
if (event->type() == eventNames().mouseupEvent && event->isMouseEvent() && static_cast<MouseEvent*>(event)->button() == LeftButton) {
if (m_capturing && renderer() && renderer()->visibleToHitTesting()) {
if (Frame* frame = document()->frame()) {
frame->eventHandler()->setCapturingMouseEventsNode(0);
m_capturing = false;
}
#if !PLATFORM(OLYMPIA)
// FIXME: It's always false on OLYMPIA platform. This problem depends on RIM bug #1067.
if (hovered()) {
#else
if (event->target() == this) {
#endif
RefPtr<HTMLInputElement> protector(input);
String oldValue = input->value();
input->setValue("");
if (!oldValue.isEmpty()) {
toRenderTextControl(input->renderer())->setChangedSinceLastChangeEvent(true);
input->dispatchEvent(Event::create(eventNames().inputEvent, true, false));
}
input->onSearch();
event->setDefaultHandled();
}
}
}
if (!event->defaultHandled())
HTMLDivElement::defaultEventHandler(event);
}
// ----------------------------
inline SpinButtonElement::SpinButtonElement(HTMLElement* shadowParent)
: TextControlInnerElement(shadowParent->document(), shadowParent)
, m_capturing(false)
, m_upDownState(Indeterminate)
, m_pressStartingState(Indeterminate)
, m_repeatingTimer(this, &SpinButtonElement::repeatingTimerFired)
{
}
PassRefPtr<SpinButtonElement> SpinButtonElement::create(HTMLElement* shadowParent)
{
return adoptRef(new SpinButtonElement(shadowParent));
}
void SpinButtonElement::defaultEventHandler(Event* event)
{
if (!event->isMouseEvent()) {
if (!event->defaultHandled())
HTMLDivElement::defaultEventHandler(event);
return;
}
RenderBox* box = renderBox();
if (!box) {
if (!event->defaultHandled())
HTMLDivElement::defaultEventHandler(event);
return;
}
HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode());
if (input->disabled() || input->isReadOnlyFormControl()) {
if (!event->defaultHandled())
HTMLDivElement::defaultEventHandler(event);
return;
}
MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
IntPoint local = roundedIntPoint(box->absoluteToLocal(mouseEvent->absoluteLocation(), false, true));
if (mouseEvent->type() == eventNames().mousedownEvent && mouseEvent->button() == LeftButton) {
if (box->borderBoxRect().contains(local)) {
RefPtr<Node> protector(input);
input->focus();
input->select();
input->stepUpFromRenderer(m_upDownState == Up ? 1 : -1);
event->setDefaultHandled();
startRepeatingTimer();
}
} else if (mouseEvent->type() == eventNames().mouseupEvent && mouseEvent->button() == LeftButton)
stopRepeatingTimer();
else if (event->type() == eventNames().mousemoveEvent) {
if (box->borderBoxRect().contains(local)) {
if (!m_capturing) {
if (Frame* frame = document()->frame()) {
frame->eventHandler()->setCapturingMouseEventsNode(this);
//.........这里部分代码省略.........
示例2: hostInput
bool SliderThumbElement::matchesReadWritePseudoClass() const
{
HTMLInputElement* input = hostInput();
return input && input->matchesReadWritePseudoClass();
}
示例3: ContainerWidget
uint64_t
HTMLTextFieldAccessible::NativeState() const
{
uint64_t state = HyperTextAccessibleWrap::NativeState();
// Text fields are always editable, even if they are also read only or
// disabled.
state |= states::EDITABLE;
// can be focusable, focused, protected. readonly, unavailable, selected
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
nsGkAtoms::password, eIgnoreCase)) {
state |= states::PROTECTED;
}
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::readonly)) {
state |= states::READONLY;
}
// Is it an <input> or a <textarea> ?
HTMLInputElement* input = HTMLInputElement::FromNode(mContent);
state |= input && input->IsSingleLineTextControl() ?
states::SINGLE_LINE : states::MULTI_LINE;
if (state & (states::PROTECTED | states::MULTI_LINE | states::READONLY |
states::UNAVAILABLE))
return state;
// Expose autocomplete states if this input is part of autocomplete widget.
Accessible* widget = ContainerWidget();
if (widget && widget-IsAutoComplete()) {
state |= states::HASPOPUP | states::SUPPORTS_AUTOCOMPLETION;
return state;
}
// Expose autocomplete state if it has associated autocomplete list.
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::list_))
return state | states::SUPPORTS_AUTOCOMPLETION | states::HASPOPUP;
// Ordinal XUL textboxes don't support autocomplete.
if (!BindingParent() && Preferences::GetBool("browser.formfill.enable")) {
// Check to see if autocompletion is allowed on this input. We don't expose
// it for password fields even though the entire password can be remembered
// for a page if the user asks it to be. However, the kind of autocomplete
// we're talking here is based on what the user types, where a popup of
// possible choices comes up.
nsAutoString autocomplete;
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::autocomplete,
autocomplete);
if (!autocomplete.LowerCaseEqualsLiteral("off")) {
Element* formElement = input->GetFormElement();
if (formElement) {
formElement->GetAttr(kNameSpaceID_None,
nsGkAtoms::autocomplete, autocomplete);
}
if (!formElement || !autocomplete.LowerCaseEqualsLiteral("off"))
state |= states::SUPPORTS_AUTOCOMPLETION;
}
}
return state;
}
示例4: MakeAnonymousElement
nsresult
nsNumberControlFrame::CreateAnonymousContent(nsTArray<ContentInfo>& aElements)
{
nsresult rv;
// We create an anonymous tree for our input element that is structured as
// follows:
//
// input
// div - outer wrapper with "display:flex" by default
// input - text input field
// div - spin box wrapping up/down arrow buttons
// div - spin up (up arrow button)
// div - spin down (down arrow button)
//
// If you change this, be careful to change the destruction order in
// nsNumberControlFrame::DestroyFrom.
// Create the anonymous outer wrapper:
rv = MakeAnonymousElement(getter_AddRefs(mOuterWrapper),
aElements,
nsGkAtoms::div,
nsCSSPseudoElements::ePseudo_mozNumberWrapper,
mStyleContext);
NS_ENSURE_SUCCESS(rv, rv);
ContentInfo& outerWrapperCI = aElements.LastElement();
// Create the ::-moz-number-text pseudo-element:
rv = MakeAnonymousElement(getter_AddRefs(mTextField),
outerWrapperCI.mChildren,
nsGkAtoms::input,
nsCSSPseudoElements::ePseudo_mozNumberText,
outerWrapperCI.mStyleContext);
NS_ENSURE_SUCCESS(rv, rv);
mTextField->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
NS_LITERAL_STRING("text"), PR_FALSE);
HTMLInputElement* content = HTMLInputElement::FromContent(mContent);
HTMLInputElement* textField = HTMLInputElement::FromContent(mTextField);
// Initialize the text field value:
nsAutoString value;
content->GetValue(value);
SetValueOfAnonTextControl(value);
// If we're readonly, make sure our anonymous text control is too:
nsAutoString readonly;
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::readonly, readonly)) {
mTextField->SetAttr(kNameSpaceID_None, nsGkAtoms::readonly, readonly, false);
}
// Propogate our tabindex:
int32_t tabIndex;
content->GetTabIndex(&tabIndex);
textField->SetTabIndex(tabIndex);
// Initialize the text field's placeholder, if ours is set:
nsAutoString placeholder;
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::placeholder, placeholder)) {
mTextField->SetAttr(kNameSpaceID_None, nsGkAtoms::placeholder, placeholder, false);
}
if (mContent->AsElement()->State().HasState(NS_EVENT_STATE_FOCUS)) {
// We don't want to focus the frame but the text field.
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mTextField);
NS_ASSERTION(element, "Really, this should be a nsIDOMElement!");
fm->SetFocus(element, 0);
}
if (StyleDisplay()->mAppearance == NS_THEME_TEXTFIELD) {
// The author has elected to hide the spinner by setting this
// -moz-appearance. We will reframe if it changes.
return rv;
}
// Create the ::-moz-number-spin-box pseudo-element:
rv = MakeAnonymousElement(getter_AddRefs(mSpinBox),
outerWrapperCI.mChildren,
nsGkAtoms::div,
nsCSSPseudoElements::ePseudo_mozNumberSpinBox,
outerWrapperCI.mStyleContext);
NS_ENSURE_SUCCESS(rv, rv);
ContentInfo& spinBoxCI = outerWrapperCI.mChildren.LastElement();
// Create the ::-moz-number-spin-up pseudo-element:
rv = MakeAnonymousElement(getter_AddRefs(mSpinUp),
spinBoxCI.mChildren,
nsGkAtoms::div,
nsCSSPseudoElements::ePseudo_mozNumberSpinUp,
spinBoxCI.mStyleContext);
NS_ENSURE_SUCCESS(rv, rv);
// Create the ::-moz-number-spin-down pseudo-element:
rv = MakeAnonymousElement(getter_AddRefs(mSpinDown),
spinBoxCI.mChildren,
//.........这里部分代码省略.........
示例5: ASSERT
PassRefPtr<FormSubmission> FormSubmission::create(HTMLFormElement* form, const Attributes& attributes, PassRefPtr<Event> event, bool lockHistory, FormSubmissionTrigger trigger)
{
ASSERT(form);
HTMLFormControlElement* submitButton = 0;
if (event && event->target() && event->target()->toNode())
submitButton = static_cast<HTMLFormControlElement*>(event->target()->toNode());
FormSubmission::Attributes copiedAttributes;
copiedAttributes.copyFrom(attributes);
if (submitButton) {
String attributeValue;
if (!(attributeValue = submitButton->getAttribute(formactionAttr)).isNull())
copiedAttributes.parseAction(attributeValue);
if (!(attributeValue = submitButton->getAttribute(formenctypeAttr)).isNull())
copiedAttributes.updateEncodingType(attributeValue);
if (!(attributeValue = submitButton->getAttribute(formmethodAttr)).isNull())
copiedAttributes.updateMethodType(attributeValue);
if (!(attributeValue = submitButton->getAttribute(formtargetAttr)).isNull())
copiedAttributes.setTarget(attributeValue);
}
Document* document = form->document();
KURL actionURL = document->completeURL(copiedAttributes.action().isEmpty() ? document->url().string() : copiedAttributes.action());
bool isMailtoForm = actionURL.protocolIs("mailto");
bool isMultiPartForm = false;
String encodingType = copiedAttributes.encodingType();
if (copiedAttributes.method() == PostMethod) {
isMultiPartForm = copiedAttributes.isMultiPartForm();
if (isMultiPartForm && isMailtoForm) {
encodingType = "application/x-www-form-urlencoded";
isMultiPartForm = false;
}
}
TextEncoding dataEncoding = isMailtoForm ? UTF8Encoding() : FormDataBuilder::encodingFromAcceptCharset(copiedAttributes.acceptCharset(), document);
RefPtr<DOMFormData> domFormData = DOMFormData::create(dataEncoding.encodingForFormSubmission());
Vector<pair<String, String> > formValues;
for (unsigned i = 0; i < form->associatedElements().size(); ++i) {
FormAssociatedElement* control = form->associatedElements()[i];
HTMLElement* element = toHTMLElement(control);
if (!element->disabled())
control->appendFormData(*domFormData, isMultiPartForm);
if (element->hasLocalName(inputTag)) {
HTMLInputElement* input = static_cast<HTMLInputElement*>(control);
if (input->isTextField()) {
formValues.append(pair<String, String>(input->name().string(), input->value()));
if (input->isSearchField())
input->addSearchResult();
}
}
}
RefPtr<FormData> formData;
String boundary;
if (isMultiPartForm) {
formData = FormData::createMultiPart(*(static_cast<FormDataList*>(domFormData.get())), domFormData->encoding(), document);
boundary = formData->boundary().data();
} else {
formData = FormData::create(*(static_cast<FormDataList*>(domFormData.get())), domFormData->encoding(), attributes.method() == GetMethod ? FormData::FormURLEncoded : FormData::parseEncodingType(encodingType));
if (copiedAttributes.method() == PostMethod && isMailtoForm) {
// Convert the form data into a string that we put into the URL.
appendMailtoPostFormDataToURL(actionURL, *formData, encodingType);
formData = FormData::create();
}
}
formData->setIdentifier(generateFormDataIdentifier());
String targetOrBaseTarget = copiedAttributes.target().isEmpty() ? document->baseTarget() : copiedAttributes.target();
RefPtr<FormState> formState = FormState::create(form, formValues, document->frame(), trigger);
return adoptRef(new FormSubmission(copiedAttributes.method(), actionURL, targetOrBaseTarget, encodingType, formState.release(), formData.release(), boundary, lockHistory, event));
}
示例6: textFieldDataListChanged
void ChromeClientImpl::textFieldDataListChanged(HTMLInputElement& input)
{
WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(input.document().frame());
if (webframe->autofillClient())
webframe->autofillClient()->dataListOptionsChanged(WebInputElement(&input));
}
示例7: stateSaver
void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (style().visibility() != VISIBLE)
return;
// Push a clip.
GraphicsContextStateSaver stateSaver(*paintInfo.context, false);
if (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseChildBlockBackgrounds) {
IntRect clipRect = enclosingIntRect(LayoutRect(paintOffset.x() + borderLeft(), paintOffset.y() + borderTop(),
width() - borderLeft() - borderRight(), height() - borderBottom() - borderTop() + buttonShadowHeight));
if (clipRect.isEmpty())
return;
stateSaver.save();
paintInfo.context->clip(clipRect);
}
if (paintInfo.phase == PaintPhaseForeground) {
const String& displayedFilename = fileTextValue();
const Font& font = style().font();
TextRun textRun = constructTextRun(this, font, displayedFilename, style(), TextRun::AllowTrailingExpansion, RespectDirection | RespectDirectionOverride);
textRun.disableRoundingHacks();
#if PLATFORM(IOS)
int iconHeight = nodeHeight(uploadButton());
int iconWidth = iconHeight;
#endif
// Determine where the filename should be placed
LayoutUnit contentLeft = paintOffset.x() + borderLeft() + paddingLeft();
HTMLInputElement* button = uploadButton();
if (!button)
return;
LayoutUnit buttonWidth = nodeWidth(button);
LayoutUnit buttonAndIconWidth = buttonWidth + afterButtonSpacing
+ (inputElement().icon() ? iconWidth + iconFilenameSpacing : 0);
LayoutUnit textX;
if (style().isLeftToRightDirection())
textX = contentLeft + buttonAndIconWidth;
else
textX = contentLeft + contentWidth() - buttonAndIconWidth - font.width(textRun);
LayoutUnit textY = 0;
// We want to match the button's baseline
// FIXME: Make this work with transforms.
if (RenderButton* buttonRenderer = toRenderButton(button->renderer()))
textY = paintOffset.y() + borderTop() + paddingTop() + buttonRenderer->baselinePosition(AlphabeticBaseline, true, HorizontalLine, PositionOnContainingLine);
else
textY = baselinePosition(AlphabeticBaseline, true, HorizontalLine, PositionOnContainingLine);
paintInfo.context->setFillColor(style().visitedDependentColor(CSSPropertyColor), style().colorSpace());
// Draw the filename
paintInfo.context->drawBidiText(font, textRun, IntPoint(roundToInt(textX), roundToInt(textY)));
if (inputElement().icon()) {
// Determine where the icon should be placed
LayoutUnit iconY = paintOffset.y() + borderTop() + paddingTop() + (contentHeight() - iconHeight) / 2;
LayoutUnit iconX;
if (style().isLeftToRightDirection())
iconX = contentLeft + buttonWidth + afterButtonSpacing;
else
iconX = contentLeft + contentWidth() - buttonWidth - afterButtonSpacing - iconWidth;
#if PLATFORM(IOS)
if (RenderButton* buttonRenderer = toRenderButton(button->renderer())) {
// Draw the file icon and decorations.
IntRect iconRect(iconX, iconY, iconWidth, iconHeight);
RenderTheme::FileUploadDecorations decorationsType = inputElement().files()->length() == 1 ? RenderTheme::SingleFile : RenderTheme::MultipleFiles;
theme().paintFileUploadIconDecorations(*this, *buttonRenderer, paintInfo, iconRect, inputElement().icon(), decorationsType);
}
#else
// Draw the file icon
inputElement().icon()->paint(paintInfo.context, IntRect(roundToInt(iconX), roundToInt(iconY), iconWidth, iconHeight));
#endif
}
}
// Paint the children.
RenderBlockFlow::paintObject(paintInfo, paintOffset);
}
示例8: toHTMLInputElement
String RenderFileUploadControl::fileTextValue() const
{
HTMLInputElement* input = toHTMLInputElement(node());
ASSERT(input->files());
return RenderTheme::theme().fileListNameForWidth(input->locale(), input->files(), style()->font(), maxFilenameWidth());
}
示例9: document
void HTMLFormElement::submit(Event* event, bool activateSubmitButton, bool lockHistory, bool lockBackForwardList)
{
FrameView* view = document()->view();
Frame* frame = document()->frame();
if (!view || !frame)
return;
if (m_insubmit) {
m_doingsubmit = true;
return;
}
m_insubmit = true;
HTMLFormControlElement* firstSuccessfulSubmitButton = 0;
bool needButtonActivation = activateSubmitButton; // do we need to activate a submit button?
frame->loader()->clearRecordedFormValues();
frame->loader()->setFormAboutToBeSubmitted(this);
for (unsigned i = 0; i < formElements.size(); ++i) {
HTMLFormControlElement* control = formElements[i];
if (control->hasLocalName(inputTag)) {
HTMLInputElement* input = static_cast<HTMLInputElement*>(control);
if (input->isTextField()) {
frame->loader()->recordFormValue(input->name(), input->value());
if (input->isSearchField())
input->addSearchResult();
}
}
if (needButtonActivation) {
if (control->isActivatedSubmit())
needButtonActivation = false;
else if (firstSuccessfulSubmitButton == 0 && control->isSuccessfulSubmitButton())
firstSuccessfulSubmitButton = control;
}
}
if (needButtonActivation && firstSuccessfulSubmitButton)
firstSuccessfulSubmitButton->setActivatedSubmit(true);
if (m_url.isEmpty())
m_url = document()->url().string();
if (m_formDataBuilder.isPostMethod()) {
if (m_formDataBuilder.isMultiPartForm() && isMailtoForm()) {
setEnctype("application/x-www-form-urlencoded");
ASSERT(!m_formDataBuilder.isMultiPartForm());
}
if (!m_formDataBuilder.isMultiPartForm()) {
RefPtr<FormData> data = createFormData(CString());
if (isMailtoForm()) {
String body = data->flattenToString();
if (equalIgnoringCase(m_formDataBuilder.encodingType(), "text/plain")) {
// Convention seems to be to decode, and s/&/\r\n/. Also, spaces are encoded as %20.
body = decodeURLEscapeSequences(body.replace('&', "\r\n").replace('+', ' ') + "\r\n");
}
Vector<char> bodyData;
bodyData.append("body=", 5);
FormDataBuilder::encodeStringAsFormData(bodyData, body.utf8());
data = FormData::create(String(bodyData.data(), bodyData.size()).replace('+', "%20").latin1());
}
frame->loader()->submitForm("POST", m_url, data, m_target, m_formDataBuilder.encodingType(), String(), event, lockHistory, lockBackForwardList);
} else {
Vector<char> boundary = m_formDataBuilder.generateUniqueBoundaryString();
frame->loader()->submitForm("POST", m_url, createFormData(boundary.data()), m_target, m_formDataBuilder.encodingType(), boundary.data(), event, lockHistory, lockBackForwardList);
}
} else {
m_formDataBuilder.setIsMultiPartForm(false);
frame->loader()->submitForm("GET", m_url, createFormData(CString()), m_target, String(), String(), event, lockHistory, lockBackForwardList);
}
if (needButtonActivation && firstSuccessfulSubmitButton)
firstSuccessfulSubmitButton->setActivatedSubmit(false);
m_doingsubmit = m_insubmit = false;
}
示例10: setToolTip
void Chrome::setToolTip(const HitTestResult& result)
{
// First priority is a potential toolTip representing a spelling or grammar error
TextDirection toolTipDirection;
String toolTip = result.spellingToolTip(toolTipDirection);
// Next priority is a toolTip from a URL beneath the mouse (if preference is set to show those).
if (toolTip.isEmpty() && m_page->settings()->showsURLsInToolTips()) {
if (Node* node = result.innerNonSharedNode()) {
// Get tooltip representing form action, if relevant
if (node->hasTagName(inputTag)) {
HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
if (input->isSubmitButton())
if (HTMLFormElement* form = input->form()) {
toolTip = form->action();
if (form->renderer())
toolTipDirection = form->renderer()->style()->direction();
else
toolTipDirection = LTR;
}
}
}
// Get tooltip representing link's URL
if (toolTip.isEmpty()) {
// FIXME: Need to pass this URL through userVisibleString once that's in WebCore
toolTip = result.absoluteLinkURL().string();
// URL always display as LTR.
toolTipDirection = LTR;
}
}
// Next we'll consider a tooltip for element with "title" attribute
if (toolTip.isEmpty())
toolTip = result.title(toolTipDirection);
// Lastly, for <input type="file"> that allow multiple files, we'll consider a tooltip for the selected filenames
if (toolTip.isEmpty()) {
if (Node* node = result.innerNonSharedNode()) {
if (node->hasTagName(inputTag)) {
HTMLInputElement* input = static_cast<HTMLInputElement*>(node);
if (input->isFileUpload()) {
FileList* files = input->files();
unsigned listSize = files->length();
if (files && listSize > 1) {
Vector<UChar> names;
for (size_t i = 0; i < listSize; ++i) {
append(names, files->item(i)->fileName());
if (i != listSize - 1)
names.append('\n');
}
toolTip = String::adopt(names);
// filename always display as LTR.
toolTipDirection = LTR;
}
}
}
}
}
m_client->setToolTip(toolTip, toolTipDirection);
}
示例11: accessKeyAction
// FIXME: Could share this with BaseCheckableInputType and RangeInputType if we had a common base class.
void BaseClickableWithKeyInputType::accessKeyAction(HTMLInputElement& element, bool sendMouseEvents)
{
element.dispatchSimulatedClick(0, sendMouseEvents ? SendMouseUpDownEvents : SendNoEvents);
}
示例12: toHTMLInputElement
int RenderFileUploadControl::maxFilenameWidth() const
{
HTMLInputElement* input = toHTMLInputElement(node());
return max(0, contentBoxRect().pixelSnappedWidth() - nodeWidth(uploadButton()) - afterButtonSpacing
- (input->icon() ? iconWidth + iconFilenameSpacing : 0));
}
示例13: TEST_F
TEST_F(InputMethodControllerTest, BackspaceFromEndOfInput)
{
document().write("<input id='sample'>");
HTMLInputElement* input = toHTMLInputElement(document().getElementById("sample"));
document().updateLayout();
input->focus();
input->setValue("fooX");
controller().setEditableSelectionOffsets(PlainTextRange(4, 4));
EXPECT_STREQ("fooX", input->value().utf8().data());
controller().extendSelectionAndDelete(1, 0);
EXPECT_STREQ("foo", input->value().utf8().data());
input->setValue(String::fromUTF8("foo\xE2\x98\x85")); // U+2605 == "black star"
controller().setEditableSelectionOffsets(PlainTextRange(4, 4));
EXPECT_STREQ("foo\xE2\x98\x85", input->value().utf8().data());
controller().extendSelectionAndDelete(1, 0);
EXPECT_STREQ("foo", input->value().utf8().data());
input->setValue(String::fromUTF8("foo\xF0\x9F\x8F\x86")); // U+1F3C6 == "trophy"
controller().setEditableSelectionOffsets(PlainTextRange(4, 4));
EXPECT_STREQ("foo\xF0\x9F\x8F\x86", input->value().utf8().data());
controller().extendSelectionAndDelete(1, 0);
EXPECT_STREQ("foo", input->value().utf8().data());
input->setValue(String::fromUTF8("foo\xE0\xB8\x81\xE0\xB9\x89")); // composed U+0E01 "ka kai" + U+0E49 "mai tho"
controller().setEditableSelectionOffsets(PlainTextRange(4, 4));
EXPECT_STREQ("foo\xE0\xB8\x81\xE0\xB9\x89", input->value().utf8().data());
controller().extendSelectionAndDelete(1, 0);
EXPECT_STREQ("foo", input->value().utf8().data());
}
示例14: RenderBlockFlow
RenderFileUploadControl::RenderFileUploadControl(HTMLInputElement& input)
: RenderBlockFlow(input)
, m_canReceiveDroppedFiles(input.canReceiveDroppedFiles())
{
}
示例15: didEndEditingOnTextField
void ChromeClientImpl::didEndEditingOnTextField(HTMLInputElement& inputElement)
{
WebLocalFrameImpl* webframe = WebLocalFrameImpl::fromFrame(inputElement.document().frame());
if (webframe->autofillClient())
webframe->autofillClient()->textFieldDidEndEditing(WebInputElement(&inputElement));
}