Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Phase 1 of style context deCOMtamination (bug 114713). Remove all dep…

…endencies on nsIStyleContext from outside of content and layout. Make nsIFrame::GetStyleData be a non-inline virtual function when called from outside of layout, since the nsStyleContext implementation won't be available to those callers. r=dbaron, sr=bzbarsky.
  • Loading branch information...
commit 7f0488eb18d286f022f06c98efc947d30d6c6197 1 parent 872ded6
bryner%netscape.com authored
Showing with 434 additions and 542 deletions.
  1. +9 −13 accessible/src/base/nsAccessible.cpp
  2. +0 −1  accessible/src/xul/nsXULTabAccessible.cpp
  3. +6 −3 content/base/src/nsStyleSet.cpp
  4. +0 −1  content/events/src/nsEventStateManager.cpp
  5. +0 −9 content/html/content/src/nsAttributeContent.cpp
  6. +0 −1  content/html/content/src/nsHTMLAppletElement.cpp
  7. +1 −1  content/html/content/src/nsHTMLAreaElement.cpp
  8. +0 −1  content/html/content/src/nsHTMLBRElement.cpp
  9. +0 −1  content/html/content/src/nsHTMLBaseFontElement.cpp
  10. +0 −1  content/html/content/src/nsHTMLBodyElement.cpp
  11. +1 −1  content/html/content/src/nsHTMLButtonElement.cpp
  12. +0 −1  content/html/content/src/nsHTMLDListElement.cpp
  13. +0 −1  content/html/content/src/nsHTMLDelElement.cpp
  14. +0 −1  content/html/content/src/nsHTMLDirectoryElement.cpp
  15. +0 −1  content/html/content/src/nsHTMLDivElement.cpp
  16. +0 −1  content/html/content/src/nsHTMLFieldSetElement.cpp
  17. +0 −1  content/html/content/src/nsHTMLFontElement.cpp
  18. +0 −1  content/html/content/src/nsHTMLFormElement.cpp
  19. +0 −1  content/html/content/src/nsHTMLFrameSetElement.cpp
  20. +0 −1  content/html/content/src/nsHTMLHRElement.cpp
  21. +0 −1  content/html/content/src/nsHTMLHeadElement.cpp
  22. +0 −1  content/html/content/src/nsHTMLHeadingElement.cpp
  23. +0 −1  content/html/content/src/nsHTMLHtmlElement.cpp
  24. +0 −1  content/html/content/src/nsHTMLIFrameElement.cpp
  25. +0 −1  content/html/content/src/nsHTMLImageElement.cpp
  26. +0 −1  content/html/content/src/nsHTMLInputElement.cpp
  27. +0 −1  content/html/content/src/nsHTMLInsElement.cpp
  28. +0 −1  content/html/content/src/nsHTMLLIElement.cpp
  29. +0 −1  content/html/content/src/nsHTMLLabelElement.cpp
  30. +0 −1  content/html/content/src/nsHTMLLegendElement.cpp
  31. +0 −1  content/html/content/src/nsHTMLLinkElement.cpp
  32. +0 −1  content/html/content/src/nsHTMLMapElement.cpp
  33. +0 −1  content/html/content/src/nsHTMLMenuElement.cpp
  34. +0 −1  content/html/content/src/nsHTMLMetaElement.cpp
  35. +0 −1  content/html/content/src/nsHTMLModElement.cpp
  36. +0 −1  content/html/content/src/nsHTMLOListElement.cpp
  37. +0 −1  content/html/content/src/nsHTMLOptGroupElement.cpp
  38. +0 −1  content/html/content/src/nsHTMLOptionElement.cpp
  39. +0 −1  content/html/content/src/nsHTMLParagraphElement.cpp
  40. +0 −1  content/html/content/src/nsHTMLPreElement.cpp
  41. +0 −1  content/html/content/src/nsHTMLQuoteElement.cpp
  42. +0 −1  content/html/content/src/nsHTMLScriptElement.cpp
  43. +0 −1  content/html/content/src/nsHTMLSelectElement.cpp
  44. +0 −1  content/html/content/src/nsHTMLSharedContainerElem.cpp
  45. +0 −1  content/html/content/src/nsHTMLSharedElement.cpp
  46. +0 −1  content/html/content/src/nsHTMLSharedLeafElement.cpp
  47. +0 −1  content/html/content/src/nsHTMLSpanElement.cpp
  48. +0 −1  content/html/content/src/nsHTMLStyleElement.cpp
  49. +0 −1  content/html/content/src/nsHTMLTableCaptionElement.cpp
  50. +0 −1  content/html/content/src/nsHTMLTableCellElement.cpp
  51. +0 −1  content/html/content/src/nsHTMLTableColElement.cpp
  52. +0 −1  content/html/content/src/nsHTMLTableElement.cpp
  53. +0 −1  content/html/content/src/nsHTMLTableRowElement.cpp
  54. +0 −1  content/html/content/src/nsHTMLTableSectionElement.cpp
  55. +0 −1  content/html/content/src/nsHTMLTextAreaElement.cpp
  56. +0 −1  content/html/content/src/nsHTMLTitleElement.cpp
  57. +0 −1  content/html/content/src/nsHTMLUListElement.cpp
  58. +0 −1  content/html/content/src/nsHTMLUnknownElement.cpp
  59. +0 −1  content/html/style/src/nsCSSStyleRule.cpp
  60. +0 −1  content/html/style/src/nsHTMLAttributes.cpp
  61. +0 −1  content/html/style/src/nsHTMLCSSStyleSheet.cpp
  62. +3 −10 content/html/style/src/nsIInspectorCSSUtils.h
  63. +51 −12 content/html/style/src/nsInspectorCSSUtils.cpp
  64. +11 −3 content/html/style/src/nsInspectorCSSUtils.h
  65. +0 −2  content/xul/content/src/nsXULElement.cpp
  66. +0 −1  content/xul/content/src/nsXULPopupListener.cpp
  67. +0 −1  content/xul/document/src/nsXULDocument.cpp
  68. +0 −1  docshell/base/nsDocShell.cpp
  69. +6 −6 dom/src/base/nsDOMClassInfo.cpp
  70. +0 −1  dom/src/base/nsGlobalWindow.cpp
  71. +2 −6 editor/libeditor/base/nsEditor.cpp
  72. +0 −2  editor/libeditor/html/nsHTMLDataTransfer.cpp
  73. +1 −1  editor/libeditor/html/nsHTMLEditRules.cpp
  74. +1 −23 editor/libeditor/html/nsHTMLEditor.cpp
  75. +0 −9 editor/libeditor/html/nsHTMLEditor.h
  76. +0 −2  editor/libeditor/text/nsPlaintextDataTransfer.cpp
  77. +0 −20 editor/libeditor/text/nsPlaintextEditor.cpp
  78. +0 −2  editor/libeditor/text/nsPlaintextEditor.h
  79. +5 −164 embedding/browser/webBrowser/nsContextMenuInfo.cpp
  80. +5 −9 embedding/components/find/src/nsFind.cpp
  81. +13 −73 extensions/inspector/base/src/inDOMUtils.cpp
  82. +0 −4 extensions/inspector/base/src/inDOMUtils.h
  83. +4 −9 extensions/typeaheadfind/src/nsTypeAheadFind.cpp
  84. +5 −6 gfx/src/windows/nsNativeThemeWin.cpp
  85. +0 −1  layout/base/nsIFrameSelection.h
  86. +25 −1 layout/base/nsPresContext.cpp
  87. +25 −0 layout/base/nsPresContext.h
  88. +10 −0 layout/base/public/nsIFrame.h
  89. +3 −0  layout/base/public/nsIFrameDebug.h
  90. +0 −1  layout/base/public/nsIFrameSelection.h
  91. +25 −0 layout/base/public/nsIPresContext.h
  92. +1 −1  layout/base/public/nsIStyleSet.h
  93. +25 −0 layout/base/public/nsPresContext.h
  94. +2 −0  layout/base/src/Makefile.in
  95. +25 −1 layout/base/src/nsPresContext.cpp
  96. +7 −0 layout/base/src/nsPresContext.h
  97. +1 −0  layout/build/Makefile.in
  98. +0 −1  layout/forms/nsLegendFrame.cpp
  99. +0 −1  layout/forms/nsSelectsAreaFrame.cpp
  100. +0 −1  layout/generic/nsAbsoluteContainingBlock.cpp
  101. +0 −1  layout/generic/nsBRFrame.cpp
  102. +0 −1  layout/generic/nsBlockBandData.cpp
  103. +22 −0 layout/generic/nsFrame.cpp
  104. +4 −0 layout/generic/nsFrame.h
  105. +0 −1  layout/generic/nsHTMLReflowCommand.cpp
  106. +10 −0 layout/generic/nsIFrame.h
  107. +3 −0  layout/generic/nsIFrameDebug.h
  108. +0 −1  layout/generic/nsLineBox.cpp
  109. +0 −1  layout/generic/nsSimplePageSequence.cpp
  110. +0 −1  layout/generic/nsSpacerFrame.cpp
  111. +0 −1  layout/generic/nsTextTransformer.cpp
  112. +1 −0  layout/html/base/src/Makefile.in
  113. +0 −1  layout/html/base/src/nsAbsoluteContainingBlock.cpp
  114. +0 −1  layout/html/base/src/nsBRFrame.cpp
  115. +0 −1  layout/html/base/src/nsBlockBandData.cpp
  116. +22 −0 layout/html/base/src/nsFrame.cpp
  117. +4 −0 layout/html/base/src/nsFrame.h
  118. +0 −1  layout/html/base/src/nsHTMLReflowCommand.cpp
  119. +0 −1  layout/html/base/src/nsLineBox.cpp
  120. +0 −1  layout/html/base/src/nsSelectsAreaFrame.cpp
  121. +0 −1  layout/html/base/src/nsSimplePageSequence.cpp
  122. +0 −1  layout/html/base/src/nsSpacerFrame.cpp
  123. +0 −1  layout/html/base/src/nsTextTransformer.cpp
  124. +1 −0  layout/html/document/src/Makefile.in
  125. +1 −0  layout/html/forms/src/Makefile.in
  126. +0 −1  layout/html/forms/src/nsLegendFrame.cpp
  127. +2 −0  layout/html/style/src/Makefile.in
  128. +0 −1  layout/html/table/src/BasicTableLayoutStrategy.cpp
  129. +0 −1  layout/html/table/src/FixedTableLayoutStrategy.cpp
  130. +1 −1  layout/html/table/src/Makefile.in
  131. +0 −1  layout/html/table/src/nsITableLayoutStrategy.h
  132. +1 −0  layout/html/tests/Makefile.in
  133. +1 −0  layout/macbuild/layoutSharedPrefix.h
  134. +1 −0  layout/macbuild/layoutSharedPrefix_debug.h
  135. +1 −0  layout/mathml/base/src/Makefile.in
  136. +0 −1  layout/mathml/base/src/nsMathMLmphantomFrame.cpp
  137. +2 −0  layout/mathml/content/src/Makefile.in
  138. +0 −1  layout/style/nsCSSStyleRule.cpp
  139. +0 −1  layout/style/nsHTMLCSSStyleSheet.cpp
  140. +3 −10 layout/style/nsIInspectorCSSUtils.h
  141. +51 −12 layout/style/nsInspectorCSSUtils.cpp
  142. +11 −3 layout/style/nsInspectorCSSUtils.h
  143. +6 −3 layout/style/nsStyleSet.cpp
  144. +2 −0  layout/svg/base/src/Makefile.in
  145. +0 −1  layout/tables/BasicTableLayoutStrategy.cpp
  146. +0 −1  layout/tables/FixedTableLayoutStrategy.cpp
  147. +0 −1  layout/tables/nsITableLayoutStrategy.h
  148. +1 −0  layout/xul/base/src/Makefile.in
  149. +2 −0  layout/xul/base/src/grid/Makefile.in
  150. +0 −1  layout/xul/base/src/nsBoxLayout.cpp
  151. +0 −1  layout/xul/base/src/nsBoxLayoutState.cpp
  152. +0 −2  layout/xul/base/src/nsContainerBox.cpp
  153. +0 −1  layout/xul/base/src/nsDocElementBoxFrame.cpp
  154. +0 −1  layout/xul/base/src/nsGrippyFrame.cpp
  155. +0 −1  layout/xul/base/src/nsProgressMeterFrame.h
  156. +0 −1  layout/xul/base/src/nsRootBoxFrame.cpp
  157. +0 −1  layout/xul/base/src/nsScrollbarButtonFrame.cpp
  158. +0 −1  layout/xul/base/src/nsSpringFrame.cpp
  159. +0 −1  layout/xul/base/src/nsSprocketLayout.cpp
  160. +0 −1  layout/xul/base/src/nsStackLayout.cpp
  161. +2 −0  layout/xul/base/src/tree/src/Makefile.in
  162. +6 −17 webshell/tests/viewer/nsBrowserWindow.cpp
