Re: [webkit-dev] Why does PositionIterator iterates until the end of the document when selecting?

2012-03-30 Thread Sergiy Byelozyorov
I see now. However, this creates a problem if the nearest position is
really far. In my case we are having a huge document with over ~300 million
characters all of which are not selectable. Just iterating over all of
these characters takes over 10 seconds.

I think the solution would be to add a possibility to skip the element with
its children alltogether into increment function by calling
new Node::areChildrenSelectable method. This would return true by default
and will be overriden in some element types. Do you think it's a feasible
solution? I am worried about the cost to the virtual function call, however
it should only cause problems if there are really many elements as well. Is
PositionInterator used somewhere else other than in selecting charaters?

P.S. All of this text is actually not even displayed - it is used as 3D
vertex arrays for geometry.

Sergiy Byelozyorov
Computer Graphics Chair
Universitat des Saarlandes
Tel.: +49 (681) 302-3837
Web: http://graphics.cs.uni-saarland.de/sbyelozyorov/



On Thu, Mar 29, 2012 at 22:56, Ojan Vafai o...@chromium.org wrote:

 One case where this matters: div
 style=-webkit-user-select:nonefoo/divbar

 If you mousedown on foo and drag right, you want to start selecting
 bar. In the common case, we don't do any walking. The next position we grab
 from the iterator is valid and we use it.

 On Thu, Mar 29, 2012 at 7:27 AM, Sergiy Byelozyorov 
 byelozyo...@cs.uni-saarland.de wrote:

 Hi,

 When searching for the character to be selected (on mouse click), we run
 an interator over the characters to determine the one under the cursor. I
 am trying to understand why does PositionInterator that is used in this
 case iterates over all characters starting from the element that was
 clicked and until the end of the document(!). The following method is
 called to verify whether PositionIterator has finished traversing the
 characters (see comments inline):

 bool PositionIterator::atEnd() const

 {

 if (!m_anchorNode) // This is clear - if we don't have an an anchor
 - then we are done.

 return true;

 if (m_nodeAfterPositionInAnchor) // This is also understandable - if
 there is a next position then we are not at the end.

 return false;

 // This is what puzzles me. First check will be true until we will
 reach the root of the Document.

 return !m_anchorNode-parentNode()  (m_anchorNode-hasChildNodes()
 || m_offsetInAnchor = lastOffsetForEditing(m_anchorNode));

 }

 Is this the intended behaviour? Why wouldn't we just stay within the
 element that was clicked on? This would save us a lot of CPU cycles because
 we won't be checking text that in all other elements until the end of the
 document, wouldn't it? This check has been around since at least 2004, so I
 doub't that it's wrong, but I don't get the logic here. Please explain this
 to me. Thanks.

 Sergiy Byelozyorov
 Computer Graphics Chair
 Universitat des Saarlandes
 Tel.: +49 (681) 302-3837
 Web: http://graphics.cs.uni-saarland.de/sbyelozyorov/


 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev



___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] Why does PositionIterator iterates until the end of the document when selecting?

2012-03-30 Thread Sergiy Byelozyorov
Hi,

