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

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

Issue 2394263004: Reformat comments in core/layout up until LayoutMultiColumnFlowThread (Closed)
Patch Set: Rebase w/HEAD Created 4 years, 2 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. All rights reserv ed. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc.
5 * All rights reserved.
5 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
6 * Copyright (C) 2010 Daniel Bates (dbates@intudata.com) 7 * Copyright (C) 2010 Daniel Bates (dbates@intudata.com)
7 * 8 *
8 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 11 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version. 12 * version 2 of the License, or (at your option) any later version.
12 * 13 *
13 * This library is distributed in the hope that it will be useful, 14 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 LayoutListMarker* LayoutListMarker::createAnonymous(LayoutListItem* item) { 59 LayoutListMarker* LayoutListMarker::createAnonymous(LayoutListItem* item) {
59 Document& document = item->document(); 60 Document& document = item->document();
60 LayoutListMarker* layoutObject = new LayoutListMarker(item); 61 LayoutListMarker* layoutObject = new LayoutListMarker(item);
61 layoutObject->setDocumentForAnonymous(&document); 62 layoutObject->setDocumentForAnonymous(&document);
62 return layoutObject; 63 return layoutObject;
63 } 64 }
64 65
65 LayoutSize LayoutListMarker::imageBulletSize() const { 66 LayoutSize LayoutListMarker::imageBulletSize() const {
66 ASSERT(isImage()); 67 ASSERT(isImage());
67 68
68 // FIXME: This is a somewhat arbitrary default width. Generated images for mar kers really won't 69 // FIXME: This is a somewhat arbitrary default width. Generated images for
69 // become particularly useful until we support the CSS3 marker pseudoclass to allow control over 70 // markers really won't become particularly useful until we support the CSS3
70 // the width and height of the marker box. 71 // marker pseudoclass to allow control over the width and height of the
72 // marker box.
71 LayoutUnit bulletWidth = style()->getFontMetrics().ascent() / LayoutUnit(2); 73 LayoutUnit bulletWidth = style()->getFontMetrics().ascent() / LayoutUnit(2);
72 return m_image->imageSize(*this, style()->effectiveZoom(), 74 return m_image->imageSize(*this, style()->effectiveZoom(),
73 LayoutSize(bulletWidth, bulletWidth)); 75 LayoutSize(bulletWidth, bulletWidth));
74 } 76 }
75 77
76 void LayoutListMarker::styleWillChange(StyleDifference diff, 78 void LayoutListMarker::styleWillChange(StyleDifference diff,
77 const ComputedStyle& newStyle) { 79 const ComputedStyle& newStyle) {
78 if (style() && 80 if (style() &&
79 (newStyle.listStylePosition() != style()->listStylePosition() || 81 (newStyle.listStylePosition() != style()->listStylePosition() ||
80 newStyle.listStyleType() != style()->listStyleType())) 82 newStyle.listStyleType() != style()->listStyleType()))
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 Length endMargin = style()->marginEnd(); 152 Length endMargin = style()->marginEnd();
151 if (startMargin.isFixed()) 153 if (startMargin.isFixed())
152 setMarginStart(LayoutUnit(startMargin.value())); 154 setMarginStart(LayoutUnit(startMargin.value()));
153 if (endMargin.isFixed()) 155 if (endMargin.isFixed())
154 setMarginEnd(LayoutUnit(endMargin.value())); 156 setMarginEnd(LayoutUnit(endMargin.value()));
155 157
156 clearNeedsLayout(); 158 clearNeedsLayout();
157 } 159 }
158 160
159 void LayoutListMarker::imageChanged(WrappedImagePtr o, const IntRect*) { 161 void LayoutListMarker::imageChanged(WrappedImagePtr o, const IntRect*) {
160 // A list marker can't have a background or border image, so no need to call t he base class method. 162 // A list marker can't have a background or border image, so no need to call
163 // the base class method.
161 if (!m_image || o != m_image->data()) 164 if (!m_image || o != m_image->data())
162 return; 165 return;
163 166
164 LayoutSize imageSize = isImage() ? imageBulletSize() : LayoutSize(); 167 LayoutSize imageSize = isImage() ? imageBulletSize() : LayoutSize();
165 if (size() != imageSize || m_image->errorOccurred()) 168 if (size() != imageSize || m_image->errorOccurred())
166 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation( 169 setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(
167 LayoutInvalidationReason::ImageChanged); 170 LayoutInvalidationReason::ImageChanged);
168 else 171 else
169 setShouldDoFullPaintInvalidation(); 172 setShouldDoFullPaintInvalidation();
170 } 173 }
171 174
172 void LayoutListMarker::updateMarginsAndContent() { 175 void LayoutListMarker::updateMarginsAndContent() {
173 updateContent(); 176 updateContent();
174 updateMargins(); 177 updateMargins();
175 } 178 }
176 179
177 void LayoutListMarker::updateContent() { 180 void LayoutListMarker::updateContent() {
178 // FIXME: This if-statement is just a performance optimization, but it's messy to use the preferredLogicalWidths dirty bit for this. 181 // FIXME: This if-statement is just a performance optimization, but it's messy
182 // to use the preferredLogicalWidths dirty bit for this.
179 // It's unclear if this is a premature optimization. 183 // It's unclear if this is a premature optimization.
180 if (!preferredLogicalWidthsDirty()) 184 if (!preferredLogicalWidthsDirty())
181 return; 185 return;
182 186
183 m_text = ""; 187 m_text = "";
184 188
185 if (isImage()) 189 if (isImage())
186 return; 190 return;
187 191
188 switch (getListStyleCategory()) { 192 switch (getListStyleCategory()) {
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 if (!style()->isHorizontalWritingMode()) { 443 if (!style()->isHorizontalWritingMode()) {
440 relativeRect = relativeRect.transposedRect(); 444 relativeRect = relativeRect.transposedRect();
441 relativeRect.setX( 445 relativeRect.setX(
442 (size().width() - relativeRect.x() - relativeRect.width()).toInt()); 446 (size().width() - relativeRect.x() - relativeRect.width()).toInt());
443 } 447 }
444 448
445 return relativeRect; 449 return relativeRect;
446 } 450 }
447 451
448 void LayoutListMarker::setSelectionState(SelectionState state) { 452 void LayoutListMarker::setSelectionState(SelectionState state) {
449 // The selection state for our containing block hierarchy is updated by the ba se class call. 453 // The selection state for our containing block hierarchy is updated by the
454 // base class call.
450 LayoutBox::setSelectionState(state); 455 LayoutBox::setSelectionState(state);
451 456
452 if (inlineBoxWrapper() && canUpdateSelectionOnRootLineBoxes()) 457 if (inlineBoxWrapper() && canUpdateSelectionOnRootLineBoxes())
453 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone); 458 inlineBoxWrapper()->root().setHasSelectedChildren(state != SelectionNone);
454 } 459 }
455 460
456 void LayoutListMarker::listItemStyleDidChange() { 461 void LayoutListMarker::listItemStyleDidChange() {
457 RefPtr<ComputedStyle> newStyle = ComputedStyle::create(); 462 RefPtr<ComputedStyle> newStyle = ComputedStyle::create();
458 // The marker always inherits from the list item, regardless of where it might end 463 // The marker always inherits from the list item, regardless of where it might
459 // up (e.g., in some deeply nested line box). See CSS3 spec. 464 // end up (e.g., in some deeply nested line box). See CSS3 spec.
460 newStyle->inheritFrom(m_listItem->styleRef()); 465 newStyle->inheritFrom(m_listItem->styleRef());
461 if (style()) { 466 if (style()) {
462 // Reuse the current margins. Otherwise resetting the margins to initial val ues 467 // Reuse the current margins. Otherwise resetting the margins to initial
463 // would trigger unnecessary layout. 468 // values would trigger unnecessary layout.
464 newStyle->setMarginStart(style()->marginStart()); 469 newStyle->setMarginStart(style()->marginStart());
465 newStyle->setMarginEnd(style()->marginRight()); 470 newStyle->setMarginEnd(style()->marginRight());
466 } 471 }
467 setStyle(newStyle.release()); 472 setStyle(newStyle.release());
468 } 473 }
469 474
470 } // namespace blink 475 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutListMarker.h ('k') | third_party/WebKit/Source/core/layout/LayoutMenuList.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698