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

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

Issue 2416033003: Remove unsafe getFontMetrics methods (Closed)
Patch Set: Address wkroman suggestions 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 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 4513 matching lines...) Expand 10 before | Expand all | Expand 10 after
4524 4524
4525 // If height of box is smaller than font height, use the latter one, 4525 // If height of box is smaller than font height, use the latter one,
4526 // otherwise the caret might become invisible. 4526 // otherwise the caret might become invisible.
4527 // 4527 //
4528 // Also, if the box is not an atomic inline-level element, always use the font 4528 // Also, if the box is not an atomic inline-level element, always use the font
4529 // height. This prevents the "big caret" bug described in: 4529 // height. This prevents the "big caret" bug described in:
4530 // <rdar://problem/3777804> Deleting all content in a document can result in 4530 // <rdar://problem/3777804> Deleting all content in a document can result in
4531 // giant tall-as-window insertion point 4531 // giant tall-as-window insertion point
4532 // 4532 //
4533 // FIXME: ignoring :first-line, missing good reason to take care of 4533 // FIXME: ignoring :first-line, missing good reason to take care of
4534 LayoutUnit fontHeight = LayoutUnit(style()->getFontMetrics().height()); 4534 const SimpleFontData* fontData = style()->font().primaryFont();
4535 LayoutUnit fontHeight =
4536 LayoutUnit(fontData ? fontData->getFontMetrics().height() : 0);
4535 if (fontHeight > rect.height() || (!isAtomicInlineLevel() && !isTable())) 4537 if (fontHeight > rect.height() || (!isAtomicInlineLevel() && !isTable()))
4536 rect.setHeight(fontHeight); 4538 rect.setHeight(fontHeight);
4537 4539
4538 if (extraWidthToEndOfLine) 4540 if (extraWidthToEndOfLine)
4539 *extraWidthToEndOfLine = location().x() + size().width() - rect.maxX(); 4541 *extraWidthToEndOfLine = location().x() + size().width() - rect.maxX();
4540 4542
4541 // Move to local coords 4543 // Move to local coords
4542 rect.moveBy(-location()); 4544 rect.moveBy(-location());
4543 4545
4544 // FIXME: Border/padding should be added for all elements but this workaround 4546 // FIXME: Border/padding should be added for all elements but this workaround
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after
5577 LayoutRect rect = frameRect(); 5579 LayoutRect rect = frameRect();
5578 5580
5579 LayoutBlock* block = containingBlock(); 5581 LayoutBlock* block = containingBlock();
5580 if (block) 5582 if (block)
5581 block->adjustChildDebugRect(rect); 5583 block->adjustChildDebugRect(rect);
5582 5584
5583 return rect; 5585 return rect;
5584 } 5586 }
5585 5587
5586 } // namespace blink 5588 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutInline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698