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

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

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 } 1033 }
1034 1034
1035 // Now check ourselves. Pixel snap hit testing. 1035 // Now check ourselves. Pixel snap hit testing.
1036 LayoutRect frameRect = roundedFrameRect(); 1036 LayoutRect frameRect = roundedFrameRect();
1037 LayoutUnit minX = frameRect.x(); 1037 LayoutUnit minX = frameRect.x();
1038 LayoutUnit minY = frameRect.y(); 1038 LayoutUnit minY = frameRect.y();
1039 LayoutUnit width = frameRect.width(); 1039 LayoutUnit width = frameRect.width();
1040 LayoutUnit height = frameRect.height(); 1040 LayoutUnit height = frameRect.height();
1041 1041
1042 // Constrain our hit testing to the line top and bottom if necessary. 1042 // Constrain our hit testing to the line top and bottom if necessary.
1043 bool noQuirksMode = renderer()->document()->inNoQuirksMode(); 1043 bool noQuirksMode = renderer()->document().inNoQuirksMode();
1044 if (!noQuirksMode && !hasTextChildren() && !(descendantsHaveSameLineHeightAn dBaseline() && hasTextDescendants())) { 1044 if (!noQuirksMode && !hasTextChildren() && !(descendantsHaveSameLineHeightAn dBaseline() && hasTextDescendants())) {
1045 RootInlineBox* rootBox = root(); 1045 RootInlineBox* rootBox = root();
1046 LayoutUnit& top = isHorizontal() ? minY : minX; 1046 LayoutUnit& top = isHorizontal() ? minY : minX;
1047 LayoutUnit& logicalHeight = isHorizontal() ? height : width; 1047 LayoutUnit& logicalHeight = isHorizontal() ? height : width;
1048 LayoutUnit bottom = min(rootBox->lineBottom(), top + logicalHeight); 1048 LayoutUnit bottom = min(rootBox->lineBottom(), top + logicalHeight);
1049 top = max(rootBox->lineTop(), top); 1049 top = max(rootBox->lineTop(), top);
1050 logicalHeight = bottom - top; 1050 logicalHeight = bottom - top;
1051 } 1051 }
1052 1052
1053 // Move x/y to our coordinates. 1053 // Move x/y to our coordinates.
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1201 boxModelObject()->paintBoxShadow(info, paintRect, s, shadowStyle); 1201 boxModelObject()->paintBoxShadow(info, paintRect, s, shadowStyle);
1202 else { 1202 else {
1203 // FIXME: We can do better here in the multi-line case. We want to push a clip so that the shadow doesn't 1203 // FIXME: We can do better here in the multi-line case. We want to push a clip so that the shadow doesn't
1204 // protrude incorrectly at the edges, and we want to possibly include sh adows cast from the previous/following lines 1204 // protrude incorrectly at the edges, and we want to possibly include sh adows cast from the previous/following lines
1205 boxModelObject()->paintBoxShadow(info, paintRect, s, shadowStyle, includ eLogicalLeftEdge(), includeLogicalRightEdge()); 1205 boxModelObject()->paintBoxShadow(info, paintRect, s, shadowStyle, includ eLogicalLeftEdge(), includeLogicalRightEdge());
1206 } 1206 }
1207 } 1207 }
1208 1208
1209 void InlineFlowBox::constrainToLineTopAndBottomIfNeeded(LayoutRect& rect) const 1209 void InlineFlowBox::constrainToLineTopAndBottomIfNeeded(LayoutRect& rect) const
1210 { 1210 {
1211 bool noQuirksMode = renderer()->document()->inNoQuirksMode(); 1211 bool noQuirksMode = renderer()->document().inNoQuirksMode();
1212 if (!noQuirksMode && !hasTextChildren() && !(descendantsHaveSameLineHeightAn dBaseline() && hasTextDescendants())) { 1212 if (!noQuirksMode && !hasTextChildren() && !(descendantsHaveSameLineHeightAn dBaseline() && hasTextDescendants())) {
1213 const RootInlineBox* rootBox = root(); 1213 const RootInlineBox* rootBox = root();
1214 LayoutUnit logicalTop = isHorizontal() ? rect.y() : rect.x(); 1214 LayoutUnit logicalTop = isHorizontal() ? rect.y() : rect.x();
1215 LayoutUnit logicalHeight = isHorizontal() ? rect.height() : rect.width() ; 1215 LayoutUnit logicalHeight = isHorizontal() ? rect.height() : rect.width() ;
1216 LayoutUnit bottom = min(rootBox->lineBottom(), logicalTop + logicalHeigh t); 1216 LayoutUnit bottom = min(rootBox->lineBottom(), logicalTop + logicalHeigh t);
1217 logicalTop = max(rootBox->lineTop(), logicalTop); 1217 logicalTop = max(rootBox->lineTop(), logicalTop);
1218 logicalHeight = bottom - logicalTop; 1218 logicalHeight = bottom - logicalTop;
1219 if (isHorizontal()) { 1219 if (isHorizontal()) {
1220 rect.setY(logicalTop); 1220 rect.setY(logicalTop);
1221 rect.setHeight(logicalHeight); 1221 rect.setHeight(logicalHeight);
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 ASSERT(child->prevOnLine() == prev); 1636 ASSERT(child->prevOnLine() == prev);
1637 prev = child; 1637 prev = child;
1638 } 1638 }
1639 ASSERT(prev == m_lastChild); 1639 ASSERT(prev == m_lastChild);
1640 #endif 1640 #endif
1641 } 1641 }
1642 1642
1643 #endif 1643 #endif
1644 1644
1645 } // namespace WebCore 1645 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/ImageQualityController.cpp ('k') | Source/core/rendering/InlineTextBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698