--- a/webengine/osswebengine/WebKit/s60/webview/WebFepTextEditor.cpp Thu Aug 19 10:58:56 2010 +0300
+++ b/webengine/osswebengine/WebKit/s60/webview/WebFepTextEditor.cpp Tue Aug 31 16:17:46 2010 +0300
@@ -15,8 +15,6 @@
*
*/
-
-
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
#include <txtetext_internal.h>
#include <txtclipboard.h>
@@ -40,10 +38,10 @@
#include "Frame.h"
#include "Editor.h"
-#include "HtmlNames.h"
+#include "HTMLNames.h"
#include "EventHandler.h"
-#include "HtmlInputElement.h"
-#include "HtmlTextAreaElement.h"
+#include "HTMLInputElement.h"
+#include "HTMLTextAreaElement.h"
#include "PlatformKeyboardEvent.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
@@ -51,13 +49,9 @@
#include <coemain.h>
#include <eikpanic.h>
#include <aknedsts.h>
-#include <aknutils.h>
+#include <AknUtils.h>
#include "Text.h"
-#include <e32const.h>
-
-#define KLineEnterChar 0x21b2
-
using namespace WebCore;
static const int kInfinite = -1;
@@ -77,9 +71,7 @@
CWebFepTextEditor::CWebFepTextEditor(WebView* aView)
: m_webView(aView),
m_textFormatMask(NULL),
- m_inlineEditText(NULL),
- m_longKeyPress(EFalse),
- m_inlineTextEditingStarted(EFalse)
+ m_inlineEditText(NULL)
{
// Set up the extended capabilities
TRAP_IGNORE(
@@ -91,7 +83,7 @@
#if defined(BRDO_BROWSER_50_FF)
SetAlignment( CAknExtendedInputCapabilities::EInputEditorAlignBidi );
#endif
- TRAP_IGNORE( EnableCcpuL() );
+ EnableCcpu(ETrue);
}
// -----------------------------------------------------------------------------
@@ -105,7 +97,6 @@
delete m_inlineEditText;
delete m_textFormatMask;
delete m_ExtendedInputCapabilities;
- delete m_CcpuSupport;
}
// -----------------------------------------------------------------------------
@@ -138,19 +129,18 @@
{
Frame* frame = m_webView->page()->focusController()->focusedOrMainFrame();
if (frame) {
- Node *node = frame->document()->focusedNode();
+ Node *node = frame->document()->focusedNode();
if (frame && frame->document() && node) {
- if (node->hasTagName(HTMLNames::inputTag)
- && (static_cast<HTMLInputElement*>(node)->inputType() == HTMLInputElement::PASSWORD)
- && !static_cast<HTMLInputElement*>(node)->readOnly()) {
+ if (node->hasTagName(HTMLNames::inputTag)
+ && (static_cast<HTMLInputElement*>(node)->inputType() == HTMLInputElement::PASSWORD)
+ && !static_cast<HTMLInputElement*>(node)->readOnly()) {
// Set the state as if it was the CEikSecretEditor
CAknEdwinState* state = static_cast<CAknEdwinState*>(State(KNullUid));
if (state) {
state->SetFlags( EAknEditorFlagNoLRNavigation |
EAknEditorFlagLatinInputModesOnly |
EAknEditorFlagNoT9 |
- EAknEditorFlagUseSCTNumericCharmap |
- EAknEditorFlagNoLRNavigation);
+ EAknEditorFlagUseSCTNumericCharmap );
state->SetDefaultInputMode(EAknEditorSecretAlphaInputMode);
state->SetCurrentInputMode(EAknEditorSecretAlphaInputMode);
state->SetPermittedCases(EAknEditorLowerCase|EAknEditorUpperCase);
@@ -158,9 +148,7 @@
state->SetPermittedInputModes(EAknEditorSecretAlphaInputMode | EAknEditorNumericInputMode);
state->SetDefaultCase(EAknEditorLowerCase);
state->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG_LATIN_ONLY);
- state->SetNumericKeymap(EAknEditorStandardNumberModeKeymap);
- state->SetCcpuState(NULL);
- TRAP_IGNORE( state->ReportAknEdStateEventL(MAknEdStateObserver::EAknEdwinStateFlagsUpdate ) );
+ state->SetNumericKeymap(EAknEditorPlainNumberModeKeymap);
}
}
else {
@@ -169,13 +157,9 @@
TUint permittedCase ( EAknEditorAllCaseModes ) ;
TUint inputMode( EAknEditorNullInputMode );
TUint permittedInputModes( EAknEditorAllInputModes );
-#ifdef BRDO_MULTITOUCH_ENABLED_FF
- TUint flags( EAknEditorFlagDefault | EAknEditorFlagSelectionVisible );
-#else
TUint flags( EAknEditorFlagDefault );
-#endif
TUint numericKeyMap( EAknEditorStandardNumberModeKeymap );
-
+
if (GetStateFromFormatMask(currentCase, permittedCase, inputMode, permittedInputModes, flags, numericKeyMap)) {
UpdateFlagsState(flags);
UpdateInputModeState(inputMode, permittedInputModes, numericKeyMap);
@@ -187,7 +171,6 @@
state->SetDefaultCase(EAknEditorLowerCase);
state->SetPermittedInputModes(EAknEditorAllInputModes);
state->SetPermittedCases(EAknEditorAllCaseModes);//allow everything
- state->SetCcpuState(this);
}
}
}
@@ -207,11 +190,9 @@
delete m_inlineEditText;
m_inlineEditText = NULL;
-
- m_longKeyPress = EFalse ;
UpdateInputModeState(EAknEditorNullInputMode, EAknEditorAllInputModes,EAknEditorStandardNumberModeKeymap);
- UpdateFlagsState(EAknEditorFlagDefault);
+ UpdateFlagsState(EAknEditorFlagDefault);
UpdateCaseState(EAknEditorLowerCase, EAknEditorAllCaseModes);
CancelFepInlineEdit();
@@ -256,7 +237,7 @@
if ( sc->isInPasswordField() ) {
caps |= TCoeInputCapabilities::ESecretText;
- UpdateFlagsState(EAknEditorFlagNoT9 | EAknEditorFlagLatinInputModesOnly);
+ UpdateFlagsState(EAknEditorFlagNoT9);
}
else {
@@ -327,7 +308,6 @@
{
CCoeEnv::Static()->ForEachFepObserverCall(FepObserverHandleStartOfTransactionL);
ClearInlineText();
- m_inlineTextEditingStarted= ETrue;
UpdateInlineText(aInitialInlineText);
}
@@ -359,22 +339,6 @@
// -----------------------------------------------------------------------------
void CWebFepTextEditor::CancelFepInlineEdit()
{
- if (IsTextAreaFocused()||IsInputElementFocused()) {
- if (m_inlineEditText && DocumentLengthForFep() < DocumentMaximumLengthForFep()) {
- HBufC* tempBuf = HBufC::NewLC(DocumentLengthForFep());
- TPtr ptr(tempBuf->Des());
- GetEditorContentForFep(ptr, 0, DocumentLengthForFep());
- TInt position = ptr.Locate(KLineEnterChar);
- if(position != KErrNotFound){
- TRAP_IGNORE(m_webView->fepTextEditor()->DoCommitFepInlineEditL());
- Frame* frame = m_webView->page()->focusController()->focusedOrMainFrame();
- if(frame){
- frame->editor()->execCommand("BackwardDelete");
- }
- }
- CleanupStack::PopAndDestroy();
- }
- }
}
// -----------------------------------------------------------------------------
@@ -424,9 +388,6 @@
if ( m_textFormatMask && m_textFormatMask->getMultitude() > 0 )
length = m_textFormatMask->getMultitude();
- if (IsLongKeyPress() &&
- (KMaxTInt != length))
- length += 1 ;
// TextArea node has no member function maxLength(), so return KMaxTInt
return length;
}
@@ -442,7 +403,7 @@
// see WebEditorClient::handleKeypress
Frame* frame = m_webView->page()->focusController()->focusedOrMainFrame();
Node* focusedNode = frame->document()->focusedNode();
- if ( focusedNode ) {
+ if ( frame && focusedNode) {
TInt lowPos = aCursorSelection.LowerPos();
TInt highPos = aCursorSelection.HigherPos();
if (focusedNode->hasTagName(HTMLNames::textareaTag)) {
@@ -469,7 +430,7 @@
Frame* frame = m_webView->page()->focusController()->focusedOrMainFrame();
Node* focusedNode = frame->document()->focusedNode();
- if (focusedNode) {
+ if (frame && focusedNode) {
if (focusedNode->hasTagName(HTMLNames::textareaTag)) {
HTMLTextAreaElement* textArea = static_cast<HTMLTextAreaElement*>(focusedNode);
TInt anchorPos = textArea->selectionStart();
@@ -552,13 +513,13 @@
if ( sc ){
IntRect rect = sc->caretRect();
Node* editNode = sc->focusNode();
- if ( editNode && editNode->isTextNode() ) {
- TPoint viewPoint = kit(frame)->frameView()->frameCoordsInViewCoords(editNode->getRect().Rect().iBr);
- xPos = viewPoint.iX;
- yPos = frame->document()->focusedNode()->getRect().bottomLeft().y() + rect.height();
-
- String str;
- WebCore::Text* aText = (WebCore::Text*)editNode;
+ TPoint viewPoint = kit(frame)->frameView()->frameCoordsInViewCoords(editNode->getRect().Rect().iBr);
+ xPos = viewPoint.iX;
+ yPos = viewPoint.iY;
+ String str;
+ if ( editNode &&
+ editNode->isTextNode() ) {
+ WebCore::Text* aText = (WebCore::Text*)editNode;
str = aText->data();
aDocumentPosition = aText->length();
TInt position = aDocumentPosition - ( str.reverseFind(KBlankDesC(), aDocumentPosition )+1);
@@ -596,16 +557,13 @@
HandleMaskedInsertText(frame, (String(*m_inlineEditText)));
}
else {
- frame->editor()->insertTextWithoutSendingTextEvent(String(*m_inlineEditText), false);
+ frame->editor()->insertTextWithoutSendingTextEvent(String(*m_inlineEditText), false);
}
}
}
//delete the m_inlineEditText since text is commited
delete m_inlineEditText;
m_inlineEditText = NULL;
-
- m_longKeyPress = EFalse;
- m_inlineTextEditingStarted= EFalse;
HandleUpdateCursor();
UpdateEditingMode();
@@ -677,7 +635,6 @@
{
aSetToTrue=ETrue;
SetCursorSelectionForFepL(aCursorSelection);
- m_longKeyPress = ETrue ;
StartFepInlineEditL(aInitialInlineText, aPositionOfInsertionPointInInlineText, aCursorVisibility, aCustomDraw, aInlineTextFormatRetriever, aPointerEventHandlerDuringInlineEdit);
}
@@ -736,28 +693,15 @@
CAknEdwinState* state = static_cast<CAknEdwinState*>(State(KNullUid));
if ( IsTextAreaFocused() ) {
-#ifdef BRDO_MULTITOUCH_ENABLED_FF
// If in a TextArea, allow "enter" key presses to be newline/paragraph
state->SetFlags( flags | EAknEditorFlagUseSCTNumericCharmap
- | EAknEditorFlagAllowEntersWithScrollDown | EAknEditorFlagSelectionVisible );
-#else
- state->SetFlags( flags | EAknEditorFlagUseSCTNumericCharmap
- | EAknEditorFlagAllowEntersWithScrollDown );
-#endif
+ | EAknEditorFlagAllowEntersWithScrollDown );
}
else {
-#ifdef BRDO_MULTITOUCH_ENABLED_FF
- state->SetFlags(flags | EAknEditorFlagUseSCTNumericCharmap | EAknEditorFlagSelectionVisible);
-#else
- state->SetFlags(flags | EAknEditorFlagUseSCTNumericCharmap );
-#endif
+ state->SetFlags(flags | EAknEditorFlagUseSCTNumericCharmap);
}
state->ReportAknEdStateEventL(MAknEdStateObserver::EAknEdwinStateFlagsUpdate);
- if (m_CcpuSupport)
- {
- TRAP_IGNORE(m_CcpuSupport->HandleFocusChangeL());
- }
}
// -----------------------------------------------------------------------------
@@ -785,6 +729,7 @@
state->SetCurrentInputMode(inputMode);
state->SetPermittedInputModes(permittedInputModes);
state->SetNumericKeymap(static_cast<TAknEditorNumericKeymap>(numericKeyMap));
+ state->ReportAknEdStateEventL(MAknEdStateObserver::EAknSyncEdwinState);
state->ReportAknEdStateEventL(MAknEdStateObserver::EAknEdwinStateInputModeUpdate);
}
@@ -826,10 +771,6 @@
CAknEdwinState* state = static_cast<CAknEdwinState*>(State(KNullUid));
if ( state ) {
TRAP_IGNORE( state->ReportAknEdStateEventL( MAknEdStateObserver::EAknCursorPositionChanged ) );
- if (m_CcpuSupport)
- {
- TRAP_IGNORE(m_CcpuSupport->HandleSelectionChangeL());
- }
}
}
@@ -852,11 +793,10 @@
TInputFormatMaskType fm = m_textFormatMask->getInputFormatMaskType(frame, cursorpos);
if (!cursorpos) {
while(fm == EStatic) {
- fm = m_textFormatMask->getInputFormatMaskType(frame, ++cursorpos);
+ fm = m_textFormatMask->getInputFormatMaskType(frame, ++cursorpos);
}
}
setSCTAvailability(true);
- CAknEdwinState* state = static_cast<CAknEdwinState*>(State(KNullUid));
switch( fm ) {
case ELeUpSymPuc: //A any upper case letter or symbolic
flags = EAknEditorFlagNoT9 | EAknEditorFlagFixedCase;
@@ -876,14 +816,14 @@
flags = EAknEditorFlagNoT9 | EAknEditorFlagFixedCase;
currentCase = EAknEditorUpperCase;
permittedCase= EAknEditorUpperCase;
- inputMode = state->CurrentInputMode();
+ inputMode = EAknEditorTextInputMode;
permittedInputModes= EAknEditorTextInputMode;
break;
case ELeLoNumSymPuc: //x any lower case, number or symbolic
flags = EAknEditorFlagNoT9 | EAknEditorFlagFixedCase;
currentCase = EAknEditorLowerCase;
permittedCase= EAknEditorLowerCase;
- inputMode = state->CurrentInputMode();
+ inputMode = EAknEditorTextInputMode;
permittedInputModes= EAknEditorTextInputMode | EAknEditorNumericInputMode;
break;
case EAnyLow: //m any lower character can be changed to upper
@@ -928,9 +868,6 @@
return ETrue;
}
- else {
- setSCTAvailability(true);
- }
return EFalse;
}
@@ -968,14 +905,10 @@
style->setProperty(CSS_PROP_COLOR, "red", false, ec);
return false;
}
- else if ( m_textFormatMask->acceptAll() )
- {
- return true;
- }
else
{
style->setProperty(CSS_PROP_COLOR, m_inputTextColor, false, ec);
- UpdateEditingMode();
+ CancelEditingMode();
return true;
}
}
@@ -1122,7 +1055,7 @@
// -----------------------------------------------------------------------------
TBool CWebFepTextEditor::CcpuIsFocused() const
{
- return (IsTextAreaFocused() || IsInputElementFocused());
+ return ETrue;
}
// -----------------------------------------------------------------------------
@@ -1134,7 +1067,7 @@
{
TCursorSelection selection;
GetCursorSelectionForFep(selection);
- return m_CcpuSupport && selection.Length();
+ return selection.Length();
}
// -----------------------------------------------------------------------------
@@ -1147,12 +1080,6 @@
PlaceDataOnClipboardL();
TCursorSelection selection;
GetCursorSelectionForFep(selection);
- Frame* frame = m_webView->page()->focusController()->focusedOrMainFrame();
- if (frame) {
- frame->editor()->deleteWithDirection(SelectionController::BACKWARD,
- CharacterGranularity, false, true);
- }
- HandleUpdateCursor();
}
// -----------------------------------------------------------------------------
@@ -1164,7 +1091,7 @@
{
TCursorSelection selection;
GetCursorSelectionForFep(selection);
- return m_CcpuSupport && selection.Length();
+ return selection.Length();
}
// -----------------------------------------------------------------------------
@@ -1175,8 +1102,6 @@
void CWebFepTextEditor::CcpuCopyL()
{
PlaceDataOnClipboardL();
- if (m_CcpuSupport)
- m_CcpuSupport->HandleSelectionChangeL();
}
// -----------------------------------------------------------------------------
@@ -1187,7 +1112,7 @@
TBool CWebFepTextEditor::CcpuCanPaste() const
{
TRAPD(err, DoCcpuCanPasteL());
- return (err == KErrNone) && m_CcpuSupport;
+ return err == KErrNone;
}
// -----------------------------------------------------------------------------
@@ -1206,7 +1131,7 @@
//
// -----------------------------------------------------------------------------
void CWebFepTextEditor::DoCcpuCanPasteL() const
-{
+{
CClipboard* cb=CClipboard::NewForReadingL(CCoeEnv::Static()->FsSession());
CleanupStack::PushL(cb);
TStreamId streamId=cb->StreamDictionary().At(KClipboardUidTypePlainText);
@@ -1257,8 +1182,8 @@
// -----------------------------------------------------------------------------
// HandleMaskedInsertText
-//
-//
+//
+//
// -----------------------------------------------------------------------------
void CWebFepTextEditor::HandleMaskedInsertText(WebCore::Frame *frame, const String& text)
{
@@ -1290,7 +1215,7 @@
// -----------------------------------------------------------------------------
// HandleMaskedDeleteText
//
-//
+//
// -----------------------------------------------------------------------------
void CWebFepTextEditor::HandleMaskedDeleteText(WebCore::Frame* frame)
{
@@ -1312,14 +1237,14 @@
// -----------------------------------------------------------------------------
// IsWapMaskedModeInput
//
-//
+//
// -----------------------------------------------------------------------------
bool CWebFepTextEditor::IsWapMaskedModeInput(WebCore::Frame* frame)
{
bool maskedInput(false);
- if (m_textFormatMask && frame->document() && frame->document()->focusedNode()) {
+ if (m_textFormatMask && frame->document() && frame->document()->focusedNode()) {
RenderStyle* s = frame->document()->focusedNode()->renderStyle();
- if (s && (!s->wapInputFormat().isEmpty() || s->wapInputRequired())){
+ if (s && (!s->wapInputFormat().isEmpty() || s->wapInputRequired())){
maskedInput = true;
}
}
@@ -1393,28 +1318,17 @@
//
//
// -----------------------------------------------------------------------------
-void CWebFepTextEditor::EnableCcpuL()
+void CWebFepTextEditor::EnableCcpu(TBool aSupport)
{
- CAknCcpuSupport* ccpu = NULL;
CAknEdwinState* edwinState = static_cast<CAknEdwinState*>(this->State(KNullUid));
- if ( edwinState && edwinState->MenuBar() && edwinState->MenuBar()->IsDisplayed() )
+ if(aSupport)
{
- return;
+ edwinState->SetCcpuState(this);
}
- ccpu = new(ELeave) CAknCcpuSupport(this);
- ccpu->SetMopParent(this);
- CleanupStack::PushL(ccpu);
- ccpu->ConstructL();
- CleanupStack::Pop(ccpu);
- delete m_CcpuSupport;
- m_CcpuSupport = ccpu;
- if (edwinState)
+ else
{
- edwinState->SetCcpuState(this);
- edwinState->SetMenu();
- if (edwinState->MenuBar())
- edwinState->MenuBar()->SetEditMenuObserver( m_CcpuSupport );
- }
+ edwinState->SetCcpuState(NULL);
+ }
}
// -----------------------------------------------------------------------------
@@ -1483,7 +1397,7 @@
// -----------------------------------------------------------------------------
// SetSCTAvailability
//
-// Set availibility of the special character table.
+// Set availibility of the special character table.
// -----------------------------------------------------------------------------
void CWebFepTextEditor::setSCTAvailability(bool aAvailable)
{
@@ -1499,31 +1413,3 @@
}
}
-// -----------------------------------------------------------------------------
-// IsLongKeyPress
-//
-// Called to know the status of the key pressed
-// -----------------------------------------------------------------------------
-TBool CWebFepTextEditor::IsLongKeyPress() const
- {
- return m_longKeyPress ;
- }
-
-TBool CWebFepTextEditor::IsInputElementFocused() const
- {
- Frame* frame = m_webView->page()->focusController()->focusedOrMainFrame();
- return ( frame && frame->document()->focusedNode() &&
- frame->document()->focusedNode()->hasTagName(HTMLNames::inputTag));
- }
-
-void CWebFepTextEditor::ReportEventL()
- {
- m_ExtendedInputCapabilities->ReportEventL(CAknExtendedInputCapabilities::
- MAknEventObserver::EPointerEventReceived, NULL );
- }
-
-TBool CWebFepTextEditor::inlineTextEditingStarted()
- {
- return m_inlineTextEditingStarted;
- }
-