OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 } | 762 } |
763 } | 763 } |
764 | 764 |
765 String counterValueForElement(Element* element) | 765 String counterValueForElement(Element* element) |
766 { | 766 { |
767 // Make sure the element is not freed during the layout. | 767 // Make sure the element is not freed during the layout. |
768 RefPtr<Element> elementRef(element); | 768 RefPtr<Element> elementRef(element); |
769 element->document()->updateLayout(); | 769 element->document()->updateLayout(); |
770 TextStream stream; | 770 TextStream stream; |
771 bool isFirstCounter = true; | 771 bool isFirstCounter = true; |
772 // The counter renderers should be children of anonymous children | 772 // The counter renderers should be children of :before or :after pseudo-elem
ents. |
773 // (i.e., :before or :after pseudo-elements). | |
774 if (RenderObject* renderer = element->renderer()) { | 773 if (RenderObject* renderer = element->renderer()) { |
775 for (RenderObject* child = renderer->firstChild(); child; child = child-
>nextSibling()) { | 774 if (RenderObject* pseudoElement = renderer->beforePseudoElementRenderer(
)) |
776 if (child->isAnonymous()) | 775 writeCounterValuesFromChildren(stream, pseudoElement, isFirstCounter
); |
777 writeCounterValuesFromChildren(stream, child, isFirstCounter); | 776 if (RenderObject* pseudoElement = renderer->afterPseudoElementRenderer()
) |
778 } | 777 writeCounterValuesFromChildren(stream, pseudoElement, isFirstCounter
); |
779 } | 778 } |
780 return stream.release(); | 779 return stream.release(); |
781 } | 780 } |
782 | 781 |
783 String markerTextForListItem(Element* element) | 782 String markerTextForListItem(Element* element) |
784 { | 783 { |
785 // Make sure the element is not freed during the layout. | 784 // Make sure the element is not freed during the layout. |
786 RefPtr<Element> elementRef(element); | 785 RefPtr<Element> elementRef(element); |
787 element->document()->updateLayout(); | 786 element->document()->updateLayout(); |
788 | 787 |
789 RenderObject* renderer = element->renderer(); | 788 RenderObject* renderer = element->renderer(); |
790 if (!renderer || !renderer->isListItem()) | 789 if (!renderer || !renderer->isListItem()) |
791 return String(); | 790 return String(); |
792 | 791 |
793 return toRenderListItem(renderer)->markerText(); | 792 return toRenderListItem(renderer)->markerText(); |
794 } | 793 } |
795 | 794 |
796 } // namespace WebCore | 795 } // namespace WebCore |
OLD | NEW |