Thanks for the link. I think it would be sufficient help in my case already
to skip content of nodes without a renderer (I have few thousands of them,
but it's far less than number of characters). I was also using outdated
version of WebKit - revisition 101748. I will try to either integrate your
patch in the version that I have or update to the newest version.

Sergiy Byelozyorov
Computer Graphics Chair
Universitat des Saarlandes
Tel.: +49 (681) 302-3837
Web: http://graphics.cs.uni-saarland.de/sbyelozyorov/



On Fri, Mar 30, 2012 at 19:41, Yong Li yong.li.web...@gmail.com wrote:

 I tried skipping hidden nodes bug didn't finish the task
 (https://bugs.webkit.org/show_bug.cgi?id=65377).

 It would be very nice we can skip entire nodes when possible.


 2012/3/30 Sergiy Byelozyorov byelozyo...@cs.uni-saarland.de:
  I see now. However, this creates a problem if the nearest position is
 really
  far. In my case we are having a huge document with over ~300 million
  characters all of which are not selectable. Just iterating over all of
 these
  characters takes over 10 seconds.
 
  I think the solution would be to add a possibility to skip the element
 with
  its children alltogether into increment function by calling
  new Node::areChildrenSelectable method. This would return true by default
  and will be overriden in some element types. Do you think it's a feasible
  solution? I am worried about the cost to the virtual function call,
 however
  it should only cause problems if there are really many elements as well.
 Is
  PositionInterator used somewhere else other than in selecting charaters?
 
  P.S. All of this text is actually not even displayed - it is used as 3D
  vertex arrays for geometry.
 
 
  Sergiy Byelozyorov
  Computer Graphics Chair
  Universitat des Saarlandes
  Tel.: +49 (681) 302-3837
  Web: http://graphics.cs.uni-saarland.de/sbyelozyorov/
 
 
 
  On Thu, Mar 29, 2012 at 22:56, Ojan Vafai o...@chromium.org wrote:
 
  One case where this matters: div
  style=-webkit-user-select:nonefoo/divbar
 
  If you mousedown on foo and drag right, you want to start selecting
  bar. In the common case, we don't do any walking. The next position we
 grab
  from the iterator is valid and we use it.
 
  On Thu, Mar 29, 2012 at 7:27 AM, Sergiy Byelozyorov
  byelozyo...@cs.uni-saarland.de wrote:
 
  Hi,
 
  When searching for the character to be selected (on mouse click), we
 run
  an interator over the characters to determine the one under the
 cursor. I am
  trying to understand why does PositionInterator that is used in this
 case
  iterates over all characters starting from the element that was
 clicked and
  until the end of the document(!). The following method is called to
 verify
  whether PositionIterator has finished traversing the characters (see
  comments inline):
 
  bool PositionIterator::atEnd() const
 
  {
 
  if (!m_anchorNode) // This is clear - if we don't have an an
 anchor -
  then we are done.
 
  return true;
 
  if (m_nodeAfterPositionInAnchor) // This is also understandable -
 if
  there is a next position then we are not at the end.
 
  return false;
 
  // This is what puzzles me. First check will be true until we will
  reach the root of the Document.
 
  return !m_anchorNode-parentNode() 
 (m_anchorNode-hasChildNodes()
  || m_offsetInAnchor = lastOffsetForEditing(m_anchorNode));
 
  }
 
 
  Is this the intended behaviour? Why wouldn't we just stay within the
  element that was clicked on? This would save us a lot of CPU cycles
 because
  we won't be checking text that in all other elements until the end of
 the
  document, wouldn't it? This check has been around since at least 2004,
 so I
  doub't that it's wrong, but I don't get the logic here. Please explain
 this
  to me. Thanks.
 
  Sergiy Byelozyorov
  Computer Graphics Chair
  Universitat des Saarlandes
  Tel.: +49 (681) 302-3837
  Web: http://graphics.cs.uni-saarland.de/sbyelozyorov/
 
 
  ___
  webkit-dev mailing list
  webkit-dev@lists.webkit.org
  http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
 
 
 
 
  ___
  webkit-dev mailing list
  webkit-dev@lists.webkit.org
  http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
 

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


[webkit-dev] Why does PositionIterator iterates until the end of the document when selecting?

2012-03-29 Thread Sergiy Byelozyorov
Hi,

When searching for the character to be selected (on mouse click), we run an
interator over the characters to determine the one under the cursor. I am
trying to understand why does PositionInterator that is used in this case
iterates over all characters starting from the element that was clicked and
until the end of the document(!). The following method is called to verify
whether PositionIterator has finished traversing the characters (see
comments inline):

bool PositionIterator::atEnd() const

{

if (!m_anchorNode) // This is clear - if we don't have an an anchor -
then we are done.

return true;

if (m_nodeAfterPositionInAnchor) // This is also understandable - if
there is a next position then we are not at the end.

return false;

// This is what puzzles me. First check will be true until we will
reach the root of the Document.

return !m_anchorNode-parentNode()  (m_anchorNode-hasChildNodes() ||
m_offsetInAnchor = lastOffsetForEditing(m_anchorNode));

}

Is this the intended behaviour? Why wouldn't we just stay within the
element that was clicked on? This would save us a lot of CPU cycles because
we won't be checking text that in all other elements until the end of the
document, wouldn't it? This check has been around since at least 2004, so I
doub't that it's wrong, but I don't get the logic here. Please explain this
to me. Thanks.

Sergiy Byelozyorov
Computer Graphics Chair
Universitat des Saarlandes
Tel.: +49 (681) 302-3837
Web: http://graphics.cs.uni-saarland.de/sbyelozyorov/
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


[webkit-dev] Creating a new MouseEvent type

2011-07-09 Thread Sergiy Byelozyorov
Dear developers,

I am experimenting with a new event type that will contain additional
information compared to MouseEvent. In particular since the event is
generated for 3D content, there will be 3D hitpoint position and normal.
However I am little confused with event generation system and picking.
Please let me explain in more detail.

I have a number of new element types that I have introduced into WebKit. The
only element that has a renderer is 3D scene root element
(XML3DXml3dElement). Renderer overrides RenderBox::nodeAtPoint, which
returns the node that corresponds to the actual element in the DOM that is
under the mouse. Now I need to create XML3DMouseEvent instead of MouseEvent
somewhere. I have tried to figure out how the mouse events are generated by
stepping through the code. I have learned that for mouse move events
WebKit::WebKitImpl::mouseMove starts picking process (that reaches
XML3DRenderer::nodeAtPoint at some point), then generates and dispatches the
event in Node::dispatchMouseEvent.

Should I override Node::dispatchMouseEvent? How can I pass the extra
information that I need to put into event from RenderBox::nodeAtPoint to
Node::displayMouseEvent? Do I need to extend PlatformMouseEvent class?

Thank you for your answers.

Sergiy Byelozyorov
Computer Graphics Chair
Universitat des Saarlandes
Tel.: +49 (681) 302-3837
Web: http://graphics.cs.uni-saarland.de/sbyelozyorov/
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] Mouse event position related to actual element content

2011-07-09 Thread Sergiy Byelozyorov
Hello,

After some experimenting I have figured out that computing mouse position
relative to the actual content (also ignoring all borders, margins and
padding) can be done as following:

int innerX = xPos - tx - x();
int innerY = yPos - ty - y();

It has worked for me for a long time already. Please let me know if I am
wrong and not taking some special cases into account.

Sergiy Byelozyorov
Computer Graphics Chair
Universitat des Saarlandes
Tel.: +49 (681) 302-3837
Web: http://graphics.cs.uni-saarland.de/sbyelozyorov/



On Thu, Mar 3, 2011 at 13:50, Sergiy Byelozyorov 
byelozyo...@cs.uni-saarland.de wrote:

 Hello,

 I develop an extension to WebKit which adds support for 
 XML3Dhttp://www.xml3d.org.
 For mouse events on XML3D element I have created custom event type
 XML3DMouseEvent that inherits from MouseEvent. In addition to normal
 coordinates it also has 3D position and normal of the element under the
 cursor. In order to avoid massive changes into WebKit I have decided to
 convert existing event from MouseEvent into XML3DMouseEvent when going
 though overloaded XML3DElement::dispatchEvent which allows me to create
 custom event class only for XML3D elements.

 There I also need to perform picking again to actually receive normal and
 position. However at this stage I don't have actual coordinates where mouse
 was relative to the actual rendered image (line x, y, tx and ty in
 RenderObject::nodeAtPoint). All I get is MouseEvent with all it's parameters
 and the element itself.

 Originally I tried using pageX and pageY and deducted offsetTop and
 offsetLeft from them, but this does not take borders and padding into
 account. I have tried accessing computedStyle to get border and padding
 width, but the value in there has type Length and I am not sure how to
 convert it to actual pixels.

 Please let me know how can mouse event position relative to element content
 (not to border or padding). If there is a nicer and more straitforward way
 to implement XML3DMouseEvent I would be happy to hear them.

 Sergiy Byelozyorov
 Computer Graphics Chair
 Universitat des Saarlandes
 Tel.: +49 (681) 302-3837
 Web: http://graphics.cs.uni-saarland.de/sbyelozyorov/


___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] ImageLoader class

