Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: Source/core/css/StylePropertySet.cpp

Issue 1183023003: Move (copy/remove)BlockProperties out of MutableStylePropertySet (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved. 4 * Copyright (C) 2011 Research In Motion Limited. All rights reserved.
5 * Copyright (C) 2013 Intel Corporation. All rights reserved. 5 * Copyright (C) 2013 Intel Corporation. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 bool StylePropertySet::hasFailedOrCanceledSubresources() const 341 bool StylePropertySet::hasFailedOrCanceledSubresources() const
342 { 342 {
343 unsigned size = propertyCount(); 343 unsigned size = propertyCount();
344 for (unsigned i = 0; i < size; ++i) { 344 for (unsigned i = 0; i < size; ++i) {
345 if (propertyAt(i).value()->hasFailedOrCanceledSubresources()) 345 if (propertyAt(i).value()->hasFailedOrCanceledSubresources())
346 return true; 346 return true;
347 } 347 }
348 return false; 348 return false;
349 } 349 }
350 350
351 // This is the list of properties we want to copy in the copyBlockProperties() f unction.
352 // It is the list of CSS properties that apply specially to block-level elements .
353 static const CSSPropertyID staticBlockProperties[] = {
354 CSSPropertyOrphans,
355 CSSPropertyOverflow, // This can be also be applied to replaced elements
356 CSSPropertyWebkitColumnCount,
357 CSSPropertyWebkitColumnGap,
358 CSSPropertyWebkitColumnRuleColor,
359 CSSPropertyWebkitColumnRuleStyle,
360 CSSPropertyWebkitColumnRuleWidth,
361 CSSPropertyWebkitColumnBreakBefore,
362 CSSPropertyWebkitColumnBreakAfter,
363 CSSPropertyWebkitColumnBreakInside,
364 CSSPropertyWebkitColumnWidth,
365 CSSPropertyPageBreakAfter,
366 CSSPropertyPageBreakBefore,
367 CSSPropertyPageBreakInside,
368 CSSPropertyTextAlign,
369 CSSPropertyTextAlignLast,
370 CSSPropertyTextIndent,
371 CSSPropertyTextJustify,
372 CSSPropertyWidows
373 };
374
375 static const Vector<CSSPropertyID>& blockProperties()
376 {
377 DEFINE_STATIC_LOCAL(Vector<CSSPropertyID>, properties, ());
378 if (properties.isEmpty())
379 CSSPropertyMetadata::filterEnabledCSSPropertiesIntoVector(staticBlockPro perties, WTF_ARRAY_LENGTH(staticBlockProperties), properties);
380 return properties;
381 }
382
383 void MutableStylePropertySet::clear() 351 void MutableStylePropertySet::clear()
384 { 352 {
385 m_propertyVector.clear(); 353 m_propertyVector.clear();
386 } 354 }
387 355
388 PassRefPtrWillBeRawPtr<MutableStylePropertySet> StylePropertySet::copyBlockPrope rties() const
389 {
390 return copyPropertiesInSet(blockProperties());
391 }
392
393 void MutableStylePropertySet::removeBlockProperties()
394 {
395 removePropertiesInSet(blockProperties().data(), blockProperties().size());
396 }
397
398 inline bool containsId(const CSSPropertyID* set, unsigned length, CSSPropertyID id) 356 inline bool containsId(const CSSPropertyID* set, unsigned length, CSSPropertyID id)
399 { 357 {
400 for (unsigned i = 0; i < length; ++i) { 358 for (unsigned i = 0; i < length; ++i) {
401 if (set[i] == id) 359 if (set[i] == id)
402 return true; 360 return true;
403 } 361 }
404 return false; 362 return false;
405 } 363 }
406 364
407 bool MutableStylePropertySet::removePropertiesInSet(const CSSPropertyID* set, un signed length) 365 bool MutableStylePropertySet::removePropertiesInSet(const CSSPropertyID* set, un signed length)
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 { 513 {
556 return adoptRefWillBeNoop(new MutableStylePropertySet(cssParserMode)); 514 return adoptRefWillBeNoop(new MutableStylePropertySet(cssParserMode));
557 } 515 }
558 516
559 PassRefPtrWillBeRawPtr<MutableStylePropertySet> MutableStylePropertySet::create( const CSSProperty* properties, unsigned count) 517 PassRefPtrWillBeRawPtr<MutableStylePropertySet> MutableStylePropertySet::create( const CSSProperty* properties, unsigned count)
560 { 518 {
561 return adoptRefWillBeNoop(new MutableStylePropertySet(properties, count)); 519 return adoptRefWillBeNoop(new MutableStylePropertySet(properties, count));
562 } 520 }
563 521
564 } // namespace blink 522 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698