Ejemplo n.º 1
0
void PlatformScrollbar::updateViewOnMouseHover()
{
    EA::Raster::Surface* const pSurface = containingWindow();
    EA::WebKit::View* pView = static_cast<EA::WebKit::View*>(pSurface->mpUserData);
    const EA::WebKit::ViewParameters& vPm = pView->GetParameters();
    if(vPm.mbRedrawScrollbarOnCursorHover)
    {
        EA::WebKit::ViewNotification* pVN = EA::WebKit::GetViewNotification();
        if(pVN != NULL)
        {
            GraphicsContext context(pSurface);

            IntRect dmgRect;
            switch ((int)m_hoveredPart)
            {
            case BackButtonPart:
                dmgRect = backButtonRect();
                break;
            case ForwardButtonPart:
                 dmgRect = forwardButtonRect();
                break;
            case ThumbPart:
                 dmgRect = thumbRect();
                break;
            }
            paint(&context, dmgRect);
            EA::WebKit::ViewUpdateInfo vui = { pView,  x(), y(), width(), height() };
            pVN->ViewUpdate(vui);
        }
    }
}
Ejemplo n.º 2
0
void ChromeClientEA::setToolTip(const String &tip, TextDirection)
{
    if(!EA::WebKit::GetParameters().mDefaultToolTipEnabled)
        return;

    EA::WebKit::View* pView = m_webPage->view();
    String tipText(tip);
    pView->SetToolTip(tipText.charactersWithNullTermination()); 
}
Ejemplo n.º 3
0
void WebViewPrivate::onExpose(BalEventExpose eventExpose)
{
    //OWB_PRINTF("WebViewPrivate::onExpose\n");
    Frame* frame = core(m_webView->mainFrame());
    if (!frame)
        return;

    if(!isInitialized) {
        //OWB_PRINTF("not isInitialized\n");
        isInitialized = true;
        frame->view()->resize(m_rect.width(), m_rect.height());
        frame->forceLayout();
        frame->view()->adjustViewSize();
    }

    GraphicsContext ctx(m_webView->viewWindow());
    ctx.setBalExposeEvent(&eventExpose);
    if (frame->contentRenderer() && frame->view() && !m_webView->dirtyRegion().isEmpty()) {
        frame->view()->layoutIfNeededRecursive();
        IntRect dirty = m_webView->dirtyRegion();
        
        // Notify the user of the draw start event.
        EA::WebKit::ViewNotification* pVN = EA::WebKit::GetViewNotification();

        EA::WebKit::View* pView = EA::WebKit::GetView(m_webView);
        
        // Clip to the main view surface and not just the dirty rect for notification.    
        int w=0;
        int h=0;
        if(pView)
            pView->GetSize(w,h);
        IntRect rect(0,0,w,h);
        rect.intersect(dirty);

        EA::WebKit::ViewUpdateInfo vui = { pView, rect.x(), rect.y(), rect.width(), rect.height(), EA::WebKit::ViewUpdateInfo::kViewDrawStart};
        if(pVN)
            pVN->DrawEvent(vui);

        frame->view()->paint(&ctx, dirty);

       // Notify the user of end draw event     
        if(pVN) {
            vui.mDrawEvent = EA::WebKit::ViewUpdateInfo::kViewDrawEnd;
            pVN->DrawEvent(vui);
            
           // TODO: Deprecate this view update 
          pVN->ViewUpdate(vui);
        }

        m_webView->clearDirtyRegion();
    }
}
Ejemplo n.º 4
0
CD3D9WebView * CD3D9WebKit::CreateView(int width, int height, LPDIRECT3DDEVICE9 device)
{
	EA::WebKit::View * view = webkit->CreateView();
	EA::WebKit::ViewParameters params = view->GetParameters();
	params.mWidth = width;
	params.mHeight = height;
	view->InitView(params);
	view->SetSize(width, height);

	view->CreateJavascriptBindings("IVMP");

	CD3D9WebView * webView = new CD3D9WebView(width, height, view);

	views.push_back(webView);
		
	return webView;
}
Ejemplo n.º 5
0
void DocumentLoader::setTitle(const String& title)
{
    if (title.isEmpty())
        return;

    String trimmed = canonicalizedTitle(title, m_frame);
    if (!trimmed.isEmpty() && m_pageTitle != trimmed) {
        frameLoader()->willChangeTitle(this);
        m_pageTitle = trimmed;
        frameLoader()->didChangeTitle(this);

        //+ 8/26/09 CSidhall - Added title setting for API
        EA::WebKit::View* pView = EA::WebKit::GetView(frame());
        if(pView){
            EA::WebKit::LoadInfo& loadInfo = pView->GetLoadInfo();
            GetFixedString(loadInfo.mPageTitle)->assign(trimmed.characters(), trimmed.length());
        }
        //- CS
    }
}
Ejemplo n.º 6
0
void EditorClientEA::setInputMethodState(bool active)
{
	WebCore::Node* pNode = NULL;
	Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame();
	if (frame && frame->document() && frame->document()->focusedNode())
	{
		pNode = frame->document()->focusedNode();
	}	

	// Note by Arpit Baldeva: If on console(true by default on consoles/can be enabled on PC through emulation), 
	// we detect if the node was focused due to the user input or through javascript.
	// If the node was focused by user input(such as click), we present the editor(emulated keyboard on consoles, debug log on PC).
	// If the node was focused by javascript, we make the cursor jump to the node. In addition, we blur <input>/<textarea> element 
	// so that the user click can bring up the emulated keyboard.
	EA::WebKit::View* pView = m_page->view();
#if defined(EA_PLATFORM_CONSOLE)
	bool onConsole = true;
#elif defined(EA_PLATFORM_WINDOWS)
	bool onConsole = pView->IsEmulatingConsoleOnPC();
#elif defined(EA_PLATFORM_OSX)
	bool onConsole = false;
#endif
	
	if(onConsole && !pView->AllowJSTextInputStateNotificationOnConsole())
	{
		if(!m_page->handle()->mouseCausedEventActive)
		{
			pView->MoveMouseCursorToNode(pNode);
			if (pNode && pNode->isHTMLElement())
			{
				if(pNode->hasTagName(WebCore::HTMLNames::inputTag) || pNode->hasTagName(WebCore::HTMLNames::textareaTag)) 
				{
					HTMLElement* pElement = static_cast<HTMLElement*> (pNode);
					pElement->blur();
				}
			}
			return;
		}
	}
	
	// CSidhall 1/22/09 Added notify user app of text input state for possible virtual keyboard...
	// We can't fully trust the enabled flag because the input field might be a password in which case we still
	// want to activate the keyboard input. So we do our own checking and also get extra info...   

	//Note by Arpit Baldeva: We are interested in the <input> and <textarea> elements. The problem is that we can't rely on the shouldUseInputMethod() of node to reliably detect an
	//editable node since it does not include password(as noted above). Webkit trunk has some cryptic comment explaining why that is the right thing to do. So we do as follows. 
	// We could add a new method to the class hierarchy to achieve following but want to minimize the changes inside core layer.

	bool inputActive	= active;
	bool searchActive	= false;
	bool passwordActive = false;
	EA::WebKit::KeyboardType kbType = EA::WebKit::kDefaultKeyBoard;
	EA::WebKit::InputType inputType = EA::WebKit::kInputTypeNone;

	
    if( pNode && pNode->isHTMLElement())
	{
		if(pNode->hasTagName(WebCore::HTMLNames::inputTag) ) 
		{	
			HTMLInputElement* pInputElement = static_cast<HTMLInputElement*> (pNode);
			inputActive		= pInputElement->isTextField(); // This check makes sure that we are not firing this event with inputActive set to true in case of HTML like <input type="button" value="Click me" onclick="msg()">
			//+ Deprecated
			searchActive	= pInputElement->isSearchField();
			passwordActive	= pInputElement->isPasswordField();
			//-
			
			//New HTML5 input types (text field related)
			if(pInputElement->isEmailField())
				inputType = EA::WebKit::kInputTypeEmail;
			else if (pInputElement->isNumberField())
				inputType = EA::WebKit::kInputTypeNumber;
			else if(pInputElement->isSearchField())
				inputType = EA::WebKit::kInputTypeSearch;
			else if(pInputElement->isTelephoneField())
				inputType = EA::WebKit::kInputTypeTelephone;
			else if(pInputElement->isURLField())
				inputType = EA::WebKit::kInputTypeUrl;
			else if(pInputElement->isPasswordField())
				inputType = EA::WebKit::kInputTypePassword;

		}
/*			//Note by Arpit Baldeva: This will always come back as true but provided the commented out code here for the sack of clarity
		else if(pNode->hasTagName(WebCore::HTMLNames::textareaTag))
		{
			inputActive = enabled;
		}
*/

		HTMLElement* pElement = static_cast<HTMLElement*> (pNode);
		if(pElement->hasClass())
		{
			const WebCore::SpaceSplitString& classNames = pElement->classNames();
			for(int i = 0; i < EA::WebKit::kCountKeyBoardTypes; ++i)
			{
				if(classNames.contains(sKeyBoardClassMap[i].mKeyboardClass))
				{
					kbType = sKeyBoardClassMap[i].mKeyboardType;
					break;
				}
			}
		}
		// Update - 12/20/2010. Since we have the password information available from the HTML, we use it
		// if the keyboard is not overridden.
		if(passwordActive && (kbType == EA::WebKit::kDefaultKeyBoard))
		{
			kbType = EA::WebKit::kPasswordKeyBoard;
		}
    }    

    // Check if should disable the caret.
    if (pView->IsCaretDisabledOnConsole() && frame && frame->selection()) 
        frame->selection()->setCaretVisible(false);

	using namespace EA::WebKit;
	if(EAWebKitClient* const pClient = GetEAWebKitClient(pView))
	{
        // Store the current settings
        EA::WebKit::TextInputStateInfo textInfo;
        textInfo.mpView				= pView;
		textInfo.mpUserData			= pView->GetUserData();
        textInfo.mIsActivated		= inputActive;
        textInfo.mIsPasswordField	= passwordActive;
        textInfo.mIsSearchField		= searchActive;
		textInfo.mKeyboardType		= kbType;
		textInfo.mInputType			= inputType;

        pClient->TextInputState(textInfo);
    }
}