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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutListMarker.cpp

Issue 2770123003: Replace ASSERT with DCHECK in core/layout/ excluding subdirs (Closed)
Patch Set: Split some DCHECKs and add DCHECK_ops wherever possible Created 3 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
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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
7 * Copyright (C) 2010 Daniel Bates (dbates@intudata.com) 7 * Copyright (C) 2010 Daniel Bates (dbates@intudata.com)
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 LayoutListMarker* LayoutListMarker::createAnonymous(LayoutListItem* item) { 58 LayoutListMarker* LayoutListMarker::createAnonymous(LayoutListItem* item) {
59 Document& document = item->document(); 59 Document& document = item->document();
60 LayoutListMarker* layoutObject = new LayoutListMarker(item); 60 LayoutListMarker* layoutObject = new LayoutListMarker(item);
61 layoutObject->setDocumentForAnonymous(&document); 61 layoutObject->setDocumentForAnonymous(&document);
62 return layoutObject; 62 return layoutObject;
63 } 63 }
64 64
65 LayoutSize LayoutListMarker::imageBulletSize() const { 65 LayoutSize LayoutListMarker::imageBulletSize() const {
66 ASSERT(isImage()); 66 DCHECK(isImage());
67 const SimpleFontData* fontData = style()->font().primaryFont(); 67 const SimpleFontData* fontData = style()->font().primaryFont();
68 DCHECK(fontData); 68 DCHECK(fontData);
69 if (!fontData) 69 if (!fontData)
70 return LayoutSize(); 70 return LayoutSize();
71 71
72 // FIXME: This is a somewhat arbitrary default width. Generated images for 72 // FIXME: This is a somewhat arbitrary default width. Generated images for
73 // markers really won't become particularly useful until we support the CSS3 73 // markers really won't become particularly useful until we support the CSS3
74 // marker pseudoclass to allow control over the width and height of the 74 // marker pseudoclass to allow control over the width and height of the
75 // marker box. 75 // marker box.
76 LayoutUnit bulletWidth = fontData->getFontMetrics().ascent() / LayoutUnit(2); 76 LayoutUnit bulletWidth = fontData->getFontMetrics().ascent() / LayoutUnit(2);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 : LayoutRect(newLogicalTop, LayoutUnit(), root.selectionHeight(), 128 : LayoutRect(newLogicalTop, LayoutUnit(), root.selectionHeight(),
129 size().height()); 129 size().height());
130 } 130 }
131 131
132 void LayoutListMarker::paint(const PaintInfo& paintInfo, 132 void LayoutListMarker::paint(const PaintInfo& paintInfo,
133 const LayoutPoint& paintOffset) const { 133 const LayoutPoint& paintOffset) const {
134 ListMarkerPainter(*this).paint(paintInfo, paintOffset); 134 ListMarkerPainter(*this).paint(paintInfo, paintOffset);
135 } 135 }
136 136
137 void LayoutListMarker::layout() { 137 void LayoutListMarker::layout() {
138 ASSERT(needsLayout()); 138 DCHECK(needsLayout());
139 LayoutAnalyzer::Scope analyzer(*this); 139 LayoutAnalyzer::Scope analyzer(*this);
140 140
141 LayoutUnit blockOffset; 141 LayoutUnit blockOffset;
142 for (LayoutBox* o = parentBox(); o && o != listItem(); o = o->parentBox()) { 142 for (LayoutBox* o = parentBox(); o && o != listItem(); o = o->parentBox()) {
143 blockOffset += o->logicalTop(); 143 blockOffset += o->logicalTop();
144 } 144 }
145 if (listItem()->style()->isLeftToRightDirection()) { 145 if (listItem()->style()->isLeftToRightDirection()) {
146 m_lineOffset = listItem()->logicalLeftOffsetForLine( 146 m_lineOffset = listItem()->logicalLeftOffsetForLine(
147 blockOffset, DoNotIndentText, LayoutUnit()); 147 blockOffset, DoNotIndentText, LayoutUnit());
148 } else { 148 } else {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 UChar suffix[2] = { 230 UChar suffix[2] = {
231 ListMarkerText::suffix(style()->listStyleType(), m_listItem->value()), 231 ListMarkerText::suffix(style()->listStyleType(), m_listItem->value()),
232 ' '}; 232 ' '};
233 TextRun run = 233 TextRun run =
234 constructTextRun(font, suffix, 2, styleRef(), style()->direction()); 234 constructTextRun(font, suffix, 2, styleRef(), style()->direction());
235 LayoutUnit suffixSpaceWidth = LayoutUnit(font.width(run)); 235 LayoutUnit suffixSpaceWidth = LayoutUnit(font.width(run));
236 return itemWidth + suffixSpaceWidth; 236 return itemWidth + suffixSpaceWidth;
237 } 237 }
238 238
239 void LayoutListMarker::computePreferredLogicalWidths() { 239 void LayoutListMarker::computePreferredLogicalWidths() {
240 ASSERT(preferredLogicalWidthsDirty()); 240 DCHECK(preferredLogicalWidthsDirty());
241 updateContent(); 241 updateContent();
242 242
243 if (isImage()) { 243 if (isImage()) {
244 LayoutSize imageSize(imageBulletSize()); 244 LayoutSize imageSize(imageBulletSize());
245 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = 245 m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth =
246 style()->isHorizontalWritingMode() ? imageSize.width() 246 style()->isHorizontalWritingMode() ? imageSize.width()
247 : imageSize.height(); 247 : imageSize.height();
248 clearPreferredLogicalWidthsDirty(); 248 clearPreferredLogicalWidthsDirty();
249 updateMargins(); 249 updateMargins();
250 return; 250 return;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 return m_listItem->lineHeight(firstLine, direction, 351 return m_listItem->lineHeight(firstLine, direction,
352 PositionOfInteriorLineBoxes); 352 PositionOfInteriorLineBoxes);
353 return LayoutBox::lineHeight(firstLine, direction, linePositionMode); 353 return LayoutBox::lineHeight(firstLine, direction, linePositionMode);
354 } 354 }
355 355
356 int LayoutListMarker::baselinePosition( 356 int LayoutListMarker::baselinePosition(
357 FontBaseline baselineType, 357 FontBaseline baselineType,
358 bool firstLine, 358 bool firstLine,
359 LineDirectionMode direction, 359 LineDirectionMode direction,
360 LinePositionMode linePositionMode) const { 360 LinePositionMode linePositionMode) const {
361 ASSERT(linePositionMode == PositionOnContainingLine); 361 DCHECK_EQ(linePositionMode, PositionOnContainingLine);
362 if (!isImage()) 362 if (!isImage())
363 return m_listItem->baselinePosition(baselineType, firstLine, direction, 363 return m_listItem->baselinePosition(baselineType, firstLine, direction,
364 PositionOfInteriorLineBoxes); 364 PositionOfInteriorLineBoxes);
365 return LayoutBox::baselinePosition(baselineType, firstLine, direction, 365 return LayoutBox::baselinePosition(baselineType, firstLine, direction,
366 linePositionMode); 366 linePositionMode);
367 } 367 }
368 368
369 LayoutListMarker::ListStyleCategory LayoutListMarker::getListStyleCategory() 369 LayoutListMarker::ListStyleCategory LayoutListMarker::getListStyleCategory()
370 const { 370 const {
371 switch (style()->listStyleType()) { 371 switch (style()->listStyleType()) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 if (style()) { 495 if (style()) {
496 // Reuse the current margins. Otherwise resetting the margins to initial 496 // Reuse the current margins. Otherwise resetting the margins to initial
497 // values would trigger unnecessary layout. 497 // values would trigger unnecessary layout.
498 newStyle->setMarginStart(style()->marginStart()); 498 newStyle->setMarginStart(style()->marginStart());
499 newStyle->setMarginEnd(style()->marginRight()); 499 newStyle->setMarginEnd(style()->marginRight());
500 } 500 }
501 setStyle(std::move(newStyle)); 501 setStyle(std::move(newStyle));
502 } 502 }
503 503
504 } // namespace blink 504 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutListItem.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutMedia.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698