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

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

Issue 2669003002: Optimize outline paint invalidation (Closed)
Patch Set: - Created 3 years, 10 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 4795 matching lines...) Expand 10 before | Expand all | Expand 10 after
4806 void LayoutBox::addVisualEffectOverflow() { 4806 void LayoutBox::addVisualEffectOverflow() {
4807 if (!style()->hasVisualOverflowingEffect()) 4807 if (!style()->hasVisualOverflowingEffect())
4808 return; 4808 return;
4809 4809
4810 // Add in the final overflow with shadows, outsets and outline combined. 4810 // Add in the final overflow with shadows, outsets and outline combined.
4811 LayoutRect visualEffectOverflow = borderBoxRect(); 4811 LayoutRect visualEffectOverflow = borderBoxRect();
4812 visualEffectOverflow.expand(computeVisualEffectOverflowOutsets()); 4812 visualEffectOverflow.expand(computeVisualEffectOverflowOutsets());
4813 addSelfVisualOverflow(visualEffectOverflow); 4813 addSelfVisualOverflow(visualEffectOverflow);
4814 } 4814 }
4815 4815
4816 LayoutRectOutsets LayoutBox::computeVisualEffectOverflowOutsets() const { 4816 LayoutRectOutsets LayoutBox::computeVisualEffectOverflowOutsets() {
4817 ASSERT(style()->hasVisualOverflowingEffect()); 4817 ASSERT(style()->hasVisualOverflowingEffect());
4818 4818
4819 LayoutUnit top; 4819 LayoutUnit top;
4820 LayoutUnit right; 4820 LayoutUnit right;
4821 LayoutUnit bottom; 4821 LayoutUnit bottom;
4822 LayoutUnit left; 4822 LayoutUnit left;
4823 4823
4824 if (const ShadowList* boxShadow = style()->boxShadow()) { 4824 if (const ShadowList* boxShadow = style()->boxShadow()) {
4825 // FIXME: Use LayoutUnit edge outsets, and then simplify this. 4825 // FIXME: Use LayoutUnit edge outsets, and then simplify this.
4826 FloatRectOutsets outsets = boxShadow->rectOutsetsIncludingOriginal(); 4826 FloatRectOutsets outsets = boxShadow->rectOutsetsIncludingOriginal();
(...skipping 15 matching lines...) Expand all
4842 // block direction. 4842 // block direction.
4843 if (UNLIKELY(hasFlippedBlocksWritingMode())) 4843 if (UNLIKELY(hasFlippedBlocksWritingMode()))
4844 std::swap(left, right); 4844 std::swap(left, right);
4845 4845
4846 if (style()->hasOutline()) { 4846 if (style()->hasOutline()) {
4847 Vector<LayoutRect> outlineRects; 4847 Vector<LayoutRect> outlineRects;
4848 // The result rects are in coordinates of this object's border box. 4848 // The result rects are in coordinates of this object's border box.
4849 addOutlineRects(outlineRects, LayoutPoint(), 4849 addOutlineRects(outlineRects, LayoutPoint(),
4850 outlineRectsShouldIncludeBlockVisualOverflow()); 4850 outlineRectsShouldIncludeBlockVisualOverflow());
4851 LayoutRect rect = unionRectEvenIfEmpty(outlineRects); 4851 LayoutRect rect = unionRectEvenIfEmpty(outlineRects);
4852 setOutlineMayBeAffectedByDescendants(rect.size() != size());
4853
4852 int outlineOutset = style()->outlineOutsetExtent(); 4854 int outlineOutset = style()->outlineOutsetExtent();
4853 top = std::max(top, -rect.y() + outlineOutset); 4855 top = std::max(top, -rect.y() + outlineOutset);
4854 right = std::max(right, rect.maxX() - size().width() + outlineOutset); 4856 right = std::max(right, rect.maxX() - size().width() + outlineOutset);
4855 bottom = std::max(bottom, rect.maxY() - size().height() + outlineOutset); 4857 bottom = std::max(bottom, rect.maxY() - size().height() + outlineOutset);
4856 left = std::max(left, -rect.x() + outlineOutset); 4858 left = std::max(left, -rect.x() + outlineOutset);
4857 } 4859 }
4858 4860
4859 return LayoutRectOutsets(top, right, bottom, left); 4861 return LayoutRectOutsets(top, right, bottom, left);
4860 } 4862 }
4861 4863
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
5694 block->adjustChildDebugRect(rect); 5696 block->adjustChildDebugRect(rect);
5695 5697
5696 return rect; 5698 return rect;
5697 } 5699 }
5698 5700
5699 bool LayoutBox::shouldClipOverflow() const { 5701 bool LayoutBox::shouldClipOverflow() const {
5700 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip(); 5702 return hasOverflowClip() || styleRef().containsPaint() || hasControlClip();
5701 } 5703 }
5702 5704
5703 } // namespace blink 5705 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698