Bug 290752. Don't create unnecessary level of style contexts for scrolled frames. r+sr=bzbarsky,a=asa

This commit is contained in:
roc+%cs.cmu.edu 2005-04-28 22:14:16 +00:00
parent 923c54f450
commit 301b411013
3 changed files with 24 additions and 19 deletions

View File

@ -4577,6 +4577,14 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIContent* aDocElement,
rootPseudo,
viewportPseudoStyle);
} else {
if (rootPseudo == nsCSSAnonBoxes::canvas) {
rootPseudo = nsCSSAnonBoxes::scrolledCanvas;
} else {
NS_ASSERTION(rootPseudo == nsCSSAnonBoxes::pageSequence,
"Unknown root pseudo");
rootPseudo = nsCSSAnonBoxes::scrolledPageSequence;
}
// Build the frame. We give it the content we are wrapping which is the document,
// the root frame, the parent view port frame, and we should get back the new
// frame and the scrollable view if one was created.
@ -6280,14 +6288,7 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsFrameConstructorState& aState,
aNewFrame = gfxScrollFrame;
// we used the style that was passed in. So resolve another one.
nsRefPtr<nsStyleContext> scrollPseudoStyle;
nsStyleSet *styleSet = mPresShell->StyleSet();
scrollPseudoStyle = styleSet->ResolvePseudoStyleFor(aContent,
nsCSSAnonBoxes::scrolledContent,
contentStyle);
contentStyle = scrollPseudoStyle;
nsStyleContext* aScrolledChildStyle = styleSet->ResolvePseudoStyleFor(aContent,
aScrolledPseudo,
contentStyle).get();

View File

@ -83,6 +83,8 @@ CSS_ANON_BOX(page, ":-moz-page")
CSS_ANON_BOX(pageContent, ":-moz-pagecontent")
CSS_ANON_BOX(pageSequence, ":-moz-page-sequence")
CSS_ANON_BOX(scrolledContent, ":-moz-scrolled-content")
CSS_ANON_BOX(scrolledCanvas, ":-moz-scrolled-canvas")
CSS_ANON_BOX(scrolledPageSequence, ":-moz-scrolled-page-sequence")
CSS_ANON_BOX(columnContent, ":-moz-column-content")
CSS_ANON_BOX(viewport, ":-moz-viewport")
CSS_ANON_BOX(viewportScroll, ":-moz-viewport-scroll")

View File

@ -129,16 +129,8 @@
display: block !important;
}
*|*::-moz-viewport, *|*::-moz-viewport-scroll, *|*::-moz-canvas {
display: block !important;
background-color: inherit;
}
*|*::-moz-viewport-scroll {
overflow: auto;
}
*|*::-moz-scrolled-content {
*|*::-moz-scrolled-content, *|*::-moz-scrolled-canvas,
*|*::-moz-scrolled-page-sequence {
/* e.g., text inputs, select boxes */
padding: inherit;
display: inherit;
@ -155,6 +147,15 @@
float: none !important;
}
*|*::-moz-viewport, *|*::-moz-viewport-scroll, *|*::-moz-canvas, *|*::-moz-scrolled-canvas {
display: block !important;
background-color: inherit;
}
*|*::-moz-viewport-scroll {
overflow: auto;
}
*|*::-moz-column-content {
/* the column boxes inside a column-flowed block */
/* make unicode-bidi inherit, otherwise it has no effect on column boxes */
@ -166,7 +167,7 @@
height: 100%;
}
*|*::-moz-page, *|*::-moz-page-sequence {
*|*::-moz-page, *|*::-moz-page-sequence, *|*::-moz-scrolled-page-sequence {
display: block !important;
background: transparent;
}
@ -199,7 +200,8 @@
cursor: default !important;
}
*|*::-moz-viewport, *|*::-moz-viewport-scroll, *|*::-moz-canvas {
*|*::-moz-viewport, *|*::-moz-viewport-scroll, *|*::-moz-canvas,
*|*::-moz-scrolled-canvas {
background-color: #737373 !important;
}