void DumpRenderTreeSupportEfl::setComposition(Evas_Object* ewkView, const char* text, int start, int length) { WebCore::Page* page = EWKPrivate::corePage(ewkView); if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame()) return; WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor(); if (!editor || (!editor->canEdit() && !editor->hasComposition())) return; const String compositionString = String::fromUTF8(text); Vector<WebCore::CompositionUnderline> underlines; underlines.append(WebCore::CompositionUnderline(0, compositionString.length(), WebCore::Color(0, 0, 0), false)); editor->setComposition(compositionString, underlines, start, start + length); }
bool DumpRenderTreeSupportEfl::compositionRange(Evas_Object* ewkView, int* start, int* length) { *start = *length = 0; WebCore::Page* page = EWKPrivate::corePage(ewkView); if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame()) return false; WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor(); if (!editor || !editor->hasComposition()) return false; *start = editor->compositionStart(); *length = editor->compositionEnd() - *start; return true; }
bool DumpRenderTreeSupportEfl::compositionRange(Evas_Object* ewkView, int* start, int* length) { *start = *length = 0; DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page, false); if (!page->focusController() || !page->focusController()->focusedOrMainFrame()) return false; WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor(); if (!editor || !editor->hasComposition()) return false; *start = editor->compositionStart(); *length = editor->compositionEnd() - *start; return true; }
WebCore::IntRect DumpRenderTreeSupportEfl::firstRectForCharacterRange(Evas_Object* ewkView, int location, int length) { WebCore::Page* page = EWKPrivate::corePage(ewkView); if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame() || !page->focusController()->focusedOrMainFrame()->editor()) return WebCore::IntRect(); if ((location + length < location) && (location + length)) length = 0; WebCore::Frame* frame = page->focusController()->focusedOrMainFrame(); WebCore::Editor* editor = frame->editor(); RefPtr<WebCore::Range> range = WebCore::TextIterator::rangeFromLocationAndLength(frame->selection()->rootEditableElementOrDocumentElement(), location, length); if (!range) return WebCore::IntRect(); return editor->firstRectForRange(range.get()); }
void DumpRenderTreeSupportEfl::confirmComposition(Evas_Object* ewkView, const char* text) { WebCore::Page* page = EWKPrivate::corePage(ewkView); if (!page || !page->focusController() || !page->focusController()->focusedOrMainFrame()) return; WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor(); if (!editor) return; if (!editor->hasComposition()) { editor->insertText(String::fromUTF8(text), 0); return; } if (text) { editor->confirmComposition(String::fromUTF8(text)); return; } editor->confirmComposition(); }
void DumpRenderTreeSupportEfl::confirmComposition(Evas_Object* ewkView, const char* text) { DRT_SUPPRT_PAGE_GET_OR_RETURN(ewkView, page); if (!page->focusController() || !page->focusController()->focusedOrMainFrame()) return; WebCore::Editor* editor = page->focusController()->focusedOrMainFrame()->editor(); if (!editor) return; if (!editor->hasComposition()) { editor->insertText(String::fromUTF8(text), 0); return; } if (text) { editor->confirmComposition(String::fromUTF8(text)); return; } editor->confirmComposition(); }
void BWebPage::handleSendEditingCapabilities(BMessage*) { bool canCut = false; bool canCopy = false; bool canPaste = false; WebCore::Frame* frame = fPage->focusController()->focusedOrMainFrame(); if (frame && frame->editor()) { WebCore::Editor* editor = frame->editor(); canCut = editor->canCut() || editor->canDHTMLCut(); canCopy = editor->canCopy() || editor->canDHTMLCopy(); canPaste = editor->canPaste() || editor->canDHTMLPaste(); } BMessage message(B_EDITING_CAPABILITIES_RESULT); message.AddBool("can cut", canCut); message.AddBool("can copy", canCopy); message.AddBool("can paste", canPaste); dispatchMessage(message); }