Chromium Code Reviews| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 if (!child->renderer()->isOutOfFlowPositioned()) { | 157 if (!child->renderer()->isOutOfFlowPositioned()) { |
| 158 if (child->isText()) { | 158 if (child->isText()) { |
| 159 RenderStyle* childStyle = child->renderer()->style(isFirstLineStyle( )); | 159 RenderStyle* childStyle = child->renderer()->style(isFirstLineStyle( )); |
| 160 if (childStyle->letterSpacing() < 0 || childStyle->textShadow() || c hildStyle->textEmphasisMark() != TextEmphasisMarkNone || childStyle->textStrokeW idth()) | 160 if (childStyle->letterSpacing() < 0 || childStyle->textShadow() || c hildStyle->textEmphasisMark() != TextEmphasisMarkNone || childStyle->textStrokeW idth()) |
| 161 child->clearKnownToHaveNoOverflow(); | 161 child->clearKnownToHaveNoOverflow(); |
| 162 } else if (child->renderer()->isReplaced()) { | 162 } else if (child->renderer()->isReplaced()) { |
| 163 RenderBox* box = toRenderBox(child->renderer()); | 163 RenderBox* box = toRenderBox(child->renderer()); |
| 164 if (box->hasRenderOverflow() || box->hasSelfPaintingLayer()) | 164 if (box->hasRenderOverflow() || box->hasSelfPaintingLayer()) |
| 165 child->clearKnownToHaveNoOverflow(); | 165 child->clearKnownToHaveNoOverflow(); |
| 166 } else if (!child->renderer()->isBR() && (child->renderer()->style(isFir stLineStyle())->boxShadow() || child->boxModelObject()->hasSelfPaintingLayer() | 166 } else if (!child->renderer()->isBR() && (child->renderer()->style(isFir stLineStyle())->boxShadow() || child->boxModelObject()->hasSelfPaintingLayer() |
| 167 || (child->renderer()->isListMarker() && !toRenderListMarker( child->renderer())->isInside()) | 167 || (child->renderer()->isListMarker() && !toRenderListMarker(child-> renderer())->isInside()) |
| 168 || child->renderer()->style(isFirstLineStyle())->hasBorderIma geOutsets())) | 168 || child->renderer()->style(isFirstLineStyle())->hasBorderImageOutse ts() |
| 169 || child->renderer()->style(isFirstLineStyle())->hasOutline())) | |
| 169 child->clearKnownToHaveNoOverflow(); | 170 child->clearKnownToHaveNoOverflow(); |
| 170 | 171 |
| 171 if (knownToHaveNoOverflow() && child->isInlineFlowBox() && !toInlineFlow Box(child)->knownToHaveNoOverflow()) | 172 if (knownToHaveNoOverflow() && child->isInlineFlowBox() && !toInlineFlow Box(child)->knownToHaveNoOverflow()) |
| 172 clearKnownToHaveNoOverflow(); | 173 clearKnownToHaveNoOverflow(); |
| 173 } | 174 } |
| 174 | 175 |
| 175 checkConsistency(); | 176 checkConsistency(); |
| 176 } | 177 } |
| 177 | 178 |
| 178 void InlineFlowBox::removeChild(InlineBox* child) | 179 void InlineFlowBox::removeChild(InlineBox* child) |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 822 LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogica lLeft : LayoutUnit(); | 823 LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogica lLeft : LayoutUnit(); |
| 823 LayoutUnit outsetLogicalRight = includeLogicalRightEdge() ? borderOutsetLogi calRight : LayoutUnit(); | 824 LayoutUnit outsetLogicalRight = includeLogicalRightEdge() ? borderOutsetLogi calRight : LayoutUnit(); |
| 824 | 825 |
| 825 LayoutUnit logicalLeftVisualOverflow = min(pixelSnappedLogicalLeft() - outse tLogicalLeft, logicalVisualOverflow.x()); | 826 LayoutUnit logicalLeftVisualOverflow = min(pixelSnappedLogicalLeft() - outse tLogicalLeft, logicalVisualOverflow.x()); |
| 826 LayoutUnit logicalRightVisualOverflow = max(pixelSnappedLogicalRight() + out setLogicalRight, logicalVisualOverflow.maxX()); | 827 LayoutUnit logicalRightVisualOverflow = max(pixelSnappedLogicalRight() + out setLogicalRight, logicalVisualOverflow.maxX()); |
| 827 | 828 |
| 828 logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisu alOverflow, | 829 logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisu alOverflow, |
| 829 logicalRightVisualOverflow - logicalLeftV isualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow); | 830 logicalRightVisualOverflow - logicalLeftV isualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow); |
| 830 } | 831 } |
| 831 | 832 |
| 833 inline void InlineFlowBox::addOutlineVisualOverflow(LayoutRect& logicalVisualOve rflow) | |
| 834 { | |
| 835 // outline on root line boxes is applying to the block and not to the lines. | |
|
leviw_travelin_and_unemployed
2014/03/11 22:51:10
Nit: is applied.
Julien - ping for review
2014/03/12 03:18:58
Done.
| |
| 836 if (!parent()) | |
| 837 return; | |
| 838 | |
| 839 RenderStyle* style = renderer()->style(isFirstLineStyle()); | |
| 840 if (!style->hasOutline()) | |
| 841 return; | |
| 842 | |
| 843 unsigned short outlineSize = style->outlineSize(); | |
| 844 logicalVisualOverflow.inflate(outlineSize); | |
| 845 } | |
| 846 | |
| 832 inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, Glyp hOverflowAndFallbackFontsMap& textBoxDataMap, LayoutRect& logicalVisualOverflow) | 847 inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, Glyp hOverflowAndFallbackFontsMap& textBoxDataMap, LayoutRect& logicalVisualOverflow) |
| 833 { | 848 { |
| 834 if (textBox->knownToHaveNoOverflow()) | 849 if (textBox->knownToHaveNoOverflow()) |
| 835 return; | 850 return; |
| 836 | 851 |
| 837 RenderStyle* style = textBox->renderer()->style(isFirstLineStyle()); | 852 RenderStyle* style = textBox->renderer()->style(isFirstLineStyle()); |
| 838 | 853 |
| 839 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox) ; | 854 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox) ; |
| 840 GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->value.s econd; | 855 GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->value.s econd; |
| 841 bool isFlippedLine = style->isFlippedLinesWritingMode(); | 856 bool isFlippedLine = style->isFlippedLinesWritingMode(); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 917 return; | 932 return; |
| 918 | 933 |
| 919 // Visual overflow just includes overflow for stuff we need to repaint ourse lves. Self-painting layers are ignored. | 934 // Visual overflow just includes overflow for stuff we need to repaint ourse lves. Self-painting layers are ignored. |
| 920 // Layout overflow is used to determine scrolling extent, so it still includ es child layers and also factors in | 935 // Layout overflow is used to determine scrolling extent, so it still includ es child layers and also factors in |
| 921 // transforms, relative positioning, etc. | 936 // transforms, relative positioning, etc. |
| 922 LayoutRect logicalLayoutOverflow(enclosingLayoutRect(logicalFrameRectIncludi ngLineHeight(lineTop, lineBottom))); | 937 LayoutRect logicalLayoutOverflow(enclosingLayoutRect(logicalFrameRectIncludi ngLineHeight(lineTop, lineBottom))); |
| 923 LayoutRect logicalVisualOverflow(logicalLayoutOverflow); | 938 LayoutRect logicalVisualOverflow(logicalLayoutOverflow); |
| 924 | 939 |
| 925 addBoxShadowVisualOverflow(logicalVisualOverflow); | 940 addBoxShadowVisualOverflow(logicalVisualOverflow); |
| 926 addBorderOutsetVisualOverflow(logicalVisualOverflow); | 941 addBorderOutsetVisualOverflow(logicalVisualOverflow); |
| 942 addOutlineVisualOverflow(logicalVisualOverflow); | |
| 927 | 943 |
| 928 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { | 944 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { |
| 929 if (curr->renderer()->isOutOfFlowPositioned()) | 945 if (curr->renderer()->isOutOfFlowPositioned()) |
| 930 continue; // Positioned placeholders don't affect calculations. | 946 continue; // Positioned placeholders don't affect calculations. |
| 931 | 947 |
| 932 if (curr->renderer()->isText()) { | 948 if (curr->renderer()->isText()) { |
| 933 InlineTextBox* text = toInlineTextBox(curr); | 949 InlineTextBox* text = toInlineTextBox(curr); |
| 934 RenderText* rt = toRenderText(text->renderer()); | 950 RenderText* rt = toRenderText(text->renderer()); |
| 935 if (rt->isBR()) | 951 if (rt->isBR()) |
| 936 continue; | 952 continue; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1058 if (!result.addNodeToRectBasedTestResult(renderer()->node(), request, lo cationInContainer, rect)) | 1074 if (!result.addNodeToRectBasedTestResult(renderer()->node(), request, lo cationInContainer, rect)) |
| 1059 return true; | 1075 return true; |
| 1060 } | 1076 } |
| 1061 | 1077 |
| 1062 return false; | 1078 return false; |
| 1063 } | 1079 } |
| 1064 | 1080 |
| 1065 void InlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom) | 1081 void InlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom) |
| 1066 { | 1082 { |
| 1067 LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom)); | 1083 LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom)); |
| 1068 overflowRect.inflate(renderer()->maximalOutlineSize(paintInfo.phase)); | |
| 1069 flipForWritingMode(overflowRect); | 1084 flipForWritingMode(overflowRect); |
| 1070 overflowRect.moveBy(paintOffset); | 1085 overflowRect.moveBy(paintOffset); |
| 1071 | 1086 |
| 1072 if (!paintInfo.rect.intersects(pixelSnappedIntRect(overflowRect))) | 1087 if (!paintInfo.rect.intersects(pixelSnappedIntRect(overflowRect))) |
| 1073 return; | 1088 return; |
| 1074 | 1089 |
| 1075 if (paintInfo.phase != PaintPhaseChildOutlines) { | 1090 if (paintInfo.phase != PaintPhaseChildOutlines) { |
| 1076 if (paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhas eSelfOutline) { | 1091 if (paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhas eSelfOutline) { |
| 1077 // Add ourselves to the paint info struct's list of inlines that nee d to paint their | 1092 // Add ourselves to the paint info struct's list of inlines that nee d to paint their |
| 1078 // outlines. | 1093 // outlines. |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1634 ASSERT(child->prevOnLine() == prev); | 1649 ASSERT(child->prevOnLine() == prev); |
| 1635 prev = child; | 1650 prev = child; |
| 1636 } | 1651 } |
| 1637 ASSERT(prev == m_lastChild); | 1652 ASSERT(prev == m_lastChild); |
| 1638 #endif | 1653 #endif |
| 1639 } | 1654 } |
| 1640 | 1655 |
| 1641 #endif | 1656 #endif |
| 1642 | 1657 |
| 1643 } // namespace WebCore | 1658 } // namespace WebCore |
| OLD | NEW |