2011-07-09 Thread Sergiy Byelozyorov
Hello,

It took me long before I have figured these things on my own. May be this
will be useful for someone.


1. How do I know that the image was loaded already? Can I set up
callback somehow?

 ImageLoader::imageChanged is called whenever new piece of data is decoded
(even if this is only part of the whole image).


1. What should functions sourceURI() and dispatchLoadEvent() do?

 sourceURI should return actual URI while being passed an attribute that
contains. dispatchLoadEvent dispatches load event to the DOM. I use
implementation similar to HTMLImageLoader for these two methods.


1. What is pixel format
for m_imageLoader.image()-image()-data()-data()? Is this the right way 
 to
access loaded image raw pixel data?

 The right way to get an image is the following:

Image* image = m_imageLoader.image()-image();

Then depending on the rendering engine one should use different classes. I
have only implemented it for SKIA as following:

const NativeImageSkia* skiaImage = image-nativeImageForCurrentFrame();
SkBitmap::Config config = skiaImage-config(); // this contains pixel format


1. How can I handle animations (e.g. GIF files)? How do I know when the
next image in the animation suquence is ready? Another callback?

 ImageLoader::imageChanged is also called for animated images.


1. Which image formats are supported? Can I add my own, like HDR?

 This one I do not know yet :).


 Thank you.

 Sergiy

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


