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

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

Issue 23737004: Paint flex items atomically, like inline-blocks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update comment Created 7 years, 3 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
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 void InlineBox::adjustPosition(float dx, float dy) 190 void InlineBox::adjustPosition(float dx, float dy)
191 { 191 {
192 m_topLeft.move(dx, dy); 192 m_topLeft.move(dx, dy);
193 193
194 if (m_renderer->isReplaced()) 194 if (m_renderer->isReplaced())
195 toRenderBox(m_renderer)->move(dx, dy); 195 toRenderBox(m_renderer)->move(dx, dy);
196 } 196 }
197 197
198 void InlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, Layo utUnit /* lineTop */, LayoutUnit /*lineBottom*/) 198 void InlineBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, Layo utUnit /* lineTop */, LayoutUnit /*lineBottom*/)
199 { 199 {
200 if (!paintInfo.shouldPaintWithinRoot(renderer()) || (paintInfo.phase != Pain tPhaseForeground && paintInfo.phase != PaintPhaseSelection)) 200 if (!paintInfo.shouldPaintWithinRoot(renderer()))
201 return; 201 return;
202 202
203 LayoutPoint childPoint = paintOffset; 203 LayoutPoint childPoint = paintOffset;
204 if (parent()->renderer()->style()->isFlippedBlocksWritingMode()) // Faster t han calling containingBlock(). 204 if (parent()->renderer()->style()->isFlippedBlocksWritingMode()) // Faster t han calling containingBlock().
205 childPoint = renderer()->containingBlock()->flipForWritingModeForChild(t oRenderBox(renderer()), childPoint); 205 childPoint = renderer()->containingBlock()->flipForWritingModeForChild(t oRenderBox(renderer()), childPoint);
206 206
207 // Paint all phases of replaced elements atomically, as though the replaced element established its 207 RenderBlock::paintAsInlineBlock(renderer(), paintInfo, childPoint);
208 // own stacking context. (See Appendix E.2, section 6.4 on inline block/tab le elements in the CSS2.1
209 // specification.)
210 bool preservePhase = paintInfo.phase == PaintPhaseSelection || paintInfo.pha se == PaintPhaseTextClip;
211 PaintInfo info(paintInfo);
212 info.phase = preservePhase ? paintInfo.phase : PaintPhaseBlockBackground;
213 renderer()->paint(info, childPoint);
214 if (!preservePhase) {
215 info.phase = PaintPhaseChildBlockBackgrounds;
216 renderer()->paint(info, childPoint);
217 info.phase = PaintPhaseFloat;
218 renderer()->paint(info, childPoint);
219 info.phase = PaintPhaseForeground;
220 renderer()->paint(info, childPoint);
221 info.phase = PaintPhaseOutline;
222 renderer()->paint(info, childPoint);
223 }
224 } 208 }
225 209
226 bool InlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result , const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs et, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/) 210 bool InlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result , const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs et, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
227 { 211 {
228 // Hit test all phases of replaced elements atomically, as though the replac ed element established its 212 // Hit test all phases of replaced elements atomically, as though the replac ed element established its
229 // own stacking context. (See Appendix E.2, section 6.4 on inline block/tab le elements in the CSS2.1 213 // own stacking context. (See Appendix E.2, section 6.4 on inline block/tab le elements in the CSS2.1
230 // specification.) 214 // specification.)
231 LayoutPoint childPoint = accumulatedOffset; 215 LayoutPoint childPoint = accumulatedOffset;
232 if (parent()->renderer()->style()->isFlippedBlocksWritingMode()) // Faster t han calling containingBlock(). 216 if (parent()->renderer()->style()->isFlippedBlocksWritingMode()) // Faster t han calling containingBlock().
233 childPoint = renderer()->containingBlock()->flipForWritingModeForChild(t oRenderBox(renderer()), childPoint); 217 childPoint = renderer()->containingBlock()->flipForWritingModeForChild(t oRenderBox(renderer()), childPoint);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 b->showTreeForThis(); 365 b->showTreeForThis();
382 } 366 }
383 367
384 void showLineTree(const WebCore::InlineBox* b) 368 void showLineTree(const WebCore::InlineBox* b)
385 { 369 {
386 if (b) 370 if (b)
387 b->showLineTreeForThis(); 371 b->showLineTreeForThis();
388 } 372 }
389 373
390 #endif 374 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698