Changeset 16721 in webkit
- Timestamp:
- Oct 2, 2006 4:15:31 PM (18 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 7 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r16718 r16721 1 2006-10-02 Beth Dakin <bdakin@apple.com> 2 3 Reviewed by Darin. 4 5 Initial implementation of CSS2 counters. See http:// 6 bugs.webkit.org/show_bug.cgi?id=4980 for more details. 7 8 * WebCore.xcodeproj/project.pbxproj: 9 * css/CSSComputedStyleDeclaration.cpp: 10 (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Return 11 the increment/reset list now that this is implemented. 12 * css/CSSPrimitiveValue.cpp: 13 (WebCore::CSSPrimitiveValue::cssText): 14 * css/Counter.h: 15 (WebCore::Counter::Counter): 16 (WebCore::Counter::~Counter): 17 (WebCore::Counter::identifier): 18 (WebCore::Counter::listStyle): 19 (WebCore::Counter::separator): 20 (WebCore::Counter::listStyleNumber): 21 (WebCore::Counter::setIdentifier): 22 (WebCore::Counter::setListStyle): 23 (WebCore::Counter::setSeparator): 24 * css/cssparser.cpp: 25 (WebCore::CSSParser::addProperty): Take care of reset/increment 26 (WebCore::CSSParser::parseValue): 27 (WebCore::CSSParser::parseContent): content can now take counters 28 (WebCore::CSSParser::parseCounterContent): Parse counter() and 29 counters() 30 (WebCore::CSSParser::parseCounter): Parse counter-reset and 31 counter-increment 32 * css/cssparser.h: 33 * css/cssstyleselector.cpp: 34 (WebCore::CSSStyleSelector::matchUARules): 35 (WebCore::CSSStyleSelector::applyProperty): 36 * platform/PlatformString.h: 37 * platform/String.cpp: 38 (WebCore::String::insert): Implemented a version of insert that 39 accepts a UChar* and a length. 40 * platform/StringImpl.cpp: 41 (WebCore::StringImpl::insert): Same as above. 42 * platform/StringImpl.h: 43 * rendering/CounterListItem.h: Added. 44 * rendering/CounterNode.cpp: Added. 45 (WebCore::CounterNode::CounterNode): 46 (WebCore::CounterNode::insertAfter): 47 (WebCore::CounterNode::removeChild): 48 (WebCore::CounterNode::remove): 49 (WebCore::CounterNode::setUsesSeparator): 50 (WebCore::CounterNode::recountAndGetNext): 51 (WebCore::CounterNode::recountTree): 52 (WebCore::CounterNode::setSelfDirty): 53 (WebCore::CounterNode::setParentDirty): 54 * rendering/CounterNode.h: Added. 55 (WebCore::CounterNode::~CounterNode): 56 (WebCore::CounterNode::parent): 57 (WebCore::CounterNode::previousSibling): 58 (WebCore::CounterNode::nextSibling): 59 (WebCore::CounterNode::firstChild): 60 (WebCore::CounterNode::lastChild): 61 (WebCore::CounterNode::value): 62 (WebCore::CounterNode::setValue): 63 (WebCore::CounterNode::count): 64 (WebCore::CounterNode::setCount): 65 (WebCore::CounterNode::setHasSeparator): 66 (WebCore::CounterNode::isReset): 67 (WebCore::CounterNode::hasSeparator): 68 (WebCore::CounterNode::willNeedLayout): 69 (WebCore::CounterNode::setWillNeedLayout): 70 (WebCore::CounterNode::isRoot): 71 (WebCore::CounterNode::setRenderer): 72 (WebCore::CounterNode::renderer): 73 * rendering/CounterResetNode.cpp: Added. 74 (WebCore::CounterResetNode::CounterResetNode): 75 (WebCore::CounterResetNode::insertAfter): 76 (WebCore::CounterResetNode::removeChild): 77 (WebCore::CounterResetNode::recountAndGetNext): 78 (WebCore::CounterResetNode::setParentDirty): 79 (WebCore::CounterResetNode::updateTotal): 80 * rendering/CounterResetNode.h: Added. 81 (WebCore::CounterResetNode::firstChild): 82 (WebCore::CounterResetNode::lastChild): 83 (WebCore::CounterResetNode::isReset): 84 (WebCore::CounterResetNode::total): 85 * rendering/RenderContainer.cpp: 86 (WebCore::RenderContainer::updatePseudoChildForObject): Account for 87 counter content. 88 * rendering/RenderCounter.cpp: Added. 89 (WebCore::RenderCounter::RenderCounter): 90 (WebCore::RenderCounter::layout): 91 (WebCore::toRoman): 92 (WebCore::toLetterString): 93 (WebCore::toHebrew): 94 (WebCore::RenderCounter::convertValueToType): 95 (WebCore::RenderCounter::calcMinMaxWidth): 96 * rendering/RenderCounter.h: Added. 97 (WebCore::RenderCounter::renderName): 98 (WebCore::RenderCounter::isCounter): 99 * rendering/RenderObject.cpp: 100 (WebCore::getRenderObjectsToCounterNodeMaps): Maps RenderObjects to 101 maps of CounterNodes 102 (WebCore::RenderObject::RenderObject): 103 (WebCore::RenderObject::destroy): Destroy the maps. 104 (WebCore::RenderObject::findCounter): Finds/creates counters. 105 * rendering/RenderObject.h: 106 (WebCore::RenderObject::isCounter): 107 * rendering/RenderStyle.cpp: 108 (WebCore::StyleVisualData::StyleVisualData): 109 (WebCore::RenderStyle::arenaDelete): 110 (WebCore::RenderStyle::RenderStyle): 111 (WebCore::RenderStyle::diff): 112 (WebCore::RenderStyle::setContent): 113 (WebCore::ContentData::clearContent): 114 (WebCore::RenderStyle::counterDataEquivalent): 115 (WebCore::hasCounter): 116 (WebCore::RenderStyle::hasCounterReset): 117 (WebCore::RenderStyle::hasCounterIncrement): 118 (WebCore::readCounter): 119 (WebCore::RenderStyle::counterReset): 120 (WebCore::RenderStyle::counterIncrement): 121 * rendering/RenderStyle.h: 122 (WebCore::StyleVisualData::operator==): 123 (WebCore::CounterData::CounterData): 124 (WebCore::CounterData::identifier): 125 (WebCore::CounterData::listStyle): 126 (WebCore::CounterData::separator): 127 (WebCore::ContentData::contentCounter): 128 (WebCore::ContentData::): 129 (WebCore::RenderStyle::counterIncrement): 130 (WebCore::RenderStyle::counterReset): 131 (WebCore::RenderStyle::setCounterIncrement): 132 (WebCore::RenderStyle::setCounterReset): 133 (WebCore::RenderStyle::setCounterResetList): 134 (WebCore::RenderStyle::setCounterIncrementList): 135 (WebCore::RenderStyle::counterResetValueList): 136 (WebCore::RenderStyle::counterIncrementValueList): 137 1 138 2006-10-02 Adele Peterson <adele@apple.com> 2 139 -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r16691 r16721 1089 1089 938E683C09F0BD7B008A48EC /* GraphicsTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 938E683B09F0BD7A008A48EC /* GraphicsTypes.h */; }; 1090 1090 938E685409F0BE04008A48EC /* GraphicsTypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 938E685309F0BE04008A48EC /* GraphicsTypes.cpp */; }; 1091 9392F1420AD185F400691BD4 /* RenderCounter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9392F1410AD185F400691BD4 /* RenderCounter.h */; }; 1092 9392F1440AD185FE00691BD4 /* RenderCounter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9392F1430AD185FE00691BD4 /* RenderCounter.cpp */; }; 1093 9392F1460AD1860C00691BD4 /* CounterResetNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 9392F1450AD1860C00691BD4 /* CounterResetNode.h */; }; 1094 9392F14A0AD1861300691BD4 /* CounterResetNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9392F1490AD1861300691BD4 /* CounterResetNode.cpp */; }; 1095 9392F14C0AD1861B00691BD4 /* CounterNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 9392F14B0AD1861B00691BD4 /* CounterNode.h */; }; 1096 9392F1500AD1862300691BD4 /* CounterNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9392F14F0AD1862300691BD4 /* CounterNode.cpp */; }; 1097 9392F1520AD1862B00691BD4 /* CounterListItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 9392F1510AD1862B00691BD4 /* CounterListItem.h */; }; 1091 1098 939885C308B7E3D100E707C4 /* EventNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 939885C108B7E3D100E707C4 /* EventNames.cpp */; }; 1092 1099 939885C408B7E3D100E707C4 /* EventNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 939885C208B7E3D100E707C4 /* EventNames.h */; }; … … 3637 3644 938E683B09F0BD7A008A48EC /* GraphicsTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsTypes.h; sourceTree = "<group>"; }; 3638 3645 938E685309F0BE04008A48EC /* GraphicsTypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsTypes.cpp; sourceTree = "<group>"; }; 3646 9392F1410AD185F400691BD4 /* RenderCounter.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderCounter.h; sourceTree = "<group>"; }; 3647 9392F1430AD185FE00691BD4 /* RenderCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderCounter.cpp; sourceTree = "<group>"; }; 3648 9392F1450AD1860C00691BD4 /* CounterResetNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CounterResetNode.h; sourceTree = "<group>"; }; 3649 9392F1490AD1861300691BD4 /* CounterResetNode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CounterResetNode.cpp; sourceTree = "<group>"; }; 3650 9392F14B0AD1861B00691BD4 /* CounterNode.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CounterNode.h; sourceTree = "<group>"; }; 3651 9392F14F0AD1862300691BD4 /* CounterNode.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = CounterNode.cpp; sourceTree = "<group>"; }; 3652 9392F1510AD1862B00691BD4 /* CounterListItem.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CounterListItem.h; sourceTree = "<group>"; }; 3639 3653 9394E0A403AA5BBE008635CE /* WebCorePageState.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCorePageState.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 3640 3654 9394E0A503AA5BBE008635CE /* WebCorePageState.mm */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCorePageState.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; … … 7854 7868 BCEA4815097D93020094C9E4 /* break_lines.cpp */, 7855 7869 BCEA4816097D93020094C9E4 /* break_lines.h */, 7870 9392F1510AD1862B00691BD4 /* CounterListItem.h */, 7871 9392F14F0AD1862300691BD4 /* CounterNode.cpp */, 7872 9392F14B0AD1861B00691BD4 /* CounterNode.h */, 7873 9392F1490AD1861300691BD4 /* CounterResetNode.cpp */, 7874 9392F1450AD1860C00691BD4 /* CounterResetNode.h */, 7856 7875 BCEA4817097D93020094C9E4 /* DataRef.h */, 7857 7876 ABE7B5210A489F830031881C /* DeprecatedRenderSelect.cpp */, … … 7890 7909 BCEA482C097D93020094C9E4 /* RenderContainer.cpp */, 7891 7910 BCEA482D097D93020094C9E4 /* RenderContainer.h */, 7911 9392F1430AD185FE00691BD4 /* RenderCounter.cpp */, 7912 9392F1410AD185F400691BD4 /* RenderCounter.h */, 7892 7913 A8EA73AF0A1900E300A8EF5F /* RenderFieldset.cpp */, 7893 7914 A8EA73B00A1900E300A8EF5F /* RenderFieldset.h */, … … 9320 9341 85004DA70ACEEB5A00C438F6 /* DOMSVGEllipseElementInternal.h in Headers */, 9321 9342 ABB5419F0ACDDFE4002820EB /* RenderListBox.h in Headers */, 9343 9392F1420AD185F400691BD4 /* RenderCounter.h in Headers */, 9344 9392F1460AD1860C00691BD4 /* CounterResetNode.h in Headers */, 9345 9392F14C0AD1861B00691BD4 /* CounterNode.h in Headers */, 9346 9392F1520AD1862B00691BD4 /* CounterListItem.h in Headers */, 9322 9347 ); 9323 9348 runOnlyForDeploymentPostprocessing = 0; … … 10447 10472 85004D9B0ACEEAEF00C438F6 /* DOMSVGEllipseElement.mm in Sources */, 10448 10473 ABB5419E0ACDDFE4002820EB /* RenderListBox.cpp in Sources */, 10474 9392F1440AD185FE00691BD4 /* RenderCounter.cpp in Sources */, 10475 9392F14A0AD1861300691BD4 /* CounterResetNode.cpp in Sources */, 10476 9392F1500AD1862300691BD4 /* CounterNode.cpp in Sources */, 10449 10477 ); 10450 10478 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/css/CSSComputedStyleDeclaration.cpp
r16549 r16721 603 603 break; 604 604 case CSS_PROP_COUNTER_INCREMENT: 605 // FIXME: unimplemented 606 break; 605 return style->counterIncrementValueList(); 607 606 case CSS_PROP_COUNTER_RESET: 608 // FIXME: unimplemented 609 break; 607 return style->counterResetValueList(); 610 608 case CSS_PROP_CURSOR: { 611 609 CSSValueList* list = 0; -
trunk/WebCore/css/CSSPrimitiveValue.cpp
r16275 r16721 525 525 break; 526 526 case CSS_COUNTER: 527 // ### 527 text = "counter("; 528 text += String::number(m_value.num); 529 text += ")"; 530 // FIXME: Add list-style and separator 528 531 break; 529 532 case CSS_RECT: { -
trunk/WebCore/css/Counter.h
r14407 r16721 24 24 #define Counter_H 25 25 26 #include "CSSPrimitiveValue.h" 27 #include "PlatformString.h" 26 28 #include "Shared.h" 27 #include "PlatformString.h"29 #include <wtf/PassRefPtr.h> 28 30 29 31 namespace WebCore { … … 31 33 class Counter : public Shared<Counter> { 32 34 public: 33 String identifier() const { return m_identifier; } 34 String listStyle() const { return m_listStyle; } 35 String separator() const { return m_separator; } 35 Counter() : m_identifier(0), m_listStyle(0), m_separator(0) { } 36 Counter(PassRefPtr<CSSPrimitiveValue> identifier, PassRefPtr<CSSPrimitiveValue> listStyle, 37 PassRefPtr<CSSPrimitiveValue> separator) 38 : m_identifier(identifier), m_listStyle(listStyle), m_separator(separator) { } 39 ~Counter() { } 36 40 37 private: 38 String m_identifier; 39 String m_listStyle; 40 String m_separator; 41 }; 41 String identifier() const { return m_identifier ? m_identifier->getStringValue() : String(); } 42 String listStyle() const { return m_listStyle ? m_listStyle->getStringValue() : String(); } 43 String separator() const { return m_separator ? m_separator->getStringValue() : String(); } 42 44 43 } // namespace 45 int listStyleNumber() const { return m_listStyle ? (int) m_listStyle->getFloatValue() : 0; } 46 47 void setIdentifier(PassRefPtr<CSSPrimitiveValue> identifier) { m_identifier = identifier; } 48 void setListStyle(PassRefPtr<CSSPrimitiveValue> listStyle) { m_listStyle = listStyle; } 49 void setSeparator(PassRefPtr<CSSPrimitiveValue> separator) { m_separator = separator; } 50 51 protected: 52 RefPtr<CSSPrimitiveValue> m_identifier; // String 53 RefPtr<CSSPrimitiveValue> m_listStyle; // int 54 RefPtr<CSSPrimitiveValue> m_separator; // String 55 }; 56 57 } //namespace 44 58 45 59 #endif -
trunk/WebCore/css/cssparser.cpp
r16571 r16721 44 44 #include "CSSValueKeywords.h" 45 45 #include "CSSValueList.h" 46 #include "Counter.h" 46 47 #include "DashboardRegion.h" 47 48 #include "Document.h" … … 336 337 337 338 338 void CSSParser::addProperty(int propId, CSSValue *value, bool important)339 void CSSParser::addProperty(int propId, PassRefPtr<CSSValue> value, bool important) 339 340 { 340 341 CSSProperty *prop = new CSSProperty(propId, value, important, m_currentShorthand, m_implicitShorthand); … … 914 915 valid_primitive = (!id && validUnit(value, FNumber|FLength|FPercent, strict)); 915 916 break; 917 case CSS_PROP_COUNTER_INCREMENT: // [ <identifier> <integer>? ]+ | none | inherit 918 if (id != CSS_VAL_NONE) 919 return parseCounter(propId, 1, important); 920 valid_primitive = true; 921 break; 922 case CSS_PROP_COUNTER_RESET: // [ <identifier> <integer>? ]+ | none | inherit 923 if (id != CSS_VAL_NONE) 924 return parseCounter(propId, 0, important); 925 valid_primitive = true; 926 break; 916 927 case CSS_PROP_FONT_FAMILY: 917 928 // [[ <family-name> | <generic-family> ],]* [<family-name> | <generic-family>] | inherit … … 1567 1578 bool CSSParser::parseContent(int propId, bool important) 1568 1579 { 1569 CSSValueList*values = new CSSValueList;1580 RefPtr<CSSValueList> values = new CSSValueList; 1570 1581 1571 1582 while (Value* val = valueList->current()) { 1572 CSSValue* parsedValue = 0;1583 RefPtr<CSSValue> parsedValue; 1573 1584 if (val->unit == CSSPrimitiveValue::CSS_URI) { 1574 1585 // url … … 1577 1588 String(KURL(styleElement->baseURL().deprecatedString(), value.deprecatedString()).url()), styleElement); 1578 1589 } else if (val->unit == Value::Function) { 1579 // attr(X) 1590 // attr(X) | counter(X [,Y]) | counters(X, Y, [,Z]) 1580 1591 ValueList *args = val->function->args; 1581 1592 String fname = domString(val->function->name).lower(); 1582 if ( fname != "attr(" ||!args)1593 if (!args) 1583 1594 return false; 1584 if (args->size() != 1) 1595 if (fname == "attr(") { 1596 if (args->size() != 1) 1597 return false; 1598 Value* a = args->current(); 1599 String attrName = domString(a->string); 1600 if (document()->isHTMLDocument()) 1601 attrName = attrName.lower(); 1602 parsedValue = new CSSPrimitiveValue(attrName, CSSPrimitiveValue::CSS_ATTR); 1603 } else if (fname == "counter(") { 1604 parsedValue = parseCounterContent(args, false); 1605 if (!parsedValue) return false; 1606 } else if (fname == "counters(") { 1607 parsedValue = parseCounterContent(args, true); 1608 if (!parsedValue) 1609 return false; 1610 } else 1585 1611 return false; 1586 Value *a = args->current();1587 String attrName = domString(a->string);1588 if (document()->isHTMLDocument())1589 attrName = attrName.lower();1590 parsedValue = new CSSPrimitiveValue(attrName, CSSPrimitiveValue::CSS_ATTR);1591 1612 } else if (val->unit == CSSPrimitiveValue::CSS_IDENT) { 1592 1613 // open-quote … … 1600 1621 if (!parsedValue) 1601 1622 break; 1602 values->append(parsedValue );1623 values->append(parsedValue.release()); 1603 1624 valueList->next(); 1604 1625 } 1605 1626 1606 1627 if (values->length()) { 1607 addProperty(propId, values , important);1628 addProperty(propId, values.release(), important); 1608 1629 valueList->next(); 1609 1630 return true; 1610 1631 } 1611 1632 1612 delete values;1613 1633 return false; 1614 1634 } … … 2022 2042 #endif 2023 2043 2044 PassRefPtr<CSSValue> CSSParser::parseCounterContent(ValueList* args, bool counters) 2045 { 2046 unsigned numArgs = args->size(); 2047 if (counters && numArgs != 3 && numArgs != 5) 2048 return 0; 2049 if (!counters && numArgs != 1 && numArgs != 3) 2050 return 0; 2051 2052 Value* i = args->current(); 2053 RefPtr<CSSPrimitiveValue> identifier = new CSSPrimitiveValue(domString(i->string), 2054 CSSPrimitiveValue::CSS_STRING); 2055 2056 RefPtr<CSSPrimitiveValue> separator; 2057 if (!counters) 2058 separator = new CSSPrimitiveValue(String(), CSSPrimitiveValue::CSS_STRING); 2059 else { 2060 i = args->next(); 2061 if (i->unit != Value::Operator || i->iValue != ',') 2062 return 0; 2063 2064 i = args->next(); 2065 if (i->unit != CSSPrimitiveValue::CSS_STRING) 2066 return 0; 2067 2068 separator = new CSSPrimitiveValue(domString(i->string), (CSSPrimitiveValue::UnitTypes) i->unit); 2069 } 2070 2071 RefPtr<CSSPrimitiveValue> listStyle; 2072 i = args->next(); 2073 if (!i) // Make the list style default decimal 2074 listStyle = new CSSPrimitiveValue(CSS_VAL_DECIMAL - CSS_VAL_DISC, CSSPrimitiveValue::CSS_NUMBER); 2075 else { 2076 if (i->unit != Value::Operator || i->iValue != ',') 2077 return 0; 2078 2079 i = args->next(); 2080 if (i->unit != CSSPrimitiveValue::CSS_IDENT) 2081 return 0; 2082 2083 short ls = 0; 2084 if (i->id == CSS_VAL_NONE) 2085 ls = CSS_VAL_KATAKANA_IROHA - CSS_VAL_DISC + 1; 2086 else if (i->id >= CSS_VAL_DISC && i->id <= CSS_VAL_KATAKANA_IROHA) 2087 ls = i->id - CSS_VAL_DISC; 2088 else 2089 return 0; 2090 2091 listStyle = new CSSPrimitiveValue(ls, (CSSPrimitiveValue::UnitTypes) i->unit); 2092 } 2093 2094 return new CSSPrimitiveValue(new Counter(identifier.release(), listStyle.release(), separator.release())); 2095 } 2096 2024 2097 bool CSSParser::parseShape(int propId, bool important) 2025 2098 { … … 2720 2793 } 2721 2794 2795 bool CSSParser::parseCounter(int propId, int defaultValue, bool important) 2796 { 2797 enum { ID, VAL } state = ID; 2798 2799 RefPtr<CSSValueList> list = new CSSValueList; 2800 RefPtr<CSSPrimitiveValue> counterName; 2801 2802 while (true) { 2803 Value* val = valueList->current(); 2804 switch (state) { 2805 case ID: 2806 if (val && val->unit == CSSPrimitiveValue::CSS_IDENT) { 2807 counterName = new CSSPrimitiveValue(domString(val->string), CSSPrimitiveValue::CSS_STRING); 2808 state = VAL; 2809 valueList->next(); 2810 continue; 2811 } 2812 break; 2813 case VAL: { 2814 int i = defaultValue; 2815 if (val && val->unit == CSSPrimitiveValue::CSS_NUMBER) { 2816 i = (int)val->fValue; 2817 valueList->next(); 2818 } 2819 2820 list->append(new CSSPrimitiveValue(new Pair(counterName.release(), 2821 new CSSPrimitiveValue(i, CSSPrimitiveValue::CSS_NUMBER)))); 2822 state = ID; 2823 continue; 2824 } 2825 } 2826 break; 2827 } 2828 2829 if (list->length() > 0) { 2830 addProperty(propId, list.release(), important); 2831 return true; 2832 } 2833 2834 return false; 2835 } 2836 2722 2837 #ifdef CSS_DEBUG 2723 2838 -
trunk/WebCore/css/cssparser.h
r16217 r16721 121 121 Document* document() const; 122 122 123 void addProperty(int propId, CSSValue*, bool important);123 void addProperty(int propId, PassRefPtr<CSSValue>, bool important); 124 124 void rollbackLastProperties(int num); 125 125 bool hasProperties() const { return numParsedProperties > 0; } … … 147 147 bool parseShape(int propId, bool important); 148 148 bool parseFont(bool important); 149 bool parseCounter(int propId, int defaultValue, bool important); 149 150 CSSValueList* parseFontFamily(); 150 151 bool parseColorParameters(Value*, int* colorValues, bool parseAlpha); … … 152 153 CSSPrimitiveValue* parseColor(); 153 154 CSSPrimitiveValue* parseColorFromValue(Value*); 155 PassRefPtr<CSSValue> parseCounterContent(ValueList* args, bool counters); 154 156 155 157 #ifdef SVG_SUPPORT -
trunk/WebCore/css/cssstyleselector.cpp
r16678 r16721 39 39 #include "CSSValueKeywords.h" 40 40 #include "CSSValueList.h" 41 #include "Counter.h" 41 42 #include "CachedImage.h" 42 43 #include "DashboardRegion.h" … … 758 759 void CSSStyleSelector::matchUARules(int& firstUARule, int& lastUARule) 759 760 { 760 // 1. First we match rules from the user agent sheet. 761 matchRules(defaultStyle, firstUARule, lastUARule); 762 763 // 2. In quirks mode, we match rules from the quirks user agent sheet. 761 // First we match rules from the user agent sheet. 762 CSSRuleSet* userAgentStyleSheet = m_medium->mediaTypeMatch("print") 763 ? defaultPrintStyle : defaultStyle; 764 matchRules(userAgentStyleSheet, firstUARule, lastUARule); 765 766 // In quirks mode, we match rules from the quirks user agent sheet. 764 767 if (!strictParsing) 765 768 matchRules(defaultQuirksStyle, firstUARule, lastUARule); 766 767 // 3. If our medium is print, then we match rules from the print sheet.768 if (m_medium->mediaTypeMatch("print"))769 matchRules(defaultPrintStyle, firstUARule, lastUARule);770 769 771 // 4.If we're in view source mode, then we match rules from the view source style sheet.770 // If we're in view source mode, then we match rules from the view source style sheet. 772 771 if (view && view->frame() && view->frame()->inViewSourceMode()) 773 772 matchRules(defaultViewSourceStyle, firstUARule, lastUARule); … … 3177 3176 for (int i = 0; i < len; i++) { 3178 3177 CSSValue *item = list->item(i); 3179 if (!item->isPrimitiveValue()) continue; 3178 if (!item->isPrimitiveValue()) 3179 continue; 3180 3180 3181 CSSPrimitiveValue *val = static_cast<CSSPrimitiveValue*>(item); 3181 3182 if (val->primitiveType()==CSSPrimitiveValue::CSS_STRING) … … 3191 3192 // register the fact that the attribute value affects the style 3192 3193 m_selectorAttrs.add(attr.localName().impl()); 3193 } 3194 else if (val->primitiveType()==CSSPrimitiveValue::CSS_URI) { 3194 } else if (val->primitiveType()==CSSPrimitiveValue::CSS_URI) { 3195 3195 CSSImageValue *image = static_cast<CSSImageValue*>(val); 3196 3196 style->setContent(image->image(element->document()->docLoader()), i != 0); 3197 } 3197 } else if (val->primitiveType()==CSSPrimitiveValue::CSS_COUNTER) { 3198 Counter* counterValue = val->getCounterValue(); 3199 CounterData counter(counterValue->identifier(), 3200 (EListStyleType)counterValue->listStyleNumber(), counterValue->separator()); 3201 style->setContent(new CounterData(counter), i != 0); 3202 } 3198 3203 } 3199 3204 break; … … 3201 3206 3202 3207 case CSS_PROP_COUNTER_INCREMENT: 3203 // list of CSS2CounterIncrement 3208 if (!value->isValueList()) 3209 return; 3210 style->setCounterIncrementList(static_cast<CSSValueList*>(value)); 3211 break; 3204 3212 case CSS_PROP_COUNTER_RESET: 3205 // list of CSS2CounterReset 3213 if (!value->isValueList()) 3214 return; 3215 style->setCounterResetList(static_cast<CSSValueList*>(value)); 3206 3216 break; 3207 3217 case CSS_PROP_FONT_FAMILY: { -
trunk/WebCore/platform/PlatformString.h
r16622 r16721 92 92 void append(UChar); 93 93 void insert(const String&, unsigned pos); 94 void insert(const UChar*, unsigned length, unsigned pos); 94 95 95 96 String& replace(UChar a, UChar b) { if (m_impl) m_impl = m_impl->replace(a, b); return *this; } -
trunk/WebCore/platform/String.cpp
r16622 r16721 158 158 } 159 159 160 void String::insert(const UChar* str, unsigned length, unsigned pos) 161 { 162 if (!m_impl) 163 m_impl = new StringImpl(str, length); 164 else 165 m_impl->insert(str, length, pos); 166 } 167 160 168 UChar String::operator[](unsigned i) const 161 169 { -
trunk/WebCore/platform/StringImpl.cpp
r16626 r16721 194 194 memcpy(c + pos, str->m_data, str->m_length * sizeof(UChar)); 195 195 memcpy(c + pos + str->m_length, m_data + pos, (m_length - pos) * sizeof(UChar)); 196 deleteUCharVector(m_data); 197 m_data = c; 198 m_length = newlen; 199 m_hasTerminatingNullCharacter = false; 200 } 201 } 202 203 void StringImpl::insert(const UChar* str, unsigned length, unsigned pos) 204 { 205 assert(!m_inTable); 206 if (pos >= m_length) { 207 RefPtr<StringImpl> s = new StringImpl(str, length); 208 append(s.get()); 209 return; 210 } 211 if (str && length != 0) { 212 size_t newlen = m_length + length; 213 UChar* c = newUCharVector(newlen); 214 memcpy(c, m_data, pos * sizeof(UChar)); 215 memcpy(c + pos, str, length * sizeof(UChar)); 216 memcpy(c + pos + length, m_data + pos, (m_length - pos) * sizeof(UChar)); 196 217 deleteUCharVector(m_data); 197 218 m_data = c; -
trunk/WebCore/platform/StringImpl.h
r16626 r16721 84 84 void append(UChar); 85 85 void insert(const StringImpl*, unsigned pos); 86 void insert(const UChar* str, unsigned length, unsigned pos); 86 87 void truncate(int len); 87 88 void remove(unsigned pos, int len = 1); -
trunk/WebCore/rendering/RenderContainer.cpp
r16250 r16721 5 5 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 6 * (C) 2000 Dirk Mueller (mueller@kde.org) 7 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 7 8 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. 8 9 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) … … 29 30 30 31 #include "htmlediting.h" 32 #include "RenderCounter.h" 31 33 #include "RenderListItem.h" 32 34 #include "RenderTable.h" … … 297 299 // inline should be mutated to INLINE. 298 300 pseudo->setDisplay(INLINE); 299 301 300 302 if (oldContentPresent) { 301 303 if (child && child->style()->styleType() == type) { … … 335 337 pseudoContainer = RenderFlow::createAnonymousFlow(document(), pseudo); /* anonymous box */ 336 338 337 if (contentData->contentType() == CONTENT_TEXT) 338 { 339 if (contentData->contentType() == CONTENT_TEXT) { 339 340 RenderText* t = new (renderArena()) RenderTextFragment(document() /*anonymous object */, contentData->contentText()); 340 341 t->setStyle(pseudo); 341 342 pseudoContainer->addChild(t); 342 } 343 else if (contentData->contentType() == CONTENT_OBJECT) 344 { 343 } else if (contentData->contentType() == CONTENT_OBJECT) { 345 344 RenderImage* img = new (renderArena()) RenderImage(document()); /* Anonymous object */ 346 345 RenderStyle* style = new (renderArena()) RenderStyle(); … … 349 348 img->setContentObject(contentData->contentObject()); 350 349 pseudoContainer->addChild(img); 350 } else if (contentData->_contentType == CONTENT_COUNTER) { 351 RenderCounter* c = new (renderArena()) RenderCounter(element(), contentData->contentCounter()); 352 RenderStyle* style = new (renderArena()) RenderStyle(); 353 style->inheritFrom(pseudo); 354 c->setIsAnonymous(true); 355 c->setStyle(style); 356 pseudoContainer->addChild(c); 351 357 } 352 358 } -
trunk/WebCore/rendering/RenderObject.cpp
r16663 r16721 5 5 * (C) 1999 Antti Koivisto (koivisto@kde.org) 6 6 * (C) 2000 Dirk Mueller (mueller@kde.org) 7 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 7 8 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. 8 9 * … … 30 31 #include "AffineTransform.h" 31 32 #include "CachedImage.h" 33 #include "CounterNode.h" 34 #include "CounterResetNode.h" 32 35 #include "Decoder.h" 33 36 #include "Document.h" … … 38 41 #include "GraphicsContext.h" 39 42 #include "HTMLNames.h" 43 #include "HTMLOListElement.h" 40 44 #include "Position.h" 41 45 #include "RenderArena.h" … … 65 69 static void *baseOfRenderObjectBeingDeleted; 66 70 #endif 71 72 typedef HashMap<String, CounterNode*> CounterNodeMap; 73 typedef HashMap<const RenderObject*, CounterNodeMap*> RenderObjectsToCounterNodeMaps; 74 75 static RenderObjectsToCounterNodeMaps* getRenderObjectsToCounterNodeMaps() 76 { 77 static RenderObjectsToCounterNodeMaps objectsMap; 78 return &objectsMap; 79 } 67 80 68 81 void* RenderObject::operator new(size_t sz, RenderArena* renderArena) throw() … … 178 191 m_replaced( false ), 179 192 m_isDragging( false ), 180 m_hasOverflowClip(false) 193 m_hasOverflowClip(false), 194 m_hasCounterNodeMap(false) 181 195 { 182 196 #ifndef NDEBUG … … 2407 2421 void RenderObject::destroy() 2408 2422 { 2423 if (m_hasCounterNodeMap) { 2424 RenderObjectsToCounterNodeMaps* objectsMap = getRenderObjectsToCounterNodeMaps(); 2425 if (CounterNodeMap* counterNodesMap = objectsMap->get(this)) { 2426 CounterNodeMap::const_iterator end = counterNodesMap->end(); 2427 for (CounterNodeMap::const_iterator it = counterNodesMap->begin(); it != end; ++it) { 2428 CounterNode* counterNode = it->second; 2429 counterNode->remove(); 2430 delete counterNode; 2431 counterNode = 0; 2432 } 2433 objectsMap->remove(this); 2434 delete counterNodesMap; 2435 } 2436 } 2437 2409 2438 document()->axObjectCache()->remove(this); 2410 2439 … … 2849 2878 } 2850 2879 2880 CounterNode* RenderObject::findCounter(const String& counterName, bool willNeedLayout, 2881 bool usesSeparator, bool createIfNotFound) 2882 { 2883 if (!style()) 2884 return 0; 2885 2886 RenderObjectsToCounterNodeMaps* objectsMap = getRenderObjectsToCounterNodeMaps(); 2887 CounterNode* newNode = 0; 2888 if (CounterNodeMap* counterNodesMap = objectsMap->get(this)) 2889 if (counterNodesMap) 2890 newNode = counterNodesMap->get(counterName); 2891 2892 if (newNode) 2893 return newNode; 2894 2895 int val = 0; 2896 if (style()->hasCounterReset(counterName) || isRoot()) { 2897 newNode = new CounterResetNode(this); 2898 val = style()->counterReset(counterName); 2899 if (style()->hasCounterIncrement(counterName)) 2900 val += style()->counterIncrement(counterName); 2901 newNode->setValue(val); 2902 } else if (style()->hasCounterIncrement(counterName)) { 2903 newNode = new CounterNode(this); 2904 newNode->setValue(style()->counterIncrement(counterName)); 2905 } else if (counterName == "list-item") { 2906 if (isListItem()) { 2907 if (element()) { 2908 String v = static_cast<Element*>(element())->getAttribute("value"); 2909 if (!v.isEmpty()) { 2910 newNode = new CounterResetNode(this); 2911 val = v.toInt(); 2912 } 2913 } 2914 2915 if (!newNode) { 2916 newNode = new CounterNode(this); 2917 val = 1; 2918 } 2919 2920 newNode->setValue(val); 2921 } else if (element() && element()->hasTagName(olTag)) { 2922 newNode = new CounterResetNode(this); 2923 newNode->setValue(static_cast<HTMLOListElement*>(element())->start()); 2924 } else if (element() && 2925 (element()->hasTagName(ulTag) || 2926 element()->hasTagName(menuTag) || 2927 element()->hasTagName(dirTag))) { 2928 newNode = new CounterResetNode(this); 2929 newNode->setValue(0); 2930 } 2931 } 2932 2933 if (!newNode && !createIfNotFound) 2934 return 0; 2935 else if (!newNode) { 2936 newNode = new CounterNode(this); 2937 newNode->setValue(0); 2938 } 2939 2940 if (willNeedLayout) 2941 newNode->setWillNeedLayout(); 2942 if (usesSeparator) 2943 newNode->setUsesSeparator(); 2944 2945 CounterNodeMap* nodeMap; 2946 if (m_hasCounterNodeMap) 2947 nodeMap = objectsMap->get(this); 2948 else { 2949 nodeMap = new CounterNodeMap; 2950 objectsMap->set(this, nodeMap); 2951 m_hasCounterNodeMap = true; 2952 } 2953 2954 nodeMap->set(counterName, newNode); 2955 2956 if (!isRoot()) { 2957 RenderObject* n = !isListItem() && previousSibling() 2958 ? previousSibling()->previousSibling() : previousSibling(); 2959 2960 CounterNode* current = 0; 2961 for (; n; n = n->previousSibling()) { 2962 current = n->findCounter(counterName, false, false, false); 2963 if (current) 2964 break; 2965 } 2966 2967 CounterNode* last = current; 2968 CounterNode* sibling = current; 2969 if (last && !newNode->isReset()) { 2970 // Found render-sibling, now search for later counter-siblings among its render-children 2971 n = n->lastChild(); 2972 while (n) { 2973 current = n->findCounter(counterName, false, false, false); 2974 if (current && (last->parent() == current->parent() || sibling == current->parent())) { 2975 last = current; 2976 // If the current counter is not the last, search deeper 2977 if (current->nextSibling()) { 2978 n = n->lastChild(); 2979 continue; 2980 } else 2981 break; 2982 } 2983 n = n->previousSibling(); 2984 } 2985 2986 if (sibling->isReset()) { 2987 if (last != sibling) 2988 sibling->insertAfter(newNode, last); 2989 else 2990 sibling->insertAfter(newNode, 0); 2991 } else 2992 last->parent()->insertAfter(newNode, last); 2993 } else { 2994 // Nothing found among siblings, let our parent search 2995 last = parent()->findCounter(counterName, false); 2996 if (last->isReset()) 2997 last->insertAfter(newNode, 0); 2998 else 2999 last->parent()->insertAfter(newNode, last); 3000 } 3001 } 3002 3003 return newNode; 3004 } 3005 2851 3006 UChar RenderObject::backslashAsCurrencySymbol() const 2852 3007 { -
trunk/WebCore/rendering/RenderObject.h
r16678 r16721 5 5 * (C) 2000 Antti Koivisto (koivisto@kde.org) 6 6 * (C) 2000 Dirk Mueller (mueller@kde.org) 7 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) 7 8 * Copyright (C) 2003, 2004, 2005, 2006 Apple Computer, Inc. 8 9 * … … 32 33 #include "ScrollBar.h" 33 34 #include "VisiblePosition.h" 35 #include <wtf/HashMap.h> 34 36 35 37 /* … … 47 49 class CollapsedBorderValue; 48 50 class Color; 51 class CounterNode; 49 52 class Document; 50 53 class Element; … … 194 197 virtual int staticY() const { return 0; } 195 198 199 CounterNode* findCounter(const String& counterName, bool willNeedLayout = false, 200 bool usesSeparator = false, bool createIfNotFound = true); 201 202 public: 196 203 // RenderObject tree manipulation 197 204 ////////////////////////////////////////// … … 255 262 virtual bool isListItem() const { return false; } 256 263 virtual bool isListMarker() const { return false; } 264 virtual bool isCounter() const { return false; } 257 265 virtual bool isRenderView() const { return false; } 258 266 bool isRoot() const; … … 933 941 934 942 bool m_hasOverflowClip : 1; 935 936 // note: do not add unnecessary bitflags, we have 32 bit already! 943 944 bool m_hasCounterNodeMap : 1; 945 937 946 friend class RenderListItem; 938 947 friend class RenderContainer; -
trunk/WebCore/rendering/RenderStyle.cpp
r16549 r16721 91 91 , textDecoration(RenderStyle::initialTextDecoration()) 92 92 , colspan(1) 93 , counter _increment(0)94 , counter _reset(0)93 , counterIncrement(0) 94 , counterReset(0) 95 95 { 96 96 } … … 106 106 , textDecoration(o.textDecoration) 107 107 , colspan(o.colspan) 108 , counter _increment(o.counter_increment)109 , counter _reset(o.counter_reset)108 , counterIncrement(o.counterIncrement) 109 , counterReset(o.counterReset) 110 110 { 111 111 } … … 578 578 } 579 579 delete content; 580 581 580 delete this; 582 581 … … 650 649 , pseudoStyle(0) 651 650 , content(o.content) 651 , counterResetList(o.counterResetList) 652 , counterIncrementList(o.counterIncrementList) 652 653 , m_pseudoState(o.m_pseudoState) 653 654 , m_affectedByAttributeSelectors(false) … … 839 840 !(noninherited_flags._originalDisplay == other->noninherited_flags._originalDisplay) || 840 841 visual->colspan != other->visual->colspan || 841 visual->counter _increment != other->visual->counter_increment ||842 visual->counter _reset != other->visual->counter_reset ||842 visual->counterIncrement != other->visual->counterIncrement || 843 visual->counterReset != other->visual->counterReset || 843 844 css3NonInheritedData->textOverflow != other->css3NonInheritedData->textOverflow || 844 845 (css3InheritedData->textSecurity != other->css3InheritedData->textSecurity)) … … 926 927 if (!(css3NonInheritedData->m_dashboardRegions == other->css3NonInheritedData->m_dashboardRegions)) 927 928 return Layout; 929 930 // If the counter lists change, trigger a relayout to re-calc CounterNodes. 931 if (counterResetList != other->counterResetList || counterIncrementList != other->counterIncrementList) 932 return Layout; 928 933 929 934 // Make sure these left/top/right/bottom checks stay below all layout checks and above … … 1110 1115 } 1111 1116 1117 void RenderStyle::setContent(CounterData* c, bool add) 1118 { 1119 if (!c) 1120 return; 1121 1122 ContentData* lastContent = content; 1123 while (lastContent && lastContent->_nextContent) 1124 lastContent = lastContent->_nextContent; 1125 1126 bool reuseContent = !add; 1127 ContentData* newContentData = 0; 1128 if (reuseContent && content) { 1129 content->clearContent(); 1130 newContentData = content; 1131 } else 1132 newContentData = new ContentData; 1133 1134 if (lastContent && !reuseContent) 1135 lastContent->_nextContent = newContentData; 1136 else 1137 content = newContentData; 1138 1139 newContentData->_content.counter = c; 1140 newContentData->_contentType = CONTENT_COUNTER; 1141 } 1142 1112 1143 ContentData::~ContentData() 1113 1144 { … … 1128 1159 _content.text->deref(); 1129 1160 _content.text = 0; 1161 break; 1162 case CONTENT_COUNTER: 1163 delete _content.counter; 1164 _content.counter = 0; 1165 break; 1130 1166 default: 1131 1167 ; … … 1213 1249 1214 1250 return x == o.x && y == o.y && blur == o.blur && color == o.color; 1251 } 1252 1253 bool RenderStyle::counterDataEquivalent(RenderStyle* otherStyle) 1254 { 1255 // FIXME: Should we also compare the CounterData? 1256 return counterResetList == otherStyle->counterResetList && 1257 counterIncrementList == otherStyle->counterIncrementList; 1258 } 1259 1260 static bool hasCounter(const String& c, CSSValueList* l) 1261 { 1262 int len = l->length(); 1263 for (int i = 0; i < len; i++) { 1264 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(l->item(i)); 1265 Pair* pair = primitiveValue->getPairValue(); 1266 ASSERT(pair); 1267 CSSPrimitiveValue* counterName = static_cast<CSSPrimitiveValue*>(pair->first()); 1268 ASSERT(counterName); 1269 if (counterName->getStringValue() == c) 1270 return true; 1271 } 1272 return false; 1273 } 1274 1275 bool RenderStyle::hasCounterReset(const String& counterName) const 1276 { 1277 if (counterResetList) 1278 return hasCounter(counterName, counterResetList.get()); 1279 return false; 1280 } 1281 1282 bool RenderStyle::hasCounterIncrement(const String& counterName) const 1283 { 1284 if (counterIncrementList) 1285 return hasCounter(counterName, counterIncrementList.get()); 1286 return false; 1287 } 1288 1289 static int readCounter(const String& c, CSSValueList* l, bool isReset) 1290 { 1291 int len = l->length(); 1292 int total = 0; 1293 1294 for (int i = 0; i < len; i++) { 1295 CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(l->item(i)); 1296 Pair* pair = primitiveValue->getPairValue(); 1297 ASSERT(pair); 1298 CSSPrimitiveValue* counterName = static_cast<CSSPrimitiveValue*>(pair->first()); 1299 CSSPrimitiveValue* counterValue = static_cast<CSSPrimitiveValue*>(pair->second()); 1300 ASSERT(counterName); 1301 ASSERT(counterValue); 1302 1303 if (counterName->getStringValue() == c) { 1304 total += (int)counterValue->getFloatValue(); 1305 if (isReset) 1306 return total; 1307 } 1308 } 1309 1310 return total; 1311 } 1312 1313 int RenderStyle::counterReset(const String& counterName) const 1314 { 1315 if (counterResetList) 1316 return readCounter(counterName, counterResetList.get(), true); 1317 else 1318 return 0; 1319 } 1320 1321 int RenderStyle::counterIncrement(const String& counterName) const 1322 { 1323 if (counterIncrementList) 1324 return readCounter(counterName, counterIncrementList.get(), false); 1325 else 1326 return 0; 1215 1327 } 1216 1328 -
trunk/WebCore/rendering/RenderStyle.h
r16549 r16721 36 36 */ 37 37 38 #include "CSSPrimitiveValue.h" 39 #include "CSSValueList.h" 38 40 #include "Color.h" 39 41 #include "CSSCursorImageValue.h" … … 43 45 #include "IntRect.h" 44 46 #include "Length.h" 47 #include "Pair.h" 45 48 #include "Shared.h" 46 49 #include "TextDirection.h" … … 61 64 using std::max; 62 65 63 class CSSStyleSelector;64 66 class CachedImage; 65 67 class CachedResource; 68 class CSSStyleSelector; 69 class CSSValueList; 66 70 struct CursorData; 67 71 class CursorList; 72 class Pair; 68 73 class RenderArena; 69 74 class ShadowValue; … … 411 416 hasClip == o.hasClip && 412 417 colspan == o.colspan && 413 counter _increment == o.counter_increment &&414 counter _reset == o.counter_reset &&418 counterIncrement == o.counterIncrement && 419 counterReset == o.counterReset && 415 420 textDecoration == o.textDecoration); 416 421 } … … 425 430 short colspan; // for html, not a css2 attribute 426 431 427 short counter _increment; //ok, so these are not visual mode spesific428 short counter _reset; //can't go to inherited, since these are not inherited432 short counterIncrement; // ok, so these are not visual mode specific 433 short counterReset; // can't go to inherited, since these are not inherited 429 434 430 435 }; … … 899 904 }; 900 905 906 class CounterData { 907 908 public: 909 CounterData() {} 910 CounterData(const String& i, EListStyleType l, const String& s) 911 : m_identifier(i), m_listStyle(l), m_separator(s) {} 912 913 String identifier() { return m_identifier; } 914 EListStyleType listStyle() { return m_listStyle; } 915 String separator() { return m_separator; } 916 917 private: 918 String m_identifier; 919 EListStyleType m_listStyle; 920 String m_separator; 921 }; 922 901 923 struct ContentData { 902 924 ContentData() :_contentType(CONTENT_NONE), _nextContent(0) {} … … 908 930 StringImpl* contentText() { if (contentType() == CONTENT_TEXT) return _content.text; return 0; } 909 931 CachedResource* contentObject() { if (contentType() == CONTENT_OBJECT) return _content.object; return 0; } 932 CounterData* contentCounter() { if (contentType() == CONTENT_COUNTER) return _content.counter; return 0; } 910 933 911 934 ContentType _contentType; … … 914 937 CachedResource* object; 915 938 StringImpl* text; 916 // counters...939 CounterData* counter; 917 940 } _content ; 918 941 … … 1072 1095 // added this here, so we can get rid of the vptr in this class. 1073 1096 // makes up for the same size. 1074 ContentData *content; 1097 ContentData* content; 1098 RefPtr<CSSValueList> counterResetList; 1099 RefPtr<CSSValueList> counterIncrementList; 1075 1100 1076 1101 unsigned m_pseudoState : 3; // PseudoState … … 1322 1347 ECaptionSide captionSide() const { return static_cast<ECaptionSide>(inherited_flags._caption_side); } 1323 1348 1324 short counterIncrement() const { return visual->counter _increment; }1325 short counterReset() const { return visual->counter _reset; }1349 short counterIncrement() const { return visual->counterIncrement; } 1350 short counterReset() const { return visual->counterReset; } 1326 1351 1327 1352 EListStyleType listStyleType() const { return static_cast<EListStyleType>(inherited_flags._list_style_type); } … … 1528 1553 1529 1554 1530 void setCounterIncrement(short v) { SET_VAR(visual,counter _increment,v) }1531 void setCounterReset(short v) { SET_VAR(visual,counter _reset,v) }1555 void setCounterIncrement(short v) { SET_VAR(visual,counterIncrement,v) } 1556 void setCounterReset(short v) { SET_VAR(visual,counterReset,v) } 1532 1557 1533 1558 void setListStyleType(EListStyleType v) { inherited_flags._list_style_type = v; } … … 1627 1652 void setContent(StringImpl* s, bool add = false); 1628 1653 void setContent(CachedResource* o, bool add = false); 1654 void setContent(CounterData*, bool add = false); 1655 1656 bool counterDataEquivalent(RenderStyle*); 1657 void setCounterResetList(PassRefPtr<CSSValueList> l) { counterResetList = l; } 1658 void setCounterIncrementList(PassRefPtr<CSSValueList> l) { counterIncrementList = l; } 1659 bool hasCounterReset(const String&) const; 1660 bool hasCounterIncrement(const String&) const; 1661 int counterReset(const String&) const; 1662 int counterIncrement(const String&) const; 1663 CSSValueList* counterResetValueList() { return counterResetList.get(); } 1664 CSSValueList* counterIncrementValueList() { return counterIncrementList.get(); } 1629 1665 1630 1666 bool inheritedNotEqual( RenderStyle *other ) const;
Note: See TracChangeset
for help on using the changeset viewer.