Age | Commit message (Collapse) | Author |
|
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>
|
|
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
|
|
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.
|
|
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
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
For a discussion of the problem see:
http://dbaron.org/mozilla/visited-privacy
|
|
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>
|
|
|
|
By moving buildUserAgentStyle and buildUserStyle from css.cc to
styleengine.cc we can avoid the circular dependency between css.hh
and cssparser.hh.
|
|
|
|
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>
|
|
|
|
|
|
|
|
|
|
|
|
* 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.
|
|
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
|
|
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
|
|
|
|
* 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>
|
|
|
|
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.
|
|
The implementation in the fltk backend is still missing.
|
|
|
|
|
|
|
|
|
|
CssLength now stores px and mm values as pure integers similar to
what dw::core::style::Length does.
|