OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2012 Apple Inc. All rights reserved. |
3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 ASSERT(flattenedSize); | 65 ASSERT(flattenedSize); |
66 | 66 |
67 CSSSelectorList list; | 67 CSSSelectorList list; |
68 list.m_selectorArray = | 68 list.m_selectorArray = |
69 reinterpret_cast<CSSSelector*>(WTF::Partitions::fastMalloc( | 69 reinterpret_cast<CSSSelector*>(WTF::Partitions::fastMalloc( |
70 sizeof(CSSSelector) * flattenedSize, kCSSSelectorTypeName)); | 70 sizeof(CSSSelector) * flattenedSize, kCSSSelectorTypeName)); |
71 size_t arrayIndex = 0; | 71 size_t arrayIndex = 0; |
72 for (size_t i = 0; i < selectorVector.size(); ++i) { | 72 for (size_t i = 0; i < selectorVector.size(); ++i) { |
73 CSSParserSelector* current = selectorVector[i].get(); | 73 CSSParserSelector* current = selectorVector[i].get(); |
74 while (current) { | 74 while (current) { |
75 // Move item from the parser selector vector into m_selectorArray without
invoking destructor (Ugh.) | 75 // Move item from the parser selector vector into m_selectorArray without |
| 76 // invoking destructor (Ugh.) |
76 CSSSelector* currentSelector = current->releaseSelector().release(); | 77 CSSSelector* currentSelector = current->releaseSelector().release(); |
77 memcpy(&list.m_selectorArray[arrayIndex], currentSelector, | 78 memcpy(&list.m_selectorArray[arrayIndex], currentSelector, |
78 sizeof(CSSSelector)); | 79 sizeof(CSSSelector)); |
79 WTF::Partitions::fastFree(currentSelector); | 80 WTF::Partitions::fastFree(currentSelector); |
80 | 81 |
81 current = current->tagHistory(); | 82 current = current->tagHistory(); |
82 ASSERT(!list.m_selectorArray[arrayIndex].isLastInSelectorList()); | 83 ASSERT(!list.m_selectorArray[arrayIndex].isLastInSelectorList()); |
83 if (current) | 84 if (current) |
84 list.m_selectorArray[arrayIndex].setNotLastInTagHistory(); | 85 list.m_selectorArray[arrayIndex].setNotLastInTagHistory(); |
85 ++arrayIndex; | 86 ++arrayIndex; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 for (const CSSSelector* s = first(); s; s = next(*s)) { | 121 for (const CSSSelector* s = first(); s; s = next(*s)) { |
121 if (s != first()) | 122 if (s != first()) |
122 result.append(", "); | 123 result.append(", "); |
123 result.append(s->selectorText()); | 124 result.append(s->selectorText()); |
124 } | 125 } |
125 | 126 |
126 return result.toString(); | 127 return result.toString(); |
127 } | 128 } |
128 | 129 |
129 } // namespace blink | 130 } // namespace blink |
OLD | NEW |