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

Side by Side Diff: Source/core/rendering/RenderLineBoxList.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/RenderLineBoxList.h ('k') | Source/core/rendering/RenderListMarker.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) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 return false; 163 return false;
164 } else { 164 } else {
165 physicalStart += offset.x(); 165 physicalStart += offset.x();
166 if (physicalStart >= rect.maxX() || physicalStart + physicalExtent <= re ct.x()) 166 if (physicalStart >= rect.maxX() || physicalStart + physicalExtent <= re ct.x())
167 return false; 167 return false;
168 } 168 }
169 169
170 return true; 170 return true;
171 } 171 }
172 172
173 bool RenderLineBoxList::anyLineIntersectsRect(RenderBoxModelObject* renderer, co nst LayoutRect& rect, const LayoutPoint& offset, LayoutUnit outlineSize) const 173 bool RenderLineBoxList::anyLineIntersectsRect(RenderBoxModelObject* renderer, co nst LayoutRect& rect, const LayoutPoint& offset) const
174 { 174 {
175 // We can check the first box and last box and avoid painting/hit testing if we don't 175 // We can check the first box and last box and avoid painting/hit testing if we don't
176 // intersect. This is a quick short-circuit that we can take to avoid walki ng any lines. 176 // intersect. This is a quick short-circuit that we can take to avoid walki ng any lines.
177 // FIXME: This check is flawed in the following extremely obscure way: 177 // FIXME: This check is flawed in the following extremely obscure way:
178 // if some line in the middle has a huge overflow, it might actually extend below the last line. 178 // if some line in the middle has a huge overflow, it might actually extend below the last line.
179 RootInlineBox& firstRootBox = firstLineBox()->root(); 179 RootInlineBox& firstRootBox = firstLineBox()->root();
180 RootInlineBox& lastRootBox = lastLineBox()->root(); 180 RootInlineBox& lastRootBox = lastLineBox()->root();
181 LayoutUnit firstLineTop = firstLineBox()->logicalTopVisualOverflow(firstRoot Box.lineTop()); 181 LayoutUnit firstLineTop = firstLineBox()->logicalTopVisualOverflow(firstRoot Box.lineTop());
182 LayoutUnit lastLineBottom = lastLineBox()->logicalBottomVisualOverflow(lastR ootBox.lineBottom()); 182 LayoutUnit lastLineBottom = lastLineBox()->logicalBottomVisualOverflow(lastR ootBox.lineBottom());
183 LayoutUnit logicalTop = firstLineTop - outlineSize;
184 LayoutUnit logicalBottom = outlineSize + lastLineBottom;
185 183
186 return rangeIntersectsRect(renderer, logicalTop, logicalBottom, rect, offset ); 184 return rangeIntersectsRect(renderer, firstLineTop, lastLineBottom, rect, off set);
187 } 185 }
188 186
189 bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer, InlineFlowBox* box, const PaintInfo& paintInfo, const LayoutPoint& offset) const 187 bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer, InlineFlowBox* box, const PaintInfo& paintInfo, const LayoutPoint& offset) const
190 { 188 {
191 RootInlineBox& root = box->root(); 189 RootInlineBox& root = box->root();
192 LayoutUnit logicalTop = min<LayoutUnit>(box->logicalTopVisualOverflow(root.l ineTop()), root.selectionTop()) - renderer->maximalOutlineSize(paintInfo.phase); 190 LayoutUnit logicalTop = min<LayoutUnit>(box->logicalTopVisualOverflow(root.l ineTop()), root.selectionTop());
193 LayoutUnit logicalBottom = box->logicalBottomVisualOverflow(root.lineBottom( )) + renderer->maximalOutlineSize(paintInfo.phase); 191 LayoutUnit logicalBottom = box->logicalBottomVisualOverflow(root.lineBottom( ));
194 192
195 return rangeIntersectsRect(renderer, logicalTop, logicalBottom, paintInfo.re ct, offset); 193 return rangeIntersectsRect(renderer, logicalTop, logicalBottom, paintInfo.re ct, offset);
196 } 194 }
197 195
198 void RenderLineBoxList::paint(RenderBoxModelObject* renderer, PaintInfo& paintIn fo, const LayoutPoint& paintOffset) const 196 void RenderLineBoxList::paint(RenderBoxModelObject* renderer, PaintInfo& paintIn fo, const LayoutPoint& paintOffset) const
199 { 197 {
200 // Only paint during the foreground/selection phases. 198 // Only paint during the foreground/selection phases.
201 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection && paintInfo.phase != PaintPhaseOutline 199 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection && paintInfo.phase != PaintPhaseOutline
202 && paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP haseChildOutlines && paintInfo.phase != PaintPhaseTextClip 200 && paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP haseChildOutlines && paintInfo.phase != PaintPhaseTextClip
203 && paintInfo.phase != PaintPhaseMask) 201 && paintInfo.phase != PaintPhaseMask)
204 return; 202 return;
205 203
206 ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer- >hasLayer())); // The only way an inline could paint like this is if it has a la yer. 204 ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer- >hasLayer())); // The only way an inline could paint like this is if it has a la yer.
207 205
208 // If we have no lines then we have no work to do. 206 // If we have no lines then we have no work to do.
209 if (!firstLineBox()) 207 if (!firstLineBox())
210 return; 208 return;
211 209
212 LayoutUnit outlineSize = renderer->maximalOutlineSize(paintInfo.phase); 210 if (!anyLineIntersectsRect(renderer, paintInfo.rect, paintOffset))
213 if (!anyLineIntersectsRect(renderer, paintInfo.rect, paintOffset, outlineSiz e))
214 return; 211 return;
215 212
216 PaintInfo info(paintInfo); 213 PaintInfo info(paintInfo);
217 ListHashSet<RenderInline*> outlineObjects; 214 ListHashSet<RenderInline*> outlineObjects;
218 info.setOutlineObjects(&outlineObjects); 215 info.setOutlineObjects(&outlineObjects);
219 216
220 // See if our root lines intersect with the dirty rect. If so, then we pain t 217 // See if our root lines intersect with the dirty rect. If so, then we pain t
221 // them. Note that boxes can easily overlap, so we can't make any assumptio ns 218 // them. Note that boxes can easily overlap, so we can't make any assumptio ns
222 // based off positions of our first line box or our last line box. 219 // based off positions of our first line box or our last line box.
223 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) { 220 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 ASSERT(child->prevLineBox() == prev); 368 ASSERT(child->prevLineBox() == prev);
372 prev = child; 369 prev = child;
373 } 370 }
374 ASSERT(prev == m_lastLineBox); 371 ASSERT(prev == m_lastLineBox);
375 #endif 372 #endif
376 } 373 }
377 374
378 #endif 375 #endif
379 376
380 } 377 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLineBoxList.h ('k') | Source/core/rendering/RenderListMarker.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698