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

Side by Side Diff: Source/core/css/LayoutStyleCSSValueMapping.cpp

Issue 948343003: Move rendering/RenderGrid to layout/LayoutGrid (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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/core.gypi ('k') | Source/core/dom/FirstLetterPseudoElement.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) 2004 Zack Rusin <zack@kde.org> 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved.
7 * Copyright (C) 2015 Google Inc. All rights reserved. 7 * Copyright (C) 2015 Google Inc. 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 Lesser General Public 10 * modify it under the terms of the GNU Lesser General Public
(...skipping 26 matching lines...) Expand all
37 #include "core/css/CSSPathValue.h" 37 #include "core/css/CSSPathValue.h"
38 #include "core/css/CSSPrimitiveValueMappings.h" 38 #include "core/css/CSSPrimitiveValueMappings.h"
39 #include "core/css/CSSReflectValue.h" 39 #include "core/css/CSSReflectValue.h"
40 #include "core/css/CSSShadowValue.h" 40 #include "core/css/CSSShadowValue.h"
41 #include "core/css/CSSTimingFunctionValue.h" 41 #include "core/css/CSSTimingFunctionValue.h"
42 #include "core/css/CSSValueList.h" 42 #include "core/css/CSSValueList.h"
43 #include "core/css/CSSValuePool.h" 43 #include "core/css/CSSValuePool.h"
44 #include "core/css/Pair.h" 44 #include "core/css/Pair.h"
45 #include "core/css/Rect.h" 45 #include "core/css/Rect.h"
46 #include "core/layout/LayoutBox.h" 46 #include "core/layout/LayoutBox.h"
47 #include "core/layout/LayoutGrid.h"
47 #include "core/layout/LayoutObject.h" 48 #include "core/layout/LayoutObject.h"
48 #include "core/layout/style/ContentData.h" 49 #include "core/layout/style/ContentData.h"
49 #include "core/layout/style/LayoutStyle.h" 50 #include "core/layout/style/LayoutStyle.h"
50 #include "core/layout/style/PathStyleMotionPath.h" 51 #include "core/layout/style/PathStyleMotionPath.h"
51 #include "core/layout/style/ShadowList.h" 52 #include "core/layout/style/ShadowList.h"
52 #include "core/rendering/RenderBlock.h" 53 #include "core/rendering/RenderBlock.h"
53 #include "core/rendering/RenderGrid.h"
54 #include "platform/LengthFunctions.h" 54 #include "platform/LengthFunctions.h"
55 55
56 namespace blink { 56 namespace blink {
57 57
58 inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(d ouble value, const LayoutStyle& style) 58 inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedPixelValue(d ouble value, const LayoutStyle& style)
59 { 59 {
60 return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style), CSSPrimitiveValue::CSS_PX); 60 return cssValuePool().createValue(adjustFloatForAbsoluteZoom(value, style), CSSPrimitiveValue::CSS_PX);
61 } 61 }
62 62
63 inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedNumberValue( double value, const LayoutStyle& style) 63 inline static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> zoomAdjustedNumberValue( double value, const LayoutStyle& style)
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue: :create(); 564 RefPtrWillBeRawPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue: :create();
565 for (size_t j = 0; j < namedGridLines.size(); ++j) 565 for (size_t j = 0; j < namedGridLines.size(); ++j)
566 lineNames->append(cssValuePool().createValue(namedGridLines[j], CSSPrimi tiveValue::CSS_STRING)); 566 lineNames->append(cssValuePool().createValue(namedGridLines[j], CSSPrimi tiveValue::CSS_STRING));
567 list.append(lineNames.release()); 567 list.append(lineNames.release());
568 } 568 }
569 569
570 static PassRefPtrWillBeRawPtr<CSSValue> valueForGridTrackList(GridTrackSizingDir ection direction, const LayoutObject* renderer, const LayoutStyle& style) 570 static PassRefPtrWillBeRawPtr<CSSValue> valueForGridTrackList(GridTrackSizingDir ection direction, const LayoutObject* renderer, const LayoutStyle& style)
571 { 571 {
572 const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style.gr idTemplateColumns() : style.gridTemplateRows(); 572 const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style.gr idTemplateColumns() : style.gridTemplateRows();
573 const OrderedNamedGridLines& orderedNamedGridLines = direction == ForColumns ? style.orderedNamedGridColumnLines() : style.orderedNamedGridRowLines(); 573 const OrderedNamedGridLines& orderedNamedGridLines = direction == ForColumns ? style.orderedNamedGridColumnLines() : style.orderedNamedGridRowLines();
574 bool isRenderGrid = renderer && renderer->isRenderGrid(); 574 bool isLayoutGrid = renderer && renderer->isLayoutGrid();
575 575
576 // Handle the 'none' case. 576 // Handle the 'none' case.
577 bool trackListIsEmpty = trackSizes.isEmpty(); 577 bool trackListIsEmpty = trackSizes.isEmpty();
578 if (isRenderGrid && trackListIsEmpty) { 578 if (isLayoutGrid && trackListIsEmpty) {
579 // For grids we should consider every listed track, whether implicitly o r explicitly created. If we don't have 579 // For grids we should consider every listed track, whether implicitly o r explicitly created. If we don't have
580 // any explicit track and there are no children then there are no implic it tracks. We cannot simply check the 580 // any explicit track and there are no children then there are no implic it tracks. We cannot simply check the
581 // number of rows/columns in our internal grid representation because it 's always at least 1x1 (see r143331). 581 // number of rows/columns in our internal grid representation because it 's always at least 1x1 (see r143331).
582 trackListIsEmpty = !toRenderBlock(renderer)->firstChild(); 582 trackListIsEmpty = !toRenderBlock(renderer)->firstChild();
583 } 583 }
584 584
585 if (trackListIsEmpty) { 585 if (trackListIsEmpty) {
586 ASSERT(orderedNamedGridLines.isEmpty()); 586 ASSERT(orderedNamedGridLines.isEmpty());
587 return cssValuePool().createIdentifierValue(CSSValueNone); 587 return cssValuePool().createIdentifierValue(CSSValueNone);
588 } 588 }
589 589
590 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ; 590 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated() ;
591 if (isRenderGrid) { 591 if (isLayoutGrid) {
592 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toR enderGrid(renderer)->columnPositions() : toRenderGrid(renderer)->rowPositions(); 592 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toL ayoutGrid(renderer)->columnPositions() : toLayoutGrid(renderer)->rowPositions();
593 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro m that, the grid container can generate implicit grid tracks, 593 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro m that, the grid container can generate implicit grid tracks,
594 // so we'll have more trackPositions than trackSizes as the latter only contain the explicit grid. 594 // so we'll have more trackPositions than trackSizes as the latter only contain the explicit grid.
595 ASSERT(trackPositions.size() - 1 >= trackSizes.size()); 595 ASSERT(trackPositions.size() - 1 >= trackSizes.size());
596 596
597 for (size_t i = 0; i < trackPositions.size() - 1; ++i) { 597 for (size_t i = 0; i < trackPositions.size() - 1; ++i) {
598 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); 598 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list);
599 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos itions[i], style)); 599 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos itions[i], style));
600 } 600 }
601 } else { 601 } else {
602 for (size_t i = 0; i < trackSizes.size(); ++i) { 602 for (size_t i = 0; i < trackSizes.size(); ++i) {
(...skipping 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after
2564 return zoomAdjustedPixelValueForLength(svgStyle.y(), style); 2564 return zoomAdjustedPixelValueForLength(svgStyle.y(), style);
2565 2565
2566 case CSSPropertyAll: 2566 case CSSPropertyAll:
2567 return nullptr; 2567 return nullptr;
2568 } 2568 }
2569 ASSERT_NOT_REACHED(); 2569 ASSERT_NOT_REACHED();
2570 return nullptr; 2570 return nullptr;
2571 } 2571 }
2572 2572
2573 } 2573 }
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/dom/FirstLetterPseudoElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698