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

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: Created 6 years, 4 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) 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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 rect.move(absPos.x(), absPos.y()); 569 rect.move(absPos.x(), absPos.y());
570 return rect; 570 return rect;
571 } 571 }
572 572
573 FloatQuad RenderBox::absoluteContentQuad() const 573 FloatQuad RenderBox::absoluteContentQuad() const
574 { 574 {
575 LayoutRect rect = contentBoxRect(); 575 LayoutRect rect = contentBoxRect();
576 return localToAbsoluteQuad(FloatRect(rect)); 576 return localToAbsoluteQuad(FloatRect(rect));
577 } 577 }
578 578
579 void RenderBox::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& add itionalOffset, const RenderLayerModelObject*) const 579 void RenderBox::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject*) const
580 { 580 {
581 if (!size().isEmpty()) 581 if (!size().isEmpty())
582 rects.append(pixelSnappedIntRect(additionalOffset, size())); 582 rects.append(LayoutRect(additionalOffset, size()));
583 } 583 }
584 584
585 bool RenderBox::canResize() const 585 bool RenderBox::canResize() const
586 { 586 {
587 // We need a special case for <iframe> because they never have 587 // We need a special case for <iframe> because they never have
588 // hasOverflowClip(). However, they do "implicitly" clip their contents, so 588 // hasOverflowClip(). However, they do "implicitly" clip their contents, so
589 // we want to allow resizing them also. 589 // we want to allow resizing them also.
590 return (hasOverflowClip() || isRenderIFrame()) && style()->resize() != RESIZ E_NONE; 590 return (hasOverflowClip() || isRenderIFrame()) && style()->resize() != RESIZ E_NONE;
591 } 591 }
592 592
(...skipping 3604 matching lines...) Expand 10 before | Expand all | Expand 10 after
4197 top = std::max(top, borderOutsets.top()); 4197 top = std::max(top, borderOutsets.top());
4198 right = std::max(right, borderOutsets.right()); 4198 right = std::max(right, borderOutsets.right());
4199 bottom = std::max(bottom, borderOutsets.bottom()); 4199 bottom = std::max(bottom, borderOutsets.bottom());
4200 left = std::max(left, borderOutsets.left()); 4200 left = std::max(left, borderOutsets.left());
4201 } 4201 }
4202 4202
4203 RenderStyle* outlineStyle = this->outlineStyle(); 4203 RenderStyle* outlineStyle = this->outlineStyle();
4204 if (outlineStyle->hasOutline()) { 4204 if (outlineStyle->hasOutline()) {
4205 if (outlineStyle->outlineStyleIsAuto()) { 4205 if (outlineStyle->outlineStyleIsAuto()) {
4206 // The result focus ring rects are in coordinates of this object's b order box. 4206 // The result focus ring rects are in coordinates of this object's b order box.
4207 Vector<IntRect> focusRingRects; 4207 Vector<LayoutRect> focusRingRects;
4208 addFocusRingRects(focusRingRects, LayoutPoint(), this); 4208 addFocusRingRects(focusRingRects, LayoutPoint(), this);
4209 IntRect rect = unionRect(focusRingRects); 4209 LayoutRect rect = unionRect(focusRingRects);
4210 4210
4211 int outlineSize = GraphicsContext::focusRingOutsetExtent(outlineStyl e->outlineOffset(), outlineStyle->outlineWidth()); 4211 int outlineSize = GraphicsContext::focusRingOutsetExtent(outlineStyl e->outlineOffset(), outlineStyle->outlineWidth());
4212 top = std::max<LayoutUnit>(top, -rect.y() + outlineSize); 4212 top = std::max(top, -rect.y() + outlineSize);
4213 right = std::max<LayoutUnit>(right, rect.maxX() - width() + outlineS ize); 4213 right = std::max(right, rect.maxX() - width() + outlineSize);
4214 bottom = std::max<LayoutUnit>(bottom, rect.maxY() - height() + outli neSize); 4214 bottom = std::max(bottom, rect.maxY() - height() + outlineSize);
4215 left = std::max<LayoutUnit>(left, -rect.x() + outlineSize); 4215 left = std::max(left, -rect.x() + outlineSize);
4216 } else { 4216 } else {
4217 LayoutUnit outlineSize = outlineStyle->outlineSize(); 4217 LayoutUnit outlineSize = outlineStyle->outlineSize();
4218 top = std::max(top, outlineSize); 4218 top = std::max(top, outlineSize);
4219 right = std::max(right, outlineSize); 4219 right = std::max(right, outlineSize);
4220 bottom = std::max(bottom, outlineSize); 4220 bottom = std::max(bottom, outlineSize);
4221 left = std::max(left, outlineSize); 4221 left = std::max(left, outlineSize);
4222 } 4222 }
4223 } 4223 }
4224 4224
4225 return LayoutBoxExtent(top, right, bottom, left); 4225 return LayoutBoxExtent(top, right, bottom, left);
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
4760 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style) 4760 RenderBox::BoxDecorationData::BoxDecorationData(const RenderStyle& style)
4761 { 4761 {
4762 backgroundColor = style.visitedDependentColor(CSSPropertyBackgroundColor); 4762 backgroundColor = style.visitedDependentColor(CSSPropertyBackgroundColor);
4763 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage(); 4763 hasBackground = backgroundColor.alpha() || style.hasBackgroundImage();
4764 ASSERT(hasBackground == style.hasBackground()); 4764 ASSERT(hasBackground == style.hasBackground());
4765 hasBorder = style.hasBorder(); 4765 hasBorder = style.hasBorder();
4766 hasAppearance = style.hasAppearance(); 4766 hasAppearance = style.hasAppearance();
4767 } 4767 }
4768 4768
4769 } // namespace blink 4769 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698