PageRenderTime 25ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/mozilla/mozilla/dist/include/layout/nsCSSFrameConstructor.h

http://kmbrasil.codeplex.com
C++ Header | 1047 lines | 713 code | 164 blank | 170 comment | 4 complexity | 5981dc2b16a3086cccf1572c0b614e52 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, GPL-2.0

Large files files are truncated, but you can click here to view the full file

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. * http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is mozilla.org code.
  16. *
  17. * The Initial Developer of the Original Code is
  18. * Netscape Communications Corporation.
  19. * Portions created by the Initial Developer are Copyright (C) 1998
  20. * the Initial Developer. All Rights Reserved.
  21. *
  22. * Contributor(s):
  23. *
  24. * Alternatively, the contents of this file may be used under the terms of
  25. * either of the GNU General Public License Version 2 or later (the "GPL"),
  26. * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27. * in which case the provisions of the GPL or the LGPL are applicable instead
  28. * of those above. If you wish to allow use of your version of this file only
  29. * under the terms of either the GPL or the LGPL, and not to allow others to
  30. * use your version of this file under the terms of the MPL, indicate your
  31. * decision by deleting the provisions above and replace them with the notice
  32. * and other provisions required by the GPL or the LGPL. If you do not delete
  33. * the provisions above, a recipient may use your version of this file under
  34. * the terms of any one of the MPL, the GPL or the LGPL.
  35. *
  36. * ***** END LICENSE BLOCK ***** */
  37. #ifndef nsCSSFrameConstructor_h___
  38. #define nsCSSFrameConstructor_h___
  39. #include "nsCOMPtr.h"
  40. #include "nsILayoutHistoryState.h"
  41. #include "nsIXBLService.h"
  42. #include "nsQuoteList.h"
  43. #include "nsCounterManager.h"
  44. #include "nsDataHashtable.h"
  45. #include "nsHashKeys.h"
  46. #include "plevent.h"
  47. #include "nsIEventQueueService.h"
  48. #include "nsIEventQueue.h"
  49. class nsIDocument;
  50. struct nsFrameItems;
  51. struct nsAbsoluteItems;
  52. struct nsTableCreator;
  53. class nsStyleContext;
  54. struct nsTableList;
  55. struct nsStyleContent;
  56. struct nsStyleDisplay;
  57. class nsIPresShell;
  58. class nsVoidArray;
  59. class nsFrameManager;
  60. class nsIDOMHTMLSelectElement;
  61. class nsPresContext;
  62. class nsStyleChangeList;
  63. class nsIFrame;
  64. struct nsFindFrameHint
  65. {
  66. nsIFrame *mPrimaryFrameForPrevSibling; // weak ref to the primary frame for the content for which we need a frame
  67. nsFindFrameHint() : mPrimaryFrameForPrevSibling(nsnull) { }
  68. };
  69. class nsFrameConstructorState;
  70. class nsFrameConstructorSaveState;
  71. class nsCSSFrameConstructor
  72. {
  73. public:
  74. nsCSSFrameConstructor(nsIDocument *aDocument, nsIPresShell* aPresShell);
  75. ~nsCSSFrameConstructor(void) {}
  76. // Maintain global objects - gXBLService
  77. static nsIXBLService * GetXBLService();
  78. static void ReleaseGlobals() { NS_IF_RELEASE(gXBLService); }
  79. // get the alternate text for a content node
  80. static void GetAlternateTextFor(nsIContent* aContent,
  81. nsIAtom* aTag, // content object's tag
  82. nsXPIDLString& aAltText);
  83. private:
  84. // These are not supported and are not implemented!
  85. nsCSSFrameConstructor(const nsCSSFrameConstructor& aCopy);
  86. nsCSSFrameConstructor& operator=(const nsCSSFrameConstructor& aCopy);
  87. public:
  88. // XXXbz this method needs to actually return errors!
  89. nsresult ConstructRootFrame(nsIContent* aDocElement,
  90. nsIFrame** aNewFrame);
  91. nsresult ReconstructDocElementHierarchy();
  92. nsresult ContentAppended(nsIContent* aContainer,
  93. PRInt32 aNewIndexInContainer);
  94. nsresult ContentInserted(nsIContent* aContainer,
  95. nsIFrame* aContainerFrame,
  96. nsIContent* aChild,
  97. PRInt32 aIndexInContainer,
  98. nsILayoutHistoryState* aFrameState,
  99. PRBool aInReinsertContent);
  100. nsresult ContentRemoved(nsIContent* aContainer,
  101. nsIContent* aChild,
  102. PRInt32 aIndexInContainer,
  103. PRBool aInReinsertContent);
  104. nsresult CharacterDataChanged(nsIContent* aContent,
  105. PRBool aAppend);
  106. nsresult ContentStatesChanged(nsIContent* aContent1,
  107. nsIContent* aContent2,
  108. PRInt32 aStateMask);
  109. // Should be called when a frame is going to be destroyed and
  110. // WillDestroyFrameTree hasn't been called yet.
  111. void NotifyDestroyingFrame(nsIFrame* aFrame);
  112. nsresult AttributeChanged(nsIContent* aContent,
  113. PRInt32 aNameSpaceID,
  114. nsIAtom* aAttribute,
  115. PRInt32 aModType);
  116. void BeginUpdate() { ++mUpdateCount; }
  117. void EndUpdate();
  118. void RecalcQuotesAndCounters();
  119. void WillDestroyFrameTree();
  120. // Note: It's the caller's responsibility to make sure to wrap a
  121. // ProcessRestyledFrames call in a view update batch.
  122. // This function does not call ProcessAttachedQueue() on the binding manager.
  123. // If the caller wants that to happen synchronously, it needs to handle that
  124. // itself.
  125. nsresult ProcessRestyledFrames(nsStyleChangeList& aRestyleArray);
  126. private:
  127. // This function does not call ProcessAttachedQueue() on the binding manager.
  128. // If the caller wants that to happen synchronously, it needs to handle that
  129. // itself.
  130. void ProcessOneRestyle(nsIContent* aContent, nsReStyleHint aRestyleHint,
  131. nsChangeHint aChangeHint);
  132. public:
  133. // This function does not call ProcessAttachedQueue() on the binding manager.
  134. // If the caller wants that to happen synchronously, it needs to handle that
  135. // itself.
  136. void ProcessPendingRestyles();
  137. void PostRestyleEvent(nsIContent* aContent, nsReStyleHint aRestyleHint,
  138. nsChangeHint aMinChangeHint);
  139. // Notification that we were unable to render a replaced element.
  140. nsresult CantRenderReplacedElement(nsIFrame* aFrame);
  141. // Request to create a continuing frame
  142. nsresult CreateContinuingFrame(nsPresContext* aPresContext,
  143. nsIFrame* aFrame,
  144. nsIFrame* aParentFrame,
  145. nsIFrame** aContinuingFrame);
  146. // Request to find the primary frame associated with a given content object.
  147. // This is typically called by the pres shell when there is no mapping in
  148. // the pres shell hash table
  149. nsresult FindPrimaryFrameFor(nsFrameManager* aFrameManager,
  150. nsIContent* aContent,
  151. nsIFrame** aFrame,
  152. nsFindFrameHint* aHint);
  153. // Get the XBL insertion point for a child
  154. nsresult GetInsertionPoint(nsIFrame* aParentFrame,
  155. nsIContent* aChildContent,
  156. nsIFrame** aInsertionPoint,
  157. PRBool* aMultiple = nsnull);
  158. nsresult CreateListBoxContent(nsPresContext* aPresContext,
  159. nsIFrame* aParentFrame,
  160. nsIFrame* aPrevFrame,
  161. nsIContent* aChild,
  162. nsIFrame** aResult,
  163. PRBool aIsAppend,
  164. PRBool aIsScrollbar,
  165. nsILayoutHistoryState* aFrameState);
  166. nsresult RemoveMappingsForFrameSubtree(nsIFrame* aRemovedFrame,
  167. nsILayoutHistoryState* aFrameState);
  168. nsIFrame* GetInitialContainingBlock() { return mInitialContainingBlock; }
  169. nsIFrame* GetPageSequenceFrame() { return mPageSequenceFrame; }
  170. private:
  171. nsresult ReinsertContent(nsIContent* aContainer,
  172. nsIContent* aChild);
  173. nsresult ConstructPageFrame(nsIPresShell* aPresShell,
  174. nsPresContext* aPresContext,
  175. nsIFrame* aParentFrame,
  176. nsIFrame* aPrevPageFrame,
  177. nsIFrame*& aPageFrame,
  178. nsIFrame*& aPageContentFrame);
  179. void DoContentStateChanged(nsIContent* aContent,
  180. PRInt32 aStateMask);
  181. private:
  182. /* aMinHint is the minimal change that should be made to the element */
  183. void RestyleElement(nsIContent* aContent,
  184. nsIFrame* aPrimaryFrame,
  185. nsChangeHint aMinHint);
  186. void RestyleLaterSiblings(nsIContent* aContent);
  187. nsresult InitAndRestoreFrame (const nsFrameConstructorState& aState,
  188. nsIContent* aContent,
  189. nsIFrame* aParentFrame,
  190. nsStyleContext* aStyleContext,
  191. nsIFrame* aPrevInFlow,
  192. nsIFrame* aNewFrame,
  193. PRBool aAllowCounters = PR_TRUE);
  194. already_AddRefed<nsStyleContext>
  195. ResolveStyleContext(nsIFrame* aParentFrame,
  196. nsIContent* aContent);
  197. nsresult ConstructFrame(nsFrameConstructorState& aState,
  198. nsIContent* aContent,
  199. nsIFrame* aParentFrame,
  200. nsFrameItems& aFrameItems);
  201. nsresult ConstructDocElementFrame(nsFrameConstructorState& aState,
  202. nsIContent* aDocElement,
  203. nsIFrame* aParentFrame,
  204. nsIFrame** aNewFrame);
  205. nsresult ConstructDocElementTableFrame(nsIContent* aDocElement,
  206. nsIFrame* aParentFrame,
  207. nsIFrame** aNewTableFrame,
  208. nsFrameConstructorState& aState);
  209. nsresult CreateGeneratedFrameFor(nsIFrame* aParentFrame,
  210. nsIContent* aContent,
  211. nsStyleContext* aStyleContext,
  212. const nsStyleContent* aStyleContent,
  213. PRUint32 aContentIndex,
  214. nsIFrame** aFrame);
  215. PRBool CreateGeneratedContentFrame(nsFrameConstructorState& aState,
  216. nsIFrame* aFrame,
  217. nsIContent* aContent,
  218. nsStyleContext* aStyleContext,
  219. nsIAtom* aPseudoElement,
  220. nsIFrame** aResult);
  221. nsresult AppendFrames(const nsFrameConstructorState& aState,
  222. nsIContent* aContainer,
  223. nsIFrame* aParentFrame,
  224. nsIFrame* aFrameList,
  225. nsIFrame* aAfterFrame);
  226. // BEGIN TABLE SECTION
  227. /**
  228. * ConstructTableFrame will construct the outer and inner table frames and
  229. * return them. Unless aIsPseudo is PR_TRUE, it will put the inner frame in
  230. * the child list of the outer frame, and will put any pseudo frames it had
  231. * to create into aChildItems. The newly-created outer frame will either be
  232. * in aChildItems or a descendant of a pseudo in aChildItems (unless it's
  233. * positioned or floated, in which case its placeholder will be in
  234. * aChildItems). If aAllowOutOfFlow is false, the table frame will be forced
  235. * to be in-flow no matter what its float or position values are.
  236. */
  237. nsresult ConstructTableFrame(nsFrameConstructorState& aState,
  238. nsIContent* aContent,
  239. nsIFrame* aContentParent,
  240. nsStyleContext* aStyleContext,
  241. nsTableCreator& aTableCreator,
  242. PRBool aIsPseudo,
  243. nsFrameItems& aChildItems,
  244. PRBool aAllowOutOfFlow,
  245. nsIFrame*& aNewOuterFrame,
  246. nsIFrame*& aNewInnerFrame);
  247. nsresult ConstructTableCaptionFrame(nsFrameConstructorState& aState,
  248. nsIContent* aContent,
  249. nsIFrame* aParent,
  250. nsStyleContext* aStyleContext,
  251. nsTableCreator& aTableCreator,
  252. nsFrameItems& aChildItems,
  253. nsIFrame*& aNewFrame,
  254. PRBool& aIsPseudoParent);
  255. nsresult ConstructTableRowGroupFrame(nsFrameConstructorState& aState,
  256. nsIContent* aContent,
  257. nsIFrame* aParent,
  258. nsStyleContext* aStyleContext,
  259. nsTableCreator& aTableCreator,
  260. PRBool aIsPseudo,
  261. nsFrameItems& aChildItems,
  262. nsIFrame*& aNewFrame,
  263. PRBool& aIsPseudoParent);
  264. nsresult ConstructTableColGroupFrame(nsFrameConstructorState& aState,
  265. nsIContent* aContent,
  266. nsIFrame* aParent,
  267. nsStyleContext* aStyleContext,
  268. nsTableCreator& aTableCreator,
  269. PRBool aIsPseudo,
  270. nsFrameItems& aChildItems,
  271. nsIFrame*& aNewFrame,
  272. PRBool& aIsPseudoParent);
  273. nsresult ConstructTableRowFrame(nsFrameConstructorState& aState,
  274. nsIContent* aContent,
  275. nsIFrame* aParent,
  276. nsStyleContext* aStyleContext,
  277. nsTableCreator& aTableCreator,
  278. PRBool aIsPseudo,
  279. nsFrameItems& aChildItems,
  280. nsIFrame*& aNewFrame,
  281. PRBool& aIsPseudoParent);
  282. nsresult ConstructTableColFrame(nsFrameConstructorState& aState,
  283. nsIContent* aContent,
  284. nsIFrame* aParent,
  285. nsStyleContext* aStyleContext,
  286. nsTableCreator& aTableCreator,
  287. PRBool aIsPseudo,
  288. nsFrameItems& aChildItems,
  289. nsIFrame*& aNewFrame,
  290. PRBool& aIsPseudoParent);
  291. nsresult ConstructTableCellFrame(nsFrameConstructorState& aState,
  292. nsIContent* aContent,
  293. nsIFrame* aParentFrame,
  294. nsStyleContext* aStyleContext,
  295. nsTableCreator& aTableCreator,
  296. PRBool aIsPseudo,
  297. nsFrameItems& aChildItems,
  298. nsIFrame*& aNewCellOuterFrame,
  299. nsIFrame*& aNewCellInnerFrame,
  300. PRBool& aIsPseudoParent);
  301. /**
  302. * ConstructTableForeignFrame constructs the frame for a non-table-element
  303. * child of a table-element frame (where "table-element" can mean rows,
  304. * cells, etc). This function will insert the new frame in the right child
  305. * list automatically, create placeholders for it in the right places as
  306. * needed, etc (hence does not return the new frame).
  307. */
  308. nsresult ConstructTableForeignFrame(nsFrameConstructorState& aState,
  309. nsIContent* aContent,
  310. nsIFrame* aParentFrameIn,
  311. nsStyleContext* aStyleContext,
  312. nsTableCreator& aTableCreator,
  313. nsFrameItems& aChildItems);
  314. nsresult CreatePseudoTableFrame(nsTableCreator& aTableCreator,
  315. nsFrameConstructorState& aState,
  316. nsIFrame* aParentFrameIn = nsnull);
  317. nsresult CreatePseudoRowGroupFrame(nsTableCreator& aTableCreator,
  318. nsFrameConstructorState& aState,
  319. nsIFrame* aParentFrameIn = nsnull);
  320. nsresult CreatePseudoColGroupFrame(nsTableCreator& aTableCreator,
  321. nsFrameConstructorState& aState,
  322. nsIFrame* aParentFrameIn = nsnull);
  323. nsresult CreatePseudoRowFrame(nsTableCreator& aTableCreator,
  324. nsFrameConstructorState& aState,
  325. nsIFrame* aParentFrameIn = nsnull);
  326. nsresult CreatePseudoCellFrame(nsTableCreator& aTableCreator,
  327. nsFrameConstructorState& aState,
  328. nsIFrame* aParentFrameIn = nsnull);
  329. nsresult GetPseudoTableFrame(nsTableCreator& aTableCreator,
  330. nsFrameConstructorState& aState,
  331. nsIFrame& aParentFrameIn);
  332. nsresult GetPseudoColGroupFrame(nsTableCreator& aTableCreator,
  333. nsFrameConstructorState& aState,
  334. nsIFrame& aParentFrameIn);
  335. nsresult GetPseudoRowGroupFrame(nsTableCreator& aTableCreator,
  336. nsFrameConstructorState& aState,
  337. nsIFrame& aParentFrameIn);
  338. nsresult GetPseudoRowFrame(nsTableCreator& aTableCreator,
  339. nsFrameConstructorState& aState,
  340. nsIFrame& aParentFrameIn);
  341. nsresult GetPseudoCellFrame(nsTableCreator& aTableCreator,
  342. nsFrameConstructorState& aState,
  343. nsIFrame& aParentFrameIn);
  344. nsresult GetParentFrame(nsTableCreator& aTableCreator,
  345. nsIFrame& aParentFrameIn,
  346. nsIAtom* aChildFrameType,
  347. nsFrameConstructorState& aState,
  348. nsIFrame*& aParentFrame,
  349. PRBool& aIsPseudoParent);
  350. /**
  351. * Function to adjust aParentFrame and aFrameItems to deal with table
  352. * pseudo-frames that may have to be inserted.
  353. * @param aChildContent the content node we want to construct a frame for
  354. * @param aChildDisplay the display struct for aChildContent
  355. * @param aParentFrame the frame we think should be the parent. This will be
  356. * adjusted to point to a pseudo-frame if needed.
  357. * @param aTag tag that would be used for frame construction
  358. * @param aNameSpaceID namespace that will be used for frame construction
  359. * @param aFrameItems the framelist we think we need to put the child frame
  360. * into. If we have to construct pseudo-frames, we'll modify the
  361. * pointer to point to the list the child frame should go into.
  362. * @param aState the nsFrameConstructorState we're using.
  363. * @param aSaveState the nsFrameConstructorSaveState we can use for pushing a
  364. * float containing block if we have to do it.
  365. * @param aCreatedPseudo whether we had to create a pseudo-parent
  366. * @return NS_OK on success, NS_ERROR_OUT_OF_MEMORY and such as needed.
  367. */
  368. // XXXbz this function should really go away once we rework pseudo-frame
  369. // handling to be better. This should simply be part of the job of
  370. // GetGeometricParent, and stuff like the frameitems and parent frame should
  371. // be kept track of in the state...
  372. nsresult AdjustParentFrame(nsIContent* aChildContent,
  373. const nsStyleDisplay* aChildDisplay,
  374. nsIAtom* aTag,
  375. PRInt32 aNameSpaceID,
  376. nsStyleContext* aChildStyle,
  377. nsIFrame* & aParentFrame,
  378. nsFrameItems* & aFrameItems,
  379. nsFrameConstructorState& aState,
  380. nsFrameConstructorSaveState& aSaveState,
  381. PRBool& aCreatedPseudo);
  382. nsresult TableProcessChildren(nsFrameConstructorState& aState,
  383. nsIContent* aContent,
  384. nsIFrame* aParentFrame,
  385. nsTableCreator& aTableCreator,
  386. nsFrameItems& aChildItems,
  387. nsIFrame*& aCaption);
  388. nsresult TableProcessChild(nsFrameConstructorState& aState,
  389. nsIContent* aChildContent,
  390. nsIContent* aParentContent,
  391. nsIFrame* aParentFrame,
  392. nsIAtom* aParentFrameType,
  393. nsStyleContext* aParentStyleContext,
  394. nsTableCreator& aTableCreator,
  395. nsFrameItems& aChildItems,
  396. nsIFrame*& aCaption);
  397. const nsStyleDisplay* GetDisplay(nsIFrame* aFrame);
  398. // END TABLE SECTION
  399. protected:
  400. static nsresult CreatePlaceholderFrameFor(nsIPresShell* aPresShell,
  401. nsPresContext* aPresContext,
  402. nsFrameManager* aFrameManager,
  403. nsIContent* aContent,
  404. nsIFrame* aFrame,
  405. nsStyleContext* aStyleContext,
  406. nsIFrame* aParentFrame,
  407. nsIFrame** aPlaceholderFrame);
  408. private:
  409. nsresult ConstructAlternateFrame(nsIContent* aContent,
  410. nsStyleContext* aStyleContext,
  411. nsIFrame* aGeometricParent,
  412. nsIFrame* aContentParent,
  413. nsIFrame*& aFrame);
  414. // @param OUT aNewFrame the new radio control frame
  415. nsresult ConstructRadioControlFrame(nsIFrame** aNewFrame,
  416. nsIContent* aContent,
  417. nsStyleContext* aStyleContext);
  418. // @param OUT aNewFrame the new checkbox control frame
  419. nsresult ConstructCheckboxControlFrame(nsIFrame** aNewFrame,
  420. nsIContent* aContent,
  421. nsStyleContext* aStyleContext);
  422. // ConstructSelectFrame puts the new frame in aFrameItems and
  423. // handles the kids of the select.
  424. nsresult ConstructSelectFrame(nsFrameConstructorState& aState,
  425. nsIContent* aContent,
  426. nsIFrame* aParentFrame,
  427. nsIAtom* aTag,
  428. nsStyleContext* aStyleContext,
  429. nsIFrame*& aNewFrame,
  430. const nsStyleDisplay* aStyleDisplay,
  431. PRBool& aFrameHasBeenInitialized,
  432. nsFrameItems& aFrameItems);
  433. // ConstructFieldSetFrame puts the new frame in aFrameItems and
  434. // handles the kids of the fieldset
  435. nsresult ConstructFieldSetFrame(nsFrameConstructorState& aState,
  436. nsIContent* aContent,
  437. nsIFrame* aParentFrame,
  438. nsIAtom* aTag,
  439. nsStyleContext* aStyleContext,
  440. nsIFrame*& aNewFrame,
  441. nsFrameItems& aFrameItems,
  442. const nsStyleDisplay* aStyleDisplay,
  443. PRBool& aFrameHasBeenInitialized);
  444. nsresult ConstructTextFrame(nsFrameConstructorState& aState,
  445. nsIContent* aContent,
  446. nsIFrame* aParentFrame,
  447. nsStyleContext* aStyleContext,
  448. nsFrameItems& aFrameItems,
  449. PRBool aPseudoParent);
  450. nsresult ConstructPageBreakFrame(nsFrameConstructorState& aState,
  451. nsIContent* aContent,
  452. nsIFrame* aParentFrame,
  453. nsStyleContext* aStyleContext,
  454. nsFrameItems& aFrameItems);
  455. // Construct a page break frame if page-break-before:always is set in aStyleContext
  456. // and add it to aFrameItems. Return true if page-break-after:always is set on aStyleContext.
  457. // Don't do this for row groups, rows or cell, because tables handle those internally.
  458. PRBool PageBreakBefore(nsFrameConstructorState& aState,
  459. nsIContent* aContent,
  460. nsIFrame* aParentFrame,
  461. nsStyleContext* aStyleContext,
  462. nsFrameItems& aFrameItems);
  463. nsresult ConstructHTMLFrame(nsFrameConstructorState& aState,
  464. nsIContent* aContent,
  465. nsIFrame* aParentFrame,
  466. nsIAtom* aTag,
  467. PRInt32 aNameSpaceID,
  468. nsStyleContext* aStyleContext,
  469. nsFrameItems& aFrameItems,
  470. PRBool aHasPseudoParent);
  471. nsresult ConstructFrameInternal( nsFrameConstructorState& aState,
  472. nsIContent* aContent,
  473. nsIFrame* aParentFrame,
  474. nsIAtom* aTag,
  475. PRInt32 aNameSpaceID,
  476. nsStyleContext* aStyleContext,
  477. nsFrameItems& aFrameItems,
  478. PRBool aXBLBaseTag);
  479. nsresult CreateAnonymousFrames(nsIAtom* aTag,
  480. nsFrameConstructorState& aState,
  481. nsIContent* aParent,
  482. nsIFrame* aNewFrame,
  483. PRBool aAppendToExisting,
  484. nsFrameItems& aChildItems,
  485. PRBool aIsRoot = PR_FALSE);
  486. nsresult CreateAnonymousFrames(nsFrameConstructorState& aState,
  487. nsIContent* aParent,
  488. nsIDocument* aDocument,
  489. nsIFrame* aNewFrame,
  490. PRBool aForceBindingParent,
  491. PRBool aAppendToExisting,
  492. nsFrameItems& aChildItems,
  493. nsIFrame* aAnonymousCreator,
  494. nsIContent* aInsertionNode,
  495. PRBool aAnonymousParentIsBlock);
  496. //MathML Mod - RBS
  497. #ifdef MOZ_MATHML
  498. nsresult ConstructMathMLFrame(nsFrameConstructorState& aState,
  499. nsIContent* aContent,
  500. nsIFrame* aParentFrame,
  501. nsIAtom* aTag,
  502. PRInt32 aNameSpaceID,
  503. nsStyleContext* aStyleContext,
  504. nsFrameItems& aFrameItems,
  505. PRBool aHasPseudoParent);
  506. #endif
  507. nsresult ConstructXULFrame(nsFrameConstructorState& aState,
  508. nsIContent* aContent,
  509. nsIFrame* aParentFrame,
  510. nsIAtom* aTag,
  511. PRInt32 aNameSpaceID,
  512. nsStyleContext* aStyleContext,
  513. nsFrameItems& aFrameItems,
  514. PRBool aXBLBaseTag,
  515. PRBool aHasPseudoParent,
  516. PRBool* aHaltProcessing);
  517. // XTF
  518. #ifdef MOZ_XTF
  519. nsresult ConstructXTFFrame(nsFrameConstructorState& aState,
  520. nsIContent* aContent,
  521. nsIFrame* aParentFrame,
  522. nsIAtom* aTag,
  523. PRInt32 aNameSpaceID,
  524. nsStyleContext* aStyleContext,
  525. nsFrameItems& aFrameItems,
  526. PRBool aHasPseudoParent);
  527. #endif
  528. // SVG - rods
  529. #ifdef MOZ_SVG
  530. nsresult TestSVGConditions(nsIContent* aContent,
  531. PRBool& aHasRequiredExtensions,
  532. PRBool& aHasRequiredFeatures,
  533. PRBool& aHasSystemLanguage);
  534. nsresult SVGSwitchProcessChildren(nsFrameConstructorState& aState,
  535. nsIContent* aContent,
  536. nsIFrame* aFrame,
  537. nsFrameItems& aFrameItems);
  538. nsresult ConstructSVGFrame(nsFrameConstructorState& aState,
  539. nsIContent* aContent,
  540. nsIFrame* aParentFrame,
  541. nsIAtom* aTag,
  542. PRInt32 aNameSpaceID,
  543. nsStyleContext* aStyleContext,
  544. nsFrameItems& aFrameItems,
  545. PRBool aHasPseudoParent,
  546. PRBool* aHaltProcessing);
  547. #endif
  548. nsresult ConstructFrameByDisplayType(nsFrameConstructorState& aState,
  549. const nsStyleDisplay* aDisplay,
  550. nsIContent* aContent,
  551. PRInt32 aNameSpaceID,
  552. nsIAtom* aTag,
  553. nsIFrame* aParentFrame,
  554. nsStyleContext* aStyleContext,
  555. nsFrameItems& aFrameItems,
  556. PRBool aHasPseudoParent);
  557. nsresult ProcessChildren(nsFrameConstructorState& aState,
  558. nsIContent* aContent,
  559. nsIFrame* aFrame,
  560. PRBool aCanHaveGeneratedContent,
  561. nsFrameItems& aFrameItems,
  562. PRBool aParentIsBlock,
  563. nsTableCreator* aTableCreator = nsnull);
  564. // @param OUT aFrame the newly created frame
  565. nsresult CreateInputFrame(nsIContent* aContent,
  566. nsIFrame** aFrame,
  567. nsStyleContext* aStyleContext);
  568. nsresult AddDummyFrameToSelect(nsFrameConstructorState& aState,
  569. nsIFrame* aListFrame,
  570. nsIFrame* aParentFrame,
  571. nsFrameItems* aChildItems,
  572. nsIContent* aContainer,
  573. nsIDOMHTMLSelectElement* aSelectElement);
  574. nsresult RemoveDummyFrameFromSelect(nsIContent* aContainer,
  575. nsIContent* aChild,
  576. nsIDOMHTMLSelectElement* aSelectElement);
  577. nsIFrame* GetFrameFor(nsIContent* aContent);
  578. nsIFrame* GetAbsoluteContainingBlock(nsIFrame* aFrame);
  579. nsIFrame* GetFloatContainingBlock(nsIFrame* aFrame);
  580. nsIContent* PropagateScrollToViewport();
  581. // Build a scroll frame:
  582. // Calls BeginBuildingScrollFrame, InitAndRestoreFrame, and then FinishBuildingScrollFrame.
  583. // Sets the primary frame for the content to the output aNewFrame.
  584. // @param aNewFrame the created scrollframe --- output only
  585. nsresult
  586. BuildScrollFrame(nsFrameConstructorState& aState,
  587. nsIContent* aContent,
  588. nsStyleContext* aContentStyle,
  589. nsIFrame* aScrolledFrame,
  590. nsIFrame* aParentFrame,
  591. nsIFrame* aContentParentFrame,
  592. nsIFrame*& aNewFrame,
  593. nsStyleContext*& aScrolledChildStyle);
  594. // Builds the initial ScrollFrame
  595. already_AddRefed<nsStyleContext>
  596. BeginBuildingScrollFrame(nsFrameConstructorState& aState,
  597. nsIContent* aContent,
  598. nsStyleContext* aContentStyle,
  599. nsIFrame* aParentFrame,
  600. nsIFrame* aContentParentFrame,
  601. nsIAtom* aScrolledPseudo,
  602. PRBool aIsRoot,
  603. nsIFrame*& aNewFrame);
  604. // Completes the building of the scrollframe:
  605. // Creates a view for the scrolledframe and makes it the child of the scrollframe.
  606. void
  607. FinishBuildingScrollFrame(nsIFrame* aScrollFrame,
  608. nsIFrame* aScrolledFrame);
  609. // InitializeSelectFrame puts scrollFrame in aFrameItems if aBuildCombobox is false
  610. nsresult
  611. InitializeSelectFrame(nsFrameConstructorState& aState,
  612. nsIFrame* scrollFrame,
  613. nsIFrame* scrolledFrame,
  614. nsIContent* aContent,
  615. nsIFrame* aParentFrame,
  616. nsStyleContext* aStyleContext,
  617. PRBool aBuildCombobox,
  618. nsFrameItems& aFrameItems);
  619. nsresult MaybeRecreateFramesForContent(nsIContent* aContent);
  620. nsresult RecreateFramesForContent(nsIContent* aContent);
  621. PRBool MaybeRecreateContainerForIBSplitterFrame(nsIFrame* aFrame, nsresult* aResult);
  622. nsresult CreateContinuingOuterTableFrame(nsIPresShell* aPresShell,
  623. nsPresContext* aPresContext,
  624. nsIFrame* aFrame,
  625. nsIFrame* aParentFrame,
  626. nsIContent* aContent,
  627. nsStyleContext* aStyleContext,
  628. nsIFrame** aContinuingFrame);
  629. nsresult CreateContinuingTableFrame(nsIPresShell* aPresShell,
  630. nsPresContext* aPresContext,
  631. nsIFrame* aFrame,
  632. nsIFrame* aParentFrame,
  633. nsIContent* aContent,
  634. nsStyleContext* aStyleContext,
  635. nsIFrame** aContinuingFrame);
  636. //----------------------------------------
  637. // Methods support creating block frames and their children
  638. already_AddRefed<nsStyleContext>
  639. GetFirstLetterStyle(nsIContent* aContent,
  640. nsStyleContext* aStyleContext);
  641. already_AddRefed<nsStyleContext>
  642. GetFirstLineStyle(nsIContent* aContent,
  643. nsStyleContext* aStyleContext);
  644. PRBool HaveFirstLetterStyle(nsIContent* aContent,
  645. nsStyleContext* aStyleContext);
  646. // Check whether a given block has first-letter style. Make sure to
  647. // only pass in blocks! And don't pass in null either.
  648. PRBool HaveFirstLetterStyle(nsIFrame* aBlockFrame);
  649. PRBool HaveFirstLineStyle(nsIContent* aContent,
  650. nsStyleContext* aStyleContext);
  651. void HaveSpecialBlockStyle(nsIContent* aContent,
  652. nsStyleContext* aStyleContext,
  653. PRBool* aHaveFirstLetterStyle,
  654. PRBool* aHaveFirstLineStyle);
  655. // |aContentParentFrame| should be null if it's really the same as
  656. // |aParentFrame|.
  657. // @param aFrameItems where we want to put the block in case it's in-flow.
  658. // @param aNewFrame an in/out parameter. On input it is the block to be
  659. // constructed. On output it is reset to the outermost
  660. // frame constructed (e.g. if we need to wrap the block in an
  661. // nsColumnSetFrame.
  662. // @param aParentFrame is the desired parent for the (possibly wrapped)
  663. // block
  664. // @param aContentParent is the parent the block would have if it
  665. // were in-flow
  666. nsresult ConstructBlock(nsFrameConstructorState& aState,
  667. const nsStyleDisplay* aDisplay,
  668. nsIContent* aContent,
  669. nsIFrame* aParentFrame,
  670. nsIFrame* aContentParentFrame,
  671. nsStyleContext* aStyleContext,
  672. nsIFrame** aNewFrame,
  673. nsFrameItems& aFrameItems,
  674. PRBool aAbsPosContainer);
  675. nsresult ConstructInline(nsFrameConstructorState& aState,
  676. const nsStyleDisplay* aDisplay,
  677. nsIContent* aContent,
  678. nsIFrame* aParentFrame,
  679. nsStyleContext* aStyleContext,
  680. PRBool aIsPositioned,
  681. nsIFrame* aNewFrame);
  682. nsresult ProcessInlineChildren(nsFrameConstructorState& aState,
  683. nsIContent* aContent,
  684. nsIFrame* aFrame,
  685. PRBool aCanHaveGeneratedContent,
  686. nsFrameItems& aFrameItems,
  687. PRBool* aKidsAllInline);
  688. PRBool AreAllKidsInline(nsIFrame* aFrameList);
  689. PRBool WipeContainingBlock(nsFrameConstructorState& aState,
  690. nsIFrame* blockContent,
  691. nsIFrame* aFrame,
  692. nsIFrame* aFrameList);
  693. PRBool NeedSpecialFrameReframe(nsIContent* aParent1,
  694. nsIContent* aParent2,
  695. nsIFrame*& aParentFrame,
  696. nsIContent* aChild,
  697. PRInt32 aIndexInContainer,
  698. nsIFrame*& aPrevSibling,
  699. nsIFrame* aNextSibling);
  700. nsresult SplitToContainingBlock(nsFrameConstructorState& aState,
  701. nsIFrame* aFrame,
  702. nsIFrame* aLeftInlineChildFrame,
  703. nsIFrame* aBlockChildFrame,
  704. nsIFrame* aRightInlineChildFrame,
  705. PRBool aTransfer);
  706. nsresult ReframeContainingBlock(nsIFrame* aFrame);
  707. nsresult StyleChangeReflow(nsIFrame* aFrame, nsIAtom* aAttribute);
  708. /** Helper function that searches the immediate child frames
  709. * (and their children if the frames are "special")
  710. * for a frame that maps the specified content object
  711. *
  712. * @param aParentFrame the primary frame for aParentContent
  713. * @param aContent the content node for which we seek a frame
  714. * @param aParentContent the parent for aContent
  715. * @param aHint an optional hint used to make the search for aFrame faster
  716. */
  717. nsIFrame* FindFrameWithContent(nsFrameManager* aFrameManager,
  718. nsIFrame* aParentFrame,
  719. nsIContent* aParentContent,
  720. nsIContent* aContent,
  721. nsFindFrameHint* aHint);
  722. //----------------------------------------
  723. // Methods support :first-letter style
  724. void CreateFloatingLetterFrame(nsFrameConstructorState& aState,
  725. nsIContent* aTextContent,
  726. nsIFrame* aTextFrame,
  727. nsIContent* aBlockContent,
  728. nsIFrame* aParentFrame,
  729. nsStyleContext* aStyleContext,
  730. nsFrameItems& aResult);
  731. nsresult CreateLetterFrame(nsFrameConstructorState& aState,
  732. nsIContent* aTextContent,
  733. nsIFrame* aParentFrame,
  734. nsFrameItems& aResult);
  735. nsresult WrapFramesInFirstLetterFrame(nsFrameConstructorState& aState,
  736. nsIContent* aBlockContent,
  737. nsIFrame* aBlockFrame,
  738. nsFrameItems& aBlockFrames);
  739. nsresult WrapFramesInFirstLetterFrame(nsFrameConstructorState& aState,
  740. nsIFrame* aParentFrame,
  741. nsIFrame* aParentFrameList,
  742. nsIFrame** aModifiedParent,
  743. nsIFrame** aTextFrame,
  744. nsIFrame** aPrevFrame,
  745. nsFrameItems& aLetterFrame,
  746. PRBool* aStopLooking);
  747. nsresult RecoverLetterFrames(nsFrameConstructorState& aState,
  748. nsIFrame* aBlockFrame);
  749. //
  750. nsresult RemoveLetterFrames(nsPresContext* aPresContext,
  751. nsIPresShell* aPresShell,
  752. nsFrameManager* aFrameManager,
  753. nsIFrame* aBlockFrame);
  754. // Recursive helper for RemoveLetterFrames
  755. nsresult RemoveFirstLetterFrames(nsPresContext* aPresContext,
  756. nsIPresShell* aPresShell,
  757. nsFrameManager* aFrameManager,
  758. nsIFrame* aFrame,
  759. PRBool* aStopLooking);
  760. // Special remove method for those pesky floating first-letter frames
  761. nsresult RemoveFloatingFirstLetterFrames(nsPresContext* aPresContext,
  762. nsIPresShell* aPresShell,
  763. nsFrameManager* aFrameManager,
  764. nsIFrame* aBlockFrame,
  765. PRBool* aStopLooking);
  766. // Capture state for the frame tree rooted at the frame associated with the
  767. // content object, aContent
  768. nsresult CaptureStateForFramesOf(nsIContent* aContent,
  769. nsILayoutHistoryState* aHistoryState);
  770. // Capture state for the frame tree rooted at aFrame.
  771. nsresult CaptureStateFor(nsIFrame* aFrame,
  772. nsILayoutHistoryState* aHistoryState);
  773. //----------------------------------------
  774. // Methods support :first-line style
  775. nsresult WrapFramesInFirstLineFrame(nsFrameConstructorState& aState,
  776. nsIContent* aContent,
  777. nsIFrame* aFrame,
  778. nsFrameItems& aFrameItems);
  779. nsresult AppendFirstLineFrames(nsFrameConstructorState& aState,
  780. nsIContent* aContent,
  781. nsIFrame* aBlockFrame,
  782. nsFrameItems& aFrameItems);
  783. nsresult InsertFirstLineFrames(nsFrameConstructorState& aState,
  784. nsIContent* aContent,
  785. nsIFrame* aBlockFrame,
  786. nsIFrame** aParentFrame,
  787. nsIFrame* aPrevSibling,
  788. nsFrameItems& aFrameItems);
  789. nsresult RemoveFixedItems(const nsFrameConstructorState& aState);
  790. // Find the ``rightmost'' frame for the content immediately preceding
  791. // aIndexInContainer, following continuations if necessary. If aChild is
  792. // not null, make sure it passes the call to IsValidSibling
  793. nsIFrame* FindPreviousSibling(nsIContent* aContainer,
  794. nsIFrame* aContainerFrame,
  795. PRInt32 aIndexInContainer,
  796. const nsIContent* aChild = nsnull);
  797. // Find the frame for the content node immediately following aIndexInContainer.
  798. // If aChild is not null, make sure it passes the call to IsValidSibling
  799. nsIFrame* FindNextSibling(nsIContent* aContainer,
  800. nsIFrame* aContainerFrame,
  801. PRInt32 aIndexInContainer,
  802. const nsIContent* aChild = nsnull);
  803. // see if aContent and aSibling are legitimate siblings due to restrictions
  804. // imposed by table columns
  805. PRBool IsValidSibling(nsIFrame* aParentFrame,
  806. const nsIFrame& aSibling,
  807. PRUint8 aSiblingDisplay,
  808. nsIContent& aContent,
  809. PRUint8& aDisplay);
  810. void QuotesDirty() {
  811. if (mUpdateCount

Large files files are truncated, but you can click here to view the full file