| 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   // FIXME: LayoutMedia::layout makes assumptions about what children are allowe
    d |  17   // FIXME: LayoutMedia::layout makes assumptions about what children are | 
|  18   // so we can't support generated content. |  18   // allowed so we can't support generated content. | 
|  19   if (layoutObject.isMedia() || layoutObject.isTextControl() || |  19   if (layoutObject.isMedia() || layoutObject.isTextControl() || | 
|  20       layoutObject.isMenuList()) |  20       layoutObject.isMenuList()) | 
|  21     return false; |  21     return false; | 
|  22  |  22  | 
|  23   // Input elements can't have generated children, but button elements can. We'l
    l |  23   // Input elements can't have generated children, but button elements can. | 
|  24   // write the code assuming any other button types that might emerge in the fut
    ure |  24   // We'll write the code assuming any other button types that might emerge in | 
|  25   // can also have children. |  25   // the future can also have children. | 
|  26   if (layoutObject.isLayoutButton()) |  26   if (layoutObject.isLayoutButton()) | 
|  27     return !isHTMLInputElement(*layoutObject.node()); |  27     return !isHTMLInputElement(*layoutObject.node()); | 
|  28  |  28  | 
|  29   return layoutObject.canHaveChildren(); |  29   return layoutObject.canHaveChildren(); | 
|  30 } |  30 } | 
|  31  |  31  | 
|  32 }  // namespace blink |  32 }  // namespace blink | 
|  33  |  33  | 
|  34 #endif  // GeneratedChildren_h |  34 #endif  // GeneratedChildren_h | 
| OLD | NEW |