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

Side by Side Diff: Source/core/rendering/InlineBox.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. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 void InlineBox::adjustPosition(float dx, float dy) 207 void InlineBox::adjustPosition(float dx, float dy)
208 { 208 {
209 m_topLeft.move(dx, dy); 209 m_topLeft.move(dx, dy);
210 210
211 if (m_renderer->isReplaced()) 211 if (m_renderer->isReplaced())
212 toRenderBox(m_renderer)->move(dx, dy); 212 toRenderBox(m_renderer)->move(dx, dy);
213 } 213 }
214 214
215 void InlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, Layo utUnit /* lineTop */, LayoutUnit /*lineBottom*/) 215 void InlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, Layo utUnit /* lineTop */, LayoutUnit /*lineBottom*/)
216 { 216 {
217 if (!paintInfo.shouldPaintWithinRoot(renderer()) || (paintInfo.phase != Pain tPhaseForeground && paintInfo.phase != PaintPhaseSelection)) 217 if (!paintInfo.shouldPaintWithinRoot(renderer()) || (paintInfo.getPhase() != PaintPhaseForeground && paintInfo.getPhase() != PaintPhaseSelection))
218 return; 218 return;
219 219
220 LayoutPoint childPoint = paintOffset; 220 LayoutPoint childPoint = paintOffset;
221 if (parent()->renderer()->style()->isFlippedBlocksWritingMode()) // Faster t han calling containingBlock(). 221 if (parent()->renderer()->style()->isFlippedBlocksWritingMode()) // Faster t han calling containingBlock().
222 childPoint = renderer()->containingBlock()->flipForWritingModeForChild(t oRenderBox(renderer()), childPoint); 222 childPoint = renderer()->containingBlock()->flipForWritingModeForChild(t oRenderBox(renderer()), childPoint);
223 223
224 // Paint all phases of replaced elements atomically, as though the replaced element established its 224 // Paint all phases of replaced elements atomically, as though the replaced element established its
225 // own stacking context. (See Appendix E.2, section 6.4 on inline block/tab le elements in the CSS2.1 225 // own stacking context. (See Appendix E.2, section 6.4 on inline block/tab le elements in the CSS2.1
226 // specification.) 226 // specification.)
227 bool preservePhase = paintInfo.phase == PaintPhaseSelection || paintInfo.pha se == PaintPhaseTextClip; 227 bool preservePhase = paintInfo.getPhase() == PaintPhaseSelection || paintInf o.getPhase() == PaintPhaseTextClip;
228 PaintInfo info(paintInfo); 228 PaintInfo info(paintInfo);
229 info.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground; 229 PaintPhase phase = preservePhase ? paintInfo.getPhase() : PaintPhaseBlockBac kground;
230 info.setPhase(phase);
230 renderer()->paint(info, childPoint); 231 renderer()->paint(info, childPoint);
231 if (!preservePhase) { 232 if (!preservePhase) {
232 info.phase = PaintPhaseChildBlockBackgrounds; 233 info.setPhase(PaintPhaseChildBlockBackgrounds);
233 renderer()->paint(info, childPoint); 234 renderer()->paint(info, childPoint);
234 info.phase = PaintPhaseFloat; 235 info.setPhase(PaintPhaseFloat);
235 renderer()->paint(info, childPoint); 236 renderer()->paint(info, childPoint);
236 info.phase = PaintPhaseForeground; 237 info.setPhase(PaintPhaseForeground);
237 renderer()->paint(info, childPoint); 238 renderer()->paint(info, childPoint);
238 info.phase = PaintPhaseOutline; 239 info.setPhase(PaintPhaseOutline);
239 renderer()->paint(info, childPoint); 240 renderer()->paint(info, childPoint);
240 } 241 }
241 } 242 }
242 243
243 bool InlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result , const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs et, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/) 244 bool InlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result , const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs et, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
244 { 245 {
245 // Hit test all phases of replaced elements atomically, as though the replac ed element established its 246 // Hit test all phases of replaced elements atomically, as though the replac ed element established its
246 // own stacking context. (See Appendix E.2, section 6.4 on inline block/tab le elements in the CSS2.1 247 // own stacking context. (See Appendix E.2, section 6.4 on inline block/tab le elements in the CSS2.1
247 // specification.) 248 // specification.)
248 LayoutPoint childPoint = accumulatedOffset; 249 LayoutPoint childPoint = accumulatedOffset;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 b->showTreeForThis(); 399 b->showTreeForThis();
399 } 400 }
400 401
401 void showLineTree(const WebCore::InlineBox* b) 402 void showLineTree(const WebCore::InlineBox* b)
402 { 403 {
403 if (b) 404 if (b)
404 b->showLineTreeForThis(); 405 b->showLineTreeForThis();
405 } 406 }
406 407
407 #endif 408 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698