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

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

Issue 1292333004: Make hit-test support clip-path references using svg clipPath (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add layout test file 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
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) 2007 David Smith (catfish.man@gmail.com) 4 * (C) 2007 David Smith (catfish.man@gmail.com)
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "core/layout/LayoutTextCombine.h" 52 #include "core/layout/LayoutTextCombine.h"
53 #include "core/layout/LayoutTextControl.h" 53 #include "core/layout/LayoutTextControl.h"
54 #include "core/layout/LayoutTextFragment.h" 54 #include "core/layout/LayoutTextFragment.h"
55 #include "core/layout/LayoutTheme.h" 55 #include "core/layout/LayoutTheme.h"
56 #include "core/layout/LayoutView.h" 56 #include "core/layout/LayoutView.h"
57 #include "core/layout/TextAutosizer.h" 57 #include "core/layout/TextAutosizer.h"
58 #include "core/layout/line/GlyphOverflow.h" 58 #include "core/layout/line/GlyphOverflow.h"
59 #include "core/layout/line/InlineIterator.h" 59 #include "core/layout/line/InlineIterator.h"
60 #include "core/layout/line/InlineTextBox.h" 60 #include "core/layout/line/InlineTextBox.h"
61 #include "core/layout/shapes/ShapeOutsideInfo.h" 61 #include "core/layout/shapes/ShapeOutsideInfo.h"
62 #include "core/layout/svg/LayoutSVGResourceClipper.h"
62 #include "core/page/Page.h" 63 #include "core/page/Page.h"
63 #include "core/paint/BlockPainter.h" 64 #include "core/paint/BlockPainter.h"
64 #include "core/paint/BoxPainter.h" 65 #include "core/paint/BoxPainter.h"
65 #include "core/paint/DeprecatedPaintLayer.h" 66 #include "core/paint/DeprecatedPaintLayer.h"
66 #include "core/paint/LayoutObjectDrawingRecorder.h" 67 #include "core/paint/LayoutObjectDrawingRecorder.h"
67 #include "core/style/ComputedStyle.h" 68 #include "core/style/ComputedStyle.h"
68 #include "core/style/ContentData.h" 69 #include "core/style/ContentData.h"
69 #include "platform/RuntimeEnabledFeatures.h" 70 #include "platform/RuntimeEnabledFeatures.h"
70 #include "platform/geometry/FloatQuad.h" 71 #include "platform/geometry/FloatQuad.h"
71 #include "platform/geometry/TransformState.h" 72 #include "platform/geometry/TransformState.h"
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1683 if (style()->clipPath()) { 1684 if (style()->clipPath()) {
1684 switch (style()->clipPath()->type()) { 1685 switch (style()->clipPath()->type()) {
1685 case ClipPathOperation::SHAPE: { 1686 case ClipPathOperation::SHAPE: {
1686 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(style()- >clipPath()); 1687 ShapeClipPathOperation* clipPath = toShapeClipPathOperation(style()- >clipPath());
1687 // FIXME: handle marginBox etc. 1688 // FIXME: handle marginBox etc.
1688 if (!clipPath->path(borderBoxRect()).contains(FloatPoint(locationInC ontainer.point() - localOffset), clipPath->windRule())) 1689 if (!clipPath->path(borderBoxRect()).contains(FloatPoint(locationInC ontainer.point() - localOffset), clipPath->windRule()))
1689 return false; 1690 return false;
1690 break; 1691 break;
1691 } 1692 }
1692 case ClipPathOperation::REFERENCE: 1693 case ClipPathOperation::REFERENCE:
1693 // FIXME: handle REFERENCE 1694 ReferenceClipPathOperation* referenceClipPathOperation = toReference ClipPathOperation(style()->clipPath());
1695 Element* element = document().getElementById(referenceClipPathOperat ion->fragment());
1696 if (element && isSVGClipPathElement(element) && element->layoutObjec t()) {
fs 2015/08/19 22:04:57 Nit: The pointer-version of is...Element checks fo
Yufeng Shen (Slow to review) 2015/08/20 20:17:21 Done.
1697 LayoutSVGResourceClipper* clipper = toLayoutSVGResourceClipper(t oLayoutSVGResourceContainer(element->layoutObject()));
1698 if (!clipper->hitTestClipContent(borderBoxRect(), FloatPoint(loc ationInContainer.point() - localOffset)))
1699 return false;
1700 }
1694 break; 1701 break;
1695 } 1702 }
1696 } 1703 }
1697 1704
1698 // If we have clipping, then we can't have any spillout. 1705 // If we have clipping, then we can't have any spillout.
1699 bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer(); 1706 bool useOverflowClip = hasOverflowClip() && !hasSelfPaintingLayer();
1700 bool useClip = (hasControlClip() || useOverflowClip); 1707 bool useClip = (hasControlClip() || useOverflowClip);
1701 bool checkChildren = !useClip; 1708 bool checkChildren = !useClip;
1702 if (!checkChildren) { 1709 if (!checkChildren) {
1703 if (hasControlClip()) { 1710 if (hasControlClip()) {
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after
2918 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const 2925 void LayoutBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Layout Object* obj) const
2919 { 2926 {
2920 showLayoutObject(); 2927 showLayoutObject();
2921 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) 2928 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box())
2922 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); 2929 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1);
2923 } 2930 }
2924 2931
2925 #endif 2932 #endif
2926 2933
2927 } // namespace blink 2934 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698