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

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

Issue 203743002: Fix "unreachable code" warnings (MSVC warning 4702) in Blink. (Closed) Base URL: svn://svn.chromium.org/blink/trunk/
Patch Set: 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/css/RuleFeature.cpp ('k') | no next file » | 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) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 return snapSizeToPixel(offsetWidth(), x() + clientLeft()); 346 return snapSizeToPixel(offsetWidth(), x() + clientLeft());
347 } 347 }
348 348
349 int RenderBox::pixelSnappedOffsetHeight() const 349 int RenderBox::pixelSnappedOffsetHeight() const
350 { 350 {
351 return snapSizeToPixel(offsetHeight(), y() + clientTop()); 351 return snapSizeToPixel(offsetHeight(), y() + clientTop());
352 } 352 }
353 353
354 bool RenderBox::canDetermineWidthWithoutLayout() const 354 bool RenderBox::canDetermineWidthWithoutLayout() const
355 { 355 {
356 // FIXME: This optimization is incorrect as written. 356 // FIXME: Remove function and callers.
357 // We need to be able to opt-in to this behavior only when
358 // it's guarentted correct.
359 // Until then disabling this optimization to be safe.
360 return false; 357 return false;
361
362 // FIXME: There are likely many subclasses of RenderBlockFlow which
363 // cannot determine their layout just from style!
364 // Perhaps we should create a "PlainRenderBlockFlow"
365 // and move this optimization there?
366 if (!isRenderBlockFlow()
367 // Flexbox items can be expanded beyond their width.
368 || isFlexItemIncludingDeprecated()
369 // Table Layout controls cell size and can expand beyond width.
370 || isTableCell())
371 return false;
372
373 RenderStyle* style = this->style();
374 return style->width().isFixed()
375 && style->minWidth().isFixed()
376 && (style->maxWidth().isUndefined() || style->maxWidth().isFixed())
377 && style->paddingLeft().isFixed()
378 && style->paddingRight().isFixed()
379 && style->boxSizing() == CONTENT_BOX;
380 } 358 }
381 359
382 LayoutUnit RenderBox::fixedOffsetWidth() const 360 LayoutUnit RenderBox::fixedOffsetWidth() const
383 { 361 {
384 ASSERT(canDetermineWidthWithoutLayout()); 362 ASSERT(canDetermineWidthWithoutLayout());
385 363
386 RenderStyle* style = this->style(); 364 RenderStyle* style = this->style();
387 365
388 LayoutUnit width = std::max(LayoutUnit(style->minWidth().value()), LayoutUni t(style->width().value())); 366 LayoutUnit width = std::max(LayoutUnit(style->minWidth().value()), LayoutUni t(style->width().value()));
389 if (style->maxWidth().isFixed()) 367 if (style->maxWidth().isFixed())
(...skipping 4315 matching lines...) Expand 10 before | Expand all | Expand 10 after
4705 return 0; 4683 return 0;
4706 4684
4707 if (!layoutState && !flowThreadContainingBlock()) 4685 if (!layoutState && !flowThreadContainingBlock())
4708 return 0; 4686 return 0;
4709 4687
4710 RenderBlock* containerBlock = containingBlock(); 4688 RenderBlock* containerBlock = containingBlock();
4711 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop(); 4689 return containerBlock->offsetFromLogicalTopOfFirstPage() + logicalTop();
4712 } 4690 }
4713 4691
4714 } // namespace WebCore 4692 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/RuleFeature.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698