| OLD | NEW |
| 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 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 offset.move(absPos.x(), absPos.y()); | 697 offset.move(absPos.x(), absPos.y()); |
| 698 return toIntSize(offset); | 698 return toIntSize(offset); |
| 699 } | 699 } |
| 700 | 700 |
| 701 FloatQuad LayoutBox::absoluteContentQuad() const | 701 FloatQuad LayoutBox::absoluteContentQuad() const |
| 702 { | 702 { |
| 703 LayoutRect rect = contentBoxRect(); | 703 LayoutRect rect = contentBoxRect(); |
| 704 return localToAbsoluteQuad(FloatRect(rect)); | 704 return localToAbsoluteQuad(FloatRect(rect)); |
| 705 } | 705 } |
| 706 | 706 |
| 707 LayoutRect LayoutBox::backgroundClipRect() const |
| 708 { |
| 709 // TODO(flackr): Check for the maximum background clip rect. |
| 710 switch (style()->backgroundClip()) { |
| 711 case BorderFillBox: |
| 712 // A 'border-box' clip on scrollable elements local attachment is treate
d as 'padding-box'. |
| 713 // https://www.w3.org/TR/css3-background/#the-background-attachment |
| 714 if (!style()->isOverflowVisible() && style()->backgroundLayers().attachm
ent() == LocalBackgroundAttachment) |
| 715 return paddingBoxRect(); |
| 716 return borderBoxRect(); |
| 717 break; |
| 718 case PaddingFillBox: |
| 719 return paddingBoxRect(); |
| 720 break; |
| 721 case ContentFillBox: |
| 722 return contentBoxRect(); |
| 723 break; |
| 724 default: |
| 725 break; |
| 726 } |
| 727 return LayoutRect(); |
| 728 } |
| 729 |
| 707 void LayoutBox::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint& ad
ditionalOffset, IncludeBlockVisualOverflowOrNot) const | 730 void LayoutBox::addOutlineRects(Vector<LayoutRect>& rects, const LayoutPoint& ad
ditionalOffset, IncludeBlockVisualOverflowOrNot) const |
| 708 { | 731 { |
| 709 rects.append(LayoutRect(additionalOffset, size())); | 732 rects.append(LayoutRect(additionalOffset, size())); |
| 710 } | 733 } |
| 711 | 734 |
| 712 bool LayoutBox::canResize() const | 735 bool LayoutBox::canResize() const |
| 713 { | 736 { |
| 714 // We need a special case for <iframe> because they never have | 737 // We need a special case for <iframe> because they never have |
| 715 // hasOverflowClip(). However, they do "implicitly" clip their contents, so | 738 // hasOverflowClip(). However, they do "implicitly" clip their contents, so |
| 716 // we want to allow resizing them also. | 739 // we want to allow resizing them also. |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1351 // FIXME: Check the opaqueness of background images. | 1374 // FIXME: Check the opaqueness of background images. |
| 1352 | 1375 |
| 1353 // FIXME: Use rounded rect if border radius is present. | 1376 // FIXME: Use rounded rect if border radius is present. |
| 1354 if (style()->hasBorderRadius()) | 1377 if (style()->hasBorderRadius()) |
| 1355 return false; | 1378 return false; |
| 1356 if (hasClipPath()) | 1379 if (hasClipPath()) |
| 1357 return false; | 1380 return false; |
| 1358 // FIXME: The background color clip is defined by the last layer. | 1381 // FIXME: The background color clip is defined by the last layer. |
| 1359 if (style()->backgroundLayers().next()) | 1382 if (style()->backgroundLayers().next()) |
| 1360 return false; | 1383 return false; |
| 1361 LayoutRect backgroundRect; | 1384 return backgroundClipRect().contains(localRect); |
| 1362 switch (style()->backgroundClip()) { | |
| 1363 case BorderFillBox: | |
| 1364 backgroundRect = borderBoxRect(); | |
| 1365 break; | |
| 1366 case PaddingFillBox: | |
| 1367 backgroundRect = paddingBoxRect(); | |
| 1368 break; | |
| 1369 case ContentFillBox: | |
| 1370 backgroundRect = contentBoxRect(); | |
| 1371 break; | |
| 1372 default: | |
| 1373 break; | |
| 1374 } | |
| 1375 return backgroundRect.contains(localRect); | |
| 1376 } | 1385 } |
| 1377 | 1386 |
| 1378 static bool isCandidateForOpaquenessTest(const LayoutBox& childBox) | 1387 static bool isCandidateForOpaquenessTest(const LayoutBox& childBox) |
| 1379 { | 1388 { |
| 1380 const ComputedStyle& childStyle = childBox.styleRef(); | 1389 const ComputedStyle& childStyle = childBox.styleRef(); |
| 1381 if (childStyle.position() != StaticPosition && childBox.containingBlock() !=
childBox.parent()) | 1390 if (childStyle.position() != StaticPosition && childBox.containingBlock() !=
childBox.parent()) |
| 1382 return false; | 1391 return false; |
| 1383 if (childStyle.visibility() != VISIBLE || childStyle.shapeOutside()) | 1392 if (childStyle.visibility() != VISIBLE || childStyle.shapeOutside()) |
| 1384 return false; | 1393 return false; |
| 1385 if (childBox.size().isZero()) | 1394 if (childBox.size().isZero()) |
| (...skipping 3549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4935 m_rareData->m_snapAreas->remove(&snapArea); | 4944 m_rareData->m_snapAreas->remove(&snapArea); |
| 4936 } | 4945 } |
| 4937 } | 4946 } |
| 4938 | 4947 |
| 4939 SnapAreaSet* LayoutBox::snapAreas() const | 4948 SnapAreaSet* LayoutBox::snapAreas() const |
| 4940 { | 4949 { |
| 4941 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; | 4950 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; |
| 4942 } | 4951 } |
| 4943 | 4952 |
| 4944 } // namespace blink | 4953 } // namespace blink |
| OLD | NEW |