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 DCHECK(flattened_size); | 65 DCHECK(flattened_size); |
66 | 66 |
67 CSSSelectorList list; | 67 CSSSelectorList list; |
68 list.selector_array_ = | 68 list.selector_array_ = |
69 reinterpret_cast<CSSSelector*>(WTF::Partitions::FastMalloc( | 69 reinterpret_cast<CSSSelector*>(WTF::Partitions::FastMalloc( |
70 sizeof(CSSSelector) * flattened_size, kCSSSelectorTypeName)); | 70 sizeof(CSSSelector) * flattened_size, kCSSSelectorTypeName)); |
71 size_t array_index = 0; | 71 size_t array_index = 0; |
72 for (size_t i = 0; i < selector_vector.size(); ++i) { | 72 for (size_t i = 0; i < selector_vector.size(); ++i) { |
73 CSSParserSelector* current = selector_vector[i].get(); | 73 CSSParserSelector* current = selector_vector[i].get(); |
74 while (current) { | 74 while (current) { |
75 // Move item from the parser selector vector into m_selectorArray without | 75 // Move item from the parser selector vector into selector_array_ without |
76 // invoking destructor (Ugh.) | 76 // invoking destructor (Ugh.) |
77 CSSSelector* current_selector = current->ReleaseSelector().release(); | 77 CSSSelector* current_selector = current->ReleaseSelector().release(); |
78 memcpy(&list.selector_array_[array_index], current_selector, | 78 memcpy(&list.selector_array_[array_index], current_selector, |
79 sizeof(CSSSelector)); | 79 sizeof(CSSSelector)); |
80 WTF::Partitions::FastFree(current_selector); | 80 WTF::Partitions::FastFree(current_selector); |
81 | 81 |
82 current = current->TagHistory(); | 82 current = current->TagHistory(); |
83 DCHECK(!list.selector_array_[array_index].IsLastInSelectorList()); | 83 DCHECK(!list.selector_array_[array_index].IsLastInSelectorList()); |
84 if (current) | 84 if (current) |
85 list.selector_array_[array_index].SetNotLastInTagHistory(); | 85 list.selector_array_[array_index].SetNotLastInTagHistory(); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 for (const CSSSelector* s = First(); s; s = Next(*s)) { | 121 for (const CSSSelector* s = First(); s; s = Next(*s)) { |
122 if (s != First()) | 122 if (s != First()) |
123 result.Append(", "); | 123 result.Append(", "); |
124 result.Append(s->SelectorText()); | 124 result.Append(s->SelectorText()); |
125 } | 125 } |
126 | 126 |
127 return result.ToString(); | 127 return result.ToString(); |
128 } | 128 } |
129 | 129 |
130 } // namespace blink | 130 } // namespace blink |
OLD | NEW |