Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv ed. |
| 7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 virtual ~SameSizeAsRenderObject() { } // Allocate vtable pointer. | 111 virtual ~SameSizeAsRenderObject() { } // Allocate vtable pointer. |
| 112 void* pointers[5]; | 112 void* pointers[5]; |
| 113 #ifndef NDEBUG | 113 #ifndef NDEBUG |
| 114 unsigned m_debugBitfields : 2; | 114 unsigned m_debugBitfields : 2; |
| 115 #endif | 115 #endif |
| 116 unsigned m_bitfields; | 116 unsigned m_bitfields; |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 COMPILE_ASSERT(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObj ect_should_stay_small); | 119 COMPILE_ASSERT(sizeof(RenderObject) == sizeof(SameSizeAsRenderObject), RenderObj ect_should_stay_small); |
| 120 | 120 |
| 121 bool RenderObject::s_affectsParentBlock = false; | |
|
eseidel
2013/04/05 01:50:36
Do we have any clue why these came to be this way?
esprehn
2013/04/17 03:29:01
I had a discussion on IRC with apple folks way bac
| |
| 122 | |
| 123 RenderObjectAncestorLineboxDirtySet* RenderObject::s_ancestorLineboxDirtySet = 0 ; | 121 RenderObjectAncestorLineboxDirtySet* RenderObject::s_ancestorLineboxDirtySet = 0 ; |
| 124 | 122 |
| 125 void* RenderObject::operator new(size_t sz, RenderArena* renderArena) | 123 void* RenderObject::operator new(size_t sz, RenderArena* renderArena) |
| 126 { | 124 { |
| 127 return renderArena->allocate(sz); | 125 return renderArena->allocate(sz); |
| 128 } | 126 } |
| 129 | 127 |
| 130 void RenderObject::operator delete(void* ptr, size_t sz) | 128 void RenderObject::operator delete(void* ptr, size_t sz) |
| 131 { | 129 { |
| 132 ASSERT(baseOfRenderObjectBeingDeleted == ptr); | 130 ASSERT(baseOfRenderObjectBeingDeleted == ptr); |
| (...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1795 return; | 1793 return; |
| 1796 } | 1794 } |
| 1797 | 1795 |
| 1798 StyleDifference diff = StyleDifferenceEqual; | 1796 StyleDifference diff = StyleDifferenceEqual; |
| 1799 unsigned contextSensitiveProperties = ContextSensitivePropertyNone; | 1797 unsigned contextSensitiveProperties = ContextSensitivePropertyNone; |
| 1800 if (m_style) | 1798 if (m_style) |
| 1801 diff = m_style->diff(style.get(), contextSensitiveProperties); | 1799 diff = m_style->diff(style.get(), contextSensitiveProperties); |
| 1802 | 1800 |
| 1803 diff = adjustStyleDifference(diff, contextSensitiveProperties); | 1801 diff = adjustStyleDifference(diff, contextSensitiveProperties); |
| 1804 | 1802 |
| 1805 styleWillChange(diff, style.get()); | 1803 StyleChangeState state; |
| 1804 styleWillChange(diff, style.get(), state); | |
| 1806 | 1805 |
| 1807 RefPtr<RenderStyle> oldStyle = m_style.release(); | 1806 RefPtr<RenderStyle> oldStyle = m_style.release(); |
| 1808 setStyleInternal(style); | 1807 setStyleInternal(style); |
| 1809 | 1808 |
| 1810 updateFillImages(oldStyle ? oldStyle->backgroundLayers() : 0, m_style ? m_st yle->backgroundLayers() : 0); | 1809 updateFillImages(oldStyle ? oldStyle->backgroundLayers() : 0, m_style ? m_st yle->backgroundLayers() : 0); |
| 1811 updateFillImages(oldStyle ? oldStyle->maskLayers() : 0, m_style ? m_style->m askLayers() : 0); | 1810 updateFillImages(oldStyle ? oldStyle->maskLayers() : 0, m_style ? m_style->m askLayers() : 0); |
| 1812 | 1811 |
| 1813 updateImage(oldStyle ? oldStyle->borderImage().image() : 0, m_style ? m_styl e->borderImage().image() : 0); | 1812 updateImage(oldStyle ? oldStyle->borderImage().image() : 0, m_style ? m_styl e->borderImage().image() : 0); |
| 1814 updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style ? m_sty le->maskBoxImage().image() : 0); | 1813 updateImage(oldStyle ? oldStyle->maskBoxImage().image() : 0, m_style ? m_sty le->maskBoxImage().image() : 0); |
| 1815 | 1814 |
| 1816 // We need to ensure that view->maximalOutlineSize() is valid for any repain ts that happen | 1815 // We need to ensure that view->maximalOutlineSize() is valid for any repain ts that happen |
| 1817 // during styleDidChange (it's used by clippedOverflowRectForRepaint()). | 1816 // during styleDidChange (it's used by clippedOverflowRectForRepaint()). |
| 1818 if (m_style->outlineWidth() > 0 && m_style->outlineSize() > maximalOutlineSi ze(PaintPhaseOutline)) | 1817 if (m_style->outlineWidth() > 0 && m_style->outlineSize() > maximalOutlineSi ze(PaintPhaseOutline)) |
| 1819 toRenderView(document()->renderer())->setMaximalOutlineSize(m_style->out lineSize()); | 1818 toRenderView(document()->renderer())->setMaximalOutlineSize(m_style->out lineSize()); |
| 1820 | 1819 |
| 1821 bool doesNotNeedLayout = !m_parent || isText(); | 1820 bool doesNotNeedLayout = !m_parent || isText(); |
| 1822 | 1821 |
| 1823 styleDidChange(diff, oldStyle.get()); | 1822 styleDidChange(diff, oldStyle.get(), state); |
| 1824 | 1823 |
| 1825 // FIXME: |this| might be destroyed here. This can currently happen for a Re nderTextFragment when | 1824 // FIXME: |this| might be destroyed here. This can currently happen for a Re nderTextFragment when |
| 1826 // its first-letter block gets an update in RenderTextFragment::styleDidChan ge. For RenderTextFragment(s), | 1825 // its first-letter block gets an update in RenderTextFragment::styleDidChan ge. For RenderTextFragment(s), |
| 1827 // we will safely bail out with the doesNotNeedLayout flag. We might want to broaden this condition | 1826 // we will safely bail out with the doesNotNeedLayout flag. We might want to broaden this condition |
| 1828 // in the future as we move renderer changes out of layout and into style ch anges. | 1827 // in the future as we move renderer changes out of layout and into style ch anges. |
| 1829 if (doesNotNeedLayout) | 1828 if (doesNotNeedLayout) |
| 1830 return; | 1829 return; |
| 1831 | 1830 |
| 1832 // Now that the layer (if any) has been updated, we need to adjust the diff again, | 1831 // Now that the layer (if any) has been updated, we need to adjust the diff again, |
| 1833 // check whether we should layout now, and decide if we need to repaint. | 1832 // check whether we should layout now, and decide if we need to repaint. |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 1850 // not having an outline to having an outline. | 1849 // not having an outline to having an outline. |
| 1851 repaint(); | 1850 repaint(); |
| 1852 } | 1851 } |
| 1853 } | 1852 } |
| 1854 | 1853 |
| 1855 static inline bool rendererHasBackground(const RenderObject* renderer) | 1854 static inline bool rendererHasBackground(const RenderObject* renderer) |
| 1856 { | 1855 { |
| 1857 return renderer && renderer->hasBackground(); | 1856 return renderer && renderer->hasBackground(); |
| 1858 } | 1857 } |
| 1859 | 1858 |
| 1860 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle* newS tyle) | 1859 void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle* newS tyle, StyleChangeState& state) |
| 1861 { | 1860 { |
| 1862 if (m_style) { | 1861 if (m_style) { |
| 1863 // If our z-index changes value or our visibility changes, | 1862 // If our z-index changes value or our visibility changes, |
| 1864 // we need to dirty our stacking context's z-order list. | 1863 // we need to dirty our stacking context's z-order list. |
| 1865 if (newStyle) { | 1864 if (newStyle) { |
| 1866 bool visibilityChanged = m_style->visibility() != newStyle->visibili ty() | 1865 bool visibilityChanged = m_style->visibility() != newStyle->visibili ty() |
| 1867 || m_style->zIndex() != newStyle->zIndex() | 1866 || m_style->zIndex() != newStyle->zIndex() |
| 1868 || m_style->hasAutoZIndex() != newStyle->hasAutoZIndex(); | 1867 || m_style->hasAutoZIndex() != newStyle->hasAutoZIndex(); |
| 1869 #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(DRAGGABLE_REGION) | 1868 #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(DRAGGABLE_REGION) |
| 1870 if (visibilityChanged) | 1869 if (visibilityChanged) |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 1893 repaint(); | 1892 repaint(); |
| 1894 if (isFloating() && (m_style->floating() != newStyle->floating())) | 1893 if (isFloating() && (m_style->floating() != newStyle->floating())) |
| 1895 // For changes in float styles, we need to conceivably remove oursel ves | 1894 // For changes in float styles, we need to conceivably remove oursel ves |
| 1896 // from the floating objects list. | 1895 // from the floating objects list. |
| 1897 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); | 1896 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); |
| 1898 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle->po sition())) | 1897 else if (isOutOfFlowPositioned() && (m_style->position() != newStyle->po sition())) |
| 1899 // For changes in positioning styles, we need to conceivably remove ourselves | 1898 // For changes in positioning styles, we need to conceivably remove ourselves |
| 1900 // from the positioned objects list. | 1899 // from the positioned objects list. |
| 1901 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); | 1900 toRenderBox(this)->removeFloatingOrPositionedChildFromBlockLists(); |
| 1902 | 1901 |
| 1903 s_affectsParentBlock = isFloatingOrOutOfFlowPositioned() | 1902 state.affectsParentBlock = isFloatingOrOutOfFlowPositioned() |
| 1904 && (!newStyle->isFloating() && !newStyle->hasOutOfFlowPosition()) | 1903 && (!newStyle->isFloating() && !newStyle->hasOutOfFlowPosition()) |
| 1905 && parent() && (parent()->isBlockFlow() || parent()->isRenderInline( )); | 1904 && parent() && (parent()->isBlockFlow() || parent()->isRenderInline( )); |
| 1906 | 1905 |
| 1907 // reset style flags | 1906 // reset style flags |
| 1908 if (diff == StyleDifferenceLayout || diff == StyleDifferenceLayoutPositi onedMovementOnly) { | 1907 if (diff == StyleDifferenceLayout || diff == StyleDifferenceLayoutPositi onedMovementOnly) { |
| 1909 setFloating(false); | 1908 setFloating(false); |
| 1910 clearPositionedState(); | 1909 clearPositionedState(); |
| 1911 } | 1910 } |
| 1912 setHorizontalWritingMode(true); | 1911 setHorizontalWritingMode(true); |
| 1913 setHasBoxDecorations(false); | 1912 setHasBoxDecorations(false); |
| 1914 setHasOverflowClip(false); | 1913 setHasOverflowClip(false); |
| 1915 setHasTransform(false); | 1914 setHasTransform(false); |
| 1916 setHasReflection(false); | 1915 setHasReflection(false); |
| 1917 } else | 1916 } |
| 1918 s_affectsParentBlock = false; | |
| 1919 | 1917 |
| 1920 if (view()->frameView()) { | 1918 if (view()->frameView()) { |
| 1921 bool shouldBlitOnFixedBackgroundImage = false; | 1919 bool shouldBlitOnFixedBackgroundImage = false; |
| 1922 #if ENABLE(FAST_MOBILE_SCROLLING) | 1920 #if ENABLE(FAST_MOBILE_SCROLLING) |
| 1923 // On low-powered/mobile devices, preventing blitting on a scroll can ca use noticeable delays | 1921 // On low-powered/mobile devices, preventing blitting on a scroll can ca use noticeable delays |
| 1924 // when scrolling a page with a fixed background image. As an optimizati on, assuming there are | 1922 // when scrolling a page with a fixed background image. As an optimizati on, assuming there are |
| 1925 // no fixed positoned elements on the page, we can acclerate scrolling ( via blitting) if we | 1923 // no fixed positoned elements on the page, we can acclerate scrolling ( via blitting) if we |
| 1926 // ignore the CSS property "background-attachment: fixed". | 1924 // ignore the CSS property "background-attachment: fixed". |
| 1927 #if PLATFORM(QT) | 1925 #if PLATFORM(QT) |
| 1928 if (view()->frameView()->delegatesScrolling()) | 1926 if (view()->frameView()->delegatesScrolling()) |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 1958 { | 1956 { |
| 1959 ASSERT(a->cursors() != b->cursors()); | 1957 ASSERT(a->cursors() != b->cursors()); |
| 1960 return a->cursors() && b->cursors() && *a->cursors() == *b->cursors(); | 1958 return a->cursors() && b->cursors() && *a->cursors() == *b->cursors(); |
| 1961 } | 1959 } |
| 1962 | 1960 |
| 1963 static inline bool areCursorsEqual(const RenderStyle* a, const RenderStyle* b) | 1961 static inline bool areCursorsEqual(const RenderStyle* a, const RenderStyle* b) |
| 1964 { | 1962 { |
| 1965 return a->cursor() == b->cursor() && (a->cursors() == b->cursors() || areNon IdenticalCursorListsEqual(a, b)); | 1963 return a->cursor() == b->cursor() && (a->cursors() == b->cursors() || areNon IdenticalCursorListsEqual(a, b)); |
| 1966 } | 1964 } |
| 1967 | 1965 |
| 1968 void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle* oldSt yle) | 1966 void RenderObject::styleDidChange(StyleDifference diff, const RenderStyle* oldSt yle, const StyleChangeState& state) |
| 1969 { | 1967 { |
| 1970 if (s_affectsParentBlock) | 1968 if (state.affectsParentBlock) |
| 1971 handleDynamicFloatPositionChange(); | 1969 handleDynamicFloatPositionChange(); |
| 1972 | 1970 |
| 1973 #if ENABLE(SVG) | 1971 #if ENABLE(SVG) |
| 1974 SVGRenderSupport::styleChanged(this); | 1972 SVGRenderSupport::styleChanged(this); |
| 1975 #endif | 1973 #endif |
| 1976 | 1974 |
| 1977 if (!m_parent) | 1975 if (!m_parent) |
| 1978 return; | 1976 return; |
| 1979 | 1977 |
| 1980 if (diff == StyleDifferenceLayout || diff == StyleDifferenceSimplifiedLayout ) { | 1978 if (diff == StyleDifferenceLayout || diff == StyleDifferenceSimplifiedLayout ) { |
| (...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3225 { | 3223 { |
| 3226 if (object1) { | 3224 if (object1) { |
| 3227 const WebCore::RenderObject* root = object1; | 3225 const WebCore::RenderObject* root = object1; |
| 3228 while (root->parent()) | 3226 while (root->parent()) |
| 3229 root = root->parent(); | 3227 root = root->parent(); |
| 3230 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3228 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
| 3231 } | 3229 } |
| 3232 } | 3230 } |
| 3233 | 3231 |
| 3234 #endif | 3232 #endif |
| OLD | NEW |