Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: Source/core/rendering/InlineFlowBox.cpp

Issue 176953008: Include the outline into the visual overflow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed dumb bug caught by Mac. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/InlineFlowBox.h ('k') | Source/core/rendering/RenderBlock.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(isFirst LineStyle())->boxShadow() || child->boxModelObject()->hasSelfPaintingLayer() 166 } else if (!child->renderer().isBR() && (child->renderer().style(isFirst LineStyle())->boxShadow() || child->boxModelObject()->hasSelfPaintingLayer()
167 || (child->renderer().isListMarker() && !toRenderListMarker(child->r enderer()).isInside()) 167 || (child->renderer().isListMarker() && !toRenderListMarker(child->r enderer()).isInside())
168 || child->renderer().style(isFirstLineStyle())->hasBorderImageOutset s())) { 168 || child->renderer().style(isFirstLineStyle())->hasBorderImageOutset s()
169 169 || child->renderer().style(isFirstLineStyle())->hasOutline())) {
170 child->clearKnownToHaveNoOverflow(); 170 child->clearKnownToHaveNoOverflow();
171 } 171 }
172 172
173 if (knownToHaveNoOverflow() && child->isInlineFlowBox() && !toInlineFlow Box(child)->knownToHaveNoOverflow()) 173 if (knownToHaveNoOverflow() && child->isInlineFlowBox() && !toInlineFlow Box(child)->knownToHaveNoOverflow())
174 clearKnownToHaveNoOverflow(); 174 clearKnownToHaveNoOverflow();
175 } 175 }
176 176
177 checkConsistency(); 177 checkConsistency();
178 } 178 }
179 179
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogica lLeft : LayoutUnit(); 825 LayoutUnit outsetLogicalLeft = includeLogicalLeftEdge() ? borderOutsetLogica lLeft : LayoutUnit();
826 LayoutUnit outsetLogicalRight = includeLogicalRightEdge() ? borderOutsetLogi calRight : LayoutUnit(); 826 LayoutUnit outsetLogicalRight = includeLogicalRightEdge() ? borderOutsetLogi calRight : LayoutUnit();
827 827
828 LayoutUnit logicalLeftVisualOverflow = min(pixelSnappedLogicalLeft() - outse tLogicalLeft, logicalVisualOverflow.x()); 828 LayoutUnit logicalLeftVisualOverflow = min(pixelSnappedLogicalLeft() - outse tLogicalLeft, logicalVisualOverflow.x());
829 LayoutUnit logicalRightVisualOverflow = max(pixelSnappedLogicalRight() + out setLogicalRight, logicalVisualOverflow.maxX()); 829 LayoutUnit logicalRightVisualOverflow = max(pixelSnappedLogicalRight() + out setLogicalRight, logicalVisualOverflow.maxX());
830 830
831 logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisu alOverflow, 831 logicalVisualOverflow = LayoutRect(logicalLeftVisualOverflow, logicalTopVisu alOverflow,
832 logicalRightVisualOverflow - logicalLeftV isualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow); 832 logicalRightVisualOverflow - logicalLeftV isualOverflow, logicalBottomVisualOverflow - logicalTopVisualOverflow);
833 } 833 }
834 834
835 inline void InlineFlowBox::addOutlineVisualOverflow(LayoutRect& logicalVisualOve rflow)
836 {
837 // Outline on root line boxes is applied to the block and not to the lines.
838 if (!parent())
839 return;
840
841 RenderStyle* style = renderer().style(isFirstLineStyle());
842 if (!style->hasOutline())
843 return;
844
845 logicalVisualOverflow.inflate(style->outlineSize());
846 }
847
835 inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, Glyp hOverflowAndFallbackFontsMap& textBoxDataMap, LayoutRect& logicalVisualOverflow) 848 inline void InlineFlowBox::addTextBoxVisualOverflow(InlineTextBox* textBox, Glyp hOverflowAndFallbackFontsMap& textBoxDataMap, LayoutRect& logicalVisualOverflow)
836 { 849 {
837 if (textBox->knownToHaveNoOverflow()) 850 if (textBox->knownToHaveNoOverflow())
838 return; 851 return;
839 852
840 RenderStyle* style = textBox->renderer().style(isFirstLineStyle()); 853 RenderStyle* style = textBox->renderer().style(isFirstLineStyle());
841 854
842 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox) ; 855 GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox) ;
843 GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->value.s econd; 856 GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->value.s econd;
844 bool isFlippedLine = style->isFlippedLinesWritingMode(); 857 bool isFlippedLine = style->isFlippedLinesWritingMode();
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 m_overflow.clear(); 938 m_overflow.clear();
926 939
927 // Visual overflow just includes overflow for stuff we need to repaint ourse lves. Self-painting layers are ignored. 940 // Visual overflow just includes overflow for stuff we need to repaint ourse lves. Self-painting layers are ignored.
928 // Layout overflow is used to determine scrolling extent, so it still includ es child layers and also factors in 941 // Layout overflow is used to determine scrolling extent, so it still includ es child layers and also factors in
929 // transforms, relative positioning, etc. 942 // transforms, relative positioning, etc.
930 LayoutRect logicalLayoutOverflow(enclosingLayoutRect(logicalFrameRectIncludi ngLineHeight(lineTop, lineBottom))); 943 LayoutRect logicalLayoutOverflow(enclosingLayoutRect(logicalFrameRectIncludi ngLineHeight(lineTop, lineBottom)));
931 LayoutRect logicalVisualOverflow(logicalLayoutOverflow); 944 LayoutRect logicalVisualOverflow(logicalLayoutOverflow);
932 945
933 addBoxShadowVisualOverflow(logicalVisualOverflow); 946 addBoxShadowVisualOverflow(logicalVisualOverflow);
934 addBorderOutsetVisualOverflow(logicalVisualOverflow); 947 addBorderOutsetVisualOverflow(logicalVisualOverflow);
948 addOutlineVisualOverflow(logicalVisualOverflow);
935 949
936 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) { 950 for (InlineBox* curr = firstChild(); curr; curr = curr->nextOnLine()) {
937 if (curr->renderer().isOutOfFlowPositioned()) 951 if (curr->renderer().isOutOfFlowPositioned())
938 continue; // Positioned placeholders don't affect calculations. 952 continue; // Positioned placeholders don't affect calculations.
939 953
940 if (curr->renderer().isText()) { 954 if (curr->renderer().isText()) {
941 InlineTextBox* text = toInlineTextBox(curr); 955 InlineTextBox* text = toInlineTextBox(curr);
942 RenderText& rt = toRenderText(text->renderer()); 956 RenderText& rt = toRenderText(text->renderer());
943 if (rt.isBR()) 957 if (rt.isBR())
944 continue; 958 continue;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 if (!result.addNodeToRectBasedTestResult(renderer().node(), request, loc ationInContainer, rect)) 1081 if (!result.addNodeToRectBasedTestResult(renderer().node(), request, loc ationInContainer, rect))
1068 return true; 1082 return true;
1069 } 1083 }
1070 1084
1071 return false; 1085 return false;
1072 } 1086 }
1073 1087
1074 void InlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom) 1088 void InlineFlowBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom)
1075 { 1089 {
1076 LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom)); 1090 LayoutRect overflowRect(visualOverflowRect(lineTop, lineBottom));
1077 overflowRect.inflate(renderer().maximalOutlineSize(paintInfo.phase));
1078 flipForWritingMode(overflowRect); 1091 flipForWritingMode(overflowRect);
1079 overflowRect.moveBy(paintOffset); 1092 overflowRect.moveBy(paintOffset);
1080 1093
1081 if (!paintInfo.rect.intersects(pixelSnappedIntRect(overflowRect))) 1094 if (!paintInfo.rect.intersects(pixelSnappedIntRect(overflowRect)))
1082 return; 1095 return;
1083 1096
1084 if (paintInfo.phase != PaintPhaseChildOutlines) { 1097 if (paintInfo.phase != PaintPhaseChildOutlines) {
1085 if (paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhas eSelfOutline) { 1098 if (paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhas eSelfOutline) {
1086 // Add ourselves to the paint info struct's list of inlines that nee d to paint their 1099 // Add ourselves to the paint info struct's list of inlines that nee d to paint their
1087 // outlines. 1100 // outlines.
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 ASSERT(child->prevOnLine() == prev); 1656 ASSERT(child->prevOnLine() == prev);
1644 prev = child; 1657 prev = child;
1645 } 1658 }
1646 ASSERT(prev == m_lastChild); 1659 ASSERT(prev == m_lastChild);
1647 #endif 1660 #endif
1648 } 1661 }
1649 1662
1650 #endif 1663 #endif
1651 1664
1652 } // namespace WebCore 1665 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/InlineFlowBox.h ('k') | Source/core/rendering/RenderBlock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698