OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 2 * Copyright (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
3 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 3 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 #ifndef LayoutCounter_h | 22 #ifndef LayoutCounter_h |
23 #define LayoutCounter_h | 23 #define LayoutCounter_h |
24 | 24 |
25 #include "core/layout/LayoutText.h" | 25 #include "core/layout/LayoutText.h" |
26 #include "core/style/CounterContent.h" | 26 #include "core/style/CounterContent.h" |
27 | 27 |
28 namespace blink { | 28 namespace blink { |
29 | 29 |
30 class CounterNode; | 30 class CounterNode; |
| 31 class PseudoElement; |
31 | 32 |
32 // LayoutCounter is used to represent the text of a counter. | 33 // LayoutCounter is used to represent the text of a counter. |
33 // See http://www.w3.org/TR/CSS21/generate.html#counters | 34 // See http://www.w3.org/TR/CSS21/generate.html#counters |
34 // | 35 // |
35 // Counters are always generated content ("content: counter(a)") thus this | 36 // Counters are always generated content ("content: counter(a)") thus this |
36 // LayoutObject is always anonymous. | 37 // LayoutObject is always anonymous. |
37 // | 38 // |
38 // CounterNodes is where the logic for knowing the value of a counter is. | 39 // CounterNodes is where the logic for knowing the value of a counter is. |
39 // LayoutCounter makes sure the CounterNodes tree is consistent with the | 40 // LayoutCounter makes sure the CounterNodes tree is consistent with the |
40 // style. It then just queries CounterNodes for their values. | 41 // style. It then just queries CounterNodes for their values. |
41 // | 42 // |
42 // CounterNodes are rare so they are stored in a map instead of growing | 43 // CounterNodes are rare so they are stored in a map instead of growing |
43 // LayoutObject. counterMaps() (in LayoutCounter.cpp) keeps the association | 44 // LayoutObject. counterMaps() (in LayoutCounter.cpp) keeps the association |
44 // between LayoutObject and CounterNodes. To avoid unneeded hash-lookups in the | 45 // between LayoutObject and CounterNodes. To avoid unneeded hash-lookups in the |
45 // common case where there is no CounterNode, LayoutObject also keeps track of | 46 // common case where there is no CounterNode, LayoutObject also keeps track of |
46 // whether it has at least one CounterNode in the hasCounterNodeMap bit. | 47 // whether it has at least one CounterNode in the hasCounterNodeMap bit. |
47 // | 48 // |
48 // Keeping the map up to date is the reason why LayoutObjects need to call into | 49 // Keeping the map up to date is the reason why LayoutObjects need to call into |
49 // LayoutCounter during their lifetime (see the static functions below). | 50 // LayoutCounter during their lifetime (see the static functions below). |
50 class LayoutCounter final : public LayoutText { | 51 class LayoutCounter final : public LayoutText { |
51 public: | 52 public: |
52 LayoutCounter(Document*, const CounterContent&); | 53 LayoutCounter(PseudoElement&, const CounterContent&); |
53 ~LayoutCounter() override; | 54 ~LayoutCounter() override; |
54 | 55 |
55 // These functions are static so that any LayoutObject can call them. | 56 // These functions are static so that any LayoutObject can call them. |
56 // The reason is that any LayoutObject in the tree can have a CounterNode | 57 // The reason is that any LayoutObject in the tree can have a CounterNode |
57 // without a LayoutCounter (e.g. by specifying 'counter-increment' without | 58 // without a LayoutCounter (e.g. by specifying 'counter-increment' without |
58 // a "content: counter(a)" directive)). | 59 // a "content: counter(a)" directive)). |
59 static void destroyCounterNodes(LayoutObject&); | 60 static void destroyCounterNodes(LayoutObject&); |
60 static void destroyCounterNode(LayoutObject&, const AtomicString& identifier); | 61 static void destroyCounterNode(LayoutObject&, const AtomicString& identifier); |
61 static void layoutObjectSubtreeAttached(LayoutObject*); | 62 static void layoutObjectSubtreeAttached(LayoutObject*); |
62 static void layoutObjectSubtreeWillBeDetached(LayoutObject*); | 63 static void layoutObjectSubtreeWillBeDetached(LayoutObject*); |
(...skipping 29 matching lines...) Expand all Loading... |
92 | 93 |
93 } // namespace blink | 94 } // namespace blink |
94 | 95 |
95 #ifndef NDEBUG | 96 #ifndef NDEBUG |
96 // Outside the WebCore namespace for ease of invocation from gdb. | 97 // Outside the WebCore namespace for ease of invocation from gdb. |
97 void showCounterLayoutTree(const blink::LayoutObject*, | 98 void showCounterLayoutTree(const blink::LayoutObject*, |
98 const char* counterName = nullptr); | 99 const char* counterName = nullptr); |
99 #endif | 100 #endif |
100 | 101 |
101 #endif // LayoutCounter_h | 102 #endif // LayoutCounter_h |
OLD | NEW |