Diff
Modified: trunk/Source/WebCore/ChangeLog (101115 => 101116)
--- trunk/Source/WebCore/ChangeLog 2011-11-24 02:31:49 UTC (rev 101115)
+++ trunk/Source/WebCore/ChangeLog 2011-11-24 02:45:02 UTC (rev 101116)
@@ -1,3 +1,35 @@
+2011-11-23 Rafael Weinstein <[email protected]>
+
+ Change CSSMutableStyleDeclaration::m_node to m_element (along with getter/setter)
+ https://bugs.webkit.org/show_bug.cgi?id=73050
+
+ Reviewed by Ojan Vafai.
+
+ No tests needed. This is just a refactor.
+
+ * css/CSSMutableStyleDeclaration.cpp:
+ (WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration):
+ (WebCore::CSSMutableStyleDeclaration::operator=):
+ (WebCore::CSSMutableStyleDeclaration::isInlineStyleDeclaration):
+ (WebCore::CSSMutableStyleDeclaration::setNeedsStyleRecalc):
+ * css/CSSMutableStyleDeclaration.h:
+ (WebCore::CSSMutableStyleDeclaration::setElement):
+ (WebCore::CSSMutableStyleDeclaration::element):
+ * css/CSSStyleRule.cpp:
+ (WebCore::CSSStyleRule::setSelectorText):
+ * dom/StyledElement.cpp:
+ (WebCore::StyledElement::createInlineStyleDecl):
+ (WebCore::StyledElement::destroyInlineStyleDecl):
+ (WebCore::StyledElement::attributeChanged):
+ (WebCore::StyledElement::createMappedDecl):
+ * html/HTMLTableElement.cpp:
+ (WebCore::HTMLTableElement::additionalAttributeStyleDecls):
+ (WebCore::HTMLTableElement::addSharedCellBordersDecl):
+ (WebCore::HTMLTableElement::addSharedCellPaddingDecl):
+ (WebCore::HTMLTableElement::addSharedGroupDecls):
+ * inspector/InspectorCSSAgent.cpp:
+ (WebCore::InspectorCSSAgent::inlineStyleElement):
+
2011-11-23 Ami Fischman <[email protected]>
Teach VideoLayerChromium how to render native texture (to support HW video decode).
Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (101115 => 101116)
--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2011-11-24 02:31:49 UTC (rev 101115)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h 2011-11-24 02:45:02 UTC (rev 101116)
@@ -30,6 +30,7 @@
#include "Document.h"
#include "Element.h"
#include "MediaList.h"
+#include "StyledElement.h"
#include <heap/Weak.h>
#include <runtime/FunctionPrototype.h>
#include <runtime/Lookup.h>
@@ -206,7 +207,7 @@
if (CSSStyleSheet* styleSheet = style->parentStyleSheet())
return root(styleSheet);
if (style->isMutableStyleDeclaration()) {
- if (Node* node = static_cast<CSSMutableStyleDeclaration*>(style)->node())
+ if (Node* node = static_cast<CSSMutableStyleDeclaration*>(style)->element())
return root(node);
}
return style;
Modified: trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp (101115 => 101116)
--- trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp 2011-11-24 02:31:49 UTC (rev 101115)
+++ trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp 2011-11-24 02:45:02 UTC (rev 101116)
@@ -65,15 +65,14 @@
if (!s_currentDecl->isInlineStyleDeclaration())
return;
- s_mutationRecipients = MutationObserverInterestGroup::createForAttributesMutation(s_currentDecl->node(), HTMLNames::styleAttr);
+ s_mutationRecipients = MutationObserverInterestGroup::createForAttributesMutation(s_currentDecl->element(), HTMLNames::styleAttr);
if (s_mutationRecipients->isEmpty()) {
s_mutationRecipients.clear();
return;
}
- Element* element = toElement(s_currentDecl->node());
- AtomicString oldValue = s_mutationRecipients->isOldValueRequested() ? element->getAttribute(HTMLNames::styleAttr) : nullAtom;
- s_mutation = MutationRecord::createAttributes(element, HTMLNames::styleAttr, oldValue);
+ AtomicString oldValue = s_mutationRecipients->isOldValueRequested() ? s_currentDecl->element()->getAttribute(HTMLNames::styleAttr) : nullAtom;
+ s_mutation = MutationRecord::createAttributes(s_currentDecl->element(), HTMLNames::styleAttr, oldValue);
}
~StyleAttributeMutationScope()
@@ -109,7 +108,7 @@
CSSMutableStyleDeclaration::CSSMutableStyleDeclaration()
: CSSStyleDeclaration(0, /* isMutable */ true)
- , m_node(0)
+ , m_element(0)
{
// This constructor is used for various inline style declarations, so disable strict parsing.
m_strictParsing = false;
@@ -117,14 +116,14 @@
CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent)
: CSSStyleDeclaration(parent, /* isMutable */ true)
- , m_node(0)
+ , m_element(0)
{
}
CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const Vector<CSSProperty>& properties)
: CSSStyleDeclaration(parent, /* isMutable */ true)
, m_properties(properties)
- , m_node(0)
+ , m_element(0)
{
m_properties.shrinkToFit();
// FIXME: This allows duplicate properties.
@@ -132,7 +131,7 @@
CSSMutableStyleDeclaration::CSSMutableStyleDeclaration(CSSRule* parent, const CSSProperty* const * properties, int numProperties)
: CSSStyleDeclaration(parent, /* isMutable */ true)
- , m_node(0)
+ , m_element(0)
{
m_properties.reserveInitialCapacity(numProperties);
HashMap<int, bool> candidates;
@@ -157,7 +156,7 @@
CSSMutableStyleDeclaration& CSSMutableStyleDeclaration::operator=(const CSSMutableStyleDeclaration& other)
{
ASSERT(!m_iteratorCount);
- // don't attach it to the same node, just leave the current m_node value
+ // don't attach it to the same element, just leave the current m_element value
m_properties = other.m_properties;
m_strictParsing = other.m_strictParsing;
return *this;
@@ -620,19 +619,19 @@
// FIXME: Ideally, this should be factored better and there
// should be a subclass of CSSMutableStyleDeclaration just
// for inline style declarations that handles this
- return m_node && m_node->isStyledElement() && static_cast<StyledElement*>(m_node)->inlineStyleDecl() == this;
+ return m_element && m_element->inlineStyleDecl() == this;
}
void CSSMutableStyleDeclaration::setNeedsStyleRecalc()
{
- if (m_node) {
+ if (m_element) {
if (isInlineStyleDeclaration()) {
- m_node->setNeedsStyleRecalc(InlineStyleChange);
- static_cast<StyledElement*>(m_node)->invalidateStyleAttribute();
- if (m_node->document())
- InspectorInstrumentation::didInvalidateStyleAttr(m_node->document(), m_node);
+ m_element->setNeedsStyleRecalc(InlineStyleChange);
+ m_element->invalidateStyleAttribute();
+ if (m_element->document())
+ InspectorInstrumentation::didInvalidateStyleAttr(m_element->document(), m_element);
} else
- m_node->setNeedsStyleRecalc(FullStyleChange);
+ m_element->setNeedsStyleRecalc(FullStyleChange);
return;
}
Modified: trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h (101115 => 101116)
--- trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h 2011-11-24 02:31:49 UTC (rev 101115)
+++ trunk/Source/WebCore/css/CSSMutableStyleDeclaration.h 2011-11-24 02:45:02 UTC (rev 101116)
@@ -31,7 +31,7 @@
namespace WebCore {
-class Node;
+class StyledElement;
class CSSMutableStyleDeclarationConstIterator {
public:
@@ -83,9 +83,9 @@
const_iterator begin() { return const_iterator(this, m_properties.begin()); }
const_iterator end() { return const_iterator(this, m_properties.end()); }
- void setNode(Node* node) { m_node = node; }
+ void setElement(StyledElement* element) { m_element = element; }
- Node* node() const { return m_node; }
+ StyledElement* element() const { return m_element; }
virtual String cssText() const;
virtual void setCssText(const String&, ExceptionCode&);
@@ -178,7 +178,7 @@
Vector<CSSProperty, 4> m_properties;
- Node* m_node;
+ StyledElement* m_element;
friend class CSSMutableStyleDeclarationConstIterator;
};
Modified: trunk/Source/WebCore/css/CSSStyleRule.cpp (101115 => 101116)
--- trunk/Source/WebCore/css/CSSStyleRule.cpp 2011-11-24 02:31:49 UTC (rev 101115)
+++ trunk/Source/WebCore/css/CSSStyleRule.cpp 2011-11-24 02:45:02 UTC (rev 101116)
@@ -28,6 +28,7 @@
#include "CSSSelector.h"
#include "CSSStyleSheet.h"
#include "Document.h"
+#include "StyledElement.h"
#include "StyleSheet.h"
namespace WebCore {
@@ -66,7 +67,7 @@
doc = styleSheet->findDocument();
if (!doc)
- doc = m_style->node() ? m_style->node()->document() : 0;
+ doc = m_style->element() ? m_style->element()->document() : 0;
if (!doc)
return;
Modified: trunk/Source/WebCore/dom/StyledElement.cpp (101115 => 101116)
--- trunk/Source/WebCore/dom/StyledElement.cpp 2011-11-24 02:31:49 UTC (rev 101115)
+++ trunk/Source/WebCore/dom/StyledElement.cpp 2011-11-24 02:45:02 UTC (rev 101116)
@@ -131,14 +131,14 @@
{
m_inlineStyleDecl = CSSMutableStyleDeclaration::create();
m_inlineStyleDecl->setParentStyleSheet(document()->elementSheet());
- m_inlineStyleDecl->setNode(this);
+ m_inlineStyleDecl->setElement(this);
m_inlineStyleDecl->setStrictParsing(isHTMLElement() && !document()->inQuirksMode());
}
void StyledElement::destroyInlineStyleDecl()
{
if (m_inlineStyleDecl) {
- m_inlineStyleDecl->setNode(0);
+ m_inlineStyleDecl->setElement(0);
m_inlineStyleDecl->setParentStyleSheet(0);
m_inlineStyleDecl = 0;
}
@@ -196,7 +196,7 @@
setMappedAttributeDecl(entry, attr, attr->decl());
attr->decl()->setMappedState(entry, attr->name(), attr->value());
attr->decl()->setParentStyleSheet(0);
- attr->decl()->setNode(0);
+ attr->decl()->setElement(0);
if (attributeMap())
attributeMap()->declAdded();
}
@@ -406,7 +406,7 @@
RefPtr<CSSMappedAttributeDeclaration> decl = CSSMappedAttributeDeclaration::create();
attr->setDecl(decl);
decl->setParentStyleSheet(document()->elementSheet());
- decl->setNode(this);
+ decl->setElement(this);
decl->setStrictParsing(false); // Mapped attributes are just always quirky.
}
Modified: trunk/Source/WebCore/html/HTMLTableElement.cpp (101115 => 101116)
--- trunk/Source/WebCore/html/HTMLTableElement.cpp 2011-11-24 02:31:49 UTC (rev 101115)
+++ trunk/Source/WebCore/html/HTMLTableElement.cpp 2011-11-24 02:45:02 UTC (rev 101116)
@@ -456,7 +456,7 @@
if (!decl) {
decl = CSSMappedAttributeDeclaration::create().leakRef(); // This single ref pins us in the table until the document dies.
decl->setParentStyleSheet(document()->elementSheet());
- decl->setNode(this);
+ decl->setElement(this);
decl->setStrictParsing(false); // Mapped attributes are just always quirky.
int v = m_borderColorAttr ? CSSValueSolid : CSSValueOutset;
@@ -467,7 +467,7 @@
setMappedAttributeDecl(ePersistent, tableborderAttr, borderValue, decl);
decl->setParentStyleSheet(0);
- decl->setNode(0);
+ decl->setElement(0);
decl->setMappedState(ePersistent, tableborderAttr, borderValue);
}
@@ -514,7 +514,7 @@
if (!decl) {
decl = CSSMappedAttributeDeclaration::create().leakRef(); // This single ref pins us in the table until the document dies.
decl->setParentStyleSheet(document()->elementSheet());
- decl->setNode(this);
+ decl->setElement(this);
decl->setStrictParsing(false); // Mapped attributes are just always quirky.
switch (borders) {
@@ -555,7 +555,7 @@
setMappedAttributeDecl(ePersistent, cellborderAttr, *cellBorderNames[borders], decl);
decl->setParentStyleSheet(0);
- decl->setNode(0);
+ decl->setElement(0);
decl->setMappedState(ePersistent, cellborderAttr, cellborderValue);
}
@@ -573,7 +573,7 @@
if (!m_paddingDecl) {
m_paddingDecl = CSSMappedAttributeDeclaration::create();
m_paddingDecl->setParentStyleSheet(document()->elementSheet());
- m_paddingDecl->setNode(this);
+ m_paddingDecl->setElement(this);
m_paddingDecl->setStrictParsing(false); // Mapped attributes are just always quirky.
m_paddingDecl->setProperty(CSSPropertyPaddingTop, paddingValue, false);
@@ -583,7 +583,7 @@
}
setMappedAttributeDecl(eUniversal, cellpaddingAttr, paddingValue, m_paddingDecl.get());
m_paddingDecl->setParentStyleSheet(0);
- m_paddingDecl->setNode(0);
+ m_paddingDecl->setElement(0);
m_paddingDecl->setMappedState(eUniversal, cellpaddingAttr, paddingValue);
}
@@ -600,7 +600,7 @@
if (!decl) {
decl = CSSMappedAttributeDeclaration::create().leakRef(); // This single ref pins us in the table until the document dies.
decl->setParentStyleSheet(document()->elementSheet());
- decl->setNode(this);
+ decl->setElement(this);
decl->setStrictParsing(false); // Mapped attributes are just always quirky.
if (rows) {
@@ -617,7 +617,7 @@
setMappedAttributeDecl(ePersistent, rulesAttr, rulesValue, decl);
decl->setParentStyleSheet(0);
- decl->setNode(0);
+ decl->setElement(0);
decl->setMappedState(ePersistent, rulesAttr, rulesValue);
}
Modified: trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp (101115 => 101116)
--- trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp 2011-11-24 02:31:49 UTC (rev 101115)
+++ trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp 2011-11-24 02:45:02 UTC (rev 101116)
@@ -447,7 +447,7 @@
CSSMutableStyleDeclaration* mutableStyle = static_cast<CSSMutableStyleDeclaration*>(style);
if (!mutableStyle->isInlineStyleDeclaration())
return 0;
- return static_cast<Element*>(mutableStyle->node());
+ return mutableStyle->element();
}
InspectorStyleSheetForInlineStyle* InspectorCSSAgent::asInspectorStyleSheet(Element* element)