aboutsummaryrefslogtreecommitdiff
path: root/dw/widget.cc
AgeCommit message (Collapse)Author
2025-02-05Fix several typosGevel Tekens
See: https://lists.mailman3.com/hyperkitty/list/dillo-dev@mailman3.com/thread/L3FFAINJJMIOZQNID5HC2DHKJIIIHEYH/
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-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-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-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-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-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-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.
2016-06-24typoJorge Arellano Cid
2016-06-17RTFL.Sebastian Geerken
2016-06-14Whitespace.Sebastian Geerken
2016-05-29Fix SRDOP related bug in Widget::sizeRequest.Sebastian Geerken
2016-05-08RTFL.Sebastian Geerken
2016-04-23GROWS: Fix rounding errors.Sebastian Geerken
2016-04-23RTFL.Sebastian Geerken
2016-04-23GROWS: new options allowDecreaseWidth and allowDecreaseHeight for size ↵Sebastian Geerken
correction.
2016-04-13Removed Layout::queueQueueResizeList and optimized multiple (both nested and ↵Sebastian Geerken
sequential) queueResize.
2016-04-04Fix typo in comment.Sebastian Geerken
2016-04-04Remove old (#if 0'ed) debugging code.Sebastian Geerken
2016-04-03WidgetReference: Widget::widgetReference.Sebastian Geerken
2016-03-26RTFL.Sebastian Geerken
2016-01-09Widget::calcExtraSpace is only called for size, not for extremes.Sebastian Geerken
2016-01-09Better abort messages.Sebastian Geerken
2016-01-09SRDOP: Extend Widget::calcExtraSpace and Widget::calcExtraSpaceImpl by ↵Sebastian Geerken
references.
2016-01-01RTFL.Sebastian Geerken
2016-01-01SRDOP: Consider references and positions in Widget::getExtremes.Sebastian Geerken
2016-01-01SRDOP: Consider references and positions in Widget::sizeRequest.Sebastian Geerken
2015-12-28SRDOP: Fix endless recursion.Sebastian Geerken
2015-12-28RTFL messages.Sebastian Geerken
2015-12-28RTFL messages.Sebastian Geerken
2015-06-10SRDOP: Work on RTFL messages.Sebastian Geerken
2015-06-08SRDOP: Positions relative to multiple references; design now considers ↵Sebastian Geerken
handling conflicts.
2015-06-06SRDOP: Positions also for extremes.Sebastian Geerken
2015-05-20Size requisitions depending on positions (SRDOP): added method signatures.Sebastian Geerken
2015-01-23Interrupted drawing etc: cleanup.Sebastian Geerken
2015-01-23Same simplifications for Widget::getWidgetAtPoint as for Widget::draw before.Sebastian Geerken
2015-01-23StackingProcessingContext, GettingWidgetAtPointContext.Sebastian Geerken
2015-01-23Interrupted drawing: cleanups, comments, documentation.Sebastian Geerken
2015-01-23Simplified interrupted drawing. (Mouse events will follow.)Sebastian Geerken
2015-01-08Merge with main repo.Sebastian Geerken
2015-01-05Extremes::adjustmentWidth may now (again) be used for extremes correction.Sebastian Geerken