Changeset 18753 in webkit
- Timestamp:
- Jan 10, 2007 5:46:53 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r18737 r18753 1 2007-01-10 Mitz Pettel <mitz@webkit.org> 2 3 Reviewed by Darin. 4 5 - test for http://bugs.webkit.org/show_bug.cgi?id=9284 6 Quirksmode (CSS1): Removing inline border styles is impossible 7 8 * fast/css/remove-shorthand-expected.txt: Added. 9 * fast/css/remove-shorthand.html: Added. 10 1 11 2007-01-10 Nikolas Zimmermann <zimmermann@kde.org> 2 12 -
trunk/WebCore/ChangeLog
r18752 r18753 1 2007-01-10 Mitz Pettel <mitz@webkit.org> 2 3 Reviewed by Darin. 4 5 - fix http://bugs.webkit.org/show_bug.cgi?id=9284 6 Quirksmode (CSS1): Removing inline border styles is impossible 7 8 Test: fast/css/remove-shorthand.html 9 10 * css/CSSMutableStyleDeclaration.cpp: 11 (WebCore::PropertyLonghand::PropertyLonghand): Added this structure 12 containing a pointer to an array if properties and the array's length. 13 (WebCore::PropertyLonghand::properties): 14 (WebCore::PropertyLonghand::length): 15 (WebCore::initShorthandMap): Initialize the mapping from shorthand 16 properties to their dependent properties. 17 (WebCore::CSSMutableStyleDeclaration::removeProperty): Changed to check 18 if the property being removed is a shorthand, and if so, to remove all 19 of its dependent properties. 20 (WebCore::CSSMutableStyleDeclaration::removePropertiesInSet): Added a 21 'notifyChanged' boolean parameter which controls whether this method 22 calls setChanged() if it actually removes any property. 23 * css/CSSMutableStyleDeclaration.h: 24 1 25 2007-01-10 Steve Falkenburg <sfalken@apple.com> 2 26 -
trunk/WebCore/css/CSSMutableStyleDeclaration.cpp
r18676 r18753 212 212 } 213 213 214 struct PropertyLonghand { 215 PropertyLonghand() 216 : m_properties(0) 217 , m_length(0) 218 { 219 } 220 221 PropertyLonghand(const int* firstProperty, unsigned numProperties) 222 : m_properties(firstProperty) 223 , m_length(numProperties) 224 { 225 } 226 227 const int* properties() const { return m_properties; } 228 unsigned length() const { return m_length; } 229 230 private: 231 const int* m_properties; 232 unsigned m_length; 233 }; 234 235 static void initShorthandMap(HashMap<int, PropertyLonghand>& shorthandMap) 236 { 237 #define SET_SHORTHAND_MAP_ENTRY(map, propID, array) \ 238 map.set(propID, PropertyLonghand(array, sizeof(array) / sizeof(array[0]))) 239 240 // FIXME: The following properties have "shorthand nature" but are not parsed as 241 // shorthands: 'font', '-webkit-border-radius' and 'overflow'. 242 243 // Do not change the order of the following four shorthands, and keep them together. 244 static const int borderProperties[4][3] = { 245 { CSS_PROP_BORDER_TOP_COLOR, CSS_PROP_BORDER_TOP_STYLE, CSS_PROP_BORDER_TOP_WIDTH }, 246 { CSS_PROP_BORDER_RIGHT_COLOR, CSS_PROP_BORDER_RIGHT_STYLE, CSS_PROP_BORDER_RIGHT_WIDTH }, 247 { CSS_PROP_BORDER_BOTTOM_COLOR, CSS_PROP_BORDER_BOTTOM_STYLE, CSS_PROP_BORDER_BOTTOM_WIDTH }, 248 { CSS_PROP_BORDER_LEFT_COLOR, CSS_PROP_BORDER_LEFT_STYLE, CSS_PROP_BORDER_LEFT_WIDTH } 249 }; 250 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP_BORDER_TOP, borderProperties[0]); 251 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP_BORDER_RIGHT, borderProperties[1]); 252 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP_BORDER_BOTTOM, borderProperties[2]); 253 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP_BORDER_LEFT, borderProperties[3]); 254 255 shorthandMap.set(CSS_PROP_BORDER, PropertyLonghand(borderProperties[0], sizeof(borderProperties) / sizeof(borderProperties[0][0]))); 256 257 static const int borderColorProperties[] = { 258 CSS_PROP_BORDER_TOP_COLOR, 259 CSS_PROP_BORDER_RIGHT_COLOR, 260 CSS_PROP_BORDER_BOTTOM_COLOR, 261 CSS_PROP_BORDER_LEFT_COLOR 262 }; 263 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP_BORDER_COLOR, borderColorProperties); 264 265 static const int borderStyleProperties[] = { 266 CSS_PROP_BORDER_TOP_STYLE, 267 CSS_PROP_BORDER_RIGHT_STYLE, 268 CSS_PROP_BORDER_BOTTOM_STYLE, 269 CSS_PROP_BORDER_LEFT_STYLE 270 }; 271 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP_BORDER_STYLE, borderStyleProperties); 272 273 static const int borderWidthProperties[] = { 274 CSS_PROP_BORDER_TOP_WIDTH, 275 CSS_PROP_BORDER_RIGHT_WIDTH, 276 CSS_PROP_BORDER_BOTTOM_WIDTH, 277 CSS_PROP_BORDER_LEFT_WIDTH 278 }; 279 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP_BORDER_WIDTH, borderWidthProperties); 280 281 static const int backgroundPositionProperties[] = { CSS_PROP_BACKGROUND_POSITION_X, CSS_PROP_BACKGROUND_POSITION_Y }; 282 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP_BACKGROUND_POSITION, backgroundPositionProperties); 283 284 static const int borderSpacingProperties[] = { CSS_PROP__WEBKIT_BORDER_HORIZONTAL_SPACING, CSS_PROP__WEBKIT_BORDER_VERTICAL_SPACING }; 285 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP_BORDER_SPACING, borderSpacingProperties); 286 287 static const int listStyleProperties[] = { 288 CSS_PROP_LIST_STYLE_IMAGE, 289 CSS_PROP_LIST_STYLE_POSITION, 290 CSS_PROP_LIST_STYLE_TYPE 291 }; 292 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP_LIST_STYLE, listStyleProperties); 293 294 static const int marginProperties[] = { 295 CSS_PROP_MARGIN_TOP, 296 CSS_PROP_MARGIN_RIGHT, 297 CSS_PROP_MARGIN_BOTTOM, 298 CSS_PROP_MARGIN_LEFT 299 }; 300 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP_MARGIN, marginProperties); 301 302 static const int marginCollapseProperties[] = { CSS_PROP__WEBKIT_MARGIN_TOP_COLLAPSE, CSS_PROP__WEBKIT_MARGIN_BOTTOM_COLLAPSE }; 303 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP__WEBKIT_MARGIN_COLLAPSE, marginCollapseProperties); 304 305 static const int marqueeProperties[] = { 306 CSS_PROP__WEBKIT_MARQUEE_DIRECTION, 307 CSS_PROP__WEBKIT_MARQUEE_INCREMENT, 308 CSS_PROP__WEBKIT_MARQUEE_REPETITION, 309 CSS_PROP__WEBKIT_MARQUEE_STYLE, 310 CSS_PROP__WEBKIT_MARQUEE_SPEED 311 }; 312 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP__WEBKIT_MARQUEE, marqueeProperties); 313 314 static const int outlineProperties[] = { 315 CSS_PROP_OUTLINE_COLOR, 316 CSS_PROP_OUTLINE_OFFSET, 317 CSS_PROP_OUTLINE_STYLE, 318 CSS_PROP_OUTLINE_WIDTH 319 }; 320 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP_OUTLINE, outlineProperties); 321 322 static const int paddingProperties[] = { 323 CSS_PROP_PADDING_TOP, 324 CSS_PROP_PADDING_RIGHT, 325 CSS_PROP_PADDING_BOTTOM, 326 CSS_PROP_PADDING_LEFT 327 }; 328 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP_PADDING, paddingProperties); 329 330 static const int textStrokeProperties[] = { CSS_PROP__WEBKIT_TEXT_STROKE_COLOR, CSS_PROP__WEBKIT_TEXT_STROKE_WIDTH }; 331 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP__WEBKIT_TEXT_STROKE, textStrokeProperties); 332 333 static const int backgroundProperties[] = { 334 CSS_PROP_BACKGROUND_ATTACHMENT, 335 CSS_PROP_BACKGROUND_COLOR, 336 CSS_PROP_BACKGROUND_IMAGE, 337 CSS_PROP_BACKGROUND_POSITION_X, 338 CSS_PROP_BACKGROUND_POSITION_Y, 339 CSS_PROP_BACKGROUND_REPEAT, 340 CSS_PROP__WEBKIT_BACKGROUND_SIZE 341 }; 342 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP_BACKGROUND, backgroundProperties); 343 344 static const int columnsProperties[] = { CSS_PROP__WEBKIT_COLUMN_WIDTH, CSS_PROP__WEBKIT_COLUMN_COUNT }; 345 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP__WEBKIT_COLUMNS, columnsProperties); 346 347 static const int columnRuleProperties[] = { 348 CSS_PROP__WEBKIT_COLUMN_RULE_COLOR, 349 CSS_PROP__WEBKIT_COLUMN_RULE_STYLE, 350 CSS_PROP__WEBKIT_COLUMN_RULE_WIDTH 351 }; 352 SET_SHORTHAND_MAP_ENTRY(shorthandMap, CSS_PROP__WEBKIT_COLUMN_RULE, columnRuleProperties); 353 354 #undef SET_SHORTHAND_MAP_ENTRY 355 } 356 214 357 String CSSMutableStyleDeclaration::removeProperty(int propertyID, bool notifyChanged, ExceptionCode& ec) 215 358 { 216 359 ec = 0; 360 361 static HashMap<int, PropertyLonghand> shorthandMap; 362 if (shorthandMap.isEmpty()) 363 initShorthandMap(shorthandMap); 364 365 PropertyLonghand longhand = shorthandMap.get(propertyID); 366 if (longhand.length()) { 367 removePropertiesInSet(longhand.properties(), longhand.length(), notifyChanged); 368 // FIXME: Return an equivalent shorthand when possible. 369 return String(); 370 } 217 371 218 372 String value; … … 451 605 } 452 606 453 void CSSMutableStyleDeclaration::removePropertiesInSet(const int *set, unsigned length )607 void CSSMutableStyleDeclaration::removePropertiesInSet(const int *set, unsigned length, bool notifyChanged) 454 608 { 455 609 bool changed = false; … … 461 615 } 462 616 } 463 if (changed )617 if (changed && notifyChanged) 464 618 setChanged(); 465 619 } -
trunk/WebCore/css/CSSMutableStyleDeclaration.h
r18676 r18753 93 93 PassRefPtr<CSSMutableStyleDeclaration> copyBlockProperties() const; 94 94 void removeBlockProperties(); 95 void removePropertiesInSet(const int* set, unsigned length );95 void removePropertiesInSet(const int* set, unsigned length, bool notifyChanged = true); 96 96 97 97 void merge(CSSMutableStyleDeclaration*, bool argOverridesOnConflict = true);
Note: See TracChangeset
for help on using the changeset viewer.