LayoutIsolation.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632
  1. /*
  2. * This source file is part of RmlUi, the HTML/CSS Interface Middleware
  3. *
  4. * For the latest information, see http://github.com/mikke89/RmlUi
  5. *
  6. * Copyright (c) 2008-2010 CodePoint Ltd, Shift Technology Ltd
  7. * Copyright (c) 2019-2025 The RmlUi Team, and contributors
  8. *
  9. * Permission is hereby granted, free of charge, to any person obtaining a copy
  10. * of this software and associated documentation files (the "Software"), to deal
  11. * in the Software without restriction, including without limitation the rights
  12. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  13. * copies of the Software, and to permit persons to whom the Software is
  14. * furnished to do so, subject to the following conditions:
  15. *
  16. * The above copyright notice and this permission notice shall be included in
  17. * all copies or substantial portions of the Software.
  18. *
  19. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  25. * THE SOFTWARE.
  26. *
  27. */
  28. #include "../../../Source/Core/Layout/FormattingContextDebug.h"
  29. #include "../../../Source/Core/Layout/LayoutNode.h"
  30. #include "../Common/TestsShell.h"
  31. #include "../Common/TypesToString.h"
  32. #include <RmlUi/Core/ComputedValues.h>
  33. #include <RmlUi/Core/Context.h>
  34. #include <RmlUi/Core/Core.h>
  35. #include <RmlUi/Core/Element.h>
  36. #include <RmlUi/Core/ElementDocument.h>
  37. #include <RmlUi/Core/ElementText.h>
  38. #include <RmlUi/Core/ElementUtilities.h>
  39. #include <RmlUi/Debugger/Debugger.h>
  40. #include <doctest.h>
  41. using namespace Rml;
  42. struct ElementLayoutInfo {
  43. ElementLayoutInfo(int tree_depth, const String& address, const Box& box, Vector2f absolute_offset) :
  44. tree_depth(tree_depth), address(address), box(box), absolute_offset(absolute_offset)
  45. {}
  46. int tree_depth;
  47. String address;
  48. Box box;
  49. Vector2f absolute_offset;
  50. bool operator==(const ElementLayoutInfo& other) const
  51. {
  52. return tree_depth == other.tree_depth && address == other.address && box == other.box && absolute_offset == other.absolute_offset;
  53. }
  54. bool operator!=(const ElementLayoutInfo& other) const { return !(*this == other); }
  55. String ToString() const
  56. {
  57. return String(size_t(4 * tree_depth), ' ') +
  58. CreateString("%s :: box = %g x %g (outer %g x %g) :: absolute_offset = %g x %g", address.c_str(), box.GetSize().x, box.GetSize().y,
  59. box.GetSizeAcross(BoxDirection::Horizontal, BoxArea::Margin), box.GetSizeAcross(BoxDirection::Vertical, BoxArea::Margin),
  60. absolute_offset.x, absolute_offset.y);
  61. }
  62. };
  63. static Vector<ElementLayoutInfo> CaptureLayoutTree(Element* root_element)
  64. {
  65. Vector<ElementLayoutInfo> layout_info_list;
  66. ElementUtilities::VisitElementsDepthOrder(root_element, [&](Element* element, int tree_depth) {
  67. layout_info_list.emplace_back(tree_depth, element->GetAddress(false, false), element->GetBox(), element->GetAbsoluteOffset());
  68. });
  69. return layout_info_list;
  70. }
  71. static void LogLayoutTree(const Vector<ElementLayoutInfo>& layout_info_list)
  72. {
  73. String message = "Element layout tree:\n";
  74. for (const auto& layout_info : layout_info_list)
  75. message += layout_info.ToString() + "\n";
  76. Rml::Log::Message(Rml::Log::LT_DEBUG, "%s", message.c_str());
  77. }
  78. static void LogDirtyLayoutTree(Element* root_element)
  79. {
  80. String tree_dirty_state;
  81. ElementUtilities::VisitElementsDepthOrder(root_element, [&](Element* element, int tree_depth) {
  82. tree_dirty_state += String(size_t(4 * tree_depth), ' ');
  83. tree_dirty_state += CreateString("%s. Self: %d Child: %d", element->GetAddress(false, tree_depth == 0).c_str(),
  84. element->GetLayoutNode()->IsSelfDirty(), element->GetLayoutNode()->IsChildDirty());
  85. tree_dirty_state += '\n';
  86. });
  87. Log::Message(Log::LT_INFO, "Dirty layout tree:\n%s\n", tree_dirty_state.c_str());
  88. }
  89. static const String document_isolation_rml = R"(
  90. <rml>
  91. <head>
  92. <link type="text/rcss" href="/assets/rml.rcss"/>
  93. <style>
  94. body {
  95. width: 800px;
  96. height: 600px;
  97. background-color: #ddd;
  98. font-family: LatoLatin;
  99. font-size: 14px;
  100. }
  101. scrollbarvertical {
  102. width: 12px;
  103. cursor: arrow;
  104. margin-right: -1px;
  105. padding-right: 1px;
  106. }
  107. scrollbarvertical slidertrack {
  108. background-color: #f0f0f0;
  109. }
  110. scrollbarvertical sliderbar {
  111. background-color: #666;
  112. }
  113. .container {
  114. width: 200px;
  115. margin: 20px;
  116. padding: 10px;
  117. background-color: #bbb;
  118. }
  119. .container > div {
  120. background-color: #aaa;
  121. margin: 5px;
  122. padding: 10px;
  123. }
  124. #flex-container {
  125. display: flex;
  126. flex-direction: column;
  127. }
  128. #overflow-container {
  129. overflow: auto;
  130. height: 150px;
  131. }
  132. #absolute-container {
  133. position: absolute;
  134. top: 300px;
  135. left: 300px;
  136. }
  137. </style>
  138. </head>
  139. <body>
  140. <div class="container" id="flex-container">
  141. <div>Flex item 1</div>
  142. <div id="flex-item">Flex item 2</div>
  143. <div id="flex-item-next">Flex item 3</div>
  144. </div>
  145. <div class="container" id="overflow-container">
  146. <div>Overflow item 1</div>
  147. <div id="overflow-item">Overflow item 2</div>
  148. <div>Overflow item 3</div>
  149. <div>Overflow item 4</div>
  150. <div>Overflow item 5</div>
  151. </div>
  152. <div class="container" id="absolute-container">
  153. <div id="absolute-item">Absolute item 1</div>
  154. <div>Absolute item 2</div>
  155. </div>
  156. <div class="container" id="normal-container">
  157. <div id="normal-item">Normal block box</div>
  158. </div>
  159. </body>
  160. </rml>
  161. )";
  162. TEST_CASE("LayoutIsolation.InsideOutsideFormattingContexts")
  163. {
  164. Context* context = TestsShell::GetContext();
  165. ElementDocument* document = context->LoadDocumentFromMemory(document_isolation_rml);
  166. document->Show();
  167. TestsShell::RenderLoop();
  168. SUBCASE("Flex")
  169. {
  170. Element* element = document->GetElementById("flex-item");
  171. Element* next_sibling = element->GetNextSibling();
  172. Element* next_outside_overflow = document->GetElementById("normal-container");
  173. REQUIRE(element);
  174. REQUIRE(next_sibling);
  175. REQUIRE(next_outside_overflow);
  176. const Vector2f absolute_offset_element = element->GetAbsoluteOffset();
  177. const Vector2f absolute_offset_next_sibling = next_sibling->GetAbsoluteOffset();
  178. const Vector2f absolute_offset_next_outside_overflow = next_outside_overflow->GetAbsoluteOffset();
  179. rmlui_dynamic_cast<ElementText*>(element->GetFirstChild())->SetText("Modified text that is long enough to cause line break");
  180. TestsShell::RenderLoop();
  181. CHECK(element->GetAbsoluteOffset() == absolute_offset_element);
  182. CHECK(next_sibling->GetAbsoluteOffset() != absolute_offset_next_sibling);
  183. CHECK(next_outside_overflow->GetAbsoluteOffset() != absolute_offset_next_outside_overflow);
  184. }
  185. SUBCASE("Overflow")
  186. {
  187. Element* element = document->GetElementById("overflow-item");
  188. Element* next_sibling = element->GetNextSibling();
  189. Element* next_outside_overflow = document->GetElementById("normal-container");
  190. REQUIRE(element);
  191. REQUIRE(next_sibling);
  192. REQUIRE(next_outside_overflow);
  193. const Vector2f absolute_offset_element = element->GetAbsoluteOffset();
  194. const Vector2f absolute_offset_next_sibling = next_sibling->GetAbsoluteOffset();
  195. const Vector2f absolute_offset_next_outside_overflow = next_outside_overflow->GetAbsoluteOffset();
  196. rmlui_dynamic_cast<ElementText*>(element->GetFirstChild())->SetText("Modified text that is long enough to cause line break");
  197. TestsShell::RenderLoop();
  198. CHECK(element->GetAbsoluteOffset() == absolute_offset_element);
  199. CHECK(next_sibling->GetAbsoluteOffset() != absolute_offset_next_sibling);
  200. CHECK(next_outside_overflow->GetAbsoluteOffset() == absolute_offset_next_outside_overflow);
  201. }
  202. SUBCASE("Absolute")
  203. {
  204. Element* element = document->GetElementById("absolute-item");
  205. Element* next_sibling = element->GetNextSibling();
  206. REQUIRE(element);
  207. REQUIRE(next_sibling);
  208. const Vector2f absolute_offset_element = element->GetAbsoluteOffset();
  209. const Vector2f absolute_offset_next_sibling = next_sibling->GetAbsoluteOffset();
  210. rmlui_dynamic_cast<ElementText*>(element->GetFirstChild())->SetText("Modified text that is long enough to cause line break");
  211. TestsShell::RenderLoop();
  212. CHECK(element->GetAbsoluteOffset() == absolute_offset_element);
  213. CHECK(next_sibling->GetAbsoluteOffset() != absolute_offset_next_sibling);
  214. }
  215. SUBCASE("Normal")
  216. {
  217. Element* element = document->GetElementById("normal-item");
  218. REQUIRE(element);
  219. const float initial_width = element->GetBox().GetSize().x;
  220. element->SetProperty("width", "250px");
  221. TestsShell::RenderLoop();
  222. float new_width = element->GetBox().GetSize().x;
  223. CHECK(new_width != initial_width);
  224. CHECK(new_width == doctest::Approx(250.0f));
  225. }
  226. document->Close();
  227. TestsShell::ShutdownShell();
  228. }
  229. #ifdef RMLUI_DEBUG
  230. // Wrap all the following tests under this condition, since the format independent debug tracker is only available in debug mode.
  231. TEST_CASE("LayoutIsolation.FullLayoutFormatIndependentCount")
  232. {
  233. Context* context = TestsShell::GetContext();
  234. FormatIndependentDebugTracker format_independent_tracker;
  235. ElementDocument* document = context->LoadDocumentFromMemory(document_isolation_rml);
  236. document->Show();
  237. TestsShell::RenderLoop();
  238. format_independent_tracker.LogMessage();
  239. const auto count_level_1 = std::count_if(format_independent_tracker.GetEntries().begin(), format_independent_tracker.GetEntries().end(),
  240. [](const auto& entry) { return entry.level == 1; });
  241. CHECK_MESSAGE(count_level_1 == 3, "Expecting one entry for each of flex, overflow, and absolute");
  242. // There are quite a few flex item format occurrences being performed currently. We might reduce the following
  243. // number while working on the flex formatting engine. If this fails for any other reason, it is likely a bug.
  244. CHECK(format_independent_tracker.CountEntries() == 10);
  245. CHECK(format_independent_tracker.CountFormattedEntries() == 10);
  246. document->Close();
  247. TestsShell::ShutdownShell();
  248. }
  249. static const String document_isolation_absolute_rml = R"(
  250. <rml>
  251. <head>
  252. <link type="text/rcss" href="/assets/rml.rcss"/>
  253. <style>
  254. body {
  255. width: 800px;
  256. height: 600px;
  257. background-color: #ddd;
  258. font-family: LatoLatin;
  259. font-size: 14px;
  260. }
  261. scrollbarvertical {
  262. width: 12px;
  263. cursor: arrow;
  264. margin-right: -1px;
  265. padding-right: 1px;
  266. }
  267. scrollbarvertical slidertrack {
  268. background-color: #f0f0f0;
  269. }
  270. scrollbarvertical sliderbar {
  271. background-color: #666;
  272. }
  273. .container {
  274. width: 200px;
  275. margin: 20px;
  276. padding: 10px;
  277. background-color: #bbb;
  278. }
  279. .container > div {
  280. background-color: #aaa;
  281. margin: 5px;
  282. padding: 10px;
  283. }
  284. #absolute-container {
  285. position: absolute;
  286. top: 300px;
  287. left: 300px;
  288. width: 30%;
  289. }
  290. </style>
  291. </head>
  292. <body>
  293. <div class="container" id="absolute-container">
  294. <div id="absolute-item">Absolutely positioned box</div>
  295. </div>
  296. <div class="container" id="normal-container">
  297. <div id="normal-item">Normal block box</div>
  298. </div>
  299. </body>
  300. </rml>
  301. )";
  302. TEST_CASE("LayoutIsolation.Absolute")
  303. {
  304. Context* context = TestsShell::GetContext();
  305. ElementDocument* document = context->LoadDocumentFromMemory(document_isolation_absolute_rml);
  306. document->Show();
  307. TestsShell::RenderLoop();
  308. FormatIndependentDebugTracker format_independent_tracker;
  309. SUBCASE("Modify absolute content")
  310. {
  311. Element* element = document->GetElementById("absolute-item");
  312. const float initial_height = element->GetOffsetHeight();
  313. rmlui_dynamic_cast<ElementText*>(element->GetFirstChild())->SetText("Modified text that is long enough to cause line break");
  314. TestsShell::RenderLoop();
  315. CHECK(element->GetOffsetHeight() != initial_height);
  316. CHECK(format_independent_tracker.CountFormattedEntries() == 1);
  317. }
  318. SUBCASE("Modify absolute width")
  319. {
  320. Element* container = document->GetElementById("absolute-container");
  321. Element* element = document->GetElementById("absolute-item");
  322. const float container_initial_width = container->GetOffsetWidth();
  323. const float element_initial_width = element->GetOffsetWidth();
  324. container->SetProperty("width", "300px");
  325. LogDirtyLayoutTree(document);
  326. document->UpdatePropertiesForDebug();
  327. LogDirtyLayoutTree(document);
  328. TestsShell::RenderLoop();
  329. CHECK(container->GetOffsetWidth() != container_initial_width);
  330. CHECK(element->GetOffsetWidth() != element_initial_width);
  331. // The following could in principle be reduced to 1, since the size of an absolute element should not affect the
  332. // layout of the formatting context it takes part in.
  333. CHECK(format_independent_tracker.CountEntries() == 2);
  334. CHECK(format_independent_tracker.CountFormattedEntries() == 2);
  335. }
  336. SUBCASE("Modify document width")
  337. {
  338. Element* container = document->GetElementById("absolute-container");
  339. Element* element = document->GetElementById("absolute-item");
  340. const float document_width = document->GetOffsetWidth();
  341. const float container_width = container->GetOffsetWidth();
  342. const float element_width = element->GetOffsetWidth();
  343. document->SetProperty("width", "1000px");
  344. TestsShell::RenderLoop();
  345. CHECK(document->GetOffsetWidth() != document_width);
  346. CHECK(container->GetOffsetWidth() != container_width);
  347. CHECK(element->GetOffsetWidth() != element_width);
  348. }
  349. SUBCASE("Modify normal content")
  350. {
  351. Element* element = document->GetElementById("normal-item");
  352. const float initial_height = element->GetOffsetHeight();
  353. LogLayoutTree(CaptureLayoutTree(document));
  354. rmlui_dynamic_cast<ElementText*>(element->GetFirstChild())->SetText("Modified text that is long enough to cause line break");
  355. TestsShell::RenderLoop();
  356. CHECK(element->GetOffsetHeight() != initial_height);
  357. CHECK(format_independent_tracker.CountFormattedEntries() == 1);
  358. }
  359. SUBCASE("Modify normal content and absolute content")
  360. {
  361. Element* absolute_element = document->GetElementById("absolute-item");
  362. Element* normal_element = document->GetElementById("normal-item");
  363. const float absolute_initial_height = absolute_element->GetOffsetHeight();
  364. const float normal_initial_height = normal_element->GetOffsetHeight();
  365. rmlui_dynamic_cast<ElementText*>(absolute_element->GetFirstChild())->SetText("Modified text that is long enough to cause line break");
  366. rmlui_dynamic_cast<ElementText*>(normal_element->GetFirstChild())->SetText("Modified text that is long enough to cause line break");
  367. TestsShell::RenderLoop();
  368. CHECK(absolute_element->GetOffsetHeight() != absolute_initial_height);
  369. CHECK(normal_element->GetOffsetHeight() != normal_initial_height);
  370. CHECK(format_independent_tracker.CountFormattedEntries() == 2);
  371. }
  372. format_independent_tracker.LogMessage();
  373. document->Close();
  374. TestsShell::ShutdownShell();
  375. }
  376. static const String layout_isolation_hidden_absolute_rml = R"(
  377. <rml>
  378. <head>
  379. <title>Demo</title>
  380. <link type="text/rcss" href="/assets/rml.rcss"/>
  381. <style>
  382. body {
  383. font-family: LatoLatin;
  384. font-size: 14px;
  385. border: 5px #a66;
  386. background: #cca;
  387. color: black;
  388. top: 200px;
  389. right: 300px;
  390. bottom: 200px;
  391. left: 300px;
  392. }
  393. div {
  394. width: 300px;
  395. height: 200px;
  396. left: 100px;
  397. top: 100px;
  398. }
  399. .hide {
  400. display: none;
  401. }
  402. .absolute {
  403. position: absolute;
  404. }
  405. .wide {
  406. width: 400px;
  407. }
  408. </style>
  409. </head>
  410. <body id="body">
  411. This is a sample.
  412. <div id="child">Child element</div>
  413. </body>
  414. </rml>
  415. )";
  416. TEST_CASE("LayoutIsolation.HiddenSkipsFormatting")
  417. {
  418. Context* context = TestsShell::GetContext();
  419. ElementDocument* document = context->LoadDocumentFromMemory(layout_isolation_hidden_absolute_rml);
  420. Element* element = document->GetElementById("child");
  421. element->SetClass("hide", true);
  422. SUBCASE("Static") {}
  423. SUBCASE("Absolute")
  424. {
  425. element->SetClass("absolute", true);
  426. }
  427. FormatIndependentDebugTracker format_independent_tracker;
  428. document->Show();
  429. TestsShell::RenderLoop();
  430. CHECK(format_independent_tracker.CountFormattedEntries() == 1);
  431. rmlui_dynamic_cast<ElementText*>(element->GetFirstChild())->SetText("Modified text");
  432. CHECK(format_independent_tracker.CountFormattedEntries() == 1);
  433. // Modifying text in a hidden element should not trigger a new layout.
  434. TestsShell::RenderLoop();
  435. CHECK(format_independent_tracker.CountFormattedEntries() == 1);
  436. format_independent_tracker.LogMessage();
  437. document->Close();
  438. TestsShell::ShutdownShell();
  439. }
  440. TEST_CASE("LayoutIsolation.HiddenToggleAndModify")
  441. {
  442. Context* context = TestsShell::GetContext();
  443. ElementDocument* document = context->LoadDocumentFromMemory(layout_isolation_hidden_absolute_rml);
  444. Element* element = document->GetElementById("child");
  445. element->SetClass("hide", true);
  446. float element_offset_left = 0;
  447. SUBCASE("Static")
  448. {
  449. element_offset_left = 305;
  450. }
  451. SUBCASE("Absolute")
  452. {
  453. element->SetClass("absolute", true);
  454. element_offset_left = 405;
  455. }
  456. document->Show();
  457. TestsShell::RenderLoop();
  458. CHECK(element->IsVisible() == false);
  459. element->SetClass("hide", false);
  460. document->UpdatePropertiesForDebug();
  461. TestsShell::RenderLoop();
  462. CHECK(element->GetAbsoluteLeft() == element_offset_left);
  463. CHECK(element->IsVisible() == true);
  464. CHECK(element->GetComputedValues().width().value == 300);
  465. CHECK(element->GetOffsetWidth() == 300.f);
  466. element->SetClass("hide", true);
  467. document->UpdatePropertiesForDebug();
  468. TestsShell::RenderLoop();
  469. CHECK(element->IsVisible() == false);
  470. CHECK(element->GetComputedValues().width().value == 300);
  471. CHECK(element->GetOffsetWidth() == 300.f);
  472. element->SetClass("wide", true);
  473. document->UpdatePropertiesForDebug();
  474. TestsShell::RenderLoop();
  475. CHECK(element->IsVisible() == false);
  476. CHECK(element->GetComputedValues().width().value == 400);
  477. CHECK(element->GetOffsetWidth() == 300.f);
  478. element->SetClass("hide", false);
  479. document->UpdatePropertiesForDebug();
  480. TestsShell::RenderLoop();
  481. CHECK(element->IsVisible() == true);
  482. CHECK(element->GetComputedValues().width().value == 400);
  483. CHECK(element->GetOffsetWidth() == 400.f);
  484. document->Close();
  485. TestsShell::ShutdownShell();
  486. }
  487. static const String layout_isolation_document_rml = R"(
  488. <rml>
  489. <head>
  490. <title>Demo</title>
  491. <link type="text/rcss" href="/assets/rml.rcss"/>
  492. <style>
  493. body {
  494. font-family: LatoLatin;
  495. font-size: 14px;
  496. border: 5px #a66;
  497. background: #cca;
  498. color: black;
  499. top: 200px;
  500. right: 300px;
  501. bottom: 200px;
  502. left: 300px;
  503. }
  504. </style>
  505. </head>
  506. <body>
  507. This is a sample.
  508. </body>
  509. </rml>
  510. )";
  511. TEST_CASE("LayoutIsolation.Document")
  512. {
  513. Context* context = TestsShell::GetContext();
  514. REQUIRE(context->GetDimensions() == Rml::Vector2i{1500, 800});
  515. FormatIndependentDebugTracker format_independent_tracker;
  516. ElementDocument* document = context->LoadDocumentFromMemory(layout_isolation_document_rml);
  517. document->Show();
  518. TestsShell::RenderLoop();
  519. CHECK(document->GetOffsetWidth() == 900.f);
  520. CHECK(document->GetOffsetHeight() == 400.f);
  521. SUBCASE("Modify absolute content")
  522. {
  523. context->SetDimensions(Rml::Vector2i{1600, 900});
  524. document->UpdatePropertiesForDebug();
  525. TestsShell::RenderLoop();
  526. CHECK(document->GetOffsetWidth() == 1000.f);
  527. CHECK(document->GetOffsetHeight() == 500.f);
  528. CHECK(format_independent_tracker.CountFormattedEntries() == 2);
  529. }
  530. format_independent_tracker.LogMessage();
  531. document->Close();
  532. TestsShell::ShutdownShell();
  533. }
  534. #endif // RMLUI_DEBUG