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

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

Issue 1774943003: blink: Rename platform/ methods to prefix with get when they collide. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clash-platform: rebase-yayyyyyyyy Created 4 years, 9 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, 2009 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 if (alwaysCreateLineBoxes()) 205 if (alwaysCreateLineBoxes())
206 return; 206 return;
207 207
208 const ComputedStyle& parentStyle = parent()->styleRef(); 208 const ComputedStyle& parentStyle = parent()->styleRef();
209 LayoutInline* parentLayoutInline = parent()->isLayoutInline() ? toLayoutInli ne(parent()) : 0; 209 LayoutInline* parentLayoutInline = parent()->isLayoutInline() ? toLayoutInli ne(parent()) : 0;
210 bool checkFonts = document().inNoQuirksMode(); 210 bool checkFonts = document().inNoQuirksMode();
211 bool alwaysCreateLineBoxesNew = (parentLayoutInline && parentLayoutInline->a lwaysCreateLineBoxes()) 211 bool alwaysCreateLineBoxesNew = (parentLayoutInline && parentLayoutInline->a lwaysCreateLineBoxes())
212 || (parentLayoutInline && parentStyle.verticalAlign() != VerticalAlignBa seline) 212 || (parentLayoutInline && parentStyle.verticalAlign() != VerticalAlignBa seline)
213 || style()->verticalAlign() != VerticalAlignBaseline 213 || style()->verticalAlign() != VerticalAlignBaseline
214 || style()->getTextEmphasisMark() != TextEmphasisMarkNone 214 || style()->getTextEmphasisMark() != TextEmphasisMarkNone
215 || (checkFonts && (!parentStyle.font().fontMetrics().hasIdenticalAscentD escentAndLineGap(style()->font().fontMetrics()) 215 || (checkFonts && (!parentStyle.font().getFontMetrics().hasIdenticalAsce ntDescentAndLineGap(style()->font().getFontMetrics())
216 || parentStyle.lineHeight() != style()->lineHeight())); 216 || parentStyle.lineHeight() != style()->lineHeight()));
217 217
218 if (!alwaysCreateLineBoxesNew && checkFonts && document().styleEngine().uses FirstLineRules()) { 218 if (!alwaysCreateLineBoxesNew && checkFonts && document().styleEngine().uses FirstLineRules()) {
219 // Have to check the first line style as well. 219 // Have to check the first line style as well.
220 const ComputedStyle& firstLineParentStyle = parent()->styleRef(true); 220 const ComputedStyle& firstLineParentStyle = parent()->styleRef(true);
221 const ComputedStyle& childStyle = styleRef(true); 221 const ComputedStyle& childStyle = styleRef(true);
222 alwaysCreateLineBoxesNew = !firstLineParentStyle.font().fontMetrics().ha sIdenticalAscentDescentAndLineGap(childStyle.font().fontMetrics()) 222 alwaysCreateLineBoxesNew = !firstLineParentStyle.font().getFontMetrics() .hasIdenticalAscentDescentAndLineGap(childStyle.font().getFontMetrics())
223 || childStyle.verticalAlign() != VerticalAlignBaseline 223 || childStyle.verticalAlign() != VerticalAlignBaseline
224 || firstLineParentStyle.lineHeight() != childStyle.lineHeight(); 224 || firstLineParentStyle.lineHeight() != childStyle.lineHeight();
225 } 225 }
226 226
227 if (alwaysCreateLineBoxesNew) { 227 if (alwaysCreateLineBoxesNew) {
228 if (!fullLayout) 228 if (!fullLayout)
229 dirtyLineBoxes(false); 229 dirtyLineBoxes(false);
230 setAlwaysCreateLineBoxes(); 230 setAlwaysCreateLineBoxes();
231 } 231 }
232 } 232 }
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 for (LayoutObject* curr = firstChild(); curr; curr = curr->nextSibling()) { 557 for (LayoutObject* curr = firstChild(); curr; curr = curr->nextSibling()) {
558 if (curr->isFloatingOrOutOfFlowPositioned()) 558 if (curr->isFloatingOrOutOfFlowPositioned())
559 continue; 559 continue;
560 560
561 // We want to get the margin box in the inline direction, and then use o ur font ascent/descent in the block 561 // We want to get the margin box in the inline direction, and then use o ur font ascent/descent in the block
562 // direction (aligned to the root box's baseline). 562 // direction (aligned to the root box's baseline).
563 if (curr->isBox()) { 563 if (curr->isBox()) {
564 LayoutBox* currBox = toLayoutBox(curr); 564 LayoutBox* currBox = toLayoutBox(curr);
565 if (currBox->inlineBoxWrapper()) { 565 if (currBox->inlineBoxWrapper()) {
566 RootInlineBox& rootBox = currBox->inlineBoxWrapper()->root(); 566 RootInlineBox& rootBox = currBox->inlineBoxWrapper()->root();
567 LayoutUnit logicalTop = rootBox.logicalTop() + (rootBox.getLineL ayoutItem().style(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - c ontainer->style(rootBox.isFirstLineStyle())->font().fontMetrics().ascent()); 567 LayoutUnit logicalTop = rootBox.logicalTop() + (rootBox.getLineL ayoutItem().style(rootBox.isFirstLineStyle())->font().getFontMetrics().ascent() - container->style(rootBox.isFirstLineStyle())->font().getFontMetrics().ascent() );
568 LayoutUnit logicalHeight(container->style(rootBox.isFirstLineSty le())->font().fontMetrics().height()); 568 LayoutUnit logicalHeight(container->style(rootBox.isFirstLineSty le())->font().getFontMetrics().height());
569 if (isHorizontal) { 569 if (isHorizontal) {
570 yield(LayoutRect(LayoutUnit(currBox->inlineBoxWrapper()->x() - currBox->marginLeft()), LayoutUnit(logicalTop), 570 yield(LayoutRect(LayoutUnit(currBox->inlineBoxWrapper()->x() - currBox->marginLeft()), LayoutUnit(logicalTop),
571 LayoutUnit(currBox->size().width() + currBox->marginWidt h()), LayoutUnit(logicalHeight))); 571 LayoutUnit(currBox->size().width() + currBox->marginWidt h()), LayoutUnit(logicalHeight)));
572 } else { 572 } else {
573 yield(LayoutRect(LayoutUnit(logicalTop), LayoutUnit(currBox- >inlineBoxWrapper()->y() - currBox->marginTop()), 573 yield(LayoutRect(LayoutUnit(logicalTop), LayoutUnit(currBox- >inlineBoxWrapper()->y() - currBox->marginTop()),
574 LayoutUnit(logicalHeight), currBox->size().height() + cu rrBox->marginHeight())); 574 LayoutUnit(logicalHeight), currBox->size().height() + cu rrBox->marginHeight()));
575 } 575 }
576 } 576 }
577 } else if (curr->isLayoutInline()) { 577 } else if (curr->isLayoutInline()) {
578 // If the child doesn't need line boxes either, then we can recur. 578 // If the child doesn't need line boxes either, then we can recur.
579 LayoutInline* currInline = toLayoutInline(curr); 579 LayoutInline* currInline = toLayoutInline(curr);
580 if (!currInline->alwaysCreateLineBoxes()) { 580 if (!currInline->alwaysCreateLineBoxes()) {
581 currInline->generateCulledLineBoxRects(yield, container); 581 currInline->generateCulledLineBoxRects(yield, container);
582 } else { 582 } else {
583 for (InlineFlowBox* childLine = currInline->firstLineBox(); chil dLine; childLine = childLine->nextLineBox()) { 583 for (InlineFlowBox* childLine = currInline->firstLineBox(); chil dLine; childLine = childLine->nextLineBox()) {
584 RootInlineBox& rootBox = childLine->root(); 584 RootInlineBox& rootBox = childLine->root();
585 LayoutUnit logicalTop = rootBox.logicalTop() + (rootBox.getL ineLayoutItem().style(rootBox.isFirstLineStyle())->font().fontMetrics().ascent() - container->style(rootBox.isFirstLineStyle())->font().fontMetrics().ascent()); 585 LayoutUnit logicalTop = rootBox.logicalTop() + (rootBox.getL ineLayoutItem().style(rootBox.isFirstLineStyle())->font().getFontMetrics().ascen t() - container->style(rootBox.isFirstLineStyle())->font().getFontMetrics().asce nt());
586 LayoutUnit logicalHeight(container->style(rootBox.isFirstLin eStyle())->font().fontMetrics().height()); 586 LayoutUnit logicalHeight(container->style(rootBox.isFirstLin eStyle())->font().getFontMetrics().height());
587 if (isHorizontal) { 587 if (isHorizontal) {
588 yield(LayoutRect(LayoutUnit(childLine->x() - childLine-> marginLogicalLeft()), 588 yield(LayoutRect(LayoutUnit(childLine->x() - childLine-> marginLogicalLeft()),
589 logicalTop, 589 logicalTop,
590 LayoutUnit(childLine->logicalWidth() + childLine->ma rginLogicalLeft() + childLine->marginLogicalRight()), 590 LayoutUnit(childLine->logicalWidth() + childLine->ma rginLogicalLeft() + childLine->marginLogicalRight()),
591 logicalHeight)); 591 logicalHeight));
592 } else { 592 } else {
593 yield(LayoutRect(logicalTop, 593 yield(LayoutRect(logicalTop,
594 LayoutUnit(childLine->y() - childLine->marginLogical Left()), 594 LayoutUnit(childLine->y() - childLine->marginLogical Left()),
595 logicalHeight, 595 logicalHeight,
596 LayoutUnit(childLine->logicalWidth() + childLine->ma rginLogicalLeft() + childLine->marginLogicalRight()))); 596 LayoutUnit(childLine->logicalWidth() + childLine->ma rginLogicalLeft() + childLine->marginLogicalRight())));
597 } 597 }
598 } 598 }
599 } 599 }
600 } else if (curr->isText()) { 600 } else if (curr->isText()) {
601 LayoutText* currText = toLayoutText(curr); 601 LayoutText* currText = toLayoutText(curr);
602 for (InlineTextBox* childText = currText->firstTextBox(); childText; childText = childText->nextTextBox()) { 602 for (InlineTextBox* childText = currText->firstTextBox(); childText; childText = childText->nextTextBox()) {
603 RootInlineBox& rootBox = childText->root(); 603 RootInlineBox& rootBox = childText->root();
604 LayoutUnit logicalTop = LayoutUnit(rootBox.logicalTop() 604 LayoutUnit logicalTop = LayoutUnit(rootBox.logicalTop()
605 + (rootBox.getLineLayoutItem().style(rootBox.isFirstLineStyl e())->font().fontMetrics().ascent() 605 + (rootBox.getLineLayoutItem().style(rootBox.isFirstLineStyl e())->font().getFontMetrics().ascent()
606 - container->style(rootBox.isFirstLineStyle())->font().fontM etrics().ascent())); 606 - container->style(rootBox.isFirstLineStyle())->font().getFo ntMetrics().ascent()));
607 LayoutUnit logicalHeight(container->style(rootBox.isFirstLineSty le())->font().fontMetrics().height()); 607 LayoutUnit logicalHeight(container->style(rootBox.isFirstLineSty le())->font().getFontMetrics().height());
608 if (isHorizontal) 608 if (isHorizontal)
609 yield(LayoutRect(childText->x(), logicalTop, childText->logi calWidth(), logicalHeight)); 609 yield(LayoutRect(childText->x(), logicalTop, childText->logi calWidth(), logicalHeight));
610 else 610 else
611 yield(LayoutRect(logicalTop, childText->y(), logicalHeight, childText->logicalWidth())); 611 yield(LayoutRect(logicalTop, childText->y(), logicalHeight, childText->logicalWidth()));
612 } 612 }
613 } 613 }
614 } 614 }
615 } 615 }
616 616
617 namespace { 617 namespace {
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 if (s != style()) 1250 if (s != style())
1251 return LayoutUnit(s->computedLineHeight()); 1251 return LayoutUnit(s->computedLineHeight());
1252 } 1252 }
1253 1253
1254 return LayoutUnit(style()->computedLineHeight()); 1254 return LayoutUnit(style()->computedLineHeight());
1255 } 1255 }
1256 1256
1257 int LayoutInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li neDirectionMode direction, LinePositionMode linePositionMode) const 1257 int LayoutInline::baselinePosition(FontBaseline baselineType, bool firstLine, Li neDirectionMode direction, LinePositionMode linePositionMode) const
1258 { 1258 {
1259 ASSERT(linePositionMode == PositionOnContainingLine); 1259 ASSERT(linePositionMode == PositionOnContainingLine);
1260 const FontMetrics& fontMetrics = style(firstLine)->fontMetrics(); 1260 const FontMetrics& fontMetrics = style(firstLine)->getFontMetrics();
1261 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2; 1261 return fontMetrics.ascent(baselineType) + (lineHeight(firstLine, direction, linePositionMode) - fontMetrics.height()) / 2;
1262 } 1262 }
1263 1263
1264 LayoutSize LayoutInline::offsetForInFlowPositionedInline(const LayoutBox& child) const 1264 LayoutSize LayoutInline::offsetForInFlowPositionedInline(const LayoutBox& child) const
1265 { 1265 {
1266 // FIXME: This function isn't right with mixed writing modes. 1266 // FIXME: This function isn't right with mixed writing modes.
1267 1267
1268 ASSERT(isInFlowPositioned()); 1268 ASSERT(isInFlowPositioned());
1269 if (!isInFlowPositioned()) 1269 if (!isInFlowPositioned())
1270 return LayoutSize(); 1270 return LayoutSize();
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 1388
1389 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const 1389 void LayoutInline::invalidateDisplayItemClients(const LayoutBoxModelObject& pain tInvalidationContainer, PaintInvalidationReason invalidationReason) const
1390 { 1390 {
1391 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason); 1391 LayoutBoxModelObject::invalidateDisplayItemClients(paintInvalidationContaine r, invalidationReason);
1392 1392
1393 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox()) 1393 for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
1394 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason); 1394 paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*box, in validationReason);
1395 } 1395 }
1396 1396
1397 } // namespace blink 1397 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutImageResource.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutListBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698