[webkit-dev] Painting Phases

2011-05-10 Thread Sergiy Byelozyorov
Good time of the day,

In RenderObject.h there are 12 phases of painting. Please explain what do
these mean and in which sequence they are called. If there is some
documentation already (either in code or on the website), please give me a
link. Thank you.

enum PaintPhase {
PaintPhaseBlockBackground,
PaintPhaseChildBlockBackground,
PaintPhaseChildBlockBackgrounds,
PaintPhaseFloat,
PaintPhaseForeground,
PaintPhaseOutline,
PaintPhaseChildOutlines,
PaintPhaseSelfOutline,
PaintPhaseSelection,
PaintPhaseCollapsedTableBorders,
PaintPhaseTextClip,
PaintPhaseMask
};

Sergiy Byelozyorov
Computer Graphics Chair
Universitat des Saarlandes
Tel.: +49 (681) 302-3837
Web: http://graphics.cs.uni-saarland.de/sbyelozyorov/
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] Fwd: Re: Painting Phases

2011-05-10 Thread Sergiy Byelozyorov
Great video. I was looking for something similar long time ago. Thanks a
lot.

Sergiy Byelozyorov
Computer Graphics Chair
Universitat des Saarlandes
Tel.: +49 (681) 302-3837
Web: http://graphics.cs.uni-saarland.de/sbyelozyorov/



On Tue, May 10, 2011 at 15:17, Mike Lawther mikelawt...@chromium.orgwrote:

 There is a good video somewhere that Eric Seidel describes the
  rendering inside WebKit that covers this.

 I think http://www.youtube.com/watch?v=RVnARGhhs9w is the right one.

mike
 ___
 webkit-dev mailing list
 webkit-dev@lists.webkit.org
 http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


[webkit-dev] Mouse event position related to actual element content

2011-03-03 Thread Sergiy Byelozyorov
Hello,

I develop an extension to WebKit which adds support for
XML3Dhttp://www.xml3d.org.
For mouse events on XML3D element I have created custom event type
XML3DMouseEvent that inherits from MouseEvent. In addition to normal
coordinates it also has 3D position and normal of the element under the
cursor. In order to avoid massive changes into WebKit I have decided to
convert existing event from MouseEvent into XML3DMouseEvent when going
though overloaded XML3DElement::dispatchEvent which allows me to create
custom event class only for XML3D elements.

There I also need to perform picking again to actually receive normal and
position. However at this stage I don't have actual coordinates where mouse
was relative to the actual rendered image (line x, y, tx and ty in
RenderObject::nodeAtPoint). All I get is MouseEvent with all it's parameters
and the element itself.

