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

Side by Side Diff: Source/core/layout/LayoutReplaced.cpp

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 years, 8 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/layout/LayoutReplaced.h ('k') | Source/core/layout/LayoutRuby.h » ('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 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } 57 }
58 58
59 void LayoutReplaced::willBeDestroyed() 59 void LayoutReplaced::willBeDestroyed()
60 { 60 {
61 if (!documentBeingDestroyed() && parent()) 61 if (!documentBeingDestroyed() && parent())
62 parent()->dirtyLinesFromChangedChild(this); 62 parent()->dirtyLinesFromChangedChild(this);
63 63
64 LayoutBox::willBeDestroyed(); 64 LayoutBox::willBeDestroyed();
65 } 65 }
66 66
67 void LayoutReplaced::styleDidChange(StyleDifference diff, const LayoutStyle* old Style) 67 void LayoutReplaced::styleDidChange(StyleDifference diff, const ComputedStyle* o ldStyle)
68 { 68 {
69 LayoutBox::styleDidChange(diff, oldStyle); 69 LayoutBox::styleDidChange(diff, oldStyle);
70 70
71 bool hadStyle = (oldStyle != 0); 71 bool hadStyle = (oldStyle != 0);
72 float oldZoom = hadStyle ? oldStyle->effectiveZoom() : LayoutStyle::initialZ oom(); 72 float oldZoom = hadStyle ? oldStyle->effectiveZoom() : ComputedStyle::initia lZoom();
73 if (style() && style()->effectiveZoom() != oldZoom) 73 if (style() && style()->effectiveZoom() != oldZoom)
74 intrinsicSizeChanged(); 74 intrinsicSizeChanged();
75 } 75 }
76 76
77 void LayoutReplaced::layout() 77 void LayoutReplaced::layout()
78 { 78 {
79 ASSERT(needsLayout()); 79 ASSERT(needsLayout());
80 LayoutAnalyzer::Scope analyzer(*this); 80 LayoutAnalyzer::Scope analyzer(*this);
81 81
82 LayoutRect oldContentRect = replacedContentRect(); 82 LayoutRect oldContentRect = replacedContentRect();
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 constrainedSize.setWidth(LayoutBox::computeReplacedLogicalHeight() * int rinsicSize.width() / intrinsicSize.height()); 215 constrainedSize.setWidth(LayoutBox::computeReplacedLogicalHeight() * int rinsicSize.width() / intrinsicSize.height());
216 constrainedSize.setHeight(LayoutBox::computeReplacedLogicalWidth() * int rinsicSize.height() / intrinsicSize.width()); 216 constrainedSize.setHeight(LayoutBox::computeReplacedLogicalWidth() * int rinsicSize.height() / intrinsicSize.width());
217 } 217 }
218 } 218 }
219 219
220 LayoutRect LayoutReplaced::replacedContentRect(const LayoutSize* overriddenIntri nsicSize) const 220 LayoutRect LayoutReplaced::replacedContentRect(const LayoutSize* overriddenIntri nsicSize) const
221 { 221 {
222 LayoutRect contentRect = contentBoxRect(); 222 LayoutRect contentRect = contentBoxRect();
223 ObjectFit objectFit = style()->objectFit(); 223 ObjectFit objectFit = style()->objectFit();
224 224
225 if (objectFit == ObjectFitFill && style()->objectPosition() == LayoutStyle:: initialObjectPosition()) { 225 if (objectFit == ObjectFitFill && style()->objectPosition() == ComputedStyle ::initialObjectPosition()) {
226 return contentRect; 226 return contentRect;
227 } 227 }
228 228
229 LayoutSize intrinsicSize = overriddenIntrinsicSize ? *overriddenIntrinsicSiz e : this->intrinsicSize(); 229 LayoutSize intrinsicSize = overriddenIntrinsicSize ? *overriddenIntrinsicSiz e : this->intrinsicSize();
230 if (!intrinsicSize.width() || !intrinsicSize.height()) 230 if (!intrinsicSize.width() || !intrinsicSize.height())
231 return contentRect; 231 return contentRect;
232 232
233 LayoutRect finalRect = contentRect; 233 LayoutRect finalRect = contentRect;
234 switch (objectFit) { 234 switch (objectFit) {
235 case ObjectFitContain: 235 case ObjectFitContain:
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 { 373 {
374 ASSERT(preferredLogicalWidthsDirty()); 374 ASSERT(preferredLogicalWidthsDirty());
375 375
376 // We cannot resolve any percent logical width here as the available logical 376 // We cannot resolve any percent logical width here as the available logical
377 // width may not be set on our containing block. 377 // width may not be set on our containing block.
378 if (style()->logicalWidth().isPercent()) 378 if (style()->logicalWidth().isPercent())
379 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth); 379 computeIntrinsicLogicalWidths(m_minPreferredLogicalWidth, m_maxPreferred LogicalWidth);
380 else 380 else
381 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeReplace dLogicalWidth(ComputePreferred); 381 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeReplace dLogicalWidth(ComputePreferred);
382 382
383 const LayoutStyle& styleToUse = styleRef(); 383 const ComputedStyle& styleToUse = styleRef();
384 if (styleToUse.logicalWidth().isPercent() || styleToUse.logicalMaxWidth().is Percent()) 384 if (styleToUse.logicalWidth().isPercent() || styleToUse.logicalMaxWidth().is Percent())
385 m_minPreferredLogicalWidth = 0; 385 m_minPreferredLogicalWidth = 0;
386 386
387 if (styleToUse.logicalMinWidth().isFixed() && styleToUse.logicalMinWidth().v alue() > 0) { 387 if (styleToUse.logicalMinWidth().isFixed() && styleToUse.logicalMinWidth().v alue() > 0) {
388 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value())); 388 m_maxPreferredLogicalWidth = std::max(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value()));
389 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value())); 389 m_minPreferredLogicalWidth = std::max(m_minPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMinWidth().value()));
390 } 390 }
391 391
392 if (styleToUse.logicalMaxWidth().isFixed()) { 392 if (styleToUse.logicalMaxWidth().isFixed()) {
393 m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value())); 393 m_maxPreferredLogicalWidth = std::min(m_maxPreferredLogicalWidth, adjust ContentBoxLogicalWidthForBoxSizing(styleToUse.logicalMaxWidth().value()));
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 return LayoutRect(); 505 return LayoutRect();
506 506
507 // The selectionRect can project outside of the overflowRect, so take their union 507 // The selectionRect can project outside of the overflowRect, so take their union
508 // for paint invalidation to avoid selection painting glitches. 508 // for paint invalidation to avoid selection painting glitches.
509 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect(); 509 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect();
510 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali dationState); 510 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali dationState);
511 return r; 511 return r;
512 } 512 }
513 513
514 } 514 }
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutReplaced.h ('k') | Source/core/layout/LayoutRuby.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698