Unique pointer a member of style node.
This commit is contained in:
@ -116,16 +116,15 @@ StyleEngine::~StyleEngine () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void StyleEngine::stackPush () {
|
void StyleEngine::stackPush () {
|
||||||
static const Node emptyNode = {
|
Node emptyNode = {
|
||||||
NULL, NULL, NULL, NULL, NULL, NULL, false, false, NULL
|
NULL, NULL, NULL, NULL, NULL, NULL, false, false, NULL
|
||||||
};
|
};
|
||||||
stack.push_back( emptyNode );
|
stack.push_back( std::move( emptyNode ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void StyleEngine::stackPop () {
|
void StyleEngine::stackPop () {
|
||||||
Node *n = &stack.at (stack.size () - 1);
|
Node *n = &stack.at (stack.size () - 1);
|
||||||
|
|
||||||
delete n->styleAttrProperties;
|
|
||||||
delete n->styleAttrPropertiesImportant;
|
delete n->styleAttrPropertiesImportant;
|
||||||
delete n->nonCssProperties;
|
delete n->nonCssProperties;
|
||||||
if (n->style)
|
if (n->style)
|
||||||
@ -199,11 +198,11 @@ void StyleEngine::setStyle (const char *styleAttr) {
|
|||||||
assert (n->styleAttrProperties == NULL);
|
assert (n->styleAttrProperties == NULL);
|
||||||
// parse style information from style="" attribute, if it exists
|
// parse style information from style="" attribute, if it exists
|
||||||
if (styleAttr && prefs.parse_embedded_css) {
|
if (styleAttr && prefs.parse_embedded_css) {
|
||||||
n->styleAttrProperties = new CssPropertyList (true);
|
n->styleAttrProperties = std::make_unique< CssPropertyList >(true);
|
||||||
n->styleAttrPropertiesImportant = new CssPropertyList (true);
|
n->styleAttrPropertiesImportant = new CssPropertyList (true);
|
||||||
|
|
||||||
CssParser::parseDeclarationBlock (baseUrl, styleAttr, strlen (styleAttr),
|
CssParser::parseDeclarationBlock (baseUrl, styleAttr, strlen (styleAttr),
|
||||||
n->styleAttrProperties,
|
n->styleAttrProperties.get(),
|
||||||
n->styleAttrPropertiesImportant);
|
n->styleAttrPropertiesImportant);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -934,7 +933,7 @@ Style * StyleEngine::style0 (int i, BrowserWindow *bw) {
|
|||||||
attrs.resetValues ();
|
attrs.resetValues ();
|
||||||
preprocessAttrs (&attrs);
|
preprocessAttrs (&attrs);
|
||||||
|
|
||||||
styleAttrProperties = stack.at (i).styleAttrProperties;
|
styleAttrProperties = stack.at (i).styleAttrProperties.get();
|
||||||
styleAttrPropertiesImportant = stack.at(i).styleAttrPropertiesImportant;
|
styleAttrPropertiesImportant = stack.at(i).styleAttrPropertiesImportant;
|
||||||
nonCssProperties = stack.at (i).nonCssProperties;
|
nonCssProperties = stack.at (i).nonCssProperties;
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
#define __STYLEENGINE_HH__
|
#define __STYLEENGINE_HH__
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
class StyleEngine;
|
class StyleEngine;
|
||||||
|
|
||||||
@ -34,7 +35,7 @@ class StyleEngine;
|
|||||||
class StyleEngine {
|
class StyleEngine {
|
||||||
private:
|
private:
|
||||||
struct Node {
|
struct Node {
|
||||||
CssPropertyList *styleAttrProperties;
|
std::unique_ptr< CssPropertyList >styleAttrProperties;
|
||||||
CssPropertyList *styleAttrPropertiesImportant;
|
CssPropertyList *styleAttrPropertiesImportant;
|
||||||
CssPropertyList *nonCssProperties;
|
CssPropertyList *nonCssProperties;
|
||||||
dw::core::style::Style *style;
|
dw::core::style::Style *style;
|
||||||
|
|||||||
Reference in New Issue
Block a user