aboutsummaryrefslogtreecommitdiff
path: root/src/css.hh
AgeCommit message (Collapse)Author
2025-02-19Fix build on Solaris 10 and old gcc 4.0.1Claes Nästén
Remove extra semicolons and commas, as well as isinf() so it builds and runs on Solaris 10. Also add extra fixes for non C++11 courtesy of Sevan Janiyan, making Dillo compile and run on OS X 10.4 PowerPC with GCC 4.0.1 and 8.5. Co-authored-by: Sevan Janiyan <venture37@geeklan.co.uk>
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-10-05Define CssLength as struct instead of intRodrigo Arias Mallo
The int type doesn't have a fixed size, and is only guarantee to hold 16 bits. The current implementation assumes a size of at least 32 bits, an uses three bits to encode the type of information stored in the rest. To add more types of lengths we would need to take more bits from the value itself. A simpler approach is just to use a enumeration to take care of the type of length and a union to encapsulate the different lengths values.
2024-06-07Ensure the same number of tags for CSS and HTMLRodrigo Arias Mallo
The Tags array can be modified without changing the "ntags" number in the CSS side. To prevent errors, an static assert ensures the same number is used in both sides, which is known at compilation time. Fixes: https://github.com/dillo-browser/dillo/issues/184
2024-03-09Use Doxygen comments for C filesRodrigo Arias Mallo
2014-12-21more (and indentation in one spot)corvid
2014-03-05use a singe matchCache per CssContextJohannes Hofmann
This fixes a crash with the following HTML: <head> <style type="text/css"> .first .second .third{ border-top-color:#aaa !important; } #n .a, .b{ color: #aaa !important; border:#bbb; } </style> </head> <body> <div id="submit" value="Submit" class="a"> jhu </div> </body> The problem is that CssSelectors can be shared between normal and !important rules. The matchCacheOffset was overwritten in that case causing the crash on access. noticed-by and test-case-by: corvid
2014-03-03fix clang warningJohannes Hofmann
2014-02-16css: embed klass into CssSimpleSelectorJohannes Hofmann
2014-02-16css: embed selectorList in CssSelectorJohannes Hofmann
2014-02-16css: mark CssStyleSheet::apply() as constJohannes Hofmann
2014-02-15share user agent style between CssContext'sJohannes Hofmann
2014-02-15mergeJohannes Hofmann
2014-02-15css: move cached matching information out of CssStyleSheetJohannes Hofmann
CssStyleSheet::apply() no longer modifies the CssStyleSheet. Cached matching information is now store in a MatchCache object which is part of CssContext. This makes it possible to share CssStyleSheet's between multiple CssContext's.
2014-02-15rudimentary support for html5 video,audio,source,embedcorvid
2014-01-06Fixed memory leak (CSS URIs).Sebastian Geerken
2013-11-30accept 'auto' only for CSS properties that allow itJohannes Hofmann
Instead of handling the 'auto' value implicitly for all CSS properties that accept lenght types, we now accept it only for specific properties where 'auto' is valid according to CSS 2.1. This fixes an assertion with the following HTML fragment: <div style="background:auto">hello</div>
2013-10-16Missing dFree.Sebastian Geerken
2013-09-30Cleaned up Johannes' patch.Sebastian Geerken
2013-09-30New type for <background-position> (incomplete).Johannes Hofmann
2013-09-26CSS attribute 'background-position'.Sebastian Geerken
2013-09-22CSS type <uri> implemented; applied to 'background-image'.Sebastian Geerken
2013-09-07the WBR element itselfcorvid
2013-09-05html5 MARK elementcorvid
2013-09-05some html5 structural elementscorvid
The spec also has some rules about how, for instance, a footer can't go inside a header, and that sort of thing, but that can wait until we have something more sophisticated than a collection of IN_* flags.
2012-07-06Attribute "lang" is evaluated for hyphenation; part of dw:core::style::Style.ysgeerken
2012-01-21ignore remote CSS rules that could reveal browser historyJohannes Hofmann
For a discussion of the problem see: http://dbaron.org/mozilla/visited-privacy
2012-01-13fix descendant selector matchingJohannes Hofmann
When matching descendant selectors we need to test all possibilities and not just the first one. While at it refactor CssSelector::match (). Testcase: <html> <head> <style type=text/css> .a > .b .c { font-weight:bold }</style> </head> <body> <div class=a> <div class=b> <div class=b> <div class=c>should be bold</div> </div> </div> </div> </body> </html> Noticed-by: Sebastian Geerken <sgeerken@dillo.org>
2011-12-30cleanup CssStyleSheet a bitJohannes Hofmann
2011-12-30move buildUserAgentStyle and buildUserStyle to styleengine.ccJohannes Hofmann
By moving buildUserAgentStyle and buildUserStyle from css.cc to styleengine.cc we can avoid the circular dependency between css.hh and cssparser.hh.
2011-12-30use array of CssStyleSheets instead of pointers in CssContextJohannes Hofmann
2011-08-02don't reuse user- and useragent-stylesheetJohannes Hofmann
The notMatchingBefore variable in CssSelector is modified as a page is styled. Thererfore we can't share a single copy of the user- and useragent-stylesheets between CssContexts. Testcase: <html> <body> <a href=whatever.html> <img alt=test src=whatever.jpg> </a> <div> <img src=something.jpg> </div> </body> </html> On reload the first image looses it's border. Tests with gettimeofday showed times below 1ms to create user- and useragent-styles on a Pentium-M 1.8 GHz laptop. reported-by: corvid <corvid@lavabit.com>
2011-06-07support !important in style attributesJohannes Hofmann
2010-11-24trim some spacescorvid
2010-10-17no need to inline CssPropertyList copy constructorJohannes Hofmann
2010-10-12implement optional deep copy for CssPropertyListJohannes Hofmann
2010-10-11allow to apply CssContext to an arbitrary node in the docTreeJohannes Hofmann
2010-10-11rework nonCssHints API of StyleEngineJohannes Hofmann
* Instead of passing the nonCssHints as a CssPropertyList, set the hints separately and create the list in StyleEngine. * The CssPropertyList holding the nonCssHints is now completely managed by StyleEngine and kept on the stack. * Replace the table_cell_props mechanic in html.cc/table.cc with a new method inheritNonCssHints() in StyleEngine.
2010-08-23add lout::misc::roundInt() for double -> int conversionJohannes Hofmann
Add lout::misc::roundInt() and use it for double -> int conversion instead of doing the + 0.5 trick all over the place. It was wrong for negative values and we might even replace roundInt() with rint() from libm in the future. Reported-by: corvid
2010-04-23use CSS rule position when specificity is equalJohannes Hofmann
When two CSS rules have the same specificity make sure they are applied in the order as they appear in the stylesheets (see [1]). Testcase: <html><head><style> A:link {color: red} A.foo {color: green} </style></head><body> <a class="foo" href=http://www.dillo.org>should be green</a> </body></html> Reported by: corvid [1] http://www.w3.org/TR/CSS2/cascade.html#cascading-order
2010-04-20css word-spacing propertycorvid
2010-04-02add CSS_TYPE_LENGTH_PERCENTAGE_NUMBERJohannes Hofmann
* Add an additional CssValueType CSS_TYPE_LENGTH_PERCENTAGE_NUMBER which can be a length, a percentage, or a number without unit. * Numbers without units are represented as CssLength of type CSS_LENGTH_TYPE_NONE. * Properly detect numbers without unit in cases where they are not allowed (see testcase below). For lengths only '0' can be specified without unit. Testcase: <html> <head> <style tyoe="text/css"> div {border: solid black 2px} </style> </head> <body> <!-- correct - border-width should be set to 0 -> no border --> <div style="border-width: 0">foo bar</div> <!-- false - border-width should be left untouched -> 2px border --> <div style="border-width: 40">foo bar</div> <!-- false - border-width should be left untouched -> 2px border --> <div style="border-width: 40 px">foo bar</div> </body> </html>
2009-12-18support border-width: thin | medium | thickJohannes Hofmann
2009-10-18represent millimeter values as fractions in CssLengthJohannes Hofmann
E.g. for letter-spacing sub-millimeter values actually make a difference. The maximum value that is representable is now 65535 mm which should be enough in most cases.
2009-10-17add letter-spacing support to CSS subsystemJohannes Hofmann
The implementation in the fltk backend is still missing.
2009-07-17Fix an implicit int cast error when int != int32_tJorge Arellano Cid
2009-07-11allow multiple class strings in CssSimpleSelectorJohannes Hofmann
2009-07-11make CssSimpleSelector members privateJohannes Hofmann
2009-07-07Added parenthesis to math expressionJorge Arellano Cid
2009-07-06adjust CssLengthJohannes Hofmann
CssLength now stores px and mm values as pure integers similar to what dw::core::style::Length does.