aboutsummaryrefslogtreecommitdiff
path: root/dw
AgeCommit message (Collapse)Author
2024-11-14Reset resize counter when viewport size changesRodrigo Arias Mallo
To prevent the page from triggering the emergency stop at resizeIdle(), we reset the resize counter when the viewport is resized. Fixes: https://github.com/dillo-browser/dillo/issues/300
2024-11-14Only limit resizes on the top-level layoutRodrigo Arias Mallo
Buttons also have their own Layout, which will try to resize every time the window has changed. We are only interested in the top-level layout, as is the one that has a problem on some pages.
2024-10-17Use the aspect ratio of the content boxRodrigo Arias Mallo
The requisition box includes the margin, padding and border. To compute the aspect ratio of the image we need to remove them to get the content box. Once the adjustment is done, we add the borders again.
2024-10-17Remove aspect ratio logic from ImageRodrigo Arias Mallo
The aspect ratio is now preserved by Widget::correctRequisition(), so we don't need to do more steps after the call.
2024-10-17Use maximum size for pathological CSS casesRodrigo Arias Mallo
When CSS min-{width,height} > max-{width,height} set the max-{width,heigh} to the maximum value min-{width,height}.
2024-10-17Add support for aspect ratio in WidgetRodrigo Arias Mallo
Images should preserve their own aspect ratio, which is determined by the image buffer size, also known as the intrinsic size. Currently, when a child requests a requisition to be corrected by correctRequisition(), only the size was adjusted, ignoring the aspect ratio. The new Widget ratio variable holds the desired aspect ratio for the widget, and will only be taken into account when non-zero. In that case, then correcting the requisition, a naive algorithm tries to first increase the length of the small size to fill the preferred aspect ratio. In the case that it is not enough, the larger size is then decreased to fit the aspect ratio. And if that doesn't work either, the aspect ratio is not enforced and the widget will be distorted. There are special cases for correctRequisition() depending if the parent exists or not. The same approach is taken for both cases, but using the viewport size instead of the parent size.
2024-10-17Only use the viewport height with forceValue setRodrigo Arias Mallo
For cases where the available height is being computed and the CSS style has the height to auto, there available height is infinite. Don't return the viewport unless forceValue is set.
2024-10-17Add comment for dubious callRodrigo Arias Mallo
2024-10-17Allow widgets to adjust new requisitionRodrigo Arias Mallo
When a widget calls the parent to correct its own requisition, let the child widget perform adjustments on the requisition. This allows images to control the height when the parent changes the width, so the image can preserve its own aspect ratio.
2024-10-17Improve comments in dw::core::WidgetRodrigo Arias Mallo
2024-10-17Use corrected requisition as fixed sizeRodrigo Arias Mallo
2024-10-17Expand percentage height values for requisitionsRodrigo Arias Mallo
When correcting a requisition, percent values were not being computed which prevents the min-height or max-height values to be taken into account.
2024-10-17Set the viewport width as initial width valueRodrigo Arias Mallo
When the initial width is -1, the contrainsts of min-width and max-width are not applied. If we set the viewport width after calcFinalWidth() it may exceed max-width. It is guaranteed to return a value different from -1 when the initial width is positive.
2024-10-17Don't apply min/max-width if the width is autoRodrigo Arias Mallo
Prevents reducing the available width of a body with width:auto and min-width:100px to 100px. The Widget::calcFinalWidth() method is also heavily documented, so we can understand precisely what it does.
2024-10-17Preserve aspect ratio of imagesRodrigo Arias Mallo
When posible, change the image size so the aspect ratio is always preserved. This is only posible when one or both dimensions have some room to play. When both dimensions are not fixed, a naive algorithm tries to satisfy all {min,max}-{width,height} and aspect ratio constraints, but it may fail. In that case, the aspect ratio is not preserved. Fixes the HTML tests img-aspect-ratio and img-max-bounds.
2024-10-17Round final relative CSS lengthRodrigo Arias Mallo
Prevents errors by one pixel
2024-10-14Take into account the scrollbar in page overlapRodrigo Arias Mallo
When the horizontal scrollbar is visible the viewport size is reduced, so the page overlap should be computed from the visible viewport only. The change ensures the overlap has the same lenght, regardless of the visibility state of the scrollbars.
2024-10-13Jump to top and bottom in scroll page modeRodrigo Arias Mallo
When scroll page mode is active, clicking on the up and down scrollbar buttons make the page jump to the top and bottom repectively.
2024-10-13Repeat page scrolling when holding the buttonRodrigo Arias Mallo
When the page scroll mode is enabled, pressing and holding the scrollbar will keep scrolling pages on that direction until the mouse button is released.
2024-10-13Control the page overlap independentlyRodrigo Arias Mallo
Introduces the new option scroll_page_overlap to control the amount of pixels of overlap when scrolling to the next or previous page. Previously this value was taken from scroll_step, but now they are controlled independently. Fixes: https://github.com/dillo-browser/dillo/issues/276
2024-10-13Scroll full pages with mouse wheelRodrigo Arias Mallo
When using the scroll wheel over a page, holding Shift will cause full pages to be scrolled instead of scroll steps. The same effect can be achieved by scrolling over the vertical scrollbar.
2024-10-13Add new scrollbar page modeRodrigo Arias Mallo
The scroll page mode changes the behavior of the mouse when clicking on the vertical scrollbar. When enabled with scrollbar_page_mode=YES, clicking with the left button anywhere on the vertical scrollbar will cause the page to scroll down one page. With the right button, to scroll up one page. Holding Shift temporarily reverts the value of the option.
2024-10-13Add support for left scrollbarRodrigo Arias Mallo
Implements support for placing the vertical scrollbar on the left side by setting scrollbar_on_left=YES on dillorc. By default, continues to be on the right side. See: https://www.toomanyatoms.com/software/mobilized_dillo.html Authored-By: dogma
2024-10-05Add support for more CSS unitsRodrigo Arias Mallo
Implements support for ch, rem, vw, vh, vmin and vmax units of CSS lengths. For now the units relative to the viewport are only computed once, and they won't change when the window is resized, but only when the page is reloaded. See: https://www.toomanyatoms.com/software/mobilized_dillo.html Authored-By: dogma
2024-08-07Stop the layouting loop after 1000 iterationsRodrigo Arias
Prevents Dillo from hoarding the CPU due to an infinite loop in the layouting. We also return the control to FLTK to update the screen and process events each 100 iterations, to keep the window responsive. It doesn't fix the root cause of the github-infinite-loop test, but it does allow the rendering to finish with no differences with the reference test.
2024-08-07Use dStrdup instead of strdupRodrigo Arias Mallo
The strdup function is not available in POSIX-2001, so we use our own implementation in dlib: dStrdup. Reviewed-by: dogma
2024-08-07Make Dillo C99 standard compliantRodrigo Arias Mallo
Reviewed-by: dogma
2024-08-07Fix pedantic warningsRodrigo Arias Mallo
Reviewed-by: dogma
2024-07-27Add SVG support for currentColorRodrigo Arias Mallo
The currentColor special value for the fill and stroke attributes allows an image to follow the same foreground color of the surounding text.
2024-06-02Remove undefined floatRef debug line in RTFLRodrigo Arias Mallo
Fixes: https://bugs.gentoo.org/933361
2024-05-03Disable "Layout::resizeIdle calls" messageRodrigo Arias Mallo
It is always shown, even when messages are turned of by "show_msg=NO", as the preferences are not available to dw. For now we disable it permanently by using the _MSG() macro. Reported-by: Kevin Koster <dillo@ombertech.com> See: https://lists.mailman3.com/hyperkitty/list/dillo-dev@mailman3.com/message/PPNR5FTO3YFDVAQCM4SDNVAF22JEV22W/
2024-03-23Set forceValue when correcting a requisitionRodrigo Arias Mallo
For cases where the parent widget has the width set to auto we need to go to the above parent to compute the available width. This is required to make tables with a width of 100% occupy the whole available width of the parent. In particular, fixes render/table-max-width.html test, which was relying on a {-1,-1,-1} requisition to have a value different than -1 in the width to consider that the CSS width is effective.
2024-03-23Revert "Constraint width with min-width or max-width"Rodrigo Arias Mallo
This reverts commit 24bcd67df29a5418d05600b038a9283a00e555d2. Fixes: https://github.com/dillo-browser/dillo/issues/99
2024-03-17Clamp width to min/max in getAvailWidthOfChild()Rodrigo Arias Mallo
When the width is set to auto, a different branch is used to compute the width via getAvailWidth(true). The returned witdh needs to be clamped to be in the min/max-width CSS range if given, as otherwise it won't be corrected. Fixes: https://github.com/dillo-browser/dillo/issues/89
2024-03-17Prefer CSS max-width when width is set to auto.Rodrigo Arias Mallo
When a widget has width to auto and the initial finalWidth is -1, set it by default to the max-width CSS value so it expands to the maximum available size.
2024-01-09Update references to website and repositoryRodrigo Arias Mallo
The website is now at https://dillo-browser.github.io/ and the repository at https://github.com/dillo-browser/dillo.
2024-01-08Constraint width in calcFinalWitdh()Rodrigo Arias Mallo
Then min-width or max-width is given in the CSS style for the current widget, the returned width should be clamped by those values. The condition *finalValue != 1 was used to clamp with min-width, but it doesn't capture the situation when the finalValue was not yet set. Similarly, for the max-width, the finalWidth was only set when *finalValue == -1, which prevented the clamping when the width is set. The change always perform the clamp when finalWidth is not set or when the value exceeds the min or max value. When both min-width and max-width are given but width is -1, the resulting width is the min-witdh, as the max-width clamp rule won't trigger after setting the *finalValue to the min-witdh.
2023-12-31Constraint width with min-width or max-widthRodrigo Arias Mallo
When a widget has a parent, the calcFinalWidth() method was not being called to compute the limits of min-width or max-width given by CSS rules. The change makes the call to calcFinalWidth in all cases.
2023-12-30Fix bogus comparison of oofContainer[i]Rodrigo Arias Mallo
The same index was being used in both sides of the comparison.
2016-08-09Merged commit #4653 (float clearance).Jorge Arellano Cid
Test case: <body> <div id="a"> <div id="b" style="float:left">main</div> </div> <div id="c" style="clear:left"></div> <div id="d">footer</div> </body> Note: passes all the tests at http://www.dillo.org/test/4648/test-suite.v1.txt
2016-08-04Revert commit #4651Jorge Arellano Cid
Introduces regressions: .-------.--------.------.-----------.-----------------------.-----.-----. | | BTG | test | pravda.ru | 4ta.html | VT | PV | | | render | t.* | #1 | #2 | Girl | footb. | horos.| | | |-------|--------|------|-----------|-----------------------|-----|-----| |d4594 | ok | ok | x a | x b | x c | ok | x d | x i | x k | '-----------------------------------------------------------------------' Note: patch #4594 is the same as patch #4651. (we use d4594 to avoid side effects from other patches). Check this testsuite [1] for more details. [1] http://www.dillo.org/test/4648/test-suite.v1.txt
2016-08-04Revert commit #4652Jorge Arellano Cid
Introduces regressions: .-------.--------.------.-----------.-----------------------.-----.-----. | | BTG | test | pravda.ru | 4ta.html | VT | PV | | | render | t.* | #1 | #2 | Girl | footb. | horos.| | | |-------|--------|------|-----------|-----------------------|-----|-----| |d4652 | ok | ok | x a | x ic| ok | x l | x d | x n | ok | '-----------------------------------------------------------------------' Check this testsuite [1] for more details. [1] http://www.dillo.org/test/4648/test-suite.v1.txt
2016-08-04Revert commit #4653 (on hold)Jorge Arellano Cid
This patch is "on hold", as it depends on reverted code, and at least would need a non-automatic merge.
2016-07-24Remove obsolete method.Sebastian Geerken
2016-07-24Fix update problem related to CSS 'clear'.Sebastian Geerken
2016-07-17Fix Layout::viewportSizeChanged.Sebastian Geerken
2016-07-17Reverse commit 4647:8c6b1b79d329.Sebastian Geerken
2016-07-17Comment on Jorge's commit.Sebastian Geerken
2016-07-17RTFL.Sebastian Geerken
2016-07-16fix Layout::viewportSizeChanged.Jorge Arellano Cid
When changing viewport size, sometimes the resize wasn't propagated properly. e.g. pravda #2 in the results below. Here follows the test suite and its results: -------------------------------------------- Legend: d4646 = dillo version #4646 in Mercurial repository. x a = Test failed, with code a = Problems 1, 9 and 3. Custom test pages at: http://www.dillo.org/test/4648/ Results Table .-------.--------.------.-----------.-----------------------.-----.-----. | | BTG | test | pravda.ru | 4ta.html | VT | PV | | | render | t.* | #1 | #2 | Girl | footb. | horos.| | | |-------|--------|------|-----------|-----------------------|-----|-----| |d4648 | ok | ok | ok | ok | ok | ok | ok | ok | ok | |d4647 | ok | ok | ok | x g | ok | ok | ok | ok | ok | |d4646 | ok | ok | x a | x l | ok | x j | x d | x n | ok | |d4645 | ok | ok | x m | x l | ok | x j | x d | ok | ok | |d4644 | ok | ok | x a | x b | ok | x j | x d | ok | x k | |incr | ok | ok | x a | x b | x c | ok | x d | ok | x k | |d4587t2|~ x f | ok | ok | ok | ok | ok | ok | x i | | |d4587+ | ok | ok | ok | ok | ok | ok | ok | x i | x k | |d4587 | ok | x e | ok | ok | ok | ok | ok | x i | x k | |d4584 | ok | x h | ok | ok | ok | ok | ok | x i | x k | -----------------------------------------------------------------------| |ok7 | ok | ok | ok | x g | ok | ok | ok | | | |tmp8 | ok | x e | | | | | | | | |tmp9 | ok | ok | | | | | | | | |tmp9.1 | ok | ok | ok | x g | ok | ok | ok | | | '-----------------------------------'-----------------------------'-----' ___________________________________________________________ / a | b | c | d | e | f | g | h | i | j | k \ incr = d4594 | 1 9 3 | 1 9 4 | 9 | 1 5 | 6 | 7 | 4 | 12 | 13 | 8 9 | 10 | 47 = prune patch '------------------------------------------------------'----' 45 = idle patch | l: 13 | m: 4 2| n: 5 9 | 46 = words patch 48 = viewportchg Problems: 1: overwrites text with images. 2: crops images (aspect ratio). 3: different layout. 4: overwrites text with float. 5: overwrites text with text. 6: CPU HOG with: t2.n, t2.n.sm 7: Missing page sections (sometimes works for the same page). 8: Small images cut in two sometimes ("ESP", "CRO", ...) 9: Wrong aspect ratio for images (text line height) 10: Page drawn with offset (but browser thinks other section is on screen). 11: CPU HOG. 12: CPU HOG with: t1, t1n, t2.n, t2.n.sm, t3. 13: overwrites text and images with text and images. Goods: *: works for the whole t.* suite. Testing (all with background images disabled): BTG: 1.- Bck/Fwd several times (first at normal then maximized). 2.- resize from max to normal several times. pravda #1: 1. Load [1] at normal size, wait most images to load, check images and check them not to overlap text, go Bck/Fwd, check again. 2. Maximize window, check images don't overlap text, check the page layout to have three main columns (the upper part). Go Bck/Fwd, check again. pravda #2: 1. Load [1] at normal size, wait most images to load, then load [2], press page down, check the "print version" float doesn't overlap text, or images (they may stack), check the two images inside it have the same size and ratio, maximize, return to normal, check the float again. 4ta: 1. Run dillo, disable images, load 4ta.html, click Girl img, go Bck/Fwd, check img, exit dillo. 2. Run dillo, disable images, load 4ta.html, click football img, go Bck/Fwd, check img, exit dillo. 3. Run dillo, disable images, load 4ta.html, click tauro img, check horoscope text, go Bck/Fwd, check h. text, click aries img, check h. text, go Bck/Fwd, check h. text, exit dillo. 4. Run dillo, disable images, load 4ta.html, click football img, go Bck/Fwd, click dep.png img, check images, go Bck/Fwd, check images. VT: 1. Load [3] at normal size, wait for most images to load, go Bck/Fwd, check images and text not to override each other. PV: 1. Load [5] at normal size, wait for most images to load, search for "re-re" with Find Text, press page down (you'll see an image), go Bck/Fwd, check the image is there. If not, you can place the cursor where the image was, if you get a hand cursor, Dillo thinks it is there. Wait for the tooltip and drag it a bit downwards to the right, Dillo will repaint from the image data. [1] http://tinyurl.com/j2yavxk [2] http://tinyurl.com/gqso9eu [3] http://tinyurl.com/msyl7x [4] http://tinyurl.com/grd6yg4 [5] http://tinyurl.com/huvf6pn