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

Side by Side Diff: third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp

Issue 2286543002: Add Length::isPercent and use it in tables. (Closed)
Patch Set: rebase Created 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/BackgroundImageGeometry.h" 5 #include "core/paint/BackgroundImageGeometry.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/layout/LayoutBox.h" 8 #include "core/layout/LayoutBox.h"
9 #include "core/layout/LayoutBoxModelObject.h" 9 #include "core/layout/LayoutBoxModelObject.h"
10 #include "core/layout/LayoutView.h" 10 #include "core/layout/LayoutView.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 LayoutSize imageIntrinsicSize = image->imageSize(obj, obj.style()->effective Zoom(), positioningAreaSize); 56 LayoutSize imageIntrinsicSize = image->imageSize(obj, obj.style()->effective Zoom(), positioningAreaSize);
57 switch (type) { 57 switch (type) {
58 case SizeLength: { 58 case SizeLength: {
59 LayoutSize tileSize(positioningAreaSize); 59 LayoutSize tileSize(positioningAreaSize);
60 60
61 Length layerWidth = fillLayer.size().size.width(); 61 Length layerWidth = fillLayer.size().size.width();
62 Length layerHeight = fillLayer.size().size.height(); 62 Length layerHeight = fillLayer.size().size.height();
63 63
64 if (layerWidth.isFixed()) 64 if (layerWidth.isFixed())
65 tileSize.setWidth(LayoutUnit(layerWidth.value())); 65 tileSize.setWidth(LayoutUnit(layerWidth.value()));
66 else if (layerWidth.hasPercent()) 66 else if (layerWidth.isPercentOrCalc())
67 tileSize.setWidth(valueForLength(layerWidth, positioningAreaSize.wid th())); 67 tileSize.setWidth(valueForLength(layerWidth, positioningAreaSize.wid th()));
68 68
69 if (layerHeight.isFixed()) 69 if (layerHeight.isFixed())
70 tileSize.setHeight(LayoutUnit(layerHeight.value())); 70 tileSize.setHeight(LayoutUnit(layerHeight.value()));
71 else if (layerHeight.hasPercent()) 71 else if (layerHeight.isPercentOrCalc())
72 tileSize.setHeight(valueForLength(layerHeight, positioningAreaSize.h eight())); 72 tileSize.setHeight(valueForLength(layerHeight, positioningAreaSize.h eight()));
73 73
74 // If one of the values is auto we have to use the appropriate 74 // If one of the values is auto we have to use the appropriate
75 // scale to maintain our aspect ratio. 75 // scale to maintain our aspect ratio.
76 if (layerWidth.isAuto() && !layerHeight.isAuto()) { 76 if (layerWidth.isAuto() && !layerHeight.isAuto()) {
77 if (imageIntrinsicSize.height()) { 77 if (imageIntrinsicSize.height()) {
78 LayoutUnit adjustedWidth = imageIntrinsicSize.width() * tileSize .height() / imageIntrinsicSize.height(); 78 LayoutUnit adjustedWidth = imageIntrinsicSize.width() * tileSize .height() / imageIntrinsicSize.height();
79 if (imageIntrinsicSize.width() >= 1 && adjustedWidth < 1) 79 if (imageIntrinsicSize.width() >= 1 && adjustedWidth < 1)
80 adjustedWidth = LayoutUnit(1); 80 adjustedWidth = LayoutUnit(1);
81 tileSize.setWidth(adjustedWidth); 81 tileSize.setWidth(adjustedWidth);
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 useFixedAttachment(paintRect.location()); 415 useFixedAttachment(paintRect.location());
416 416
417 // Clip the final output rect to the paint rect 417 // Clip the final output rect to the paint rect
418 m_destRect.intersect(paintRect); 418 m_destRect.intersect(paintRect);
419 419
420 // Snap as-yet unsnapped values. 420 // Snap as-yet unsnapped values.
421 setDestRect(LayoutRect(pixelSnappedIntRect(m_destRect))); 421 setDestRect(LayoutRect(pixelSnappedIntRect(m_destRect)));
422 } 422 }
423 423
424 } // namespace blink 424 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc ('k') | third_party/WebKit/Source/core/style/ComputedStyle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698