Opera 12.15 Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fdelm.h 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. /* -*- Mode: c++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*-
  2. **
  3. ** Copyright (C) 2000-2005 Opera Software AS. All rights reserved.
  4. **
  5. ** This file is part of the Opera web browser. It may not be distributed
  6. ** under any circumstances.
  7. **
  8. */
  9. #ifndef DOCHAND_FDELM_H
  10. #define DOCHAND_FDELM_H
  11. #include "modules/dochand/docman.h"
  12. #include "modules/util/tree.h"
  13. #include "modules/doc/doctypes.h"
  14. #include "modules/doc/css_mode.h"
  15. #include "modules/windowcommander/OpWindowCommander.h" // For LayoutMode and NEARBY_INTERACTIVE_ITEM_DETECTION
  16. #define DOCHAND_ATTR_SUB_WIN_ID Markup::DOCHANDA_SUB_WIN_ID
  17. // Used in both fdelm.cpp and frm_doc.cpp.
  18. #define FRAME_BORDER_SIZE 2
  19. #define RELATIVE_MIN_SIZE 25
  20. class HTML_Element;
  21. class FormObject;
  22. class VisualDevice;
  23. class OpView;
  24. class CoreView;
  25. class ES_TerminatingThread;
  26. #include "modules/doc/frm_doc.h"
  27. class DocumentManager;
  28. class FDEElmRef;
  29. class FrameReinitData
  30. {
  31. public:
  32. FrameReinitData(int history_num, BOOL visible, LayoutMode old_layout_mode)
  33. : m_history_num(history_num), m_visible(visible),
  34. m_old_layout_mode(old_layout_mode) {}
  35. int m_history_num;
  36. BOOL m_visible;
  37. LayoutMode m_old_layout_mode;
  38. };
  39. class FramesDocElmAttr : public ComplexAttr
  40. {
  41. public:
  42. FramesDocElm* m_fde;
  43. FramesDocElmAttr(FramesDocElm* fde) : m_fde(fde) {}
  44. // ComplexAttr methods
  45. virtual OP_STATUS CreateCopy(ComplexAttr **copy_to) { return OpStatus::ERR_NOT_SUPPORTED; }
  46. virtual BOOL MoveToOtherDocument(FramesDocument *old_document, FramesDocument *new_document) { return FALSE; }
  47. };
  48. class FramesDocElm
  49. : private Tree
  50. {
  51. public:
  52. class FDEElmRef : public ElementRef
  53. {
  54. public:
  55. FDEElmRef(FramesDocElm* fde) : m_fde(fde) {}
  56. FramesDocElm* GetFramesDocElm() { return m_fde; }
  57. // ElementRef methods
  58. virtual void OnDelete(FramesDocument *document);
  59. virtual void OnRemove(FramesDocument *document) { return OnDelete(document); }
  60. virtual BOOL IsA(ElementRefType type) { return type == ElementRef::FRAMESDOCELM; }
  61. private:
  62. FramesDocElm* m_fde;
  63. };
  64. private:
  65. union
  66. {
  67. struct
  68. {
  69. unsigned int row:1;
  70. unsigned int is_frameset:1;
  71. unsigned int is_inline:1;
  72. unsigned int is_secondary:1; ///< This FramesDocElm represents the same HTML_Element as its parent.
  73. unsigned int is_in_doc_coords:1;
  74. unsigned int frame_border:1;
  75. unsigned int frame_border_top:1;
  76. unsigned int frame_border_left:1;
  77. unsigned int frame_border_right:1;
  78. unsigned int frame_border_bottom:1;
  79. unsigned int frame_noresize:1;
  80. unsigned int hidden:1;
  81. #ifdef SVG_SUPPORT
  82. unsigned int is_svg_resource:1;
  83. #endif
  84. unsigned int nofity_parent_on_content_change:1;
  85. unsigned int is_being_deleted:1;
  86. unsigned int size_type:2;
  87. unsigned int is_stacked:1;
  88. unsigned int normal_row:1;
  89. unsigned int special_object:1;
  90. unsigned int special_object_layout_mode:3;
  91. unsigned int es_onload_called:1;
  92. unsigned int es_onload_ready:1;
  93. unsigned int is_deleted:1;
  94. unsigned int checked_unload_targets:1;
  95. unsigned int has_unload_targets:1;
  96. // unsigned int unused:4;
  97. } packed1; // 32 bits
  98. unsigned int packed1_init;
  99. };
  100. BYTE frame_scrolling;
  101. int frame_margin_width;
  102. int frame_margin_height;
  103. int frame_spacing;
  104. //int frameset_border;
  105. DocumentManager*
  106. doc_manager;
  107. FramesDocument* parent_frm_doc;
  108. /**
  109. * Used for iframes only.
  110. * Stores the OpInputContext associated with some layout object. This input context is a parent
  111. * of this iframe's VisualDevice. When NULL, then the parent input context of this
  112. * iframe's VisualDevice is the VisualDevice of the parent document.
  113. * The layout takes care of notifying this iframe about parent context changes. */
  114. OpInputContext* parent_layout_input_ctx;
  115. FDEElmRef m_helm;
  116. #ifdef _PRINT_SUPPORT_
  117. HTML_Element* m_print_twin_elm;
  118. #endif // _PRINT_SUPPORT_
  119. AffinePos pos; ///< Position relative to parent's rendering viewport
  120. int width; ///< Rendering viewport width
  121. int height; ///< Rendering viewport height
  122. int normal_width; ///< Layout viewport width
  123. int normal_height; ///< Layout viewport height
  124. int sub_win_id;
  125. #ifndef MOUSELESS
  126. int drag_val;
  127. int drag_offset;
  128. #endif // !MOUSELESS
  129. int size_val;
  130. VisualDevice* frm_dev;
  131. OpString name;
  132. OpString frame_id;
  133. FrameReinitData*
  134. reinit_data; ///< Used for asynchronous initialization of frames
  135. /**
  136. * Convert the specified value from screen to document coordinates, unless
  137. * IsInDocCoords() is TRUE.
  138. */
  139. AffinePos ToDocIfScreen(const AffinePos& val) const;
  140. /**
  141. * Convert the specified value from screen to document coordinates, unless
  142. * IsInDocCoords() is TRUE.
  143. */
  144. int ToDocIfScreen(int val, BOOL round_up) const;
  145. /**
  146. * Convert the specified value from document to screen coordinates, unless
  147. * IsInDocCoords() is TRUE.
  148. */
  149. int ToScreenIfScreen(int val, BOOL round_up) const;
  150. AffinePos GetDocOrScreenAbsPos() const;
  151. int GetDocOrScreenAbsX() const;
  152. int GetDocOrScreenAbsY() const;
  153. /**
  154. * Get position, relative to parent, in document coordinates
  155. */
  156. AffinePos GetPos() const;
  157. /**
  158. * Get X position, relative to parent, in document coordinates
  159. */
  160. int GetX() const;
  161. /**
  162. * Get Y position, relative to parent, in document coordinates
  163. */
  164. int GetY() const;
  165. /**
  166. * Set X position, relative to parent, in document coordinates.
  167. * Does not commit the change.
  168. */
  169. void SetX(int x);
  170. /**
  171. * Set Y position, relative to parent, in document coordinates.
  172. * Does not commit the change.
  173. */
  174. void SetY(int y);
  175. #ifndef MOUSELESS
  176. int GetMaxX();
  177. int GetMaxY();
  178. int GetMinWidth();
  179. int GetMinHeight();
  180. void Reformat(int x, int y);
  181. BOOL CanResize();
  182. void PropagateSizeChanges(BOOL left, BOOL right, BOOL top, BOOL bottom/*, int border*/);
  183. #endif // !MOUSELESS
  184. enum
  185. {
  186. /** Value of frame_index indicating that frame is not currently stored in (i)frame root */
  187. FRAME_NOT_IN_ROOT = -1
  188. };
  189. /**
  190. * Index of this frame element. It keeps track of the insertion order.
  191. */
  192. int frame_index;
  193. /**
  194. * Checks if given element is or belongs to current document's (i)frame root
  195. */
  196. BOOL IsFrameRoot(FramesDocElm *head);
  197. /**
  198. * Checks if mouse events should be disabled for the CoreView
  199. * associated with this frame, due to SVG interactivity rules.
  200. * This function should be called whenever the frame is shown.
  201. *
  202. * When this function is called, mouse events will be disabled for
  203. * the associated CoreView if:
  204. *
  205. * - The SVG is loaded using an <img> tag.
  206. * - The SVG is loaded using an <object> tag, and interaction is
  207. * explicitly disabled with <param name="render" value="frozen">.
  208. * - The SVG is a plugin placeholder.
  209. */
  210. void SVGCheckWantMouseEvents();
  211. public:
  212. FramesDocElm(int id, int x, int y, int w, int h, FramesDocument* frm_doc, HTML_Element* he, VisualDevice* vd, int type, int val, BOOL inline_frm, FramesDocElm* parent_frmset, BOOL secondary = FALSE);
  213. ~FramesDocElm();
  214. void SetSubWinId(int id) { sub_win_id = id; }
  215. OP_STATUS Init(HTML_Element *helm, VisualDevice* vd, OpView* clipview); // must be called immediately after the constructor
  216. void Reset(int type, int val, FramesDocElm* parent_frmset, HTML_Element *helm = NULL);
  217. VisualDevice* GetVisualDevice() { return frm_dev; }
  218. /**
  219. * // Geir: kunne ikke parent_frm_doc hentes ut fra doc_manager (GetDocManager()->GetParentDoc())?
  220. *
  221. * @returns The owner document, never NULL.
  222. */
  223. FramesDocument* GetParentFramesDoc() { return parent_frm_doc; };
  224. /**
  225. * @returns The top FramesDocument. Never NULL.
  226. *
  227. * @see FramesDocument::GetTopFramesDoc().
  228. */
  229. FramesDocument* GetTopFramesDoc();
  230. BOOL IsRow() { return packed1.row; }
  231. void SetIsRow(BOOL is_row) { packed1.row = is_row; }
  232. void CheckFrameEdges(BOOL& outer_top, BOOL& outer_left, BOOL& outer_right, BOOL& outer_bottom, BOOL top_checked = FALSE, BOOL left_checked = FALSE, BOOL right_checked = FALSE, BOOL bottom_checked = FALSE);
  233. BOOL GetFrameBorder() { return packed1.frame_border; }
  234. void SetFrameBorder(BOOL border) { packed1.frame_border = border; }
  235. int GetFrameSpacing() { return frame_spacing; }
  236. //int Border();
  237. BOOL GetFrameTopBorder() { return packed1.frame_border_top; }
  238. BOOL GetFrameLeftBorder() { return packed1.frame_border_left; }
  239. BOOL GetFrameRightBorder() { return packed1.frame_border_right; }
  240. BOOL GetFrameBottomBorder() { return packed1.frame_border_bottom; }
  241. void SetFrameBorders(BOOL top, BOOL left, BOOL right, BOOL bottom)
  242. { packed1.frame_border_top = top; packed1.frame_border_left = left; packed1.frame_border_right = right; packed1.frame_border_bottom = bottom; }
  243. /** @return TRUE if this element has been checked if it contains an
  244. * embedded unload target.
  245. */
  246. BOOL GetCheckedUnloadHandler() { return packed1.checked_unload_targets; }
  247. /** Mark or unmark this element's cached unload target information.
  248. * Must be cleared on an element when one of its descendant frame
  249. * elements gains or loses an unload handler.
  250. */
  251. void SetCheckedUnloadHandler(BOOL flag) { packed1.checked_unload_targets = flag; }
  252. /** @return TRUE if this element has embedded unload handlers.
  253. */
  254. BOOL GetHasUnloadHandler() { return packed1.has_unload_targets; }
  255. /** Set if this element has embedded unload targets or not. If a
  256. * frameset has this flag set, but no unload handlers directly
  257. * on its element, it will still be considered an unload target.
  258. */
  259. void SetHasUnloadHandler(BOOL flag) { packed1.has_unload_targets = flag; }
  260. /** Determine if this element has any unload targets directly attached
  261. * or below it in the element tree.
  262. * @return TRUE if it contains any embedded unload targets,
  263. * FALSE otherwise.
  264. */
  265. BOOL CheckForUnloadTarget();
  266. /** Update this element's unload handler information given that
  267. * an unload target has been added or removed somewhere within
  268. * its document. If that represents a change in overall status,
  269. * clear the cached and now-invalid unload information on any
  270. * of its ancestor elements.
  271. *
  272. * @param added Flag indicating if an unload handler was added
  273. * or removed.
  274. */
  275. void UpdateUnloadTarget(BOOL added);
  276. OP_DOC_STATUS BuildTree(FramesDocument* top_frm_doc, Head* existing_frames = NULL);
  277. /**
  278. * @return TRUE if the xpos, ypos, width, height, normal_width and
  279. * normal_height members and the SetRootSize() method represent or should
  280. * represent the position and size in document coordinates, FALSE if the
  281. * position and size is or should be represented in screen
  282. * coordinates. FramesDocElm normally represent size and position in screen
  283. * coordinates, but they need to be represented in document coordinates in
  284. * TrueZoom, to avoid rounding errors.
  285. */
  286. BOOL IsInDocCoords() const;
  287. /**
  288. * Get position relative to the root of the frameset to which this
  289. * frame/frameset belongs, in document coordinates.
  290. */
  291. AffinePos GetAbsPos() const;
  292. /**
  293. * Get X position relative to the root of the frameset to which this
  294. * frame/frameset belongs, in document coordinates.
  295. */
  296. int GetAbsX() const;
  297. /**
  298. * Get Y position relative to the root of the frameset to which this
  299. * frame/frameset belongs, in document coordinates.
  300. */
  301. int GetAbsY() const;
  302. /**
  303. * Get frame width, in document coordinates.
  304. */
  305. int GetWidth() const;
  306. /**
  307. * Get frame height, in document coordinates.
  308. */
  309. int GetHeight() const;
  310. /**
  311. * Get layout viewport width, in document coordinates.
  312. */
  313. int GetNormalWidth() const;
  314. /**
  315. * Get layout viewport width, in document coordinates.
  316. */
  317. int GetNormalHeight() const;
  318. /**
  319. * Set position, in document coordinates.
  320. */
  321. void SetPosition(const AffinePos& doc_pos);
  322. /**
  323. * Set size, in document coordinates.
  324. */
  325. void SetSize(int w, int h);
  326. /**
  327. * Set size and position, in document coordinates.
  328. */
  329. void SetGeometry(const AffinePos& doc_pos, int w, int h);
  330. /**
  331. * Force new frame height, in document coordinates.
  332. */
  333. void ForceHeight(int h);
  334. /**
  335. * Show all frames in this frameset.
  336. */
  337. OP_STATUS ShowFrames();
  338. /**
  339. * Hide all frames in this frameset.
  340. */
  341. void HideFrames();
  342. /**
  343. * Commit size and position changes, i.e. update VisualDevice.
  344. *
  345. * Makes sure that the VisualDevice size is up-to-date (see xpos,
  346. * ypos, width and height members).
  347. *
  348. * Will never trigger reflow.
  349. */
  350. void UpdateGeometry();
  351. /**
  352. * Set root frameset size, in screen or document coordinates, depending on IsInDocCoords().
  353. * These values will be used by FormatFrames() as top-level document available size.
  354. */
  355. void SetRootSize(int width, int height);
  356. /**
  357. * Distribute available space among sub-frames, according to framesets'
  358. * COLS and ROWS attributes. If the size of a sub-frame changes here, the
  359. * document in that frame will also be reflowed right away if that document
  360. * defines another frameset; or, if it defines a regular HTML document
  361. * (with BODY), it will be scheduled for reflow (marked dirty, etc.).
  362. */
  363. OP_DOC_STATUS FormatFrames(BOOL format_rows = TRUE, BOOL format_cols = TRUE);
  364. /**
  365. * Initiate loading of the URL specified for each frame in this frameset.
  366. *
  367. * @param origin_thread The thread that inserted the frame.
  368. */
  369. OP_STATUS LoadFrames(ES_Thread *origin_thread = NULL);
  370. /**
  371. * Reflow each document in this frameset brutally and thoroughly.
  372. * This involves reloading CSS properties and regenerating all layout boxes.
  373. */
  374. OP_DOC_STATUS FormatDocs();
  375. FramesDocElm* Parent() const;
  376. FramesDocElm* Suc() const { return (FramesDocElm*)Tree::Suc(); };
  377. FramesDocElm* Pred() const { return (FramesDocElm*)Tree::Pred(); };
  378. FramesDocElm* FirstChild() const { return (FramesDocElm*)Tree::FirstChild(); };
  379. FramesDocElm* LastChild() const { return (FramesDocElm*)Tree::LastChild(); };
  380. FramesDocElm* Next() const { return (FramesDocElm*)Tree::Next(); }
  381. FramesDocElm* Prev() const { return (FramesDocElm*)Tree::Prev(); }
  382. FramesDocElm* FirstLeaf() { return (FramesDocElm*)Tree::FirstLeaf(); }
  383. FramesDocElm* LastLeaf() { return (FramesDocElm*)Tree::LastLeaf(); }
  384. FramesDocElm* NextLeaf() { return (FramesDocElm*)Tree::NextLeaf(); }
  385. FramesDocElm* PrevLeaf() { return (FramesDocElm*)Tree::PrevLeaf(); }
  386. OP_STATUS Undisplay(BOOL will_be_destroyed = FALSE);
  387. /**
  388. * Shows the frame if it has VisualDevice. It is a shortcut to VisualDevice::Show(),
  389. * which it calls, passing appropriate param.
  390. * @returns OK, OOM or generic error if something went wrong in VisualDevice::Show().
  391. */
  392. OP_STATUS Show();
  393. /**
  394. * Hides the frame if it has VisualDevice. Should be used instead of VisualDevice::Hide(),
  395. * which it calls.
  396. * @param free_views if TRUE, deletes the view and most other things of this frame's VisualDevice
  397. * If FALSE, just hides the view of the VisualDevice.
  398. * @see VisualDevice::Hide()
  399. */
  400. void Hide(BOOL free_views = FALSE);
  401. #ifdef _PRINT_SUPPORT_
  402. void Display(VisualDevice* vd, const RECT& rect);
  403. #endif // _PRINT_SUPPORT_
  404. void DisplayBorder(VisualDevice* vd);
  405. #ifndef MOUSELESS
  406. /**
  407. * Check something and return a FramesDocElm if something is the case.
  408. *
  409. * @param x Mouse X position in top-level document coordinates
  410. * @param y Mouse Y position in top-level document coordinates
  411. */
  412. FramesDocElm* IsSeparator(int x, int y);
  413. /**
  414. * Start moving frame separator.
  415. *
  416. * @param x Mouse X position in top-level document coordinates
  417. * @param y Mouse Y position in top-level document coordinates
  418. */
  419. void StartMoveSeparator(int x, int y);
  420. /**
  421. * Move frame separator.
  422. *
  423. * @param x Mouse X position in top-level document coordinates
  424. * @param y Mouse Y position in top-level document coordinates
  425. */
  426. void MoveSeparator(int x, int y);
  427. /**
  428. * Stop moving frame separator.
  429. *
  430. * @param x Mouse X position in top-level document coordinates
  431. * @param y Mouse Y position in top-level document coordinates
  432. */
  433. void EndMoveSeparator(int x, int y);
  434. #endif // !MOUSELESS
  435. OP_STATUS ReactivateDocument();
  436. BOOL IsLoaded(BOOL inlines_loaded = TRUE);
  437. void SetInlinesUsed(BOOL used);
  438. void Free(BOOL layout_only = FALSE, FramesDocument::FreeImportance importance = FramesDocument::FREE_NORMAL);
  439. OP_STATUS SetMode(BOOL win_show_images, BOOL win_load_images, CSSMODE win_css_mode, CheckExpiryType check_expiry);
  440. OP_STATUS SetAsCurrentDoc(BOOL state, BOOL visible_if_current = TRUE);
  441. void SetCurrentHistoryPos(int n, BOOL parent_doc_changed, BOOL is_user_initiated);
  442. void RemoveFromHistory(int from);
  443. void RemoveUptoHistory(int to);
  444. void RemoveElementFromHistory(int pos);
  445. void CheckHistory(int decrement, int& minhist, int& maxhist);
  446. DocListElm* GetHistoryElmAt(int pos, BOOL forward = FALSE);
  447. const URL& GetCurrentURL() { return doc_manager->GetCurrentURL(); };
  448. BOOL IsInlineFrame() { return packed1.is_inline; }
  449. static FramesDocElm* GetFrmDocElmByHTML(HTML_Element*);
  450. int GetSubWinId() { return sub_win_id; }
  451. int GetSizeType() { return (unsigned int)packed1.size_type; }
  452. int GetSizeVal() { return size_val; }
  453. HTML_Element* GetHtmlElement();
  454. void SetHtmlElement(HTML_Element *elm);
  455. void DetachHtmlElement();
  456. /**
  457. * Returns the name of the frame, i.e. the name attribute
  458. * of the element creating this frame. This is typically
  459. * used to identify the frame.
  460. *
  461. * <p>The used to have an internal fallback to the id if the
  462. * name was missing, but that is gone and callers will have
  463. * to check GetFrameId themselves.
  464. *
  465. * @returns The name or NULL.
  466. *
  467. * @see GetFrameId();
  468. */
  469. const uni_char* GetName();
  470. OP_STATUS SetName(const uni_char* str);
  471. /**
  472. * Returns the id string of the frame, i.e. the id of the
  473. * element creating this frame. Typically the name
  474. * is used to identify a frame but the id acts as a backup name.
  475. *
  476. * @returns The id string or NULL.
  477. *
  478. * @see GetName()
  479. */
  480. const uni_char* GetFrameId() { return frame_id.CStr(); }
  481. /**
  482. * Propagates the DocumentManager::StopLoading() call to the whole
  483. * frame tree.
  484. *
  485. * @see DocumentManager::StopLoading()
  486. */
  487. void StopLoading(BOOL format = TRUE, BOOL abort = FALSE);
  488. OP_BOOLEAN CheckSource();
  489. virtual BOOL OnLoadCalled() const { return packed1.es_onload_called; }
  490. void SetOnLoadCalled(BOOL the_truth) { packed1.es_onload_called = the_truth; }
  491. virtual BOOL OnLoadReady() const { return packed1.es_onload_ready; }
  492. void SetOnLoadReady(BOOL the_truth) { packed1.es_onload_ready = the_truth; }
  493. void SetIsDeleted() { packed1.is_deleted = 1; }
  494. BOOL IsDeleted() { return packed1.is_deleted; }
  495. Window* GetWindow() const { return doc_manager->GetWindow(); }
  496. DocumentManager*GetDocManager() const { return doc_manager; }
  497. FramesDocument* GetCurrentDoc() { return doc_manager->GetCurrentDoc(); }
  498. OP_STATUS HandleLoading(OpMessage msg, URL_ID url_id, MH_PARAM_2 user_data);
  499. void ReloadIfModified();
  500. #ifdef _PRINT_SUPPORT_
  501. OP_STATUS CopyFrames(FramesDocElm* new_frm);
  502. OP_STATUS CreatePrintLayoutAllPages(PrintDevice* pd, FramesDocElm* print_root);
  503. #endif // _PRINT_SUPPORT_
  504. int CountPages();
  505. #ifdef _PRINT_SUPPORT_
  506. OP_DOC_STATUS PrintPage(PrintDevice* pd, int page_num, BOOL selected_only);
  507. #endif // _PRINT_SUPPORT_
  508. void UpdateSecurityState(BOOL include_loading_docs);
  509. BOOL GetHidden() { return packed1.hidden; }
  510. void SetHidden(BOOL val) { packed1.hidden = val; }
  511. BOOL IsFrameset() { return packed1.is_frameset; };
  512. void SetIsFrameset(BOOL the_truth) { packed1.is_frameset = the_truth; }
  513. BOOL GetFrameNoresize() { return packed1.frame_noresize; };
  514. void SetFrameNoresize(BOOL noresize) { packed1.frame_noresize = noresize; }
  515. BYTE GetFrameScrolling() { return frame_scrolling; };
  516. void SetFrameScrolling(BYTE scrolling);
  517. int GetFrameMarginWidth() { return frame_margin_width; };
  518. int GetFrameMarginHeight() { return frame_margin_height; };
  519. void UpdateFrameMargins(HTML_Element *he);
  520. int CountFrames();
  521. FramesDocElm* GetFrameByNumber(int& num);
  522. FramesDocElm* LastLeafActive();
  523. FramesDocElm* ParentActive();
  524. FramesDocElm* FirstChildActive();
  525. FramesDocElm* LastChildActive();
  526. FramesDocElm* PrevActive();
  527. FramesDocElm* NextActive();
  528. #ifdef SVG_SUPPORT
  529. /**
  530. * Returns whether this is a SVG resource document. The SVG module
  531. * should be notified when such documents has finished loading.
  532. */
  533. BOOL IsSVGResourceDocument() const { return packed1.is_svg_resource; }
  534. /**
  535. * Mark this document as a SVG resource document. @see
  536. * IsSVGResourceDocument().
  537. */
  538. void SetAsSVGResourceDocument() { packed1.is_svg_resource = 1; }
  539. #endif
  540. /**
  541. * Get the 'notify parent on content change' flag. This is part of
  542. * the -o-content-size feature. Frames with width/height:
  543. * -o-content-size will have this flag set and the parent document
  544. * will adapt the size of the frame to the content document.
  545. */
  546. BOOL GetNotifyParentOnContentChange() const { return packed1.nofity_parent_on_content_change; }
  547. /**
  548. * Set the 'notify parent on size change' flag.
  549. */
  550. void SetNotifyParentOnContentChange(BOOL notify = TRUE) { packed1.nofity_parent_on_content_change = notify; }
  551. #ifdef _PRINT_SUPPORT_
  552. FramesDocument* GetPrintDoc() { return doc_manager->GetPrintDoc(); }
  553. void DeletePrintCopy();
  554. void SetPrintTwinElm(HTML_Element *twin) { m_print_twin_elm = twin; }
  555. #endif // _PRINT_SUPPORT_
  556. BOOL IsBeingDeleted() { return packed1.is_being_deleted; }
  557. void AppendChildrenToList(Head* list);
  558. void CheckSmartFrames(BOOL on);
  559. void ExpandFrameSize(int inc_width, int inc_height);
  560. void CalculateFrameSizes(int frames_policy);
  561. void SetNormalRow(BOOL value) { packed1.normal_row = value; }
  562. void CheckFrameStacking(BOOL stack_frames);
  563. BOOL HasExplicitZeroSize();
  564. void CheckERA_LayoutMode();
  565. LayoutMode GetLayoutMode() const;
  566. void CheckSpecialObject(HTML_Element* he);
  567. BOOL IsSpecialObject() const { return packed1.special_object; }
  568. OP_STATUS OnlineModeChanged();
  569. void OnRenderingViewportChanged(const OpRect &rendering_viewport);
  570. FrameReinitData*
  571. GetReinitData() { return reinit_data; }
  572. OP_STATUS SetReinitData(int history_num, BOOL visible, LayoutMode frame_layout_mode);
  573. void RemoveReinitData();
  574. // an interface of Tree class needed by other code parts
  575. void Under(FramesDocElm* elm);
  576. void Into(FramesDocElm* elm) { Under(elm); }
  577. // when any of the below versions is called we can skip checking whether the tree is a (i)frame root as we are sure it's not (it's not type of FramesDocElm).
  578. void Under(Tree* tree) { Tree::Under(tree); }
  579. void Into(Tree* tree) { Tree::Into(tree); }
  580. void Into(Head *list) { Tree::Into(list); }
  581. void Out();
  582. BOOL Empty() { return Tree::Empty(); }
  583. /** Specifically designed for use with the list of deleted iframes in FramesDocument. */
  584. static FramesDocElm* GetFirstFramesDocElm(Tree* tree_root) { return static_cast<FramesDocElm*>(tree_root->FirstChild()); }
  585. /**
  586. * Checks whether a frame is allowed to have any content.
  587. */
  588. BOOL IsContentAllowed();
  589. #ifdef NEARBY_INTERACTIVE_ITEM_DETECTION
  590. /**
  591. * Helper method used to add frame's scrollbars to interactive items list.
  592. * The method has the following assumptions:
  593. * - this frame has current doc.
  594. * - this frame is visible in the top document's visual viewport
  595. * - the rect_of_interest is fully inside the part of this frame that is intersecting the top document's visual viewport
  596. * @param[in/out] rect_of_interest rectangle in the coordinates of this frame's current document.
  597. * Any scrollbar, which cover the document's area that intersect the
  598. * rect of interest, will be added. After successful call the rect will be limited
  599. * to the maximum part that does not intersect any scrollbar.
  600. * @param list list to insert the scrollbars into.
  601. * @return OpStatus::OK or OpStatus::ERR_NO_MEMORY. */
  602. OP_STATUS AddFrameScrollbars(OpRect& rect_of_interest, List<InteractiveItemInfo>& list);
  603. #endif // NEARBY_INTERACTIVE_ITEM_DETECTION
  604. /**
  605. * Sets the current OpInputContext (associated with some layout object), which is the parent
  606. * of this iframe or restores the parent OpInputContext of this iframe's VisualDevice
  607. * to the VisualDevice of the parent document (if the context is NULL).
  608. */
  609. void SetParentLayoutInputContext(OpInputContext* context);
  610. };
  611. #endif // DOCHAND_FDELM_H