Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed problems with sorting css selectors.
Closes #39
  • Loading branch information
tordex committed Oct 23, 2015
1 parent 583c7e3 commit 7ee5c11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/css_selector.h
Expand Up @@ -244,12 +244,12 @@ namespace litehtml
return (v1.m_specificity < v2.m_specificity);
}

inline bool operator > (css_selector::ptr v1, css_selector::ptr v2)
inline bool operator >(const css_selector::ptr& v1, const css_selector::ptr& v2)
{
return (*v1 > *v2);
}

inline bool operator < (css_selector::ptr v1, css_selector::ptr v2)
inline bool operator < (const css_selector::ptr& v1, const css_selector::ptr& v2)
{
return (*v1 < *v2);
}
Expand Down
7 changes: 6 additions & 1 deletion src/stylesheet.cpp
Expand Up @@ -126,7 +126,12 @@ bool litehtml::css::parse_selectors( const tstring& txt, const litehtml::style::

void litehtml::css::sort_selectors()
{
sort(m_selectors.begin(), m_selectors.end(), std::less<css_selector::ptr>( ));
std::sort(m_selectors.begin(), m_selectors.end(),
[](const css_selector::ptr& v1, const css_selector::ptr& v2)
{
return (*v1) < (*v2);
}
);
}

void litehtml::css::parse_atrule(const tstring& text, const tchar_t* baseurl, const std::shared_ptr<document>& doc, const media_query_list::ptr& media)
Expand Down

0 comments on commit 7ee5c11

Please sign in to comment.