View
22 accessible/src/base/nsAccessible.cpp
@@ -77,7 +77,6 @@
#include "nsGUIEvent.h"
#include "nsILink.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsReadableUtils.h"
#include "nsIBindingManager.h"
@@ -731,12 +730,10 @@ PRBool nsAccessible::IsPartiallyVisible(PRBool *aIsOffscreen)
return PR_FALSE;
// If visibility:hidden or visibility:collapsed then mark with STATE_INVISIBLE
- nsCOMPtr<nsIStyleContext> styleContext;
- frame->GetStyleContext(getter_AddRefs(styleContext));
- if (styleContext) {
- const nsStyleVisibility* vis =
- (const nsStyleVisibility*)styleContext->GetStyleData(eStyleStruct_Visibility);
- if (!vis || !vis->IsVisible())
+ const nsStyleVisibility* vis;
+ ::GetStyleData(frame, &vis);
+ if (!vis || !vis->IsVisible())
+ {
return PR_FALSE;
}
@@ -1330,15 +1327,14 @@ NS_IMETHODIMP nsAccessible::AppendFlatStringFromContentNode(nsIContent *aContent
// If this text is inside a block level frame (as opposed to span level), we need to add spaces around that
// block's text, so we don't get words jammed together in final name
// Extra spaces will be trimmed out later
- nsCOMPtr<nsIStyleContext> styleContext;
- frame->GetStyleContext(getter_AddRefs(styleContext));
- if (styleContext) {
- const nsStyleDisplay* display = (const nsStyleDisplay*)styleContext->GetStyleData(eStyleStruct_Display);
- if (display->IsBlockLevel() || display->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL) {
+ const nsStyleDisplay* display;
+ ::GetStyleData(frame, &display);
+ if (display && (display->IsBlockLevel() ||
+ display->mDisplay == NS_STYLE_DISPLAY_TABLE_CELL))
+ {
isHTMLBlock = PR_TRUE;
if (!aFlatString->IsEmpty())
aFlatString->Append(NS_LITERAL_STRING(" "));
- }
}
}
}
View
1  accessible/src/xul/nsXULTabAccessible.cpp
@@ -49,7 +49,6 @@
#include "nsIFrame.h"
#include "nsIPluginViewer.h"
#include "nsIScriptGlobalObject.h"
-#include "nsIStyleContext.h"
#include "nsIWebShell.h"
#include "nsIWebShellWindow.h"
#include "nsplugindefs.h"
View
9 content/base/src/nsStyleSet.cpp
@@ -341,7 +341,7 @@ class StyleSetImpl : public nsIStyleSet
#ifdef DEBUG
void List(FILE* out, PRInt32 aIndent, nsISupportsArray* aSheets);
- void ListContexts(nsIStyleContext* aRootContext, FILE* out, PRInt32 aIndent);
+ void ListContexts(nsIFrame* aRootFrame, FILE* out, PRInt32 aIndent);
#endif
nsCOMPtr<nsISupportsArray> mOverrideSheets; // most significant first
@@ -1762,9 +1762,12 @@ void StyleSetImpl::List(FILE* out, PRInt32 aIndent)
}
-void StyleSetImpl::ListContexts(nsIStyleContext* aRootContext, FILE* out, PRInt32 aIndent)
+void StyleSetImpl::ListContexts(nsIFrame* aRootFrame, FILE* out, PRInt32 aIndent)
{
- aRootContext->List(out, aIndent);
+ nsCOMPtr<nsIStyleContext> sc;
+ aRootFrame->GetStyleContext(getter_AddRefs(sc));
+ if (sc)
+ sc->List(out, aIndent);
}
#endif
View
1  content/events/src/nsEventStateManager.cpp
@@ -44,7 +44,6 @@
#include "nsIDocument.h"
#include "nsIFrame.h"
#include "nsIWidget.h"
-#include "nsIStyleContext.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsDOMEvent.h"
View
9 content/html/content/src/nsAttributeContent.cpp
@@ -66,15 +66,6 @@
#include "nsINameSpaceManager.h"
#include "nsITextContent.h"
-class nsIDOMAttr;
-class nsIDOMNodeList;
-class nsIFrame;
-class nsIStyleContext;
-class nsIStyleRule;
-class nsISupportsArray;
-class nsIDOMText;
-
-
// XXX share all id's in this dir
View
1  content/html/content/src/nsHTMLAppletElement.cpp
@@ -41,7 +41,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIDocument.h"
View
2  content/html/content/src/nsHTMLAreaElement.cpp
@@ -42,8 +42,8 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsILink.h"
+#include "nsIPresShell.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIEventStateManager.h"
View
1  content/html/content/src/nsHTMLBRElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLBaseFontElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
View
1  content/html/content/src/nsHTMLBodyElement.cpp
@@ -43,7 +43,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
View
2  content/html/content/src/nsHTMLButtonElement.cpp
@@ -42,7 +42,7 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
+#include "nsIPresShell.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIFormControl.h"
View
1  content/html/content/src/nsHTMLDListElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLDelElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
View
1  content/html/content/src/nsHTMLDirectoryElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLDivElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLFieldSetElement.cpp
@@ -41,7 +41,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIForm.h"
View
1  content/html/content/src/nsHTMLFontElement.cpp
@@ -42,7 +42,6 @@
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
#include "nsIDeviceContext.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLFormElement.cpp
@@ -47,7 +47,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIDocument.h"
View
1  content/html/content/src/nsHTMLFrameSetElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIFrameSetElement.h"
View
1  content/html/content/src/nsHTMLHRElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLHeadElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
View
1  content/html/content/src/nsHTMLHeadingElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLHtmlElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIDocument.h"
View
1  content/html/content/src/nsHTMLIFrameElement.cpp
@@ -43,7 +43,6 @@
#include "nsIFrameLoader.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsIDocument.h"
View
1  content/html/content/src/nsHTMLImageElement.cpp
@@ -41,7 +41,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
View
1  content/html/content/src/nsHTMLInputElement.cpp
@@ -54,7 +54,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLInsElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
View
1  content/html/content/src/nsHTMLLIElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLLabelElement.cpp
@@ -42,7 +42,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIFormControl.h"
View
1  content/html/content/src/nsHTMLLegendElement.cpp
@@ -41,7 +41,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIForm.h"
View
1  content/html/content/src/nsHTMLLinkElement.cpp
@@ -42,7 +42,6 @@
#include "nsGenericHTMLElement.h"
#include "nsILink.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIDOMStyleSheet.h"
View
1  content/html/content/src/nsHTMLMapElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "GenericElementCollection.h"
View
1  content/html/content/src/nsHTMLMenuElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLMetaElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
View
1  content/html/content/src/nsHTMLModElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
View
1  content/html/content/src/nsHTMLOListElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLOptGroupElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIFrame.h"
View
1  content/html/content/src/nsHTMLOptionElement.cpp
@@ -44,7 +44,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIFormControl.h"
View
1  content/html/content/src/nsHTMLParagraphElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLPreElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLQuoteElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
View
1  content/html/content/src/nsHTMLScriptElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsITextContent.h"
View
1  content/html/content/src/nsHTMLSelectElement.cpp
@@ -46,7 +46,6 @@
#include "nsITextContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLSharedContainerElem.cpp
@@ -44,7 +44,6 @@
#include "nsIDOMHTMLQuoteElement.h"
#include "nsIDOMHTMLTableCaptionElem.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLSharedElement.cpp
@@ -43,7 +43,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsRuleNode.h"
View
1  content/html/content/src/nsHTMLSharedLeafElement.cpp
@@ -43,7 +43,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsRuleNode.h"
View
1  content/html/content/src/nsHTMLSpanElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIAtom.h"
View
1  content/html/content/src/nsHTMLStyleElement.cpp
@@ -42,7 +42,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIDOMStyleSheet.h"
View
1  content/html/content/src/nsHTMLTableCaptionElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLTableCellElement.cpp
@@ -44,7 +44,6 @@
#include "nsHTMLAttributes.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsRuleNode.h"
View
1  content/html/content/src/nsHTMLTableColElement.cpp
@@ -42,7 +42,6 @@
#include "nsHTMLAttributes.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsRuleNode.h"
View
1  content/html/content/src/nsHTMLTableElement.cpp
@@ -46,7 +46,6 @@
#include "nsHTMLAttributes.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLParts.h"
View
1  content/html/content/src/nsHTMLTableRowElement.cpp
@@ -46,7 +46,6 @@
#include "nsGenericHTMLElement.h"
#include "GenericElementCollection.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLParts.h"
View
1  content/html/content/src/nsHTMLTableSectionElement.cpp
@@ -42,7 +42,6 @@
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
#include "nsHTMLParts.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "GenericElementCollection.h"
View
1  content/html/content/src/nsHTMLTextAreaElement.cpp
@@ -51,7 +51,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLTitleElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsIDOMText.h"
View
1  content/html/content/src/nsHTMLUListElement.cpp
@@ -40,7 +40,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsHTMLAttributes.h"
View
1  content/html/content/src/nsHTMLUnknownElement.cpp
@@ -39,7 +39,6 @@
#include "nsIHTMLContent.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLAtoms.h"
-#include "nsIStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsLayoutAtoms.h"
View
1  content/html/style/src/nsCSSStyleRule.cpp
@@ -47,7 +47,6 @@
#include "nsICSSLoader.h"
#include "nsIHTMLContentContainer.h"
#include "nsIURL.h"
-#include "nsIStyleContext.h"
#include "nsIPresContext.h"
#include "nsIDocument.h"
#include "nsIDeviceContext.h"
View
1  content/html/style/src/nsHTMLAttributes.cpp
@@ -48,7 +48,6 @@
#include "nsISupportsArray.h"
#include "nsCRT.h"
#include "nsIArena.h"
-#include "nsIStyleContext.h"
#include "nsHTMLAtoms.h"
#include "nsIHTMLContent.h"
#include "nsVoidArray.h"
View
1  content/html/style/src/nsHTMLCSSStyleSheet.cpp
@@ -49,7 +49,6 @@
#include "nsIFrame.h"
#include "nsICSSStyleRule.h"
#include "nsIStyleRuleProcessor.h"
-#include "nsIStyleContext.h"
#include "nsIPresContext.h"
#include "nsIDocument.h"
#include "nsCOMPtr.h"
View
13 content/html/style/src/nsIInspectorCSSUtils.h
@@ -46,9 +46,7 @@ class nsRuleNode;
class nsIStyleRule;
class nsIFrame;
struct nsRect;
-class nsIPresShell;
class nsIContent;
-class nsIStyleContext;
// 0252892b-419a-49f4-981d-4c6716099451
#define NS_IINSPECTORCSSUTILS_IID \
@@ -78,14 +76,9 @@ class nsIInspectorCSSUtils : public nsISupports {
// Hooks to avoid having to use nsStyleCoord.
NS_IMETHOD AdjustRectForMargins(nsIFrame* aFrame, nsRect& aRect) = 0;
- // Hooks to methods that need layout atoms (static vars in layout)
- NS_IMETHOD GetStyleContextForFrame(nsIFrame* aFrame,
- nsIStyleContext** aStyleContext) = 0;
-
- // Hooks to ::GetStyleData<T>(nsCOMPtr<nsIStyleContext>, const nsStyleText**)
- // and calls nsStyleText->WhiteSpaceIsSignificant();
- NS_IMETHOD IsWhiteSpaceSignificant(nsIStyleContext* aStyleContext,
- PRBool *aIsSignificant) = 0;
+ // Hooks to methods that need nsStyleContext
+ NS_IMETHOD GetRuleNodeForContent(nsIContent* aContent,
+ nsRuleNode** aParent) = 0;
};
#endif /* nsIInspectorCSSUtils_h___ */
View
63 content/html/style/src/nsInspectorCSSUtils.cpp
@@ -41,6 +41,8 @@
#include "nsRuleNode.h"
#include "nsString.h"
#include "nsLayoutAtoms.h"
+#include "nsIDocument.h"
+#include "nsIPresShell.h"
nsInspectorCSSUtils::nsInspectorCSSUtils()
{
@@ -111,12 +113,10 @@ nsInspectorCSSUtils::AdjustRectForMargins(nsIFrame* aFrame, nsRect& aRect)
return NS_OK;
}
-NS_IMETHODIMP
+nsresult
nsInspectorCSSUtils::GetStyleContextForFrame(nsIFrame* aFrame,
nsIStyleContext** aStyleContext)
{
- NS_PRECONDITION(aFrame, "We'd better have a frame!");
-
nsCOMPtr<nsIStyleContext> styleContext;
aFrame->GetStyleContext(getter_AddRefs(styleContext));
if (!styleContext) {
@@ -142,17 +142,56 @@ nsInspectorCSSUtils::GetStyleContextForFrame(nsIFrame* aFrame,
return NS_OK;
}
+nsresult
+nsInspectorCSSUtils::GetStyleContextForContent(nsIContent* aContent,
+ nsIPresShell* aPresShell,
+ nsIStyleContext** aStyleContext)
+{
+ nsIFrame* frame = nsnull;
+ aPresShell->GetPrimaryFrameFor(aContent, &frame);
+ if (frame)
+ return GetStyleContextForFrame(frame, aStyleContext);
+
+ // No frame has been created, so resolve the style ourself.
+ nsCOMPtr<nsIStyleContext> parentContext;
+ nsCOMPtr<nsIContent> parent;
+ aContent->GetParent(*getter_AddRefs(parent));
+ if (parent) {
+ nsresult rv = GetStyleContextForContent(aContent, aPresShell,
+ getter_AddRefs(parentContext));
+ NS_ENSURE_SUCCESS(rv, rv);
+ }
+
+ nsCOMPtr<nsIPresContext> presContext;
+ aPresShell->GetPresContext(getter_AddRefs(presContext));
+ NS_ENSURE_TRUE(presContext, NS_ERROR_UNEXPECTED);
+
+ if (aContent->IsContentOfType(nsIContent::eELEMENT))
+ return presContext->ResolveStyleContextFor(aContent, parentContext,
+ aStyleContext);
+
+ return presContext->ResolveStyleContextForNonElement(parentContext,
+ aStyleContext);
+}
+
NS_IMETHODIMP
-nsInspectorCSSUtils::IsWhiteSpaceSignificant(nsIStyleContext* aStyleContext,
- PRBool *aIsSignificant)
+nsInspectorCSSUtils::GetRuleNodeForContent(nsIContent* aContent,
+ nsRuleNode** aRuleNode)
{
- NS_PRECONDITION(aStyleContext, "We'd better have a style context!");
- NS_PRECONDITION(aIsSignificant, "We'd better have an out pointer!");
+ *aRuleNode = nsnull;
- const nsStyleText* text = nsnull;
- ::GetStyleData(aStyleContext, &text);
- NS_ASSERTION(text, "Could not get a style struct!");
+ nsCOMPtr<nsIDocument> doc;
+ aContent->GetDocument(*getter_AddRefs(doc));
+ NS_ENSURE_TRUE(doc, NS_ERROR_UNEXPECTED);
- *aIsSignificant = text->WhiteSpaceIsSignificant();
- return NS_OK;
+ nsCOMPtr<nsIPresShell> presShell;
+ doc->GetShellAt(0, getter_AddRefs(presShell));
+ NS_ENSURE_TRUE(presShell, NS_ERROR_UNEXPECTED);
+
+ nsCOMPtr<nsIStyleContext> sContext;
+ nsresult rv = GetStyleContextForContent(aContent, presShell,
+ getter_AddRefs(sContext));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ return sContext->GetRuleNode(aRuleNode);
}
View
14 content/html/style/src/nsInspectorCSSUtils.h
@@ -42,6 +42,9 @@
#include "nsIInspectorCSSUtils.h"
+class nsIPresShell;
+class nsIStyleContext;
+
class nsInspectorCSSUtils : public nsIInspectorCSSUtils {
public:
@@ -57,10 +60,15 @@ class nsInspectorCSSUtils : public nsIInspectorCSSUtils {
NS_IMETHOD GetRuleNodeRule(nsRuleNode *aNode, nsIStyleRule **aRule);
NS_IMETHOD IsRuleNodeRoot(nsRuleNode *aNode, PRBool *aIsRoot);
NS_IMETHOD AdjustRectForMargins(nsIFrame* aFrame, nsRect& aRect);
- NS_IMETHOD GetStyleContextForFrame(nsIFrame* aFrame,
+ NS_IMETHOD GetRuleNodeForContent(nsIContent* aContent,
+ nsRuleNode** aRuleNode);
+
+private:
+ nsresult GetStyleContextForContent(nsIContent* aContent,
+ nsIPresShell* aPresShell,
nsIStyleContext** aStyleContext);
- NS_IMETHOD IsWhiteSpaceSignificant(nsIStyleContext* aStyleContext,
- PRBool *aIsSignificant);
+ nsresult GetStyleContextForFrame(nsIFrame* aFrame,
+ nsIStyleContext** aStyleContext);
};
#endif /* nsInspectorCSSUtils_h___ */
View
2  content/xul/content/src/nsXULElement.cpp
@@ -85,7 +85,6 @@
#include "nsIFastLoadService.h"
#include "nsIHTMLContentContainer.h"
#include "nsIHTMLStyleSheet.h"
-#include "nsIStyleContext.h"
#include "nsINameSpace.h"
#include "nsINameSpaceManager.h"
#include "nsIObjectInputStream.h"
@@ -99,7 +98,6 @@
#include "nsIScriptGlobalObject.h"
#include "nsIScriptGlobalObjectOwner.h"
#include "nsIServiceManager.h"
-#include "nsIStyleContext.h"
#include "nsIStyleRule.h"
#include "nsIStyleSheet.h"
#include "nsIStyledContent.h"
View
1  content/xul/content/src/nsXULPopupListener.cpp
@@ -76,7 +76,6 @@
#include "nsIEventStateManager.h"
#include "nsIFrame.h"
-#include "nsIStyleContext.h"
// on win32 and os/2, context menus come up on mouse up. On other platforms,
// they appear on mouse down. Certain bits of code care about this difference.
View
1  content/xul/document/src/nsXULDocument.cpp
@@ -109,7 +109,6 @@
#include "nsIRDFService.h"
#include "nsIServiceManager.h"
#include "nsIStreamListener.h"
-#include "nsIStyleContext.h"
#include "nsIStyleSet.h"
#include "nsIStyleSheet.h"
#include "nsITextContent.h"
View
1  docshell/base/nsDocShell.cpp
@@ -134,7 +134,6 @@
#endif
#include "nsIFrame.h"
-#include "nsIStyleContext.h"
// for embedding
#include "nsIWebBrowserChromeFocus.h"
View
12 dom/src/base/nsDOMClassInfo.cpp
@@ -4367,13 +4367,13 @@ nsElementSH::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
shell->GetPresContext(getter_AddRefs(pctx));
NS_ENSURE_TRUE(pctx, NS_ERROR_UNEXPECTED);
- nsCOMPtr<nsIStyleContext> sctx;
- rv = pctx->ResolveStyleContextFor(content, nsnull,
- getter_AddRefs(sctx));
- NS_ENSURE_SUCCESS(rv, rv);
+ // XXX this is a hack so that we don't take a performance hit by using
+ // the DOM computed style API. We can get rid of this hack if we merge
+ // the jsdom library with layout.
- const nsStyleDisplay* display =
- (const nsStyleDisplay*)sctx->GetStyleData(eStyleStruct_Display);
+ const nsStyleDisplay* display;
+ pctx->ResolveStyleContextAndGetStyleData(content, eStyleStruct_Display,
+ (const nsStyleStruct*) display);
NS_ENSURE_TRUE(display, NS_ERROR_UNEXPECTED);
if (display->mBinding.IsEmpty()) {
View
1  dom/src/base/nsGlobalWindow.cpp
@@ -113,7 +113,6 @@
#include "nsIFrameSelection.h"
#include "nsISidebar.h" // XXX for sidebar HACK, see bug 20721
#include "nsIPrompt.h"
-#include "nsIStyleContext.h"
#include "nsIWebNavigation.h"
#include "nsIWebBrowser.h"
#include "nsIWebBrowserChrome.h"
View
8 editor/libeditor/base/nsEditor.cpp
@@ -66,7 +66,6 @@
#include "nsIEnumerator.h"
#include "nsIAtom.h"
#include "nsICaret.h"
-#include "nsIStyleContext.h"
#include "nsIEditActionListener.h"
#include "nsIEditorObserver.h"
#include "nsIKBStateControl.h"
@@ -4098,7 +4097,6 @@ nsEditor::IsPreformatted(nsIDOMNode *aNode, PRBool *aResult)
nsresult result;
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
nsIFrame *frame;
- nsCOMPtr<nsIStyleContext> styleContext;
const nsStyleText* styleText;
PRBool bPreformatted;
@@ -4111,8 +4109,8 @@ nsEditor::IsPreformatted(nsIDOMNode *aNode, PRBool *aResult)
result = ps->GetPrimaryFrameFor(content, &frame);
if (NS_FAILED(result)) return result;
- result = ps->GetStyleContextFor(frame, getter_AddRefs(styleContext));
- if (NS_FAILED(result))
+ ::GetStyleData(frame, &styleText);
+ if (!styleText)
{
// Consider nodes without a style context to be NOT preformatted:
// For instance, this is true of JS tags inside the body (which show
@@ -4121,8 +4119,6 @@ nsEditor::IsPreformatted(nsIDOMNode *aNode, PRBool *aResult)
return NS_OK;
}
- styleText = (const nsStyleText*)styleContext->GetStyleData(eStyleStruct_Text);
-
bPreformatted = (NS_STYLE_WHITESPACE_PRE == styleText->mWhiteSpace) ||
(NS_STYLE_WHITESPACE_MOZ_PRE_WRAP == styleText->mWhiteSpace);
View
2  editor/libeditor/html/nsHTMLDataTransfer.cpp
@@ -74,8 +74,6 @@
#include "nsIDocumentObserver.h"
#include "nsIDocumentStateListener.h"
-#include "nsIStyleContext.h"
-
#include "nsIEnumerator.h"
#include "nsIContent.h"
#include "nsIContentIterator.h"
View
2  editor/libeditor/html/nsHTMLEditRules.cpp
@@ -52,6 +52,7 @@
#include "TypeInState.h"
#include "nsIServiceManager.h"
+#include "nsCRT.h"
#include "nsIContent.h"
#include "nsIContentIterator.h"
@@ -66,7 +67,6 @@
#include "nsIDOMNSRange.h"
#include "nsIDOMCharacterData.h"
#include "nsIEnumerator.h"
-#include "nsIStyleContext.h"
#include "nsIPresShell.h"
#include "nsLayoutCID.h"
#include "nsIPrefBranch.h"
View
24 editor/libeditor/html/nsHTMLEditor.cpp
@@ -85,8 +85,6 @@
#include "nsIDocumentObserver.h"
#include "nsIDocumentStateListener.h"
-#include "nsIStyleContext.h"
-
#include "nsIEnumerator.h"
#include "nsIContent.h"
#include "nsIContentIterator.h"
@@ -133,6 +131,7 @@
// Misc
#include "TextEditorTest.h"
#include "nsEditorUtils.h"
+#include "nsIStyleSet.h"
#include "nsIPref.h"
#include "nsParserCIID.h"
#include "nsITextContent.h"
@@ -4495,27 +4494,6 @@ void nsHTMLEditor::IsTextPropertySetByContent(nsIDOMNode *aNode,
}
}
-void nsHTMLEditor::IsTextStyleSet(nsIStyleContext *aSC,
- nsIAtom *aProperty,
- const nsAString *aAttribute,
- PRBool &aIsSet) const
-{
- aIsSet = PR_FALSE;
- if (aSC && aProperty)
- {
- nsStyleFont* font = (nsStyleFont*)aSC->GetStyleData(eStyleStruct_Font);
- if (nsIEditProperty::i==aProperty)
- {
- aIsSet = PRBool(font->mFont.style & NS_FONT_STYLE_ITALIC);
- }
- else if (nsIEditProperty::b==aProperty)
- { // XXX: check this logic with Peter
- aIsSet = PRBool(font->mFont.weight > NS_FONT_WEIGHT_NORMAL);
- }
- }
-}
-
-
#ifdef XP_MAC
#pragma mark -
#endif
View
9 editor/libeditor/html/nsHTMLEditor.h
@@ -620,15 +620,6 @@ class nsHTMLEditor : public nsPlaintextEditor,
nsIDOMNode **aStyleNode,
nsAString *outValue = nsnull) const;
- /** style-based query returns PR_TRUE if (aProperty, aAttribute) is set in aSC.
- * WARNING: not well tested yet since we don't do style-based queries anywhere.
- */
- virtual void IsTextStyleSet(nsIStyleContext *aSC,
- nsIAtom *aProperty,
- const nsAString *aAttributes,
- PRBool &aIsSet) const;
-
-
void ResetTextSelectionForRange(nsIDOMNode *aParent,
PRInt32 aStartOffset,
PRInt32 aEndOffset,
View
2  editor/libeditor/text/nsPlaintextDataTransfer.cpp
@@ -68,8 +68,6 @@
#include "nsIDocumentObserver.h"
#include "nsIDocumentStateListener.h"
-#include "nsIStyleContext.h"
-
#include "nsIEnumerator.h"
#include "nsIContent.h"
#include "nsIContentIterator.h"
View
20 editor/libeditor/text/nsPlaintextEditor.cpp
@@ -98,8 +98,6 @@
#include "nsEditorUtils.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
-#include "nsStyleConsts.h"
-#include "nsIStyleContext.h"
#include "nsUnicharUtils.h"
#include "nsAOLCiter.h"
@@ -1196,24 +1194,6 @@ nsPlaintextEditor::GetMaxTextLength(PRInt32* aMaxTextLength)
return NS_OK;
}
-NS_IMETHODIMP
-nsPlaintextEditor::GetBodyStyleContext(nsIStyleContext** aStyleContext)
-{
- nsCOMPtr<nsIDOMElement> body;
- nsresult res = GetRootElement(getter_AddRefs(body));
- if (NS_FAILED(res)) return res;
- nsCOMPtr<nsIContent> content = do_QueryInterface(body);
-
- nsIFrame *frame;
- if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
- nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
- if (!ps) return NS_ERROR_NOT_INITIALIZED;
- res = ps->GetPrimaryFrameFor(content, &frame);
- if (NS_FAILED(res)) return res;
-
- return ps->GetStyleContextFor(frame, aStyleContext);
-}
-
//
// Get the wrap width
//
View
2  editor/libeditor/text/nsPlaintextEditor.h
@@ -205,8 +205,6 @@ class nsPlaintextEditor : public nsEditor,
* an error if some serious error occurs
*/
NS_IMETHOD GetLayoutObject(nsIDOMNode *aInNode, nsISupports **aOutLayoutObject);
- NS_IMETHOD GetBodyStyleContext(nsIStyleContext** aStyleContext);
-
// Helpers for output routines
NS_IMETHOD GetAndInitDocEncoder(const nsAString& aFormatType,
PRUint32 aFlags,
View
169 embedding/browser/webBrowser/nsContextMenuInfo.cpp
@@ -27,7 +27,6 @@
#include "nsIFrame.h"
#include "nsIImageFrame.h"
#include "imgIRequest.h"
-#include "nsIStyleContext.h"
#include "nsICanvasFrame.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLElement.h"
@@ -291,15 +290,10 @@ nsContextMenuInfo::GetBackgroundImageRequest(nsIDOMNode * aDOMNode, imgIRequest
if (NS_SUCCEEDED(rv) && frame)
{
// look for a background image on the element
- nsCOMPtr<nsIStyleContext> styleContext;
- rv = presShell->GetStyleContextFor(frame, getter_AddRefs(styleContext));
- if (NS_FAILED(rv) || !styleContext) return rv;
-
do {
- bg = (const nsStyleBackground*)
- styleContext->GetStyleData(eStyleStruct_Background);
- styleContext = dont_AddRef(styleContext->GetParent());
- } while (bg && bg->mBackgroundImage.IsEmpty() && styleContext.get());
+ ::GetStyleData(frame, &bg);
+ frame->GetParent(&frame);
+ } while (bg && bg->mBackgroundImage.IsEmpty() && frame);
if (bg && !bg->mBackgroundImage.IsEmpty())
{
@@ -332,7 +326,8 @@ nsContextMenuInfo::GetBackgroundImageRequest(nsIDOMNode * aDOMNode, imgIRequest
nsICanvasFrame* canvasFrame;
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsICanvasFrame), (void**)&canvasFrame))) {
PRBool isCanvas;
- FindBackground(presContext, frame, &bg, &isCanvas);
+ PRBool foundBackground;
+ presContext->FindFrameBackground(frame, &bg, &isCanvas, &foundBackground);
if (bg && !bg->mBackgroundImage.IsEmpty())
{
nsIFrame *pBGFrame = nsnull;
@@ -407,157 +402,3 @@ nsresult nsContextMenuInfo::GetFrameForBackgroundUpdate(nsIPresContext *aPresCon
return rv;
}
-
-inline PRBool
-nsContextMenuInfo::FindCanvasBackground(nsIPresContext* aPresContext,
- nsIFrame* aForFrame,
- const nsStyleBackground** aBackground)
-{
-
- // XXXldb What if the root element is positioned, etc.? (We don't
- // allow that yet, do we?)
- nsIFrame *firstChild;
- aForFrame->FirstChild(aPresContext, nsnull, &firstChild);
- if (firstChild) {
- const nsStyleBackground *result;
- GetStyleData(firstChild, &result);
-
- // for printing and print preview.. this should be a pageContentFrame
- nsCOMPtr<nsIAtom> frameType;
- nsCOMPtr<nsIStyleContext> parentContext;
-
- firstChild->GetFrameType(getter_AddRefs(frameType));
- nsCOMPtr<nsIAtom> mTag_pageContentFrame = getter_AddRefs(NS_NewAtom("PageContentFrame"));
- if ( (frameType == mTag_pageContentFrame) ){
- // we have to find the background style ourselves.. since the
- // pageContentframe does not have content
- while(firstChild){
- for (nsIFrame* kidFrame = firstChild; nsnull != kidFrame; ) {
- kidFrame->GetStyleContext(getter_AddRefs(parentContext));
- result = (nsStyleBackground*)parentContext->GetStyleData(eStyleStruct_Background);
- if (!result->BackgroundIsTransparent()){
- GetStyleData(kidFrame, aBackground);
- return PR_TRUE;
- } else {
- kidFrame->GetNextSibling(&kidFrame);
- }
- }
- firstChild->FirstChild(aPresContext, nsnull, &firstChild);
- }
- return PR_FALSE; // nothing found for this
- }
-
- // Check if we need to do propagation from BODY rather than HTML.
- if (result->BackgroundIsTransparent()) {
- nsCOMPtr<nsIContent> content;
- aForFrame->GetContent(getter_AddRefs(content));
- if (content) {
- nsCOMPtr<nsIDOMNode> node( do_QueryInterface(content) );
- // Use |GetOwnerDocument| so it works during destruction.
- nsCOMPtr<nsIDOMDocument> doc;
- node->GetOwnerDocument(getter_AddRefs(doc));
- nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(doc);
- if (htmlDoc) {
- nsCOMPtr<nsIDOMHTMLElement> body;
- htmlDoc->GetBody(getter_AddRefs(body));
- nsCOMPtr<nsIContent> bodyContent = do_QueryInterface(body);
- // We need to null check the body node (bug 118829) since
- // there are cases, thanks to the fix for bug 5569, where we
- // will reflow a document with no body. In particular, if a
- // SCRIPT element in the head blocks the parser and then has a
- // SCRIPT that does "document.location.href = 'foo'", then
- // nsParser::Terminate will call |DidBuildModel| methods
- // through to the content sink, which will call |StartLayout|
- // and thus |InitialReflow| on the pres shell. See bug 119351
- // for the ugly details.
- if (bodyContent) {
- nsCOMPtr<nsIPresShell> shell;
- aPresContext->GetShell(getter_AddRefs(shell));
- nsIFrame *bodyFrame;
- nsresult rv = shell->GetPrimaryFrameFor(bodyContent, &bodyFrame);
- if (NS_SUCCEEDED(rv) && bodyFrame)
- ::GetStyleData(bodyFrame, &result);
- }
- }
- }
- }
-
- *aBackground = result;
- } else {
- // This should always give transparent, so we'll fill it in with the
- // default color if needed. This seems to happen a bit while a page is
- // being loaded.
- GetStyleData(aForFrame, aBackground);
- }
-
- return PR_TRUE;
-}
-
-inline PRBool
-nsContextMenuInfo::FindElementBackground(nsIPresContext* aPresContext,
- nsIFrame* aForFrame,
- const nsStyleBackground** aBackground)
-{
- nsIFrame *parentFrame;
- aForFrame->GetParent(&parentFrame);
- // XXXldb We shouldn't have to null-check |parentFrame| here.
- if (parentFrame && IsCanvasFrame(parentFrame)) {
- // Check that we're really the root (rather than in another child list).
- nsIFrame *childFrame;
- parentFrame->FirstChild(aPresContext, nsnull, &childFrame);
- if (childFrame == aForFrame)
- return PR_FALSE; // Background was already drawn for the canvas.
- }
-
- ::GetStyleData(aForFrame, aBackground);
-
- nsCOMPtr<nsIContent> content;
- aForFrame->GetContent(getter_AddRefs(content));
- if (!content || !content->IsContentOfType(nsIContent::eHTML))
- return PR_TRUE; // not frame for an HTML element
-
- if (!parentFrame)
- return PR_TRUE; // no parent to look at
-
- nsCOMPtr<nsIAtom> tag;
- content->GetTag(*getter_AddRefs(tag));
- nsCOMPtr<nsIAtom> mTag_body = getter_AddRefs(NS_NewAtom("body"));
- if (tag != mTag_body)
- return PR_TRUE; // not frame for <BODY> element
-
- // We should only look at the <html> background if we're in an HTML document
- nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
- nsCOMPtr<nsIDOMDocument> doc;
- node->GetOwnerDocument(getter_AddRefs(doc));
- nsCOMPtr<nsIDOMHTMLDocument> htmlDoc(do_QueryInterface(doc));
- if (!htmlDoc)
- return PR_TRUE;
-
- const nsStyleBackground *htmlBG;
- ::GetStyleData(parentFrame, &htmlBG);
- return !htmlBG->BackgroundIsTransparent();
-}
-
-PRBool
-nsContextMenuInfo::IsCanvasFrame(nsIFrame *aFrame)
-{
- nsCOMPtr<nsIAtom> mTag_canvasFrame = getter_AddRefs(NS_NewAtom("CanvasFrame"));
- nsCOMPtr<nsIAtom> mTag_rootFrame = getter_AddRefs(NS_NewAtom("RootFrame"));
- nsCOMPtr<nsIAtom> mTag_pageFrame = getter_AddRefs(NS_NewAtom("PageFrame"));
- nsCOMPtr<nsIAtom> frameType;
- aFrame->GetFrameType(getter_AddRefs(frameType));
- return (frameType == mTag_canvasFrame ||
- frameType == mTag_rootFrame ||
- frameType == mTag_pageFrame);
-}
-
-PRBool
-nsContextMenuInfo::FindBackground(nsIPresContext* aPresContext,
- nsIFrame* aForFrame,
- const nsStyleBackground** aBackground,
- PRBool* aIsCanvas)
-{
- *aIsCanvas = PR_TRUE;
- return FindCanvasBackground(aPresContext, aForFrame, aBackground);
-}
-
View
14 embedding/components/find/src/nsFind.cpp
@@ -51,7 +51,6 @@
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsIDocument.h"
-#include "nsIStyleContext.h"
#include "nsTextFragment.h"
#include "nsString.h"
#include "nsIAtom.h"
@@ -488,14 +487,11 @@ PRBool nsFind::IsVisibleNode(nsIDOMNode *aDOMNode)
return PR_FALSE;
}
- nsCOMPtr<nsIStyleContext> styleContext;
- frame->GetStyleContext(getter_AddRefs(styleContext));
- if (styleContext) {
- const nsStyleVisibility* vis =
- (const nsStyleVisibility*)styleContext->GetStyleData(eStyleStruct_Visibility);
- if (!vis || !vis->IsVisible()) {
- return PR_FALSE;
- }
+ const nsStyleVisibility* vis;
+ ::GetStyleData(frame, &vis);
+ if (!vis || !vis->IsVisible())
+ {
+ return PR_FALSE;
}
return PR_TRUE;
View
86 extensions/inspector/base/src/inDOMUtils.cpp
@@ -49,7 +49,6 @@
#include "nsITextContent.h"
#include "nsEnumeratorUtils.h"
#include "nsIXBLBinding.h"
-#include "nsIStyleContext.h"
#include "nsRuleNode.h"
#include "nsIStyleRule.h"
#include "nsICSSStyleRule.h"
@@ -74,49 +73,6 @@ NS_IMPL_ISUPPORTS1(inDOMUtils, inIDOMUtils);
///////////////////////////////////////////////////////////////////////////////
// inIDOMUtils
-// Helper to get a style context for the node, recursively resolving if needed.
-nsresult
-inDOMUtils::GetStyleContextForContent(nsIContent* aContent,
- nsIPresShell* aPresShell,
- nsIStyleContext** aStyleContext)
-{
- NS_PRECONDITION(aContent, "Gotta have a content");
- NS_PRECONDITION(aPresShell, "Need a PresShell");
- NS_PRECONDITION(aStyleContext, "Need somewhere to put the result");
-
- *aStyleContext = nsnull;
-
- nsIFrame* frame;
- aPresShell->GetPrimaryFrameFor(aContent, &frame);
- if (frame) {
- return mCSSUtils->GetStyleContextForFrame(frame, aStyleContext);
- }
-
- // No frame. Do this the hard way.
- // Get the parent style context
- nsCOMPtr<nsIStyleContext> parentContext;
- nsCOMPtr<nsIContent> parent;
- aContent->GetParent(*getter_AddRefs(parent));
- if (parent) {
- nsresult rv = GetStyleContextForContent(parent, aPresShell,
- getter_AddRefs(parentContext));
- if (NS_FAILED(rv))
- return rv;
- }
-
- nsCOMPtr<nsIPresContext> presContext;
- aPresShell->GetPresContext(getter_AddRefs(presContext));
- NS_ENSURE_TRUE(presContext, NS_ERROR_UNEXPECTED);
-
- if (aContent->IsContentOfType(nsIContent::eELEMENT)) {
- return presContext->ResolveStyleContextFor(aContent, parentContext,
- aStyleContext);
- }
-
- return presContext->ResolveStyleContextForNonElement(parentContext,
- aStyleContext);
-}
-
NS_IMETHODIMP
inDOMUtils::IsIgnorableWhitespace(nsIDOMCharacterData *aDataNode,
PRBool *aReturn)
@@ -148,20 +104,15 @@ inDOMUtils::IsIgnorableWhitespace(nsIDOMCharacterData *aDataNode,
nsCOMPtr<nsIPresShell> presShell = inLayoutUtils::GetPresShellFor(win);
NS_ASSERTION(presShell, "No pres shell!");
- nsCOMPtr<nsIStyleContext> styleContext;
- GetStyleContextForContent(textContent, presShell,
- getter_AddRefs(styleContext));
-
- if (styleContext) {
- PRBool significant = PR_FALSE;
- mCSSUtils->IsWhiteSpaceSignificant(styleContext, &significant);
-
- *aReturn = !significant;
- }
- else {
- // No style context. Let's just assume the default value of
- // white-space: normal, which we can safely ignore.
- *aReturn = PR_TRUE;
+ nsIFrame* frame;
+ nsCOMPtr<nsIContent> content = do_QueryInterface(aDataNode);
+ presShell->GetPrimaryFrameFor(content, &frame);
+ if (frame) {
+ const nsStyleText* text;
+ ::GetStyleData(frame, &text);
+ if (text)
+ *aReturn = (text->mWhiteSpace != NS_STYLE_WHITESPACE_PRE &&
+ text->mWhiteSpace != NS_STYLE_WHITESPACE_MOZ_PRE_WRAP);
}
return NS_OK;
@@ -170,28 +121,17 @@ inDOMUtils::IsIgnorableWhitespace(nsIDOMCharacterData *aDataNode,
NS_IMETHODIMP
inDOMUtils::GetStyleRules(nsIDOMElement *aElement, nsISupportsArray **_retval)
{
+ if (!aElement) return NS_ERROR_NULL_POINTER;
+
*_retval = nsnull;
nsCOMPtr<nsISupportsArray> rules;
NS_NewISupportsArray(getter_AddRefs(rules));
if (!rules) return NS_ERROR_OUT_OF_MEMORY;
- nsCOMPtr<nsIDOMWindowInternal> win(inLayoutUtils::GetWindowFor(aElement));
- if (!win) return NS_ERROR_NULL_POINTER;
-
- nsCOMPtr<nsIPresShell> shell(inLayoutUtils::GetPresShellFor(win));
- nsCOMPtr<nsIContent> content(do_QueryInterface(aElement));
- nsCOMPtr<nsIStyleContext> styleContext;
-
- GetStyleContextForContent(content, shell,
- getter_AddRefs(styleContext));
- if (!styleContext) {
- NS_ERROR("no StyleContext");
- return NS_ERROR_UNEXPECTED;
- }
-
nsRuleNode* ruleNode = nsnull;
- styleContext->GetRuleNode(&ruleNode);
+ nsCOMPtr<nsIContent> content = do_QueryInterface(aElement);
+ mCSSUtils->GetRuleNodeForContent(content, &ruleNode);
nsCOMPtr<nsIStyleRule> srule;
for (PRBool isRoot;
View
4 extensions/inspector/base/src/inDOMUtils.h
@@ -55,10 +55,6 @@ class inDOMUtils : public inIDOMUtils
virtual ~inDOMUtils();
protected:
- nsresult GetStyleContextForContent(nsIContent* aContent,
- nsIPresShell* aPresShell,
- nsIStyleContext** aStyleContext);
-
nsCOMPtr<nsIInspectorCSSUtils> mCSSUtils;
};
View
13 extensions/typeaheadfind/src/nsTypeAheadFind.cpp
@@ -69,7 +69,6 @@
#include "nsIContent.h"
#include "nsIFrame.h"
#include "nsFrameTraversal.h"
-#include "nsIStyleContext.h"
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLElement.h"
@@ -2376,14 +2375,10 @@ nsTypeAheadFind::IsRangeVisible(nsIPresShell *aPresShell,
return PR_FALSE;
}
- nsCOMPtr<nsIStyleContext> styleContext;
- frame->GetStyleContext(getter_AddRefs(styleContext));
- if (styleContext) {
- const nsStyleVisibility* vis =
- (const nsStyleVisibility*)styleContext->GetStyleData(eStyleStruct_Visibility);
- if (!vis || !vis->IsVisible()) {
- return PR_FALSE;
- }
+ const nsStyleVisibility* vis = nsnull;
+ ::GetStyleData(frame, &vis);
+ if (!vis || !vis->IsVisible()) {
+ return PR_FALSE;
}
View
11 gfx/src/windows/nsNativeThemeWin.cpp
@@ -1092,14 +1092,13 @@ static PRBool IsAlreadyStyled(nsIFrame* aFrame, PRUint8 aWidgetType) {
return PR_FALSE;
}
- nsCOMPtr<nsIStyleContext> styleContext;
- aFrame->GetStyleContext(getter_AddRefs(styleContext));
-
- const nsStyleBackground* ourBG = (const nsStyleBackground*)styleContext->GetStyleData(eStyleStruct_Background);
+ const nsStyleBackground* ourBG;
+ ::GetStyleData(aFrame, &ourBG);
if (ourBG->mBackgroundColor != bgColor && ourBG->mBackgroundColor != disabledBG)
return PR_TRUE;
- const nsStyleBorder* ourBorder = (const nsStyleBorder*)styleContext->GetStyleData(eStyleStruct_Border);
+ const nsStyleBorder* ourBorder;
+ ::GetStyleData(aFrame, &ourBorder);
//see if any sides are dotted, dashed or solid
for (PRInt32 cnt = 0; cnt < 4; cnt++) {
if ((ourBorder->GetBorderStyle(cnt) == NS_STYLE_BORDER_STYLE_DOTTED) ||
@@ -1839,4 +1838,4 @@ NS_METHOD NS_NewNativeTheme(nsISupports *aOuter, REFNSIID aIID, void **aResult)
if (!theme)
return NS_ERROR_OUT_OF_MEMORY;
return theme->QueryInterface(aIID, aResult);
-}
+}
View
1  layout/base/nsIFrameSelection.h
@@ -51,7 +51,6 @@
#include "nsISelection.h"
#include "nsIContent.h"
#include "nsCOMPtr.h"
-#include "nsIStyleContext.h"
#include "nsISelectionController.h"
View
26 layout/base/nsPresContext.cpp
@@ -64,7 +64,7 @@
#include "nsNetUtil.h"
#include "nsXPIDLString.h"
#include "nsIWeakReferenceUtils.h"
-
+#include "nsCSSRendering.h"
#include "prprf.h"
#include "nsContentPolicyUtils.h"
#include "nsIScriptGlobalObject.h"
@@ -957,6 +957,19 @@ nsPresContext::ResolveStyleContextFor(nsIContent* aContent,
}
NS_IMETHODIMP
+nsPresContext::ResolveStyleContextAndGetStyleData(nsIContent* aContent,
+ int aSID,
+ const nsStyleStruct*& aStyleStruct)
+{
+ nsCOMPtr<nsIStyleContext> sc;
+ nsresult rv = ResolveStyleContextFor(aContent, nsnull, getter_AddRefs(sc));
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ aStyleStruct = sc->GetStyleData((nsStyleStructID) aSID);
+ return aStyleStruct ? NS_OK : NS_ERROR_FAILURE;
+}
+
+NS_IMETHODIMP
nsPresContext::ResolveStyleContextForNonElement(
nsIStyleContext* aParentContext,
nsIStyleContext** aResult)
@@ -1779,6 +1792,17 @@ nsPresContext::SysColorChanged()
return ClearStyleDataAndReflow();
}
+NS_IMETHODIMP
+nsPresContext::FindFrameBackground(nsIFrame* aFrame,
+ const nsStyleBackground** aBackground,
+ PRBool* aIsCanvas,
+ PRBool* aFoundBackground)
+{
+ *aFoundBackground = nsCSSRendering::FindBackground(this, aFrame,
+ aBackground, aIsCanvas);
+ return NS_OK;
+}
+
#ifdef MOZ_REFLOW_PERF
NS_IMETHODIMP
nsPresContext::CountReflows(const char * aName, PRUint32 aType, nsIFrame * aFrame)
View
25 layout/base/nsPresContext.h
@@ -71,6 +71,8 @@ class nsIIOService;
class nsICSSPseudoComparator;
class nsILanguageAtom;
class nsITheme;
+struct nsStyleStruct;
+struct nsStyleBackground;
#ifdef MOZ_REFLOW_PERF
class nsIRenderingContext;
@@ -195,6 +197,19 @@ class nsIPresContext : public nsISupports {
nsIStyleContext** aResult) = 0;
/**
+ * Resolve the given style struct for a content node.
+ * This is probably NOT what you're looking for to find out the style
+ * properties of an element. From inside layout, you should use the style
+ * context directly; from outside layout you should use GetStyleData
+ * for a frame or the DOM computed style interfaces for content nodes.
+ * aSID should be a nsStyleStructID but isn't due to include ordering
+ * problems.
+ */
+ NS_IMETHOD ResolveStyleContextAndGetStyleData(nsIContent* aContent,
+ int aSID,
+ const nsStyleStruct*& aStyleStruct) = 0;
+
+ /**
* Resolve style for a non-element content node (i.e., one that is
* guaranteed not to match any rules). Eventually such nodes
* shouldn't have style contexts at all, but this at least prevents
@@ -534,6 +549,16 @@ class nsIPresContext : public nsISupports {
*/
NS_IMETHOD SysColorChanged() = 0;
+ /*
+ * Fill in an nsStyleBackground to be used to paint the background for an
+ * element. This applies the rules for propagating backgrounds between
+ * BODY, the root element, and the canvas.
+ */
+ NS_IMETHOD FindFrameBackground(nsIFrame* aFrame,
+ const nsStyleBackground** aBackground,
+ PRBool* aIsCanavs,
+ PRBool* aFoundBackground) = 0;
+
#ifdef MOZ_REFLOW_PERF
NS_IMETHOD CountReflows(const char * aName, PRUint32 aType, nsIFrame * aFrame) = 0;
NS_IMETHOD PaintCount(const char * aName, nsIRenderingContext* aRendingContext, nsIFrame * aFrame, PRUint32 aColor) = 0;
View
10 layout/base/public/nsIFrame.h
@@ -579,12 +579,22 @@ class nsIFrame : public nsISupports
/**
* Get the style data associated with this frame.
*/
+ NS_IMETHOD GetStyleDataExternal(nsStyleStructID aSID,
+ const nsStyleStruct*& aStyleStruct) = 0;
+
+#ifdef _IMPL_NS_LAYOUT
nsresult GetStyleData(nsStyleStructID aSID,
const nsStyleStruct*& aStyleStruct) const {
NS_ASSERTION(mStyleContext, "No style context found!");
aStyleStruct = mStyleContext->GetStyleData(aSID);
return NS_OK;
}
+#else
+ nsresult GetStyleData(nsStyleStructID aSID,
+ const nsStyleStruct*& aStyleStruct) {
+ return GetStyleDataExternal(aSID, aStyleStruct);
+ }
+#endif
// Fill a style struct with data
nsresult GetStyle(nsStyleStructID aSID, const nsStyleStruct** aStruct) const {
View
3  layout/base/public/nsIFrameDebug.h
@@ -140,6 +140,9 @@ class nsIFrameDebug : public nsISupports {
static void ShowEventTargetFrameBorder(PRBool aEnable);
static PRBool GetShowEventTargetFrameBorder();
+ virtual void SizeOfStyleContext(nsISizeOfHandler* aSizeOfHandler,
+ PRUint32& aSize) = 0;
+
private:
NS_IMETHOD_(nsrefcnt) AddRef(void) = 0;
NS_IMETHOD_(nsrefcnt) Release(void) = 0;
View
1  layout/base/public/nsIFrameSelection.h
@@ -51,7 +51,6 @@
#include "nsISelection.h"
#include "nsIContent.h"
#include "nsCOMPtr.h"
-#include "nsIStyleContext.h"
#include "nsISelectionController.h"
View
25 layout/base/public/nsIPresContext.h
@@ -71,6 +71,8 @@ class nsIIOService;
class nsICSSPseudoComparator;
class nsILanguageAtom;
class nsITheme;
+struct nsStyleStruct;
+struct nsStyleBackground;
#ifdef MOZ_REFLOW_PERF
class nsIRenderingContext;
@@ -195,6 +197,19 @@ class nsIPresContext : public nsISupports {
nsIStyleContext** aResult) = 0;
/**
+ * Resolve the given style struct for a content node.
+ * This is probably NOT what you're looking for to find out the style
+ * properties of an element. From inside layout, you should use the style