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

Side by Side Diff: sky/engine/core/rendering/RenderFlexibleBox.cpp

Issue 867903002: Remove UseCounter (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 | « sky/engine/core/page/Page.cpp ('k') | sky/engine/core/rendering/RenderObject.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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "sky/engine/config.h" 31 #include "sky/engine/config.h"
32 #include "sky/engine/core/rendering/RenderFlexibleBox.h" 32 #include "sky/engine/core/rendering/RenderFlexibleBox.h"
33 33
34 #include <limits> 34 #include <limits>
35 #include "sky/engine/core/frame/UseCounter.h"
36 #include "sky/engine/core/rendering/RenderLayer.h" 35 #include "sky/engine/core/rendering/RenderLayer.h"
37 #include "sky/engine/core/rendering/RenderView.h" 36 #include "sky/engine/core/rendering/RenderView.h"
38 #include "sky/engine/platform/LengthFunctions.h" 37 #include "sky/engine/platform/LengthFunctions.h"
39 #include "sky/engine/wtf/MathExtras.h" 38 #include "sky/engine/wtf/MathExtras.h"
40 39
41 namespace blink { 40 namespace blink {
42 41
43 struct RenderFlexibleBox::LineContext { 42 struct RenderFlexibleBox::LineContext {
44 LineContext(LayoutUnit crossAxisOffset, LayoutUnit crossAxisExtent, size_t n umberOfChildren, LayoutUnit maxAscent) 43 LineContext(LayoutUnit crossAxisOffset, LayoutUnit crossAxisExtent, size_t n umberOfChildren, LayoutUnit maxAscent)
45 : crossAxisOffset(crossAxisOffset) 44 : crossAxisOffset(crossAxisOffset)
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 514
516 bool RenderFlexibleBox::childPreferredMainAxisContentExtentRequiresLayout(Render Box* child, bool hasInfiniteLineLength) const 515 bool RenderFlexibleBox::childPreferredMainAxisContentExtentRequiresLayout(Render Box* child, bool hasInfiniteLineLength) const
517 { 516 {
518 return preferredMainAxisExtentDependsOnLayout(flexBasisForChild(child), hasI nfiniteLineLength) && hasOrthogonalFlow(child); 517 return preferredMainAxisExtentDependsOnLayout(flexBasisForChild(child), hasI nfiniteLineLength) && hasOrthogonalFlow(child);
519 } 518 }
520 519
521 LayoutUnit RenderFlexibleBox::preferredMainAxisContentExtentForChild(RenderBox* child, bool hasInfiniteLineLength, bool relayoutChildren) 520 LayoutUnit RenderFlexibleBox::preferredMainAxisContentExtentForChild(RenderBox* child, bool hasInfiniteLineLength, bool relayoutChildren)
522 { 521 {
523 child->clearOverrideSize(); 522 child->clearOverrideSize();
524 523
525 if (child->style()->hasAspectRatio() || child->isImage() || child->isCanvas( ))
526 UseCounter::count(document(), UseCounter::AspectRatioFlexItem);
527
528 Length flexBasis = flexBasisForChild(child); 524 Length flexBasis = flexBasisForChild(child);
529 if (preferredMainAxisExtentDependsOnLayout(flexBasis, hasInfiniteLineLength) ) { 525 if (preferredMainAxisExtentDependsOnLayout(flexBasis, hasInfiniteLineLength) ) {
530 LayoutUnit mainAxisExtent; 526 LayoutUnit mainAxisExtent;
531 if (hasOrthogonalFlow(child)) { 527 if (hasOrthogonalFlow(child)) {
532 if (child->needsLayout() || relayoutChildren) { 528 if (child->needsLayout() || relayoutChildren) {
533 m_intrinsicSizeAlongMainAxis.remove(child); 529 m_intrinsicSizeAlongMainAxis.remove(child);
534 child->forceChildLayout(); 530 child->forceChildLayout();
535 m_intrinsicSizeAlongMainAxis.set(child, child->logicalHeight()); 531 m_intrinsicSizeAlongMainAxis.set(child, child->logicalHeight());
536 } 532 }
537 ASSERT(m_intrinsicSizeAlongMainAxis.contains(child)); 533 ASSERT(m_intrinsicSizeAlongMainAxis.contains(child));
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
1298 ASSERT(child); 1294 ASSERT(child);
1299 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1295 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1300 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1296 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1301 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1297 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1302 adjustAlignmentForChild(child, newOffset - originalOffset); 1298 adjustAlignmentForChild(child, newOffset - originalOffset);
1303 } 1299 }
1304 } 1300 }
1305 } 1301 }
1306 1302
1307 } 1303 }
OLDNEW
« no previous file with comments | « sky/engine/core/page/Page.cpp ('k') | sky/engine/core/rendering/RenderObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698