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

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

Issue 1269123002: Preparation for combining paths of focus rings and outlines (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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
« no previous file with comments | « Source/core/layout/LayoutBox.h ('k') | Source/core/layout/LayoutBoxModelObject.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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 offset.move(absPos.x(), absPos.y()); 615 offset.move(absPos.x(), absPos.y());
616 return toIntSize(offset); 616 return toIntSize(offset);
617 } 617 }
618 618
619 FloatQuad LayoutBox::absoluteContentQuad() const 619 FloatQuad LayoutBox::absoluteContentQuad() const
620 { 620 {
621 LayoutRect rect = contentBoxRect(); 621 LayoutRect rect = contentBoxRect();
622 return localToAbsoluteQuad(FloatRect(rect)); 622 return localToAbsoluteQuad(FloatRect(rect));
623 } 623 }
624 624
625 void LayoutBox::addFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset) const 625 void LayoutBox::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint& ad ditionalOffset) const
626 { 626 {
627 if (!size().isEmpty()) 627 if (!size().isEmpty())
628 rects.append(LayoutRect(additionalOffset, size())); 628 rects.append(LayoutRect(additionalOffset, size()));
629 } 629 }
630 630
631 bool LayoutBox::canResize() const 631 bool LayoutBox::canResize() const
632 { 632 {
633 // We need a special case for <iframe> because they never have 633 // We need a special case for <iframe> because they never have
634 // hasOverflowClip(). However, they do "implicitly" clip their contents, so 634 // hasOverflowClip(). However, they do "implicitly" clip their contents, so
635 // we want to allow resizing them also. 635 // we want to allow resizing them also.
(...skipping 3467 matching lines...) Expand 10 before | Expand all | Expand 10 after
4103 4103
4104 if (style()->hasBorderImageOutsets()) { 4104 if (style()->hasBorderImageOutsets()) {
4105 LayoutRectOutsets borderOutsets = style()->borderImageOutsets(); 4105 LayoutRectOutsets borderOutsets = style()->borderImageOutsets();
4106 top = std::max(top, borderOutsets.top()); 4106 top = std::max(top, borderOutsets.top());
4107 right = std::max(right, borderOutsets.right()); 4107 right = std::max(right, borderOutsets.right());
4108 bottom = std::max(bottom, borderOutsets.bottom()); 4108 bottom = std::max(bottom, borderOutsets.bottom());
4109 left = std::max(left, borderOutsets.left()); 4109 left = std::max(left, borderOutsets.left());
4110 } 4110 }
4111 4111
4112 if (style()->hasOutline()) { 4112 if (style()->hasOutline()) {
4113 int outlineOutset = style()->outlineOutsetExtent();
4113 if (style()->outlineStyleIsAuto()) { 4114 if (style()->outlineStyleIsAuto()) {
4114 // The result focus ring rects are in coordinates of this object's b order box. 4115 // The result focus ring rects are in coordinates of this object's b order box.
4115 Vector<LayoutRect> focusRingRects; 4116 Vector<LayoutRect> focusRingRects;
4116 addFocusRingRects(focusRingRects, LayoutPoint()); 4117 addOutlineRects(focusRingRects, LayoutPoint());
4117 LayoutRect rect = unionRect(focusRingRects); 4118 LayoutRect rect = unionRect(focusRingRects);
4118 4119
4119 int outlineSize = GraphicsContext::focusRingOutsetExtent(style()->ou tlineOffset(), style()->outlineWidth()); 4120 top = std::max(top, -rect.y() + outlineOutset);
4120 top = std::max(top, -rect.y() + outlineSize); 4121 right = std::max(right, rect.maxX() - size().width() + outlineOutset );
4121 right = std::max(right, rect.maxX() - size().width() + outlineSize); 4122 bottom = std::max(bottom, rect.maxY() - size().height() + outlineOut set);
4122 bottom = std::max(bottom, rect.maxY() - size().height() + outlineSiz e); 4123 left = std::max(left, -rect.x() + outlineOutset);
4123 left = std::max(left, -rect.x() + outlineSize);
4124 } else { 4124 } else {
4125 LayoutUnit outlineSize = style()->outlineSize(); 4125 top = std::max<LayoutUnit>(top, outlineOutset);
chrishtr 2015/08/04 05:09:02 The functionality changes involving fixing outline
Xianzhu 2015/08/04 17:41:42 Rebaselined the following three tests which cover
4126 top = std::max(top, outlineSize); 4126 right = std::max<LayoutUnit>(right, outlineOutset);
4127 right = std::max(right, outlineSize); 4127 bottom = std::max<LayoutUnit>(bottom, outlineOutset);
4128 bottom = std::max(bottom, outlineSize); 4128 left = std::max<LayoutUnit>(left, outlineOutset);
4129 left = std::max(left, outlineSize);
4130 } 4129 }
4131 } 4130 }
4132 4131
4133 return LayoutRectOutsets(top, right, bottom, left); 4132 return LayoutRectOutsets(top, right, bottom, left);
4134 } 4133 }
4135 4134
4136 void LayoutBox::addOverflowFromChild(LayoutBox* child, const LayoutSize& delta) 4135 void LayoutBox::addOverflowFromChild(LayoutBox* child, const LayoutSize& delta)
4137 { 4136 {
4138 // Never allow flow threads to propagate overflow up to a parent. 4137 // Never allow flow threads to propagate overflow up to a parent.
4139 if (child->isLayoutFlowThread()) 4138 if (child->isLayoutFlowThread())
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
4785 StyleImage* borderImage = style()->borderImage().image(); 4784 StyleImage* borderImage = style()->borderImage().image();
4786 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); 4785 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded();
4787 } 4786 }
4788 4787
4789 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const 4788 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const
4790 { 4789 {
4791 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; 4790 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr;
4792 } 4791 }
4793 4792
4794 } // namespace blink 4793 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBox.h ('k') | Source/core/layout/LayoutBoxModelObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698