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

Side by Side Diff: Source/core/rendering/RenderBlockLineLayout.cpp

Issue 355843002: Rename style(bool) to styleOrFirstLineStyle(bool) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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) 2000 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved. 3 * Copyright (C) 2003, 2004, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ight reserved.
4 * Copyright (C) 2010 Google Inc. All rights reserved. 4 * Copyright (C) 2010 Google 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 setMarginStartForChild(renderer, -startOverhang); 411 setMarginStartForChild(renderer, -startOverhang);
412 setMarginEndForChild(renderer, -endOverhang); 412 setMarginEndForChild(renderer, -endOverhang);
413 } 413 }
414 414
415 static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* ru n, RenderText* renderer, float xPos, const LineInfo& lineInfo, 415 static inline void setLogicalWidthForTextRun(RootInlineBox* lineBox, BidiRun* ru n, RenderText* renderer, float xPos, const LineInfo& lineInfo,
416 GlyphOverflowAndFallbackFontsMap& t extBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMeasurements& w ordMeasurements) 416 GlyphOverflowAndFallbackFontsMap& t extBoxDataMap, VerticalPositionCache& verticalPositionCache, WordMeasurements& w ordMeasurements)
417 { 417 {
418 HashSet<const SimpleFontData*> fallbackFonts; 418 HashSet<const SimpleFontData*> fallbackFonts;
419 GlyphOverflow glyphOverflow; 419 GlyphOverflow glyphOverflow;
420 420
421 const Font& font = renderer->style(lineInfo.isFirstLine())->font(); 421 const Font& font = renderer->styleOrFirstLineStyle(lineInfo.isFirstLine())-> font();
422 // Always compute glyph overflow if the block's line-box-contain value is "g lyphs". 422 // Always compute glyph overflow if the block's line-box-contain value is "g lyphs".
423 if (lineBox->fitsToGlyphs()) { 423 if (lineBox->fitsToGlyphs()) {
424 // If we don't stick out of the root line's font box, then don't bother computing our glyph overflow. This optimization 424 // If we don't stick out of the root line's font box, then don't bother computing our glyph overflow. This optimization
425 // will keep us from computing glyph bounds in nearly all cases. 425 // will keep us from computing glyph bounds in nearly all cases.
426 bool includeRootLine = lineBox->includesRootLineBoxFontOrLeading(); 426 bool includeRootLine = lineBox->includesRootLineBoxFontOrLeading();
427 int baselineShift = lineBox->verticalPositionForBox(run->m_box, vertical PositionCache); 427 int baselineShift = lineBox->verticalPositionForBox(run->m_box, vertical PositionCache);
428 int rootDescent = includeRootLine ? font.fontMetrics().descent() : 0; 428 int rootDescent = includeRootLine ? font.fontMetrics().descent() : 0;
429 int rootAscent = includeRootLine ? font.fontMetrics().ascent() : 0; 429 int rootAscent = includeRootLine ? font.fontMetrics().ascent() : 0;
430 int boxAscent = font.fontMetrics().ascent() - baselineShift; 430 int boxAscent = font.fontMetrics().ascent() - baselineShift;
431 int boxDescent = font.fontMetrics().descent() + baselineShift; 431 int boxDescent = font.fontMetrics().descent() + baselineShift;
432 if (boxAscent > rootDescent || boxDescent > rootAscent) 432 if (boxAscent > rootDescent || boxDescent > rootAscent)
433 glyphOverflow.computeBounds = true; 433 glyphOverflow.computeBounds = true;
434 } 434 }
435 435
436 LayoutUnit hyphenWidth = 0; 436 LayoutUnit hyphenWidth = 0;
437 if (toInlineTextBox(run->m_box)->hasHyphen()) { 437 if (toInlineTextBox(run->m_box)->hasHyphen()) {
438 const Font& font = renderer->style(lineInfo.isFirstLine())->font(); 438 const Font& font = renderer->styleOrFirstLineStyle(lineInfo.isFirstLine( ))->font();
439 hyphenWidth = measureHyphenWidth(renderer, font, run->direction()); 439 hyphenWidth = measureHyphenWidth(renderer, font, run->direction());
440 } 440 }
441 float measuredWidth = 0; 441 float measuredWidth = 0;
442 442
443 bool kerningIsEnabled = font.fontDescription().typesettingFeatures() & Kerni ng; 443 bool kerningIsEnabled = font.fontDescription().typesettingFeatures() & Kerni ng;
444 444
445 #if OS(MACOSX) 445 #if OS(MACOSX)
446 // FIXME: Having any font feature settings enabled can lead to selection gap s on 446 // FIXME: Having any font feature settings enabled can lead to selection gap s on
447 // Chromium-mac. https://bugs.webkit.org/show_bug.cgi?id=113418 447 // Chromium-mac. https://bugs.webkit.org/show_bug.cgi?id=113418
448 bool canUseSimpleFontCodePath = renderer->canUseSimpleFontCodePath() && !fon t.fontDescription().featureSettings(); 448 bool canUseSimpleFontCodePath = renderer->canUseSimpleFontCodePath() && !fon t.fontDescription().featureSettings();
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 if (rt->is8Bit()) 648 if (rt->is8Bit())
649 opportunitiesInRun = Character::expansionOpportunityCount(rt ->characters8() + r->m_start, r->m_stop - r->m_start, r->m_box->direction(), isA fterExpansion); 649 opportunitiesInRun = Character::expansionOpportunityCount(rt ->characters8() + r->m_start, r->m_stop - r->m_start, r->m_box->direction(), isA fterExpansion);
650 else 650 else
651 opportunitiesInRun = Character::expansionOpportunityCount(rt ->characters16() + r->m_start, r->m_stop - r->m_start, r->m_box->direction(), is AfterExpansion); 651 opportunitiesInRun = Character::expansionOpportunityCount(rt ->characters16() + r->m_start, r->m_stop - r->m_start, r->m_box->direction(), is AfterExpansion);
652 expansionOpportunities.append(opportunitiesInRun); 652 expansionOpportunities.append(opportunitiesInRun);
653 expansionOpportunityCount += opportunitiesInRun; 653 expansionOpportunityCount += opportunitiesInRun;
654 } 654 }
655 655
656 if (rt->textLength()) { 656 if (rt->textLength()) {
657 if (!r->m_start && needsWordSpacing && isSpaceOrNewline(rt->char acterAt(r->m_start))) 657 if (!r->m_start && needsWordSpacing && isSpaceOrNewline(rt->char acterAt(r->m_start)))
658 totalLogicalWidth += rt->style(lineInfo.isFirstLine())->font ().fontDescription().wordSpacing(); 658 totalLogicalWidth += rt->styleOrFirstLineStyle(lineInfo.isFi rstLine())->font().fontDescription().wordSpacing();
659 needsWordSpacing = !isSpaceOrNewline(rt->characterAt(r->m_stop - 1)); 659 needsWordSpacing = !isSpaceOrNewline(rt->characterAt(r->m_stop - 1));
660 } 660 }
661 661
662 setLogicalWidthForTextRun(lineBox, r, rt, totalLogicalWidth, lineInf o, textBoxDataMap, verticalPositionCache, wordMeasurements); 662 setLogicalWidthForTextRun(lineBox, r, rt, totalLogicalWidth, lineInf o, textBoxDataMap, verticalPositionCache, wordMeasurements);
663 } else { 663 } else {
664 isAfterExpansion = false; 664 isAfterExpansion = false;
665 if (!r->m_object->isRenderInline()) { 665 if (!r->m_object->isRenderInline()) {
666 RenderBox* renderBox = toRenderBox(r->m_object); 666 RenderBox* renderBox = toRenderBox(r->m_object);
667 if (renderBox->isRubyRun()) 667 if (renderBox->isRubyRun())
668 setMarginsForRubyRun(r, toRenderRubyRun(renderBox), previous Object, lineInfo); 668 setMarginsForRubyRun(r, toRenderRubyRun(renderBox), previous Object, lineInfo);
(...skipping 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat (); 2177 float logicalLeft = logicalLeftOffsetForLine(logicalHeight(), false).toFloat ();
2178 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft; 2178 float availableLogicalWidth = logicalRightOffsetForLine(logicalHeight(), fal se) - logicalLeft;
2179 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0); 2179 updateLogicalWidthForAlignment(textAlign, 0, 0, logicalLeft, totalLogicalWid th, availableLogicalWidth, 0);
2180 2180
2181 if (!style()->isLeftToRightDirection()) 2181 if (!style()->isLeftToRightDirection())
2182 return logicalWidth() - logicalLeft; 2182 return logicalWidth() - logicalLeft;
2183 return logicalLeft; 2183 return logicalLeft;
2184 } 2184 }
2185 2185
2186 } 2186 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlock.cpp ('k') | Source/core/rendering/RenderDeprecatedFlexibleBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698