Title: [112699] trunk/Source/WebCore
- Revision
- 112699
- Author
- [email protected]
- Date
- 2012-03-30 11:27:16 -0700 (Fri, 30 Mar 2012)
Log Message
Add a compile assert for the size of CSSProperty
https://bugs.webkit.org/show_bug.cgi?id=82756
Reviewed by Andreas Kling.
Add a compile assert to ensure CSSProperty instances stay small.
Also make member variables of CSSProperty private as they should have been,
and extract wrapValueInCommaSeparatedList from createFontFaceRule.
* css/CSSParser.cpp:
(WebCore::CSSParser::createFontFaceRule):
* css/CSSProperty.cpp:
(SameSizeAsCSSProperty):
(WebCore):
(WebCore::CSSProperty::wrapValueInCommaSeparatedList):
* css/CSSProperty.h:
(CSSProperty):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (112698 => 112699)
--- trunk/Source/WebCore/ChangeLog 2012-03-30 18:24:18 UTC (rev 112698)
+++ trunk/Source/WebCore/ChangeLog 2012-03-30 18:27:16 UTC (rev 112699)
@@ -1,5 +1,26 @@
2012-03-30 Ryosuke Niwa <[email protected]>
+ Add a compile assert for the size of CSSProperty
+ https://bugs.webkit.org/show_bug.cgi?id=82756
+
+ Reviewed by Andreas Kling.
+
+ Add a compile assert to ensure CSSProperty instances stay small.
+
+ Also make member variables of CSSProperty private as they should have been,
+ and extract wrapValueInCommaSeparatedList from createFontFaceRule.
+
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::createFontFaceRule):
+ * css/CSSProperty.cpp:
+ (SameSizeAsCSSProperty):
+ (WebCore):
+ (WebCore::CSSProperty::wrapValueInCommaSeparatedList):
+ * css/CSSProperty.h:
+ (CSSProperty):
+
+2012-03-30 Ryosuke Niwa <[email protected]>
+
Let there be a clean xcodeproj.
* WebCore.xcodeproj/project.pbxproj:
Modified: trunk/Source/WebCore/css/CSSParser.cpp (112698 => 112699)
--- trunk/Source/WebCore/css/CSSParser.cpp 2012-03-30 18:24:18 UTC (rev 112698)
+++ trunk/Source/WebCore/css/CSSParser.cpp 2012-03-30 18:27:16 UTC (rev 112699)
@@ -9086,11 +9086,9 @@
m_allowImportRules = m_allowNamespaceDeclarations = false;
for (unsigned i = 0; i < m_parsedProperties.size(); ++i) {
CSSProperty& property = m_parsedProperties[i];
- if (property.id() == CSSPropertyFontVariant && property.value()->isPrimitiveValue()) {
- RefPtr<CSSValue> value = property.m_value.release();
- property.m_value = CSSValueList::createCommaSeparated();
- static_cast<CSSValueList*>(property.value())->append(value.release());
- } else if (property.id() == CSSPropertyFontFamily && (!property.value()->isValueList() || static_cast<CSSValueList*>(property.value())->length() != 1)) {
+ if (property.id() == CSSPropertyFontVariant && property.value()->isPrimitiveValue())
+ property.wrapValueInCommaSeparatedList();
+ else if (property.id() == CSSPropertyFontFamily && (!property.value()->isValueList() || static_cast<CSSValueList*>(property.value())->length() != 1)) {
// Unlike font-family property, font-family descriptor in @font-face rule
// has to be a value list with exactly one family name. It cannot have a
// have 'initial' value and cannot 'inherit' from parent.
Modified: trunk/Source/WebCore/css/CSSProperty.cpp (112698 => 112699)
--- trunk/Source/WebCore/css/CSSProperty.cpp 2012-03-30 18:24:18 UTC (rev 112698)
+++ trunk/Source/WebCore/css/CSSProperty.cpp 2012-03-30 18:27:16 UTC (rev 112699)
@@ -23,16 +23,31 @@
#include "CSSPropertyLonghand.h"
#include "CSSPropertyNames.h"
+#include "CSSValueList.h"
#include "PlatformString.h"
#include "RenderStyleConstants.h"
namespace WebCore {
+struct SameSizeAsCSSProperty {
+ uint32_t bitfields;
+ void* value;
+};
+
+COMPILE_ASSERT(sizeof(CSSProperty) == sizeof(SameSizeAsCSSProperty), CSSProperty_should_stay_small);
+
String CSSProperty::cssText() const
{
return String(getPropertyName(static_cast<CSSPropertyID>(id()))) + ": " + m_value->cssText() + (isImportant() ? " !important" : "") + "; ";
}
+void CSSProperty::wrapValueInCommaSeparatedList()
+{
+ RefPtr<CSSValue> value = m_value.release();
+ m_value = CSSValueList::createCommaSeparated();
+ static_cast<CSSValueList*>(m_value.get())->append(value.release());
+}
+
enum LogicalBoxSide { BeforeSide, EndSide, AfterSide, StartSide };
enum PhysicalBoxSide { TopSide, RightSide, BottomSide, LeftSide };
Modified: trunk/Source/WebCore/css/CSSProperty.h (112698 => 112699)
--- trunk/Source/WebCore/css/CSSProperty.h 2012-03-30 18:24:18 UTC (rev 112698)
+++ trunk/Source/WebCore/css/CSSProperty.h 2012-03-30 18:27:16 UTC (rev 112699)
@@ -52,15 +52,18 @@
String cssText() const;
+ void wrapValueInCommaSeparatedList();
+
static int resolveDirectionAwareProperty(int propertyID, TextDirection, WritingMode);
static bool isInheritedProperty(unsigned propertyID);
+private:
// Make sure the following fits in 4 bytes. Really.
unsigned m_id : 14;
unsigned m_shorthandID : 14; // If this property was set as part of a shorthand, gives the shorthand.
- bool m_important : 1;
- bool m_implicit : 1; // Whether or not the property was set implicitly as the result of a shorthand.
- bool m_inherited : 1;
+ unsigned m_important : 1;
+ unsigned m_implicit : 1; // Whether or not the property was set implicitly as the result of a shorthand.
+ unsigned m_inherited : 1;
RefPtr<CSSValue> m_value;
};
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes