void NativeViewHost::Layout()
    {
        if((!native_view_ && !view_view_) || !native_wrapper_.get())
        {
            return;
        }

        gfx::Rect vis_bounds = GetVisibleBounds();
        bool visible = !vis_bounds.IsEmpty();

        if(visible && !fast_resize_)
        {
            if(vis_bounds.size() != size())
            {
                // Only a portion of the Widget is really visible.
                int x = vis_bounds.x();
                int y = vis_bounds.y();
                native_wrapper_->InstallClip(x, y, vis_bounds.width(),
                    vis_bounds.height());
            }
            else if(native_wrapper_->HasInstalledClip())
            {
                // The whole widget is visible but we installed a clip on the widget,
                // uninstall it.
                native_wrapper_->UninstallClip();
            }
        }

        if(visible)
        {
            // Since widgets know nothing about the View hierarchy (they are direct
            // children of the Widget that hosts our View hierarchy) they need to be
            // positioned in the coordinate system of the Widget, not the current
            // view.  Also, they should be positioned respecting the border insets
            // of the native view.
            gfx::Rect local_bounds = ConvertRectToWidget(GetContentsBounds());
            native_wrapper_->ShowWidget(local_bounds.x(), local_bounds.y(),
                local_bounds.width(), local_bounds.height());
        }
        else
        {
            native_wrapper_->HideWidget();
        }
    }
Example #2
0
    void FlashView::OnAxInvalidate(const gfx::Rect& rect)
    {
		gfx::Rect invalidate = ConvertRectToWidget(rect);
        SchedulePaintInRect(invalidate);
    }
Example #3
0
	void PuttyView::Layout()
	{
		RECT viewRect = ConvertRectToWidget(bounds()).ToRECT();
		puttyController_->setPagePos(&viewRect);
	}