| 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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 isFirstCounter = false; | 819 isFirstCounter = false; |
| 820 String str(toLayoutText(child)->text()); | 820 String str(toLayoutText(child)->text()); |
| 821 stream << str; | 821 stream << str; |
| 822 } | 822 } |
| 823 } | 823 } |
| 824 } | 824 } |
| 825 | 825 |
| 826 String counterValueForElement(Element* element) | 826 String counterValueForElement(Element* element) |
| 827 { | 827 { |
| 828 // Make sure the element is not freed during the layout. | 828 // Make sure the element is not freed during the layout. |
| 829 RefPtrWillBeRawPtr<Element> protector(element); | 829 RawPtr<Element> protector(element); |
| 830 element->document().updateLayout(); | 830 element->document().updateLayout(); |
| 831 TextStream stream; | 831 TextStream stream; |
| 832 bool isFirstCounter = true; | 832 bool isFirstCounter = true; |
| 833 // The counter layoutObjects should be children of :before or :after pseudo-
elements. | 833 // The counter layoutObjects should be children of :before or :after pseudo-
elements. |
| 834 if (LayoutObject* before = element->pseudoElementLayoutObject(PseudoIdBefore
)) | 834 if (LayoutObject* before = element->pseudoElementLayoutObject(PseudoIdBefore
)) |
| 835 writeCounterValuesFromChildren(stream, before, isFirstCounter); | 835 writeCounterValuesFromChildren(stream, before, isFirstCounter); |
| 836 if (LayoutObject* after = element->pseudoElementLayoutObject(PseudoIdAfter)) | 836 if (LayoutObject* after = element->pseudoElementLayoutObject(PseudoIdAfter)) |
| 837 writeCounterValuesFromChildren(stream, after, isFirstCounter); | 837 writeCounterValuesFromChildren(stream, after, isFirstCounter); |
| 838 return stream.release(); | 838 return stream.release(); |
| 839 } | 839 } |
| 840 | 840 |
| 841 String markerTextForListItem(Element* element) | 841 String markerTextForListItem(Element* element) |
| 842 { | 842 { |
| 843 // Make sure the element is not freed during the layout. | 843 // Make sure the element is not freed during the layout. |
| 844 RefPtrWillBeRawPtr<Element> protector(element); | 844 RawPtr<Element> protector(element); |
| 845 element->document().updateLayout(); | 845 element->document().updateLayout(); |
| 846 | 846 |
| 847 LayoutObject* layoutObject = element->layoutObject(); | 847 LayoutObject* layoutObject = element->layoutObject(); |
| 848 if (!layoutObject || !layoutObject->isListItem()) | 848 if (!layoutObject || !layoutObject->isListItem()) |
| 849 return String(); | 849 return String(); |
| 850 | 850 |
| 851 return toLayoutListItem(layoutObject)->markerText(); | 851 return toLayoutListItem(layoutObject)->markerText(); |
| 852 } | 852 } |
| 853 | 853 |
| 854 } // namespace blink | 854 } // namespace blink |
| OLD | NEW |