| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 | 79 |
| 80 static void setHasTextDescendantsOnAncestors(InlineFlowBox* box) | 80 static void setHasTextDescendantsOnAncestors(InlineFlowBox* box) |
| 81 { | 81 { |
| 82 while (box && !box->hasTextDescendants()) { | 82 while (box && !box->hasTextDescendants()) { |
| 83 box->setHasTextDescendants(); | 83 box->setHasTextDescendants(); |
| 84 box = box->parent(); | 84 box = box->parent(); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 static bool hasSelfPaintingLayer(InlineBox* box) |
| 89 { |
| 90 RenderObject& renderer = box->renderer(); |
| 91 if (renderer.isBox()) |
| 92 return toRenderBox(renderer).hasSelfPaintingLayer(); |
| 93 return false; |
| 94 } |
| 95 |
| 88 void InlineFlowBox::addToLine(InlineBox* child) | 96 void InlineFlowBox::addToLine(InlineBox* child) |
| 89 { | 97 { |
| 90 ASSERT(!child->parent()); | 98 ASSERT(!child->parent()); |
| 91 ASSERT(!child->nextOnLine()); | 99 ASSERT(!child->nextOnLine()); |
| 92 ASSERT(!child->prevOnLine()); | 100 ASSERT(!child->prevOnLine()); |
| 93 checkConsistency(); | 101 checkConsistency(); |
| 94 | 102 |
| 95 child->setParent(this); | 103 child->setParent(this); |
| 96 if (!m_firstChild) { | 104 if (!m_firstChild) { |
| 97 m_firstChild = child; | 105 m_firstChild = child; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 152 |
| 145 if (!child->renderer().isOutOfFlowPositioned()) { | 153 if (!child->renderer().isOutOfFlowPositioned()) { |
| 146 if (child->isText()) { | 154 if (child->isText()) { |
| 147 RenderStyle* childStyle = child->renderer().style(isFirstLineStyle()
); | 155 RenderStyle* childStyle = child->renderer().style(isFirstLineStyle()
); |
| 148 if (childStyle->letterSpacing() < 0 || childStyle->textShadow() || c
hildStyle->textEmphasisMark() != TextEmphasisMarkNone || childStyle->textStrokeW
idth()) | 156 if (childStyle->letterSpacing() < 0 || childStyle->textShadow() || c
hildStyle->textEmphasisMark() != TextEmphasisMarkNone || childStyle->textStrokeW
idth()) |
| 149 child->clearKnownToHaveNoOverflow(); | 157 child->clearKnownToHaveNoOverflow(); |
| 150 } else if (child->renderer().isReplaced()) { | 158 } else if (child->renderer().isReplaced()) { |
| 151 RenderBox& box = toRenderBox(child->renderer()); | 159 RenderBox& box = toRenderBox(child->renderer()); |
| 152 if (box.hasRenderOverflow() || box.hasSelfPaintingLayer()) | 160 if (box.hasRenderOverflow() || box.hasSelfPaintingLayer()) |
| 153 child->clearKnownToHaveNoOverflow(); | 161 child->clearKnownToHaveNoOverflow(); |
| 154 } else if (child->renderer().style(isFirstLineStyle())->boxShadow() || c
hild->boxModelObject()->hasSelfPaintingLayer() | 162 } else if (child->renderer().style(isFirstLineStyle())->boxShadow() || h
asSelfPaintingLayer(child) |
| 155 || child->renderer().style(isFirstLineStyle())->hasBorderImageOutset
s() | 163 || child->renderer().style(isFirstLineStyle())->hasBorderImageOutset
s() |
| 156 || child->renderer().style(isFirstLineStyle())->hasOutline()) { | 164 || child->renderer().style(isFirstLineStyle())->hasOutline()) { |
| 157 child->clearKnownToHaveNoOverflow(); | 165 child->clearKnownToHaveNoOverflow(); |
| 158 } | 166 } |
| 159 | 167 |
| 160 if (knownToHaveNoOverflow() && child->isInlineFlowBox() && !toInlineFlow
Box(child)->knownToHaveNoOverflow()) | 168 if (knownToHaveNoOverflow() && child->isInlineFlowBox() && !toInlineFlow
Box(child)->knownToHaveNoOverflow()) |
| 161 clearKnownToHaveNoOverflow(); | 169 clearKnownToHaveNoOverflow(); |
| 162 } | 170 } |
| 163 | 171 |
| 164 checkConsistency(); | 172 checkConsistency(); |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 continue; // Positioned placeholders don't affect calculations. | 890 continue; // Positioned placeholders don't affect calculations. |
| 883 | 891 |
| 884 if (curr->renderer().isText()) { | 892 if (curr->renderer().isText()) { |
| 885 InlineTextBox* text = toInlineTextBox(curr); | 893 InlineTextBox* text = toInlineTextBox(curr); |
| 886 LayoutRect textBoxOverflow(enclosingLayoutRect(text->logicalFrameRec
t())); | 894 LayoutRect textBoxOverflow(enclosingLayoutRect(text->logicalFrameRec
t())); |
| 887 addTextBoxVisualOverflow(text, textBoxDataMap, textBoxOverflow); | 895 addTextBoxVisualOverflow(text, textBoxDataMap, textBoxOverflow); |
| 888 logicalVisualOverflow.unite(textBoxOverflow); | 896 logicalVisualOverflow.unite(textBoxOverflow); |
| 889 } else if (curr->renderer().isRenderInline()) { | 897 } else if (curr->renderer().isRenderInline()) { |
| 890 InlineFlowBox* flow = toInlineFlowBox(curr); | 898 InlineFlowBox* flow = toInlineFlowBox(curr); |
| 891 flow->computeOverflow(lineTop, lineBottom, textBoxDataMap); | 899 flow->computeOverflow(lineTop, lineBottom, textBoxDataMap); |
| 892 if (!flow->boxModelObject()->hasSelfPaintingLayer()) | 900 if (!hasSelfPaintingLayer(flow)) |
| 893 logicalVisualOverflow.unite(flow->logicalVisualOverflowRect(line
Top, lineBottom)); | 901 logicalVisualOverflow.unite(flow->logicalVisualOverflowRect(line
Top, lineBottom)); |
| 894 LayoutRect childLayoutOverflow = flow->logicalLayoutOverflowRect(lin
eTop, lineBottom); | 902 LayoutRect childLayoutOverflow = flow->logicalLayoutOverflowRect(lin
eTop, lineBottom); |
| 895 childLayoutOverflow.move(flow->boxModelObject()->relativePositionLog
icalOffset()); | 903 childLayoutOverflow.move(flow->boxModelObject()->relativePositionLog
icalOffset()); |
| 896 logicalLayoutOverflow.unite(childLayoutOverflow); | 904 logicalLayoutOverflow.unite(childLayoutOverflow); |
| 897 } else { | 905 } else { |
| 898 addReplacedChildOverflow(curr, logicalLayoutOverflow, logicalVisualO
verflow); | 906 addReplacedChildOverflow(curr, logicalLayoutOverflow, logicalVisualO
verflow); |
| 899 } | 907 } |
| 900 } | 908 } |
| 901 | 909 |
| 902 setOverflowFromLogicalRects(logicalLayoutOverflow, logicalVisualOverflow, li
neTop, lineBottom); | 910 setOverflowFromLogicalRects(logicalLayoutOverflow, logicalVisualOverflow, li
neTop, lineBottom); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 { | 943 { |
| 936 LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom)); | 944 LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom)); |
| 937 overflowRect.moveBy(accumulatedOffset); | 945 overflowRect.moveBy(accumulatedOffset); |
| 938 if (!locationInContainer.intersects(overflowRect)) | 946 if (!locationInContainer.intersects(overflowRect)) |
| 939 return false; | 947 return false; |
| 940 | 948 |
| 941 // Check children first. | 949 // Check children first. |
| 942 // We need to account for culled inline parents of the hit-tested nodes, so
that they may also get included in area-based hit-tests. | 950 // We need to account for culled inline parents of the hit-tested nodes, so
that they may also get included in area-based hit-tests. |
| 943 RenderObject* culledParent = 0; | 951 RenderObject* culledParent = 0; |
| 944 for (InlineBox* curr = lastChild(); curr; curr = curr->prevOnLine()) { | 952 for (InlineBox* curr = lastChild(); curr; curr = curr->prevOnLine()) { |
| 945 if (curr->renderer().isText() || !curr->boxModelObject()->hasSelfPaintin
gLayer()) { | 953 if (curr->renderer().isText() || !hasSelfPaintingLayer(curr)) { |
| 946 RenderObject* newParent = 0; | 954 RenderObject* newParent = 0; |
| 947 // Culled parents are only relevant for area-based hit-tests, so ign
ore it in point-based ones. | 955 // Culled parents are only relevant for area-based hit-tests, so ign
ore it in point-based ones. |
| 948 if (locationInContainer.isRectBasedTest()) { | 956 if (locationInContainer.isRectBasedTest()) { |
| 949 newParent = curr->renderer().parent(); | 957 newParent = curr->renderer().parent(); |
| 950 if (newParent == renderer()) | 958 if (newParent == renderer()) |
| 951 newParent = 0; | 959 newParent = 0; |
| 952 } | 960 } |
| 953 // Check the culled parent after all its children have been checked,
to do this we wait until | 961 // Check the culled parent after all its children have been checked,
to do this we wait until |
| 954 // we are about to test an element with a different parent. | 962 // we are about to test an element with a different parent. |
| 955 if (newParent != culledParent) { | 963 if (newParent != culledParent) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 { | 1001 { |
| 994 LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom)); | 1002 LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom)); |
| 995 overflowRect.moveBy(paintOffset); | 1003 overflowRect.moveBy(paintOffset); |
| 996 | 1004 |
| 997 if (!paintInfo.rect.intersects(pixelSnappedIntRect(overflowRect))) | 1005 if (!paintInfo.rect.intersects(pixelSnappedIntRect(overflowRect))) |
| 998 return; | 1006 return; |
| 999 | 1007 |
| 1000 paintBoxDecorationBackground(paintInfo, paintOffset); | 1008 paintBoxDecorationBackground(paintInfo, paintOffset); |
| 1001 | 1009 |
| 1002 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 1010 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
| 1003 if (curr->renderer().isText() || !curr->boxModelObject()->hasSelfPaintin
gLayer()) | 1011 if (curr->renderer().isText() || !hasSelfPaintingLayer(curr)) |
| 1004 curr->paint(paintInfo, paintOffset, lineTop, lineBottom, layers); | 1012 curr->paint(paintInfo, paintOffset, lineTop, lineBottom, layers); |
| 1005 } | 1013 } |
| 1006 } | 1014 } |
| 1007 | 1015 |
| 1008 void InlineFlowBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c,
const FillLayer& fillLayer, const LayoutRect& rect) | 1016 void InlineFlowBox::paintFillLayers(const PaintInfo& paintInfo, const Color& c,
const FillLayer& fillLayer, const LayoutRect& rect) |
| 1009 { | 1017 { |
| 1010 if (fillLayer.next()) | 1018 if (fillLayer.next()) |
| 1011 paintFillLayers(paintInfo, c, *fillLayer.next(), rect); | 1019 paintFillLayers(paintInfo, c, *fillLayer.next(), rect); |
| 1012 paintFillLayer(paintInfo, c, fillLayer, rect); | 1020 paintFillLayer(paintInfo, c, fillLayer, rect); |
| 1013 } | 1021 } |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1352 ASSERT(child->prevOnLine() == prev); | 1360 ASSERT(child->prevOnLine() == prev); |
| 1353 prev = child; | 1361 prev = child; |
| 1354 } | 1362 } |
| 1355 ASSERT(prev == m_lastChild); | 1363 ASSERT(prev == m_lastChild); |
| 1356 #endif | 1364 #endif |
| 1357 } | 1365 } |
| 1358 | 1366 |
| 1359 #endif | 1367 #endif |
| 1360 | 1368 |
| 1361 } // namespace blink | 1369 } // namespace blink |
| OLD | NEW |