Chromium Code Reviews

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

Issue 21430003: Implement interfaces in PaintInfo and make it a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@getterPaintInfo01
Patch Set: Second try Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 168 matching lines...)
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; 183 LayoutUnit logicalTop = firstLineTop - outlineSize;
184 LayoutUnit logicalBottom = outlineSize + lastLineBottom; 184 LayoutUnit logicalBottom = outlineSize + lastLineBottom;
185 185
186 return rangeIntersectsRect(renderer, logicalTop, logicalBottom, rect, offset ); 186 return rangeIntersectsRect(renderer, logicalTop, logicalBottom, rect, offset );
187 } 187 }
188 188
189 bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer, InlineFlowBox* box, const PaintInfo& paintInfo, const LayoutPoint& offset) const 189 bool RenderLineBoxList::lineIntersectsDirtyRect(RenderBoxModelObject* renderer, InlineFlowBox* box, PaintInfo& paintInfo, const LayoutPoint& offset) const
190 { 190 {
191 RootInlineBox* root = box->root(); 191 RootInlineBox* root = box->root();
192 LayoutUnit logicalTop = min<LayoutUnit>(box->logicalTopVisualOverflow(root-> lineTop()), root->selectionTop()) - renderer->maximalOutlineSize(paintInfo.phase ); 192 LayoutUnit logicalTop = min<LayoutUnit>(box->logicalTopVisualOverflow(root-> lineTop()), root->selectionTop()) - renderer->maximalOutlineSize(paintInfo.getPh ase());
193 LayoutUnit logicalBottom = box->logicalBottomVisualOverflow(root->lineBottom ()) + renderer->maximalOutlineSize(paintInfo.phase); 193 LayoutUnit logicalBottom = box->logicalBottomVisualOverflow(root->lineBottom ()) + renderer->maximalOutlineSize(paintInfo.getPhase());
194 194
195 return rangeIntersectsRect(renderer, logicalTop, logicalBottom, paintInfo.re ct, offset); 195 return rangeIntersectsRect(renderer, logicalTop, logicalBottom, paintInfo.ge tRect(), offset);
196 } 196 }
197 197
198 void RenderLineBoxList::paint(RenderBoxModelObject* renderer, PaintInfo& paintIn fo, const LayoutPoint& paintOffset) const 198 void RenderLineBoxList::paint(RenderBoxModelObject* renderer, PaintInfo& paintIn fo, const LayoutPoint& paintOffset) const
199 { 199 {
200 // Only paint during the foreground/selection phases. 200 // Only paint during the foreground/selection phases.
201 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection && paintInfo.phase != PaintPhaseOutline 201 if (paintInfo.getPhase() != PaintPhaseForeground && paintInfo.getPhase() != PaintPhaseSelection && paintInfo.getPhase() != PaintPhaseOutline
202 && paintInfo.phase != PaintPhaseSelfOutline && paintInfo.phase != PaintP haseChildOutlines && paintInfo.phase != PaintPhaseTextClip 202 && paintInfo.getPhase() != PaintPhaseSelfOutline && paintInfo.getPhase() != PaintPhaseChildOutlines && paintInfo.getPhase() != PaintPhaseTextClip
203 && paintInfo.phase != PaintPhaseMask) 203 && paintInfo.getPhase() != PaintPhaseMask)
204 return; 204 return;
205 205
206 ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer- >hasLayer())); // The only way an inline could paint like this is if it has a la yer. 206 ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer- >hasLayer())); // The only way an inline could paint like this is if it has a la yer.
207 207
208 // If we have no lines then we have no work to do. 208 // If we have no lines then we have no work to do.
209 if (!firstLineBox()) 209 if (!firstLineBox())
210 return; 210 return;
211 211
212 LayoutUnit outlineSize = renderer->maximalOutlineSize(paintInfo.phase); 212 LayoutUnit outlineSize = renderer->maximalOutlineSize(paintInfo.getPhase());
213 if (!anyLineIntersectsRect(renderer, paintInfo.rect, paintOffset, outlineSiz e)) 213 if (!anyLineIntersectsRect(renderer, paintInfo.getRect(), paintOffset, outli neSize))
214 return; 214 return;
215 215
216 PaintInfo info(paintInfo); 216 PaintInfo info(paintInfo);
217 ListHashSet<RenderInline*> outlineObjects; 217 ListHashSet<RenderInline*> outlineObjects;
218 info.outlineObjects = &outlineObjects; 218 info.setOutlineObjects(&outlineObjects);
219 219
220 // See if our root lines intersect with the dirty rect. If so, then we pain t 220 // 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 221 // 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. 222 // based off positions of our first line box or our last line box.
223 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) { 223 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
224 if (lineIntersectsDirtyRect(renderer, curr, info, paintOffset)) { 224 if (lineIntersectsDirtyRect(renderer, curr, info, paintOffset)) {
225 RootInlineBox* root = curr->root(); 225 RootInlineBox* root = curr->root();
226 curr->paint(info, paintOffset, root->lineTop(), root->lineBottom()); 226 curr->paint(info, paintOffset, root->lineTop(), root->lineBottom());
227 } 227 }
228 } 228 }
229 229
230 if (info.phase == PaintPhaseOutline || info.phase == PaintPhaseSelfOutline | | info.phase == PaintPhaseChildOutlines) { 230 if (info.getPhase() == PaintPhaseOutline || info.getPhase() == PaintPhaseSel fOutline || info.getPhase() == PaintPhaseChildOutlines) {
231 ListHashSet<RenderInline*>::iterator end = info.outlineObjects->end(); 231 ListHashSet<RenderInline*>::iterator end = info.getOutlineObjects()->end ();
232 for (ListHashSet<RenderInline*>::iterator it = info.outlineObjects->begi n(); it != end; ++it) { 232 for (ListHashSet<RenderInline*>::iterator it = info.getOutlineObjects()- >begin(); it != end; ++it) {
233 RenderInline* flow = *it; 233 RenderInline* flow = *it;
234 flow->paintOutline(info, paintOffset); 234 flow->paintOutline(info, paintOffset);
235 } 235 }
236 info.outlineObjects->clear(); 236 info.getOutlineObjects()->clear();
237 } 237 }
238 } 238 }
239 239
240 bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestReq uest& request, HitTestResult& result, const HitTestLocation& locationInContainer , const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) const 240 bool RenderLineBoxList::hitTest(RenderBoxModelObject* renderer, const HitTestReq uest& request, HitTestResult& result, const HitTestLocation& locationInContainer , const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction) const
241 { 241 {
242 if (hitTestAction != HitTestForeground) 242 if (hitTestAction != HitTestForeground)
243 return false; 243 return false;
244 244
245 ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer- >hasLayer())); // The only way an inline could hit test like this is if it has a layer. 245 ASSERT(renderer->isRenderBlock() || (renderer->isRenderInline() && renderer- >hasLayer())); // The only way an inline could hit test like this is if it has a layer.
246 246
(...skipping 124 matching lines...)
371 ASSERT(child->prevLineBox() == prev); 371 ASSERT(child->prevLineBox() == prev);
372 prev = child; 372 prev = child;
373 } 373 }
374 ASSERT(prev == m_lastLineBox); 374 ASSERT(prev == m_lastLineBox);
375 #endif 375 #endif
376 } 376 }
377 377
378 #endif 378 #endif
379 379
380 } 380 }
OLDNEW

Powered by Google App Engine