Originally I tried using pageX and pageY and deducted offsetTop and
offsetLeft from them, but this does not take borders and padding into
account. I have tried accessing computedStyle to get border and padding
width, but the value in there has type Length and I am not sure how to
convert it to actual pixels.

Please let me know how can mouse event position relative to element content
(not to border or padding). If there is a nicer and more straitforward way
to implement XML3DMouseEvent I would be happy to hear them.

Sergiy Byelozyorov
Computer Graphics Chair
Universitat des Saarlandes
Tel.: +49 (681) 302-3837
Web: http://graphics.cs.uni-saarland.de/sbyelozyorov/
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] attach/detach or insertedIntoDocument/removedFromDocument

2010-04-29 Thread Sergiy Byelozyorov
Noone?

Sergiy


On Tue, Apr 27, 2010 at 12:59 PM, Sergiy Byelozyorov 
r...@graphics.cs.uni-sb.de wrote:

 Hello,

 I am implementing XML3D http://www.xml3d.org/ format into WebKit. I have
 a number of new elements that I have added to a separate namespace. Root
 element is xml3d and it's the only one who has a renderer. Every child
 that is attached to the subtree of this element should notify parent element
 about itself and register themselves with this renderer. I need to have a
 function that I can override to perform this initialization. My
 implementation uses third party library for rendering and requires me to
 have a single renderer to render the whole scene, therefore I can't split
 renderer into many subrenderers for each node. Moreover, 3D scenes do not
 follow box model and rendering of single node often requires to interact
 with other elements in the scene (e.g. for ray tracing) thus storing the
 entire scene in the single data-structure is more effective.

 To perform the registration with the parent renderer I have tried using
 insertedIntoDocument/removedFromDocument, but they result in overhead when
 I am attaching element to a tree which is not rendered at all (such as
 loaded by Ajax). Then I switched to attach/detach but these are called
 many times, i.e. every node gets attached, detached, attached again etc.
 while loading the document, which still causes the overhead. Is there any
 set of functions that would allow me to know when I am attached to the
 subtree and that tree should be rendered?

 Thank you in advance,
 Sergiy

___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


[webkit-dev] attach/detach or insertedIntoDocument/removedFromDocument

2010-04-27 Thread Sergiy Byelozyorov
Hello,

I am implementing XML3D http://www.xml3d.org/ format into WebKit. I have a
number of new elements that I have added to a separate namespace. Root
element is xml3d and it's the only one who has a renderer. Every child
that is attached to the subtree of this element should notify parent element
about itself and register themselves with this renderer. I need to have a
function that I can override to perform this initialization. My
implementation uses third party library for rendering and requires me to
have a single renderer to render the whole scene, therefore I can't split
renderer into many subrenderers for each node. Moreover, 3D scenes do not
follow box model and rendering of single node often requires to interact
with other elements in the scene (e.g. for ray tracing) thus storing the
entire scene in the single data-structure is more effective.

To perform the registration with the parent renderer I have tried using
insertedIntoDocument/removedFromDocument, but they result in overhead when I
am attaching element to a tree which is not rendered at all (such as loaded
by Ajax). Then I switched to attach/detach but these are called many times,
i.e. every node gets attached, detached, attached again etc. while loading
the document, which still causes the overhead. Is there any set of functions
that would allow me to know when I am attached to the subtree and that tree
should be rendered?

Thank you in advance,
Sergiy
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


[webkit-dev] ImageLoader class

2009-11-25 Thread Sergiy Byelozyorov
Hello,

I am writing my own class using ImageLoader. Can somebody, please, help me
with these questions:

   1. How do I know that the image was loaded already? Can I set up callback
   somehow?
   2. What should functions sourceURI() and dispatchLoadEvent() do?
   3. What is pixel format
   for m_imageLoader.image()-image()-data()-data()? Is this the right way to
   access loaded image raw pixel data?
   4. How can I handle animations (e.g. GIF files)? How do I know when the
   next image in the animation suquence is ready? Another callback?
   5. Which image formats are supported? Can I add my own, like HDR?

Thank you.

Sergiy
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev