krithika wrote:
> On Apr 2, 10:01 am, Eli Friedman <[EMAIL PROTECTED]> wrote:
>> krithika wrote:
>>> On Mar 31, 1:50 am, Eli Friedman <[EMAIL PROTECTED]> wrote:
>>>> krithika wrote:
>>>>> On Mar 30, 4:31 pm, Eli Friedman <[EMAIL PROTECTED]> wrote:
>>>>>> krithika wrote:
>>>>>>>    for (nsIFrame* page = mFrames.FirstChild(); page; page = page-
>>>>>>>> GetNextSibling())
>>>>>>>     {
>>>>>>>      nsPageFrame * pf = NS_STATIC_CAST(nsPageFrame*, page);
>>>>>>>      nsIFrame* contentFrame = pf->GetFirstChild(nsnull);
>>>>>>>       nsPageContentFrame* contentPage =
>>>>>>> NS_STATIC_CAST(nsPageContentFrame*, contentFrame);
>>>>>>>       nsIFrame* firstPageElem=  contentPage-
>>>>>>>> GetFirstChild(nsnull);
>>>>>>>       nsIContent* cont = firstPageElem->GetContent();
>>>>>>>       ...
>>>>>>>       //process Content to get page start element and end element
>>>>>>> details
>>>>>>>     }
>>>>>> Hmm, I'm assuming mFrames is the child frame list for 
>>>>>> nsSimplePageSequence.
>>>>>> In a normal situation (without any fixed-position elements), the only
>>>>>> direct child of a page content frame is going to be a continuation of
>>>>>> the frame associated with the root content node, since all the content
>>>>>> in a document is a child of the root content node.  If you're interested
>>>>>> in where paragraphs and stuff split in an HTML document, you're going to
>>>>>> have to go down deeper into the frame tree.
>>>>>> -Eli
>>>>> I tried mFrames , but is protected. Can this be accessed from
>>>>> somewhere.?
>>>>> How do I iterate frame tree?
>>>>> Will it give me the indication of where page breaks?
>>>>> Iam lost again.
>>>>> thanks & regards,
>>>>> Krithika
>>>> The normal way to navigate the frame tree is to use
>>>> GetFirstChild(nsnull) to get the primary child, then GetNextSibling() to
>>>> iterate over the list of children (sibling frames are in a singly-linked
>>>> list), not attempting to directly access other frames' frame list.
>>>> -Eli
>>> Hi,
>>> After I get AreaFrame from nsPageContentFrame Iam unable to iterate it
>>> through.GetNextSibling always returns null.
>>> How do I proceed in this case?
>>> regards,
>>> Krithika
>> The pages aren't connected together through the sibling list.  You can
>> use GetNextContinuation() to find continuations for blocks (i.e. frames
>> with the same content).  Or you can just go back up the tree and use
>> GetNextSibling to get the next page.
>>
>> -Eli
> 
> I have a for loop to navigate to next page.I only what to iterate
> individual page content.
> 
> 
>>From PageContentFrame I recursively do a GetFirstChild(nsnull) and I
> am trying to print the frame type and content child count of those
> frames.
> 
> For each page the first two frames are identical and subsequent frames
> differ.
> // all pages have this first and then frame type and content changes.
> Page Element FrameType: AreaFrame
> content child count 2
> ==================================
> Page Element FrameType: BlockFrame
> content child count 55
> ==================================
> 
> 
> I am unable to understand this behaviour basically becos of my poor
> understanding of how these frames are arranged is inside of each
> PageContentFrame.
> 
> Can you throw some light on this?.
> 
> Thanks,
> Krithika

Tree for a simple HTML document like
<html><body>
<p>Para 1
<p>Para 2
...
<p>Para 20
PageFrame
     PageContentFrame
         AreaFrame content: html
             BlockFrame content: body
                 BlockFrame content: p
                     TextFrame content: #text "Para 1"
                 BlockFrame content: p
                     TextFrame content: #text "Para 2"
...
PageFrame
     PageContentFrame
         AreaFrame content: html (continuation)
             BlockFrame content: body (continuation)
                 BlockFrame content: p
                     TextFrame content: #text "Para 20"

Continuations are special because they correspond to the same content as 
a previous frame.  They're linked together through GetNextContinuation 
and GetPrevContinuation.

nsIFrameDebug contains some methods that let you dump frame trees; that 
could be helpful for understanding what's going on.
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout

Reply via email to