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

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

Issue 492053002: Use LayoutRect during addFocusRingRects to avoid loss of precision (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: NeedsRebaseline (pixel tests about focus rings. 1-pixel width diff at the edge because of different rounding) Created 6 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
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | Source/core/rendering/RenderInline.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 rect.move(absPos.x(), absPos.y()); 566 rect.move(absPos.x(), absPos.y());
567 return rect; 567 return rect;
568 } 568 }
569 569
570 FloatQuad RenderBox::absoluteContentQuad() const 570 FloatQuad RenderBox::absoluteContentQuad() const
571 { 571 {
572 LayoutRect rect = contentBoxRect(); 572 LayoutRect rect = contentBoxRect();
573 return localToAbsoluteQuad(FloatRect(rect)); 573 return localToAbsoluteQuad(FloatRect(rect));
574 } 574 }
575 575
576 void RenderBox::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& add itionalOffset, const RenderLayerModelObject*) const 576 void RenderBox::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*) const
577 { 577 {
578 if (!size().isEmpty()) 578 if (!size().isEmpty())
579 rects.append(pixelSnappedIntRect(additionalOffset, size())); 579 rects.append(LayoutRect(additionalOffset, size()));
580 } 580 }
581 581
582 bool RenderBox::canResize() const 582 bool RenderBox::canResize() const
583 { 583 {
584 // We need a special case for <iframe> because they never have 584 // We need a special case for <iframe> because they never have
585 // hasOverflowClip(). However, they do "implicitly" clip their contents, so 585 // hasOverflowClip(). However, they do "implicitly" clip their contents, so
586 // we want to allow resizing them also. 586 // we want to allow resizing them also.
587 return (hasOverflowClip() || isRenderIFrame()) && style()->resize() != RESIZ E_NONE; 587 return (hasOverflowClip() || isRenderIFrame()) && style()->resize() != RESIZ E_NONE;
588 } 588 }
589 589
(...skipping 3597 matching lines...) Expand 10 before | Expand all | Expand 10 after
4187 LayoutBoxExtent borderOutsets = style()->borderImageOutsets(); 4187 LayoutBoxExtent borderOutsets = style()->borderImageOutsets();
4188 top = std::max(top, borderOutsets.top()); 4188 top = std::max(top, borderOutsets.top());
4189 right = std::max(right, borderOutsets.right()); 4189 right = std::max(right, borderOutsets.right());
4190 bottom = std::max(bottom, borderOutsets.bottom()); 4190 bottom = std::max(bottom, borderOutsets.bottom());
4191 left = std::max(left, borderOutsets.left()); 4191 left = std::max(left, borderOutsets.left());
4192 } 4192 }
4193 4193
4194 if (style()->hasOutline()) { 4194 if (style()->hasOutline()) {
4195 if (style()->outlineStyleIsAuto()) { 4195 if (style()->outlineStyleIsAuto()) {
4196 // The result focus ring rects are in coordinates of this object's b order box. 4196 // The result focus ring rects are in coordinates of this object's b order box.
4197 Vector<IntRect> focusRingRects; 4197 Vector<LayoutRect> focusRingRects;
4198 addFocusRingRects(focusRingRects, LayoutPoint(), this); 4198 addFocusRingRects(focusRingRects, LayoutPoint(), this);
4199 IntRect rect = unionRect(focusRingRects); 4199 LayoutRect rect = unionRect(focusRingRects);
4200 4200
4201 int outlineSize = GraphicsContext::focusRingOutsetExtent(style()->ou tlineOffset(), style()->outlineWidth()); 4201 int outlineSize = GraphicsContext::focusRingOutsetExtent(style()->ou tlineOffset(), style()->outlineWidth());
4202 top = std::max<LayoutUnit>(top, -rect.y() + outlineSize); 4202 top = std::max(top, -rect.y() + outlineSize);
4203 right = std::max<LayoutUnit>(right, rect.maxX() - width() + outlineS ize); 4203 right = std::max(right, rect.maxX() - width() + outlineSize);
4204 bottom = std::max<LayoutUnit>(bottom, rect.maxY() - height() + outli neSize); 4204 bottom = std::max(bottom, rect.maxY() - height() + outlineSize);
4205 left = std::max<LayoutUnit>(left, -rect.x() + outlineSize); 4205 left = std::max(left, -rect.x() + outlineSize);
4206 } else { 4206 } else {
4207 LayoutUnit outlineSize = style()->outlineSize(); 4207 LayoutUnit outlineSize = style()->outlineSize();
4208 top = std::max(top, outlineSize); 4208 top = std::max(top, outlineSize);
4209 right = std::max(right, outlineSize); 4209 right = std::max(right, outlineSize);
4210 bottom = std::max(bottom, outlineSize); 4210 bottom = std::max(bottom, outlineSize);
4211 left = std::max(left, outlineSize); 4211 left = std::max(left, outlineSize);
4212 } 4212 }
4213 } 4213 }
4214 4214
4215 return LayoutBoxExtent(top, right, bottom, left); 4215 return LayoutBoxExtent(top, right, bottom, left);
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
4750 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) 4750 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style)
4751 { 4751 {
4752 backgroundColor = style.visitedDependentColor(CSSPropertyBackgroundColor); 4752 backgroundColor = style.visitedDependentColor(CSSPropertyBackgroundColor);
4753 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); 4753 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage();
4754 ASSERT(hasBackground == style.hasBackground()); 4754 ASSERT(hasBackground == style.hasBackground());
4755 hasBorder = style.hasBorder(); 4755 hasBorder = style.hasBorder();
4756 hasAppearance = style.hasAppearance(); 4756 hasAppearance = style.hasAppearance();
4757 } 4757 }
4758 4758
4759 } // namespace blink 4759 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBox.h ('k') | Source/core/rendering/RenderInline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698