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

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

Issue 339333002: Removing using declarations that import names in the C++ Standard library. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixing mac error Created 6 years, 6 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
« no previous file with comments | « Source/core/rendering/FixedTableLayout.cpp ('k') | Source/core/rendering/InlineBox.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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 10 matching lines...) Expand all
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 */ 22 */
23 23
24 #include "config.h" 24 #include "config.h"
25 #include "core/rendering/FloatingObjects.h" 25 #include "core/rendering/FloatingObjects.h"
26 26
27 #include "core/rendering/RenderBlockFlow.h" 27 #include "core/rendering/RenderBlockFlow.h"
28 #include "core/rendering/RenderBox.h" 28 #include "core/rendering/RenderBox.h"
29 #include "core/rendering/RenderView.h" 29 #include "core/rendering/RenderView.h"
30 30
31 using namespace std;
32 using namespace WTF; 31 using namespace WTF;
33 32
34 namespace WebCore { 33 namespace WebCore {
35 34
36 struct SameSizeAsFloatingObject { 35 struct SameSizeAsFloatingObject {
37 void* pointers[2]; 36 void* pointers[2];
38 LayoutRect rect; 37 LayoutRect rect;
39 int paginationStrut; 38 int paginationStrut;
40 uint32_t bitfields : 8; 39 uint32_t bitfields : 8;
41 }; 40 };
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 } 193 }
195 194
196 LayoutUnit FloatingObjects::lowestFloatLogicalBottom(FloatingObject::Type floatT ype) 195 LayoutUnit FloatingObjects::lowestFloatLogicalBottom(FloatingObject::Type floatT ype)
197 { 196 {
198 bool isInHorizontalWritingMode = m_horizontalWritingMode; 197 bool isInHorizontalWritingMode = m_horizontalWritingMode;
199 if (floatType != FloatingObject::FloatLeftRight) { 198 if (floatType != FloatingObject::FloatLeftRight) {
200 if (hasLowestFloatLogicalBottomCached(isInHorizontalWritingMode, floatTy pe)) 199 if (hasLowestFloatLogicalBottomCached(isInHorizontalWritingMode, floatTy pe))
201 return getCachedlowestFloatLogicalBottom(floatType); 200 return getCachedlowestFloatLogicalBottom(floatType);
202 } else { 201 } else {
203 if (hasLowestFloatLogicalBottomCached(isInHorizontalWritingMode, Floatin gObject::FloatLeft) && hasLowestFloatLogicalBottomCached(isInHorizontalWritingMo de, FloatingObject::FloatRight)) { 202 if (hasLowestFloatLogicalBottomCached(isInHorizontalWritingMode, Floatin gObject::FloatLeft) && hasLowestFloatLogicalBottomCached(isInHorizontalWritingMo de, FloatingObject::FloatRight)) {
204 return max(getCachedlowestFloatLogicalBottom(FloatingObject::FloatLe ft), 203 return std::max(getCachedlowestFloatLogicalBottom(FloatingObject::Fl oatLeft),
205 getCachedlowestFloatLogicalBottom(FloatingObject::FloatRight)); 204 getCachedlowestFloatLogicalBottom(FloatingObject::FloatRight));
206 } 205 }
207 } 206 }
208 207
209 LayoutUnit lowestFloatBottom = 0; 208 LayoutUnit lowestFloatBottom = 0;
210 const FloatingObjectSet& floatingObjectSet = set(); 209 const FloatingObjectSet& floatingObjectSet = set();
211 FloatingObjectSetIterator end = floatingObjectSet.end(); 210 FloatingObjectSetIterator end = floatingObjectSet.end();
212 if (floatType == FloatingObject::FloatLeftRight) { 211 if (floatType == FloatingObject::FloatLeftRight) {
213 LayoutUnit lowestFloatBottomLeft = 0; 212 LayoutUnit lowestFloatBottomLeft = 0;
214 LayoutUnit lowestFloatBottomRight = 0; 213 LayoutUnit lowestFloatBottomRight = 0;
215 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end ; ++it) { 214 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end ; ++it) {
216 FloatingObject* floatingObject = it->get(); 215 FloatingObject* floatingObject = it->get();
217 if (floatingObject->isPlaced()) { 216 if (floatingObject->isPlaced()) {
218 FloatingObject::Type curType = floatingObject->type(); 217 FloatingObject::Type curType = floatingObject->type();
219 LayoutUnit curFloatLogicalBottom = m_renderer->logicalBottomForF loat(floatingObject); 218 LayoutUnit curFloatLogicalBottom = m_renderer->logicalBottomForF loat(floatingObject);
220 if (curType & FloatingObject::FloatLeft) 219 if (curType & FloatingObject::FloatLeft)
221 lowestFloatBottomLeft = max(lowestFloatBottomLeft, curFloatL ogicalBottom); 220 lowestFloatBottomLeft = std::max(lowestFloatBottomLeft, curF loatLogicalBottom);
222 if (curType & FloatingObject::FloatRight) 221 if (curType & FloatingObject::FloatRight)
223 lowestFloatBottomRight = max(lowestFloatBottomRight, curFloa tLogicalBottom); 222 lowestFloatBottomRight = std::max(lowestFloatBottomRight, cu rFloatLogicalBottom);
224 } 223 }
225 } 224 }
226 lowestFloatBottom = max(lowestFloatBottomLeft, lowestFloatBottomRight); 225 lowestFloatBottom = std::max(lowestFloatBottomLeft, lowestFloatBottomRig ht);
227 setCachedLowestFloatLogicalBottom(isInHorizontalWritingMode, FloatingObj ect::FloatLeft, lowestFloatBottomLeft); 226 setCachedLowestFloatLogicalBottom(isInHorizontalWritingMode, FloatingObj ect::FloatLeft, lowestFloatBottomLeft);
228 setCachedLowestFloatLogicalBottom(isInHorizontalWritingMode, FloatingObj ect::FloatRight, lowestFloatBottomRight); 227 setCachedLowestFloatLogicalBottom(isInHorizontalWritingMode, FloatingObj ect::FloatRight, lowestFloatBottomRight);
229 } else { 228 } else {
230 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end ; ++it) { 229 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end ; ++it) {
231 FloatingObject* floatingObject = it->get(); 230 FloatingObject* floatingObject = it->get();
232 if (floatingObject->isPlaced() && floatingObject->type() == floatTyp e) 231 if (floatingObject->isPlaced() && floatingObject->type() == floatTyp e)
233 lowestFloatBottom = max(lowestFloatBottom, m_renderer->logicalBo ttomForFloat(floatingObject)); 232 lowestFloatBottom = std::max(lowestFloatBottom, m_renderer->logi calBottomForFloat(floatingObject));
234 } 233 }
235 setCachedLowestFloatLogicalBottom(isInHorizontalWritingMode, floatType, lowestFloatBottom); 234 setCachedLowestFloatLogicalBottom(isInHorizontalWritingMode, floatType, lowestFloatBottom);
236 } 235 }
237 236
238 return lowestFloatBottom; 237 return lowestFloatBottom;
239 } 238 }
240 239
241 bool FloatingObjects::hasLowestFloatLogicalBottomCached(bool isHorizontal, Float ingObject::Type type) const 240 bool FloatingObjects::hasLowestFloatLogicalBottomCached(bool isHorizontal, Float ingObject::Type type) const
242 { 241 {
243 int floatIndex = static_cast<int>(type) - 1; 242 int floatIndex = static_cast<int>(type) - 1;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 383
385 LayoutUnit FloatingObjects::logicalRightOffsetForPositioningFloat(LayoutUnit fix edOffset, LayoutUnit logicalTop, LayoutUnit *heightRemaining) 384 LayoutUnit FloatingObjects::logicalRightOffsetForPositioningFloat(LayoutUnit fix edOffset, LayoutUnit logicalTop, LayoutUnit *heightRemaining)
386 { 385 {
387 int logicalTopAsInt = roundToInt(logicalTop); 386 int logicalTopAsInt = roundToInt(logicalTop);
388 ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatRight> adapter( m_renderer, logicalTopAsInt, logicalTopAsInt, fixedOffset); 387 ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatRight> adapter( m_renderer, logicalTopAsInt, logicalTopAsInt, fixedOffset);
389 placedFloatsTree().allOverlapsWithAdapter(adapter); 388 placedFloatsTree().allOverlapsWithAdapter(adapter);
390 389
391 if (heightRemaining) 390 if (heightRemaining)
392 *heightRemaining = adapter.heightRemaining(); 391 *heightRemaining = adapter.heightRemaining();
393 392
394 return min(fixedOffset, adapter.offset()); 393 return std::min(fixedOffset, adapter.offset());
395 } 394 }
396 395
397 LayoutUnit FloatingObjects::logicalLeftOffset(LayoutUnit fixedOffset, LayoutUnit logicalTop, LayoutUnit logicalHeight) 396 LayoutUnit FloatingObjects::logicalLeftOffset(LayoutUnit fixedOffset, LayoutUnit logicalTop, LayoutUnit logicalHeight)
398 { 397 {
399 ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft> adapter(m_ renderer, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), fixedO ffset); 398 ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft> adapter(m_ renderer, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), fixedO ffset);
400 placedFloatsTree().allOverlapsWithAdapter(adapter); 399 placedFloatsTree().allOverlapsWithAdapter(adapter);
401 400
402 return adapter.offset(); 401 return adapter.offset();
403 } 402 }
404 403
405 LayoutUnit FloatingObjects::logicalRightOffset(LayoutUnit fixedOffset, LayoutUni t logicalTop, LayoutUnit logicalHeight) 404 LayoutUnit FloatingObjects::logicalRightOffset(LayoutUnit fixedOffset, LayoutUni t logicalTop, LayoutUnit logicalHeight)
406 { 405 {
407 ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight> adapter(m _renderer, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), fixed Offset); 406 ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight> adapter(m _renderer, roundToInt(logicalTop), roundToInt(logicalTop + logicalHeight), fixed Offset);
408 placedFloatsTree().allOverlapsWithAdapter(adapter); 407 placedFloatsTree().allOverlapsWithAdapter(adapter);
409 408
410 return min(fixedOffset, adapter.offset()); 409 return std::min(fixedOffset, adapter.offset());
411 } 410 }
412 411
413 FloatingObjects::FloatBottomCachedValue::FloatBottomCachedValue() 412 FloatingObjects::FloatBottomCachedValue::FloatBottomCachedValue()
414 : value(0) 413 : value(0)
415 , dirty(true) 414 , dirty(true)
416 { 415 {
417 } 416 }
418 417
419 inline static bool rangesIntersect(int floatTop, int floatBottom, int objectTop, int objectBottom) 418 inline static bool rangesIntersect(int floatTop, int floatBottom, int objectTop, int objectBottom)
420 { 419 {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 } 536 }
538 537
539 String ValueToString<FloatingObject*>::string(const FloatingObject* floatingObje ct) 538 String ValueToString<FloatingObject*>::string(const FloatingObject* floatingObje ct)
540 { 539 {
541 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped MaxY()); 540 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped MaxY());
542 } 541 }
543 #endif 542 #endif
544 543
545 544
546 } // namespace WebCore 545 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/FixedTableLayout.cpp ('k') | Source/core/rendering/InlineBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698