[Panning] ScrollBy fails ...

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[Panning] ScrollBy fails ...

Antônio Gomes-2
guys,

I have a draft implementation of a panning (grab and drag) component  
(in C++) working quite fine for almost all tested websites. It's not
complicated at all, I'm just working with mouse press/move/release
events of a gtkmozembed browser, and scroll/pan it through some
nsGlobalWindow methods (e.g. ScrollBy).

However, when I try to pan gmail or any other js-based site for example,
the scrollBy method fails because of there is no nsIScrollableView
available.

quoted from nsGlobalWindow.cpp, line 3730

NS_IMETHODIMP
nsGlobalWindow::ScrollBy(PRInt32 aXScrollDif, PRInt32 aYScrollDif)
{
  nsresult result;
  nsIScrollableView *view = nsnull;      /// no addref/release for views/
  float p2t, t2p;

  FlushPendingNotifications(Flush_Layout);
  result = GetScrollInfo(&view, &p2t, &t2p);

  *if* (view) {
    nscoord xPos, yPos;
    result = view->GetScrollPosition(xPos, yPos);
    *if* (NS_SUCCEEDED(result)) {
      result = ScrollTo(NSTwipsToIntPixels(xPos, t2p) + aXScrollDif,
                        NSTwipsToIntPixels(yPos, t2p) + aYScrollDif);
       printf ("[DEBUGGING ENGINE] nsGlobalWindow::ScrollBy - we have 'view'\n");
    }
  } *else* printf ("[DEBUGGING ENGINE] there is no view\n");

  *return* result;

(...)

That's really odd once I can scroll same sites up/down (through mouse)
via scrollbars without problems.  So, my question is: Which other
methods I can use to scroll pages like these (and so improve my panning
component) ? What methods perform scrolling actions via scrollbars ?

Cheers

--Antonio Gomes
_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout
Reply | Threaded
Open this post in threaded view
|

Re: [Panning] ScrollBy fails ...

Boris Zbarsky
Antônio Gomes wrote:
> However, when I try to pan gmail or any other js-based site for example,
> the scrollBy method fails because of there is no nsIScrollableView
> available.

Is the site setting overflow:hidden or something?

> That's really odd once I can scroll same sites up/down (through mouse)
> via scrollbars without problems.

Is there a site you can scroll with the mouse but not via the scrollBy methods?

> So, my question is: Which other
> methods I can use to scroll pages like these (and so improve my panning
> component) ? What methods perform scrolling actions via scrollbars ?

Those methods are internal.

-Boris
_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout
Reply | Threaded
Open this post in threaded view
|

Re: [Panning] ScrollBy fails ...

Antônio Gomes-2
ext Boris Zbarsky wrote:

> Antônio Gomes wrote:
>
>> However, when I try to pan gmail or any other js-based site for
>> example, the scrollBy method fails because of there is no
>> nsIScrollableView available.
>
>
> Is the site setting overflow:hidden or something?

Boris, how can I check this ?

--Antonio

>
>> That's really odd once I can scroll same sites up/down (through
>> mouse) via scrollbars without problems.
>
>
> Is there a site you can scroll with the mouse but not via the scrollBy
> methods?


_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout
Reply | Threaded
Open this post in threaded view
|

Re: [Panning] ScrollBy fails ...

Boris Zbarsky
In reply to this post by Boris Zbarsky
Antônio Gomes wrote:
> Boris, how can I check this ?

DOM inspector or looking at the site's source, stylesheets, JS, etc?

-Boris
_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout
Reply | Threaded
Open this post in threaded view
|

Re: [Panning] ScrollBy fails ...

Antônio Gomes-2
In reply to this post by Boris Zbarsky
ext Boris Zbarsky wrote:

> Antônio Gomes wrote:
>
>> However, when I try to pan gmail or any other js-based site for
>> example, the scrollBy method fails because of there is no
>> nsIScrollableView available.
>
>
> Is the site setting overflow:hidden or something?

Yes, it is. Is it a problem ? Is there any workaround on it ?

Thanks

--Antonio Gomes
_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout
Reply | Threaded
Open this post in threaded view
|

Re: [Panning] ScrollBy fails ...

Boris Zbarsky
In reply to this post by Boris Zbarsky
Antônio Gomes wrote:
>> Is the site setting overflow:hidden or something?
>
> Yes, it is.

That means no scrolling, more or less.  Or at least no scrolling on the root.

> Is it a problem ? Is there any workaround on it ?

Depends on what you're trying to do, exactly.  Since I have no idea what that is...

-Boris

_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout
Reply | Threaded
Open this post in threaded view
|

Re: [Panning] ScrollBy fails ...

Antônio Gomes-2
ext Boris Zbarsky wrote:

> Antônio Gomes wrote:
>
>>> Is the site setting overflow:hidden or something?
>>
>>
>> Yes, it is.
>
>
> That means no scrolling, more or less.  Or at least no scrolling on
> the root.
>
>> Is it a problem ? Is there any workaround on it ?
>
>
> Depends on what you're trying to do, exactly.  Since I have no idea
> what that is...

After the boris' tip I took another path , and got C++ based panning
component  (acrobat-like) Thanks ;)

In short terms, it does as follows: after receiving a mouse_click event
I succeed recovering the html page's 'body' element, and then I can
scroll it using the SetScrollTop/Left methods to pan though the page.

   (...)
   nsHtmlElement->SetScrollTop(valeuY);
   nsHtmlElement->SetScrollLeft(valueX);


Altough, I've got it working properly for almost all tested webpages,
when I tried on for framed ones it does not work as expected. When my
original event target is a 'html frame', the panning is done only inside
the frame, but I'd like to pan the parent's  (enclosing) page instead.

How could I know if my original target is a HTML frame ? And then, how
could I get the its parent ?

--Antonio Gomes
_______________________________________________
dev-tech-layout mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-layout