OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef GeneratedChildren_h | 5 #ifndef GeneratedChildren_h |
6 #define GeneratedChildren_h | 6 #define GeneratedChildren_h |
7 | 7 |
8 #include "core/layout/LayoutObject.h" | 8 #include "core/layout/LayoutObject.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 // We only create "generated" child layoutObjects like one for first-letter if: | 12 // We only create "generated" child layoutObjects like one for first-letter if: |
13 // - the firstLetterBlock can have children in the DOM and | 13 // - the firstLetterBlock can have children in the DOM and |
14 // - the block doesn't have any special assumption on its text children. | 14 // - the block doesn't have any special assumption on its text children. |
15 // This correctly prevents form controls from having such layoutObjects. | 15 // This correctly prevents form controls from having such layoutObjects. |
16 static bool canHaveGeneratedChildren(const LayoutObject& layoutObject) | 16 static bool canHaveGeneratedChildren(const LayoutObject& layoutObject) |
17 { | 17 { |
18 // FIXME: LayoutMedia::layout makes assumptions about what children are allo
wed | 18 // FIXME: LayoutMedia::layout makes assumptions about what children are allo
wed |
19 // so we can't support generated content. | 19 // so we can't support generated content. |
20 if (layoutObject.isMedia() || layoutObject.isTextControl() || layoutObject.i
sMenuList()) | 20 if (layoutObject.isMedia() || layoutObject.isTextControl() || layoutObject.i
sMenuList()) |
21 return false; | 21 return false; |
22 | 22 |
23 if (layoutObject.isLayoutRegion()) | |
24 return true; | |
25 | |
26 // Input elements can't have generated children, but button elements can. We
'll | 23 // Input elements can't have generated children, but button elements can. We
'll |
27 // write the code assuming any other button types that might emerge in the f
uture | 24 // write the code assuming any other button types that might emerge in the f
uture |
28 // can also have children. | 25 // can also have children. |
29 if (layoutObject.isLayoutButton()) | 26 if (layoutObject.isLayoutButton()) |
30 return !isHTMLInputElement(*layoutObject.node()); | 27 return !isHTMLInputElement(*layoutObject.node()); |
31 | 28 |
32 return layoutObject.canHaveChildren(); | 29 return layoutObject.canHaveChildren(); |
33 } | 30 } |
34 | 31 |
35 } // namespace blink | 32 } // namespace blink |
36 | 33 |
37 #endif // GeneratedChildren_h | 34 #endif // GeneratedChildren_h |
OLD | NEW |