[webkit-dev] Could someone explain a bit on document fragments?

2010-08-20 Thread Matt 'Murph' Finnicum
I see, for a large page, that a document is created and then a number
of fragments. Are these fragments all then merged into that document?
Or are they merged into one another, forming a new document somehow?
Where is that done?

What would be a acceptable way to measure the total time spent
parsing? Going from parser creation to parser finish doesn't work when
there are many document fragments, each with it's own parser. Should I
add up the time spent in all of the parsers?

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


[webkit-dev] How to properly create some element nodes within webcore?

2010-07-07 Thread Matt 'Murph' Finnicum
I know this sounds a bit silly, but it's a simplified version of what i'm doing.

Let's say I decided to replace every webpage with hello world. I
decided to do this from finishedParsing() within dom/Document.cpp:

void Document::finishedParsing()
{
ExceptionCode ec = 0;
HTMLBodyElement* body_node = new HTMLBodyElement(bodyTag, this);
setBody(body_node, ec);

RefPtrNode new_node = Text::create(this, Hello, World);
body_node - appendChild(new_node,ec);

-- rest of finishedParsing as usual --

That works fine.

Now lets say I want it to be blue:

void Document::finishedParsing()
{
ExceptionCode ec = 0;
HTMLBodyElement* body_node = new HTMLBodyElement(bodyTag, this);
setBody(body_node, ec);

RefPtrNode new_font_node =
HTMLElementFactory::createHTMLElement(QualifiedName(nullAtom,
String(font),nullAtom), this, 0, false);

static_castElement*(new_font_node.get())-setAttribute(String(bolor),String(blue),ec);
RefPtrNode new_text_node = Text::create(this, Hello, World);
new_font_node - appendChild(new_text_node,ec);
body_node - appendChild(new_font_node,ec);

--rest of finshedParsing as usual --

Again, this works fine.

But blue is too flashy for my taste, and I now want it to just be bolded.
void Document::finishedParsing()
{
ExceptionCode ec = 0;
HTMLBodyElement* body_node = new HTMLBodyElement(bodyTag, this);
setBody(body_node, ec);

RefPtrNode new_bold_node =
HTMLElementFactory::createHTMLElement(QualifiedName(nullAtom,
String(b),nullAtom), this, 0, false);
RefPtrNode new_text_node = Text::create(this, Hello, World);
new_bold_node - appendChild(new_text_node,ec);
body_node - appendChild(new_bold_node,ec);

--rest of finishedParsing as usual --

... nothing is bold. Other, similar elements like 'strong' 'em' 'u'
'i' don't do anything.

What am I doing wrong?

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


Re: [webkit-dev] How to properly create some element nodes within webcore?

2010-07-07 Thread Matt 'Murph' Finnicum
That was it.
Thanks a million!

On Wed, Jul 7, 2010 at 12:34 PM, Sam Weinig sam.wei...@gmail.com wrote:


 On Wed, Jul 7, 2010 at 8:30 AM, Matt 'Murph' Finnicum mattf...@gmail.com
 wrote:

 I know this sounds a bit silly, but it's a simplified version of what i'm
 doing.

 Let's say I decided to replace every webpage with hello world. I
 decided to do this from finishedParsing() within dom/Document.cpp:

 void Document::finishedParsing()
 {
    ExceptionCode ec = 0;
    HTMLBodyElement* body_node = new HTMLBodyElement(bodyTag, this);
    setBody(body_node, ec);

    RefPtrNode new_node = Text::create(this, Hello, World);
    body_node - appendChild(new_node,ec);

    -- rest of finishedParsing as usual --

 That works fine.

 Now lets say I want it to be blue:

 void Document::finishedParsing()
 {
    ExceptionCode ec = 0;
    HTMLBodyElement* body_node = new HTMLBodyElement(bodyTag, this);
    setBody(body_node, ec);

    RefPtrNode new_font_node =
 HTMLElementFactory::createHTMLElement(QualifiedName(nullAtom,
 String(font),nullAtom), this, 0, false);

  static_castElement*(new_font_node.get())-setAttribute(String(bolor),String(blue),ec);
    RefPtrNode new_text_node = Text::create(this, Hello, World);
    new_font_node - appendChild(new_text_node,ec);
    body_node - appendChild(new_font_node,ec);

    --rest of finshedParsing as usual --

 Again, this works fine.

 But blue is too flashy for my taste, and I now want it to just be bolded.
 void Document::finishedParsing()
 {
    ExceptionCode ec = 0;
    HTMLBodyElement* body_node = new HTMLBodyElement(bodyTag, this);
    setBody(body_node, ec);

    RefPtrNode new_bold_node =
 HTMLElementFactory::createHTMLElement(QualifiedName(nullAtom,
 String(b),nullAtom), this, 0, false);
    RefPtrNode new_text_node = Text::create(this, Hello, World);
    new_bold_node - appendChild(new_text_node,ec);
    body_node - appendChild(new_bold_node,ec);

    --rest of finishedParsing as usual --

 ... nothing is bold. Other, similar elements like 'strong' 'em' 'u'
 'i' don't do anything.

 What am I doing wrong?


 This is probably not working because you are not creating an Element with
 the HTML namespace.
 One thing you could try is instead of using
  QualifiedName(nullAtom, String(b),nullAtom), use HTMLNames::bTag.
 -Sam
___
webkit-dev mailing list
webkit-dev@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev


Re: [webkit-dev] Why so many text nodes in the DOM? (especially ones with just whitespace)

2010-06-17 Thread Matt 'Murph' Finnicum
On Thu, Jun 17, 2010 at 4:19 PM, David Hyatt hy...@apple.com wrote:

 On Jun 17, 2010, at 2:45 PM, Gustavo Sverzut Barbieri wrote:

  David, it's bit more than annoying, it's fragmenting memory for no
  good. In the long run on systems will small memory it does make a
  difference :-/
 
  I'd like to see some option, maybe compile-time, to strip these
  useless whitespaces.
 

 As Alexey points out, this is a compatibility issue though.  People write
 code assuming the whitespace nodes are there.  If you remove them, you'll
 see Web site breakage.

 dave
 (hy...@apple.com)


Do people write code assuming the content of the whitespace nodes? That
seems very unlikely to me. If not, we could collapse them and be much more
efficient about things (such as a simple flag in their parent node that
represents their existence)

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