mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
sped up nsBlockFrame significantly by reducing the number of times we resolve style by almost 50% on initial layout
(percentage savings go way up as the window is resized)
This commit is contained in:
parent
2b158c7942
commit
bc48be7cc5
@ -1164,10 +1164,10 @@ nsBlockFrame::ReflowMappedChildren(nsIPresContext* aCX,
|
||||
nsIFrame* kidFrame;
|
||||
|
||||
for (kidFrame = mFirstChild; nsnull != kidFrame; ) {
|
||||
nsIContentPtr kid;
|
||||
|
||||
kidFrame->GetContent(kid.AssignRef());
|
||||
nsIStyleContextPtr kidSC = aCX->ResolveStyleContextFor(kid, this);
|
||||
|
||||
/* we get the kid's style from kidFrame's cached style context */
|
||||
nsIStyleContextPtr kidSC;
|
||||
kidFrame->GetStyleContext(aCX, kidSC.AssignRef());
|
||||
|
||||
// Attempt to place and reflow the child
|
||||
|
||||
@ -1246,6 +1246,14 @@ nsBlockFrame::ReflowMappedChildren(nsIPresContext* aCX,
|
||||
return result;
|
||||
}
|
||||
|
||||
/* XXX:
|
||||
* In this method, we seem to be getting the style for the next child,
|
||||
* and checking that child's style for the child's display type.
|
||||
* The problem is that it's very inefficient to ResolveStyleFor(kid) here
|
||||
* and then just throw it away, when we end up doing a ResolveStyleFor(kid)
|
||||
* again when we actually create a frame for the content.
|
||||
* It would be nice to cache the resolved style, maybe in the reflow state?
|
||||
*/
|
||||
PRBool nsBlockFrame::MoreToReflow(nsIPresContext* aCX)
|
||||
{
|
||||
PRBool rv = PR_FALSE;
|
||||
|
@ -1164,10 +1164,10 @@ nsBlockFrame::ReflowMappedChildren(nsIPresContext* aCX,
|
||||
nsIFrame* kidFrame;
|
||||
|
||||
for (kidFrame = mFirstChild; nsnull != kidFrame; ) {
|
||||
nsIContentPtr kid;
|
||||
|
||||
kidFrame->GetContent(kid.AssignRef());
|
||||
nsIStyleContextPtr kidSC = aCX->ResolveStyleContextFor(kid, this);
|
||||
|
||||
/* we get the kid's style from kidFrame's cached style context */
|
||||
nsIStyleContextPtr kidSC;
|
||||
kidFrame->GetStyleContext(aCX, kidSC.AssignRef());
|
||||
|
||||
// Attempt to place and reflow the child
|
||||
|
||||
@ -1246,6 +1246,14 @@ nsBlockFrame::ReflowMappedChildren(nsIPresContext* aCX,
|
||||
return result;
|
||||
}
|
||||
|
||||
/* XXX:
|
||||
* In this method, we seem to be getting the style for the next child,
|
||||
* and checking that child's style for the child's display type.
|
||||
* The problem is that it's very inefficient to ResolveStyleFor(kid) here
|
||||
* and then just throw it away, when we end up doing a ResolveStyleFor(kid)
|
||||
* again when we actually create a frame for the content.
|
||||
* It would be nice to cache the resolved style, maybe in the reflow state?
|
||||
*/
|
||||
PRBool nsBlockFrame::MoreToReflow(nsIPresContext* aCX)
|
||||
{
|
||||
PRBool rv = PR_FALSE;
|
||||
|
@ -1164,10 +1164,10 @@ nsBlockFrame::ReflowMappedChildren(nsIPresContext* aCX,
|
||||
nsIFrame* kidFrame;
|
||||
|
||||
for (kidFrame = mFirstChild; nsnull != kidFrame; ) {
|
||||
nsIContentPtr kid;
|
||||
|
||||
kidFrame->GetContent(kid.AssignRef());
|
||||
nsIStyleContextPtr kidSC = aCX->ResolveStyleContextFor(kid, this);
|
||||
|
||||
/* we get the kid's style from kidFrame's cached style context */
|
||||
nsIStyleContextPtr kidSC;
|
||||
kidFrame->GetStyleContext(aCX, kidSC.AssignRef());
|
||||
|
||||
// Attempt to place and reflow the child
|
||||
|
||||
@ -1246,6 +1246,14 @@ nsBlockFrame::ReflowMappedChildren(nsIPresContext* aCX,
|
||||
return result;
|
||||
}
|
||||
|
||||
/* XXX:
|
||||
* In this method, we seem to be getting the style for the next child,
|
||||
* and checking that child's style for the child's display type.
|
||||
* The problem is that it's very inefficient to ResolveStyleFor(kid) here
|
||||
* and then just throw it away, when we end up doing a ResolveStyleFor(kid)
|
||||
* again when we actually create a frame for the content.
|
||||
* It would be nice to cache the resolved style, maybe in the reflow state?
|
||||
*/
|
||||
PRBool nsBlockFrame::MoreToReflow(nsIPresContext* aCX)
|
||||
{
|
||||
PRBool rv = PR_FALSE;
|
||||
|
@ -1164,10 +1164,10 @@ nsBlockFrame::ReflowMappedChildren(nsIPresContext* aCX,
|
||||
nsIFrame* kidFrame;
|
||||
|
||||
for (kidFrame = mFirstChild; nsnull != kidFrame; ) {
|
||||
nsIContentPtr kid;
|
||||
|
||||
kidFrame->GetContent(kid.AssignRef());
|
||||
nsIStyleContextPtr kidSC = aCX->ResolveStyleContextFor(kid, this);
|
||||
|
||||
/* we get the kid's style from kidFrame's cached style context */
|
||||
nsIStyleContextPtr kidSC;
|
||||
kidFrame->GetStyleContext(aCX, kidSC.AssignRef());
|
||||
|
||||
// Attempt to place and reflow the child
|
||||
|
||||
@ -1246,6 +1246,14 @@ nsBlockFrame::ReflowMappedChildren(nsIPresContext* aCX,
|
||||
return result;
|
||||
}
|
||||
|
||||
/* XXX:
|
||||
* In this method, we seem to be getting the style for the next child,
|
||||
* and checking that child's style for the child's display type.
|
||||
* The problem is that it's very inefficient to ResolveStyleFor(kid) here
|
||||
* and then just throw it away, when we end up doing a ResolveStyleFor(kid)
|
||||
* again when we actually create a frame for the content.
|
||||
* It would be nice to cache the resolved style, maybe in the reflow state?
|
||||
*/
|
||||
PRBool nsBlockFrame::MoreToReflow(nsIPresContext* aCX)
|
||||
{
|
||||
PRBool rv = PR_FALSE;
|
||||
|
@ -1164,10 +1164,10 @@ nsBlockFrame::ReflowMappedChildren(nsIPresContext* aCX,
|
||||
nsIFrame* kidFrame;
|
||||
|
||||
for (kidFrame = mFirstChild; nsnull != kidFrame; ) {
|
||||
nsIContentPtr kid;
|
||||
|
||||
kidFrame->GetContent(kid.AssignRef());
|
||||
nsIStyleContextPtr kidSC = aCX->ResolveStyleContextFor(kid, this);
|
||||
|
||||
/* we get the kid's style from kidFrame's cached style context */
|
||||
nsIStyleContextPtr kidSC;
|
||||
kidFrame->GetStyleContext(aCX, kidSC.AssignRef());
|
||||
|
||||
// Attempt to place and reflow the child
|
||||
|
||||
@ -1246,6 +1246,14 @@ nsBlockFrame::ReflowMappedChildren(nsIPresContext* aCX,
|
||||
return result;
|
||||
}
|
||||
|
||||
/* XXX:
|
||||
* In this method, we seem to be getting the style for the next child,
|
||||
* and checking that child's style for the child's display type.
|
||||
* The problem is that it's very inefficient to ResolveStyleFor(kid) here
|
||||
* and then just throw it away, when we end up doing a ResolveStyleFor(kid)
|
||||
* again when we actually create a frame for the content.
|
||||
* It would be nice to cache the resolved style, maybe in the reflow state?
|
||||
*/
|
||||
PRBool nsBlockFrame::MoreToReflow(nsIPresContext* aCX)
|
||||
{
|
||||
PRBool rv = PR_FALSE;
|
||||
|
@ -1164,10 +1164,10 @@ nsBlockFrame::ReflowMappedChildren(nsIPresContext* aCX,
|
||||
nsIFrame* kidFrame;
|
||||
|
||||
for (kidFrame = mFirstChild; nsnull != kidFrame; ) {
|
||||
nsIContentPtr kid;
|
||||
|
||||
kidFrame->GetContent(kid.AssignRef());
|
||||
nsIStyleContextPtr kidSC = aCX->ResolveStyleContextFor(kid, this);
|
||||
|
||||
/* we get the kid's style from kidFrame's cached style context */
|
||||
nsIStyleContextPtr kidSC;
|
||||
kidFrame->GetStyleContext(aCX, kidSC.AssignRef());
|
||||
|
||||
// Attempt to place and reflow the child
|
||||
|
||||
@ -1246,6 +1246,14 @@ nsBlockFrame::ReflowMappedChildren(nsIPresContext* aCX,
|
||||
return result;
|
||||
}
|
||||
|
||||
/* XXX:
|
||||
* In this method, we seem to be getting the style for the next child,
|
||||
* and checking that child's style for the child's display type.
|
||||
* The problem is that it's very inefficient to ResolveStyleFor(kid) here
|
||||
* and then just throw it away, when we end up doing a ResolveStyleFor(kid)
|
||||
* again when we actually create a frame for the content.
|
||||
* It would be nice to cache the resolved style, maybe in the reflow state?
|
||||
*/
|
||||
PRBool nsBlockFrame::MoreToReflow(nsIPresContext* aCX)
|
||||
{
|
||||
PRBool rv = PR_FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user