| 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) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "core/dom/StyleEngine.h" | 31 #include "core/dom/StyleEngine.h" |
| 32 #include "core/dom/shadow/ShadowRoot.h" | 32 #include "core/dom/shadow/ShadowRoot.h" |
| 33 #include "core/editing/Editor.h" | 33 #include "core/editing/Editor.h" |
| 34 #include "core/editing/FrameSelection.h" | 34 #include "core/editing/FrameSelection.h" |
| 35 #include "core/events/OverflowEvent.h" | 35 #include "core/events/OverflowEvent.h" |
| 36 #include "core/fetch/ResourceLoadPriorityOptimizer.h" | 36 #include "core/fetch/ResourceLoadPriorityOptimizer.h" |
| 37 #include "core/frame/FrameView.h" | 37 #include "core/frame/FrameView.h" |
| 38 #include "core/frame/LocalFrame.h" | 38 #include "core/frame/LocalFrame.h" |
| 39 #include "core/frame/Settings.h" | 39 #include "core/frame/Settings.h" |
| 40 #include "core/page/Page.h" | 40 #include "core/page/Page.h" |
| 41 #include "core/paint/BlockPainter.h" |
| 41 #include "core/paint/BoxPainter.h" | 42 #include "core/paint/BoxPainter.h" |
| 42 #include "core/rendering/GraphicsContextAnnotator.h" | 43 #include "core/rendering/GraphicsContextAnnotator.h" |
| 43 #include "core/rendering/HitTestLocation.h" | 44 #include "core/rendering/HitTestLocation.h" |
| 44 #include "core/rendering/HitTestResult.h" | 45 #include "core/rendering/HitTestResult.h" |
| 45 #include "core/rendering/InlineIterator.h" | 46 #include "core/rendering/InlineIterator.h" |
| 46 #include "core/rendering/InlineTextBox.h" | 47 #include "core/rendering/InlineTextBox.h" |
| 47 #include "core/rendering/PaintInfo.h" | 48 #include "core/rendering/PaintInfo.h" |
| 48 #include "core/rendering/RenderCombineText.h" | 49 #include "core/rendering/RenderCombineText.h" |
| 49 #include "core/rendering/RenderDeprecatedFlexibleBox.h" | 50 #include "core/rendering/RenderDeprecatedFlexibleBox.h" |
| 50 #include "core/rendering/RenderFlexibleBox.h" | 51 #include "core/rendering/RenderFlexibleBox.h" |
| (...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1751 ASSERT(!needsLayout()); | 1752 ASSERT(!needsLayout()); |
| 1752 if (needsLayout()) | 1753 if (needsLayout()) |
| 1753 return; | 1754 return; |
| 1754 | 1755 |
| 1755 if (view()->layoutState()->pageLogicalHeightChanged() || (view()->layoutStat
e()->pageLogicalHeight() && view()->layoutState()->pageLogicalOffset(*this, logi
calTop()) != pageLogicalOffset())) | 1756 if (view()->layoutState()->pageLogicalHeightChanged() || (view()->layoutStat
e()->pageLogicalHeight() && view()->layoutState()->pageLogicalOffset(*this, logi
calTop()) != pageLogicalOffset())) |
| 1756 layoutScope.setChildNeedsLayout(this); | 1757 layoutScope.setChildNeedsLayout(this); |
| 1757 } | 1758 } |
| 1758 | 1759 |
| 1759 void RenderBlock::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) | 1760 void RenderBlock::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
| 1760 { | 1761 { |
| 1761 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); | 1762 BlockPainter(*this).paint(paintInfo, paintOffset); |
| 1762 | |
| 1763 LayoutPoint adjustedPaintOffset = paintOffset + location(); | |
| 1764 | |
| 1765 PaintPhase phase = paintInfo.phase; | |
| 1766 | |
| 1767 LayoutRect overflowBox; | |
| 1768 // Check if we need to do anything at all. | |
| 1769 // FIXME: Could eliminate the isDocumentElement() check if we fix background
painting so that the RenderView | |
| 1770 // paints the root's background. | |
| 1771 if (!isDocumentElement()) { | |
| 1772 overflowBox = overflowRectForPaintRejection(); | |
| 1773 flipForWritingMode(overflowBox); | |
| 1774 overflowBox.moveBy(adjustedPaintOffset); | |
| 1775 if (!overflowBox.intersects(paintInfo.rect)) | |
| 1776 return; | |
| 1777 } | |
| 1778 | |
| 1779 // There are some cases where not all clipped visual overflow is accounted f
or. | |
| 1780 // FIXME: reduce the number of such cases. | |
| 1781 ContentsClipBehavior contentsClipBehavior = ForceContentsClip; | |
| 1782 if (hasOverflowClip() && !hasControlClip() && !(shouldPaintSelectionGaps() &
& phase == PaintPhaseForeground) && !hasCaret()) | |
| 1783 contentsClipBehavior = SkipContentsClipIfPossible; | |
| 1784 | |
| 1785 bool pushedClip = pushContentsClip(paintInfo, adjustedPaintOffset, contentsC
lipBehavior); | |
| 1786 { | |
| 1787 GraphicsContextCullSaver cullSaver(*paintInfo.context); | |
| 1788 // Cull if we have more than one child and we didn't already clip. | |
| 1789 bool shouldCull = document().settings()->containerCullingEnabled() && !p
ushedClip && !isDocumentElement() | |
| 1790 && firstChild() && lastChild() && firstChild() != lastChild(); | |
| 1791 if (shouldCull) | |
| 1792 cullSaver.cull(overflowBox); | |
| 1793 | |
| 1794 paintObject(paintInfo, adjustedPaintOffset); | |
| 1795 } | |
| 1796 if (pushedClip) | |
| 1797 popContentsClip(paintInfo, phase, adjustedPaintOffset); | |
| 1798 | |
| 1799 // Our scrollbar widgets paint exactly when we tell them to, so that they wo
rk properly with | |
| 1800 // z-index. We paint after we painted the background/border, so that the sc
rollbars will | |
| 1801 // sit above the background/border. | |
| 1802 if (hasOverflowClip() && style()->visibility() == VISIBLE && (phase == Paint
PhaseBlockBackground || phase == PaintPhaseChildBlockBackground) && paintInfo.sh
ouldPaintWithinRoot(this) && !paintInfo.paintRootBackgroundOnly()) | |
| 1803 layer()->scrollableArea()->paintOverflowControls(paintInfo.context, roun
dedIntPoint(adjustedPaintOffset), paintInfo.rect, false /* paintingOverlayContro
ls */); | |
| 1804 } | |
| 1805 | |
| 1806 void RenderBlock::paintColumnRules(PaintInfo& paintInfo, const LayoutPoint& pain
tOffset) | |
| 1807 { | |
| 1808 const Color& ruleColor = resolveColor(CSSPropertyWebkitColumnRuleColor); | |
| 1809 bool ruleTransparent = style()->columnRuleIsTransparent(); | |
| 1810 EBorderStyle ruleStyle = style()->columnRuleStyle(); | |
| 1811 LayoutUnit ruleThickness = style()->columnRuleWidth(); | |
| 1812 LayoutUnit colGap = columnGap(); | |
| 1813 bool renderRule = ruleStyle > BHIDDEN && !ruleTransparent; | |
| 1814 if (!renderRule) | |
| 1815 return; | |
| 1816 | |
| 1817 ColumnInfo* colInfo = columnInfo(); | |
| 1818 unsigned colCount = columnCount(colInfo); | |
| 1819 | |
| 1820 bool antialias = BoxPainter::shouldAntialiasLines(paintInfo.context); | |
| 1821 | |
| 1822 if (colInfo->progressionAxis() == ColumnInfo::InlineAxis) { | |
| 1823 bool leftToRight = style()->isLeftToRightDirection(); | |
| 1824 LayoutUnit currLogicalLeftOffset = leftToRight ? LayoutUnit() : contentL
ogicalWidth(); | |
| 1825 LayoutUnit ruleAdd = logicalLeftOffsetForContent(); | |
| 1826 LayoutUnit ruleLogicalLeft = leftToRight ? LayoutUnit() : contentLogical
Width(); | |
| 1827 LayoutUnit inlineDirectionSize = colInfo->desiredColumnWidth(); | |
| 1828 BoxSide boxSide = isHorizontalWritingMode() | |
| 1829 ? leftToRight ? BSLeft : BSRight | |
| 1830 : leftToRight ? BSTop : BSBottom; | |
| 1831 | |
| 1832 for (unsigned i = 0; i < colCount; i++) { | |
| 1833 // Move to the next position. | |
| 1834 if (leftToRight) { | |
| 1835 ruleLogicalLeft += inlineDirectionSize + colGap / 2; | |
| 1836 currLogicalLeftOffset += inlineDirectionSize + colGap; | |
| 1837 } else { | |
| 1838 ruleLogicalLeft -= (inlineDirectionSize + colGap / 2); | |
| 1839 currLogicalLeftOffset -= (inlineDirectionSize + colGap); | |
| 1840 } | |
| 1841 | |
| 1842 // Now paint the column rule. | |
| 1843 if (i < colCount - 1) { | |
| 1844 LayoutUnit ruleLeft = isHorizontalWritingMode() ? paintOffset.x(
) + ruleLogicalLeft - ruleThickness / 2 + ruleAdd : paintOffset.x() + borderLeft
() + paddingLeft(); | |
| 1845 LayoutUnit ruleRight = isHorizontalWritingMode() ? ruleLeft + ru
leThickness : ruleLeft + contentWidth(); | |
| 1846 LayoutUnit ruleTop = isHorizontalWritingMode() ? paintOffset.y()
+ borderTop() + paddingTop() : paintOffset.y() + ruleLogicalLeft - ruleThicknes
s / 2 + ruleAdd; | |
| 1847 LayoutUnit ruleBottom = isHorizontalWritingMode() ? ruleTop + co
ntentHeight() : ruleTop + ruleThickness; | |
| 1848 IntRect pixelSnappedRuleRect = pixelSnappedIntRectFromEdges(rule
Left, ruleTop, ruleRight, ruleBottom); | |
| 1849 drawLineForBoxSide(paintInfo.context, pixelSnappedRuleRect.x(),
pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRuleRect.maxY
(), boxSide, ruleColor, ruleStyle, 0, 0, antialias); | |
| 1850 } | |
| 1851 | |
| 1852 ruleLogicalLeft = currLogicalLeftOffset; | |
| 1853 } | |
| 1854 } else { | |
| 1855 bool topToBottom = !style()->isFlippedBlocksWritingMode(); | |
| 1856 LayoutUnit ruleLeft = isHorizontalWritingMode() | |
| 1857 ? borderLeft() + paddingLeft() | |
| 1858 : colGap / 2 - colGap - ruleThickness / 2 + borderBefore() + padding
Before(); | |
| 1859 LayoutUnit ruleWidth = isHorizontalWritingMode() ? contentWidth() : rule
Thickness; | |
| 1860 LayoutUnit ruleTop = isHorizontalWritingMode() | |
| 1861 ? colGap / 2 - colGap - ruleThickness / 2 + borderBefore() + padding
Before() | |
| 1862 : borderStart() + paddingStart(); | |
| 1863 LayoutUnit ruleHeight = isHorizontalWritingMode() ? ruleThickness : cont
entHeight(); | |
| 1864 LayoutRect ruleRect(ruleLeft, ruleTop, ruleWidth, ruleHeight); | |
| 1865 | |
| 1866 if (!topToBottom) { | |
| 1867 if (isHorizontalWritingMode()) | |
| 1868 ruleRect.setY(height() - ruleRect.maxY()); | |
| 1869 else | |
| 1870 ruleRect.setX(width() - ruleRect.maxX()); | |
| 1871 } | |
| 1872 | |
| 1873 ruleRect.moveBy(paintOffset); | |
| 1874 | |
| 1875 BoxSide boxSide = isHorizontalWritingMode() | |
| 1876 ? topToBottom ? BSTop : BSBottom | |
| 1877 : topToBottom ? BSLeft : BSRight; | |
| 1878 | |
| 1879 LayoutSize step(0, topToBottom ? colInfo->columnHeight() + colGap : -(co
lInfo->columnHeight() + colGap)); | |
| 1880 if (!isHorizontalWritingMode()) | |
| 1881 step = step.transposedSize(); | |
| 1882 | |
| 1883 for (unsigned i = 1; i < colCount; i++) { | |
| 1884 ruleRect.move(step); | |
| 1885 IntRect pixelSnappedRuleRect = pixelSnappedIntRect(ruleRect); | |
| 1886 drawLineForBoxSide(paintInfo.context, pixelSnappedRuleRect.x(), pixe
lSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRuleRect.maxY(),
boxSide, ruleColor, ruleStyle, 0, 0, antialias); | |
| 1887 } | |
| 1888 } | |
| 1889 } | |
| 1890 | |
| 1891 void RenderBlock::paintColumnContents(PaintInfo& paintInfo, const LayoutPoint& p
aintOffset, bool paintingFloats) | |
| 1892 { | |
| 1893 // We need to do multiple passes, breaking up our child painting into strips
. | |
| 1894 GraphicsContext* context = paintInfo.context; | |
| 1895 ColumnInfo* colInfo = columnInfo(); | |
| 1896 unsigned colCount = columnCount(colInfo); | |
| 1897 if (!colCount) | |
| 1898 return; | |
| 1899 LayoutUnit currLogicalTopOffset = 0; | |
| 1900 LayoutUnit colGap = columnGap(); | |
| 1901 for (unsigned i = 0; i < colCount; i++) { | |
| 1902 // For each rect, we clip to the rect, and then we adjust our coords. | |
| 1903 LayoutRect colRect = columnRectAt(colInfo, i); | |
| 1904 flipForWritingMode(colRect); | |
| 1905 LayoutUnit logicalLeftOffset = (isHorizontalWritingMode() ? colRect.x()
: colRect.y()) - logicalLeftOffsetForContent(); | |
| 1906 LayoutSize offset = isHorizontalWritingMode() ? LayoutSize(logicalLeftOf
fset, currLogicalTopOffset) : LayoutSize(currLogicalTopOffset, logicalLeftOffset
); | |
| 1907 if (colInfo->progressionAxis() == ColumnInfo::BlockAxis) { | |
| 1908 if (isHorizontalWritingMode()) | |
| 1909 offset.expand(0, colRect.y() - borderTop() - paddingTop()); | |
| 1910 else | |
| 1911 offset.expand(colRect.x() - borderLeft() - paddingLeft(), 0); | |
| 1912 } | |
| 1913 colRect.moveBy(paintOffset); | |
| 1914 PaintInfo info(paintInfo); | |
| 1915 info.rect.intersect(enclosingIntRect(colRect)); | |
| 1916 | |
| 1917 if (!info.rect.isEmpty()) { | |
| 1918 GraphicsContextStateSaver stateSaver(*context); | |
| 1919 LayoutRect clipRect(colRect); | |
| 1920 | |
| 1921 if (i < colCount - 1) { | |
| 1922 if (isHorizontalWritingMode()) | |
| 1923 clipRect.expand(colGap / 2, 0); | |
| 1924 else | |
| 1925 clipRect.expand(0, colGap / 2); | |
| 1926 } | |
| 1927 // Each strip pushes a clip, since column boxes are specified as bei
ng | |
| 1928 // like overflow:hidden. | |
| 1929 // FIXME: Content and column rules that extend outside column boxes
at the edges of the multi-column element | |
| 1930 // are clipped according to the 'overflow' property. | |
| 1931 context->clip(enclosingIntRect(clipRect)); | |
| 1932 | |
| 1933 // Adjust our x and y when painting. | |
| 1934 LayoutPoint adjustedPaintOffset = paintOffset + offset; | |
| 1935 if (paintingFloats) | |
| 1936 paintFloats(info, adjustedPaintOffset, paintInfo.phase == PaintP
haseSelection || paintInfo.phase == PaintPhaseTextClip); | |
| 1937 else | |
| 1938 paintContents(info, adjustedPaintOffset); | |
| 1939 } | |
| 1940 | |
| 1941 LayoutUnit blockDelta = (isHorizontalWritingMode() ? colRect.height() :
colRect.width()); | |
| 1942 if (style()->isFlippedBlocksWritingMode()) | |
| 1943 currLogicalTopOffset += blockDelta; | |
| 1944 else | |
| 1945 currLogicalTopOffset -= blockDelta; | |
| 1946 } | |
| 1947 } | |
| 1948 | |
| 1949 void RenderBlock::paintContents(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) | |
| 1950 { | |
| 1951 // Avoid painting descendants of the root element when stylesheets haven't l
oaded. This eliminates FOUC. | |
| 1952 // It's ok not to draw, because later on, when all the stylesheets do load,
styleResolverChanged() on the Document | |
| 1953 // will do a full paint invalidation. | |
| 1954 if (document().didLayoutWithPendingStylesheets() && !isRenderView()) | |
| 1955 return; | |
| 1956 | |
| 1957 if (childrenInline()) | |
| 1958 m_lineBoxes.paint(this, paintInfo, paintOffset); | |
| 1959 else { | |
| 1960 PaintPhase newPhase = (paintInfo.phase == PaintPhaseChildOutlines) ? Pai
ntPhaseOutline : paintInfo.phase; | |
| 1961 newPhase = (newPhase == PaintPhaseChildBlockBackgrounds) ? PaintPhaseChi
ldBlockBackground : newPhase; | |
| 1962 | |
| 1963 // We don't paint our own background, but we do let the kids paint their
backgrounds. | |
| 1964 PaintInfo paintInfoForChild(paintInfo); | |
| 1965 paintInfoForChild.phase = newPhase; | |
| 1966 paintInfoForChild.updatePaintingRootForChildren(this); | |
| 1967 paintChildren(paintInfoForChild, paintOffset); | |
| 1968 } | |
| 1969 } | 1763 } |
| 1970 | 1764 |
| 1971 void RenderBlock::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) | 1765 void RenderBlock::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) |
| 1972 { | 1766 { |
| 1973 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) | 1767 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBo
x()) |
| 1974 paintChild(child, paintInfo, paintOffset); | 1768 paintChild(child, paintInfo, paintOffset); |
| 1975 } | 1769 } |
| 1976 | 1770 |
| 1977 void RenderBlock::paintChild(RenderBox* child, PaintInfo& paintInfo, const Layou
tPoint& paintOffset) | 1771 void RenderBlock::paintChild(RenderBox* child, PaintInfo& paintInfo, const Layou
tPoint& paintOffset) |
| 1978 { | 1772 { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2006 renderer->paint(info, childPoint); | 1800 renderer->paint(info, childPoint); |
| 2007 info.phase = PaintPhaseFloat; | 1801 info.phase = PaintPhaseFloat; |
| 2008 renderer->paint(info, childPoint); | 1802 renderer->paint(info, childPoint); |
| 2009 info.phase = PaintPhaseForeground; | 1803 info.phase = PaintPhaseForeground; |
| 2010 renderer->paint(info, childPoint); | 1804 renderer->paint(info, childPoint); |
| 2011 info.phase = PaintPhaseOutline; | 1805 info.phase = PaintPhaseOutline; |
| 2012 renderer->paint(info, childPoint); | 1806 renderer->paint(info, childPoint); |
| 2013 } | 1807 } |
| 2014 } | 1808 } |
| 2015 | 1809 |
| 2016 static inline bool caretBrowsingEnabled(const Frame* frame) | |
| 2017 { | |
| 2018 Settings* settings = frame->settings(); | |
| 2019 return settings && settings->caretBrowsingEnabled(); | |
| 2020 } | |
| 2021 | |
| 2022 static inline bool hasCursorCaret(const FrameSelection& selection, const RenderB
lock* block, bool caretBrowsing) | |
| 2023 { | |
| 2024 return selection.caretRenderer() == block && (selection.hasEditableStyle() |
| caretBrowsing); | |
| 2025 } | |
| 2026 | |
| 2027 static inline bool hasDragCaret(const DragCaretController& dragCaretController,
const RenderBlock* block, bool caretBrowsing) | |
| 2028 { | |
| 2029 return dragCaretController.caretRenderer() == block && (dragCaretController.
isContentEditable() || caretBrowsing); | |
| 2030 } | |
| 2031 | |
| 2032 bool RenderBlock::hasCaret() const | |
| 2033 { | |
| 2034 bool caretBrowsing = caretBrowsingEnabled(frame()); | |
| 2035 return hasCursorCaret(frame()->selection(), this, caretBrowsing) | |
| 2036 || hasDragCaret(frame()->page()->dragCaretController(), this, caretBrows
ing); | |
| 2037 } | |
| 2038 | |
| 2039 void RenderBlock::paintCarets(PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) | |
| 2040 { | |
| 2041 bool caretBrowsing = caretBrowsingEnabled(frame()); | |
| 2042 | |
| 2043 FrameSelection& selection = frame()->selection(); | |
| 2044 if (hasCursorCaret(selection, this, caretBrowsing)) { | |
| 2045 selection.paintCaret(paintInfo.context, paintOffset, paintInfo.rect); | |
| 2046 } | |
| 2047 | |
| 2048 DragCaretController& dragCaretController = frame()->page()->dragCaretControl
ler(); | |
| 2049 if (hasDragCaret(dragCaretController, this, caretBrowsing)) { | |
| 2050 dragCaretController.paintDragCaret(frame(), paintInfo.context, paintOffs
et, paintInfo.rect); | |
| 2051 } | |
| 2052 } | |
| 2053 | |
| 2054 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) | 1810 void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs
et) |
| 2055 { | 1811 { |
| 2056 PaintPhase paintPhase = paintInfo.phase; | 1812 BlockPainter(*this).paintObject(paintInfo, paintOffset); |
| 2057 | |
| 2058 // Adjust our painting position if we're inside a scrolled layer (e.g., an o
verflow:auto div). | |
| 2059 LayoutPoint scrolledOffset = paintOffset; | |
| 2060 if (hasOverflowClip()) | |
| 2061 scrolledOffset.move(-scrolledContentOffset()); | |
| 2062 | |
| 2063 // 1. paint background, borders etc | |
| 2064 if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChil
dBlockBackground) && style()->visibility() == VISIBLE) { | |
| 2065 if (hasBoxDecorationBackground()) | |
| 2066 paintBoxDecorationBackground(paintInfo, paintOffset); | |
| 2067 if (hasColumns() && !paintInfo.paintRootBackgroundOnly()) | |
| 2068 paintColumnRules(paintInfo, scrolledOffset); | |
| 2069 } | |
| 2070 | |
| 2071 if (paintPhase == PaintPhaseMask && style()->visibility() == VISIBLE) { | |
| 2072 paintMask(paintInfo, paintOffset); | |
| 2073 return; | |
| 2074 } | |
| 2075 | |
| 2076 if (paintPhase == PaintPhaseClippingMask && style()->visibility() == VISIBLE
) { | |
| 2077 paintClippingMask(paintInfo, paintOffset); | |
| 2078 return; | |
| 2079 } | |
| 2080 | |
| 2081 // We're done. We don't bother painting any children. | |
| 2082 if (paintPhase == PaintPhaseBlockBackground || paintInfo.paintRootBackground
Only()) | |
| 2083 return; | |
| 2084 | |
| 2085 // 2. paint contents | |
| 2086 if (paintPhase != PaintPhaseSelfOutline) { | |
| 2087 if (hasColumns()) | |
| 2088 paintColumnContents(paintInfo, scrolledOffset); | |
| 2089 else | |
| 2090 paintContents(paintInfo, scrolledOffset); | |
| 2091 } | |
| 2092 | |
| 2093 // 3. paint selection | |
| 2094 // FIXME: Make this work with multi column layouts. For now don't fill gaps
. | |
| 2095 bool isPrinting = document().printing(); | |
| 2096 if (!isPrinting && !hasColumns()) | |
| 2097 paintSelection(paintInfo, scrolledOffset); // Fill in gaps in selection
on lines and between blocks. | |
| 2098 | |
| 2099 // 4. paint floats. | |
| 2100 if (paintPhase == PaintPhaseFloat || paintPhase == PaintPhaseSelection || pa
intPhase == PaintPhaseTextClip) { | |
| 2101 if (hasColumns()) | |
| 2102 paintColumnContents(paintInfo, scrolledOffset, true); | |
| 2103 else | |
| 2104 paintFloats(paintInfo, scrolledOffset, paintPhase == PaintPhaseSelec
tion || paintPhase == PaintPhaseTextClip); | |
| 2105 } | |
| 2106 | |
| 2107 // 5. paint outline. | |
| 2108 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline)
&& style()->hasOutline() && style()->visibility() == VISIBLE) { | |
| 2109 // Don't paint focus ring for anonymous block continuation because the | |
| 2110 // inline element having outline-style:auto paints the whole focus ring. | |
| 2111 if (!style()->outlineStyleIsAuto() || !isAnonymousBlockContinuation()) | |
| 2112 paintOutline(paintInfo, LayoutRect(paintOffset, size())); | |
| 2113 } | |
| 2114 | |
| 2115 // 6. paint continuation outlines. | |
| 2116 if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseChildOutline
s)) | |
| 2117 paintContinuationOutlines(paintInfo, paintOffset); | |
| 2118 | |
| 2119 // 7. paint caret. | |
| 2120 // If the caret's node's render object's containing block is this block, and
the paint action is PaintPhaseForeground, | |
| 2121 // then paint the caret. | |
| 2122 if (paintPhase == PaintPhaseForeground) | |
| 2123 paintCarets(paintInfo, paintOffset); | |
| 2124 } | 1813 } |
| 2125 | 1814 |
| 2126 RenderInline* RenderBlock::inlineElementContinuation() const | 1815 RenderInline* RenderBlock::inlineElementContinuation() const |
| 2127 { | 1816 { |
| 2128 RenderBoxModelObject* continuation = this->continuation(); | 1817 RenderBoxModelObject* continuation = this->continuation(); |
| 2129 return continuation && continuation->isInline() ? toRenderInline(continuatio
n) : 0; | 1818 return continuation && continuation->isInline() ? toRenderInline(continuatio
n) : 0; |
| 2130 } | 1819 } |
| 2131 | 1820 |
| 2132 RenderBlock* RenderBlock::blockElementContinuation() const | 1821 RenderBlock* RenderBlock::blockElementContinuation() const |
| 2133 { | 1822 { |
| (...skipping 2676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4810 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 4499 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
| 4811 { | 4500 { |
| 4812 showRenderObject(); | 4501 showRenderObject(); |
| 4813 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 4502 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 4814 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 4503 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 4815 } | 4504 } |
| 4816 | 4505 |
| 4817 #endif | 4506 #endif |
| 4818 | 4507 |
| 4819 } // namespace blink | 4508 } // namespace blink |
| OLD | NEW |