-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
DTCSSStylesheet.h
80 lines (54 loc) · 1.72 KB
/
DTCSSStylesheet.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//
// DTCSSStylesheet.h
// CoreTextExtensions
//
// Created by Oliver Drobnik on 9/5/11.
// Copyright (c) 2011 Drobnik.com. All rights reserved.
//
#import <Foundation/Foundation.h>
@class DTHTMLElement;
/**
This class represents a CSS style sheet used for specifying formatting for certain CSS selectors.
It supports matching styles by class, by id or by tag name. Hierarchy matching is not supported yet.
*/
@interface DTCSSStylesheet : NSObject <NSCopying>
/**
@name Creating Stylesheets
*/
/**
Creates the default stylesheet.
This stylesheet is based on the standard styles that Webkit provides for these tags. This stylesheet is loaded from an embedded copy of default.css.
*/
+ (DTCSSStylesheet *)defaultStyleSheet;
/**
Creates a stylesheet with a given style block
@param css The CSS string for the style block
*/
- (id)initWithStyleBlock:(NSString *)css;
/**
@name Working with CSS Style Blocks
*/
/**
Parses a style block string and adds the found style rules to the receiver.
@param css The CSS string for the style block
*/
- (void)parseStyleBlock:(NSString *)css;
/**
Merges styles from given stylesheet into the receiver
@param stylesheet the stylesheet to merge
*/
- (void)mergeStylesheet:(DTCSSStylesheet *)stylesheet;
/**
@name Accessing Style Information
*/
/**
Returns a dictionary that contains the merged style for a given element and the applicable style rules from the receiver.
@param element The HTML element.
@returns The merged style dictionary containing only styles which selector matches the element
*/
- (NSDictionary *)mergedStyleDictionaryForElement:(DTHTMLElement *)element;
/**
Returns a dictionary of the styles of the receiver
*/
- (NSDictionary *)styles;
@end