Dillo v3.1.1-98-g318d1f14
Loading...
Searching...
No Matches
CssSelector Class Reference

CSS selector class. More...

#include <css.hh>

Classes

struct  CombinatorAndSelector
 

Public Types

enum  Combinator { COMB_NONE , COMB_DESCENDANT , COMB_CHILD , COMB_ADJACENT_SIBLING }
 

Public Member Functions

 CssSelector ()
 
 ~CssSelector ()
 
void addSimpleSelector (Combinator c)
 
CssSimpleSelectortop ()
 
int size ()
 
bool match (Doctree *dt, const DoctreeNode *node, MatchCache *matchCache)
 
void setMatchCacheOffset (int mo)
 
int getRequiredMatchCache ()
 
int specificity ()
 Return the specificity of the selector.
 
bool checksPseudoClass ()
 
void print ()
 
void ref ()
 
void unref ()
 

Private Member Functions

bool match (Doctree *dt, const DoctreeNode *node, int i, Combinator comb, MatchCache *matchCache)
 Return whether selector matches at a given node in the document tree.
 

Private Attributes

int refCount
 
int matchCacheOffset
 
lout::misc::SimpleVector< struct CombinatorAndSelectorselectorList
 

Detailed Description

CSS selector class.

Todo:
Implement missing selector options.

Definition at line 397 of file css.hh.

Member Enumeration Documentation

◆ Combinator

Enumerator
COMB_NONE 
COMB_DESCENDANT 
COMB_CHILD 
COMB_ADJACENT_SIBLING 

Definition at line 399 of file css.hh.

Constructor & Destructor Documentation

◆ CssSelector()

◆ ~CssSelector()

CssSelector::~CssSelector ( )

Definition at line 119 of file css.cc.

References selectorList.

Member Function Documentation

◆ addSimpleSelector()

void CssSelector::addSimpleSelector ( Combinator  c)

◆ checksPseudoClass()

bool CssSelector::checksPseudoClass ( )

Definition at line 184 of file css.cc.

References selectorList.

Referenced by CssRule::isSafe().

◆ getRequiredMatchCache()

int CssSelector::getRequiredMatchCache ( )
inline

Definition at line 435 of file css.hh.

References matchCacheOffset, and size().

Referenced by CssStyleSheet::addRule(), and CssContext::addRule().

◆ match() [1/2]

bool CssSelector::match ( Doctree dt,
const DoctreeNode node,
int  i,
Combinator  comb,
MatchCache matchCache 
)
private

◆ match() [2/2]

bool CssSelector::match ( Doctree dt,
const DoctreeNode node,
MatchCache matchCache 
)
inline

Definition at line 426 of file css.hh.

References COMB_NONE, match(), and selectorList.

◆ print()

void CssSelector::print ( )

Definition at line 206 of file css.cc.

References COMB_ADJACENT_SIBLING, COMB_CHILD, COMB_DESCENDANT, and selectorList.

Referenced by CssRule::print().

◆ ref()

void CssSelector::ref ( )
inline

Definition at line 441 of file css.hh.

References refCount.

Referenced by CssRule::CssRule(), and CssParser::parseRuleset().

◆ setMatchCacheOffset()

void CssSelector::setMatchCacheOffset ( int  mo)
inline

Definition at line 431 of file css.hh.

References matchCacheOffset.

Referenced by CssContext::addRule().

◆ size()

int CssSelector::size ( )
inline

Definition at line 425 of file css.hh.

References selectorList.

Referenced by CssRule::CssRule(), and getRequiredMatchCache().

◆ specificity()

int CssSelector::specificity ( )

Return the specificity of the selector.

The specificity of a CSS selector is defined in http://www.w3.org/TR/CSS21/cascade.html#specificity

Definition at line 197 of file css.cc.

References selectorList.

Referenced by CssRule::CssRule().

◆ top()

CssSimpleSelector * CssSelector::top ( )
inline

Definition at line 422 of file css.hh.

References selectorList.

Referenced by CssStyleSheet::addRule(), and CssParser::parseSelector().

◆ unref()

void CssSelector::unref ( )
inline

Definition at line 442 of file css.hh.

References refCount.

Referenced by CssParser::parseRuleset(), and CssRule::~CssRule().

Member Data Documentation

◆ matchCacheOffset

int CssSelector::matchCacheOffset
private

◆ refCount

int CssSelector::refCount
private

Definition at line 412 of file css.hh.

Referenced by CssSelector(), ref(), and unref().

◆ selectorList

lout::misc::SimpleVector<struct CombinatorAndSelector> CssSelector::selectorList
private

The documentation for this class was generated from the following files: