| 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 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights
reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "core/rendering/RenderFullScreen.h" | 34 #include "core/rendering/RenderFullScreen.h" |
| 35 #include "core/rendering/RenderGeometryMap.h" | 35 #include "core/rendering/RenderGeometryMap.h" |
| 36 #include "core/rendering/RenderLayer.h" | 36 #include "core/rendering/RenderLayer.h" |
| 37 #include "core/rendering/RenderTheme.h" | 37 #include "core/rendering/RenderTheme.h" |
| 38 #include "core/rendering/RenderView.h" | 38 #include "core/rendering/RenderView.h" |
| 39 #include "core/rendering/style/StyleInheritedData.h" | 39 #include "core/rendering/style/StyleInheritedData.h" |
| 40 #include "platform/geometry/FloatQuad.h" | 40 #include "platform/geometry/FloatQuad.h" |
| 41 #include "platform/geometry/TransformState.h" | 41 #include "platform/geometry/TransformState.h" |
| 42 #include "platform/graphics/GraphicsContext.h" | 42 #include "platform/graphics/GraphicsContext.h" |
| 43 | 43 |
| 44 using namespace std; | |
| 45 | |
| 46 namespace WebCore { | 44 namespace WebCore { |
| 47 | 45 |
| 48 RenderInline::RenderInline(Element* element) | 46 RenderInline::RenderInline(Element* element) |
| 49 : RenderBoxModelObject(element) | 47 : RenderBoxModelObject(element) |
| 50 , m_alwaysCreateLineBoxes(false) | 48 , m_alwaysCreateLineBoxes(false) |
| 51 { | 49 { |
| 52 setChildrenInline(true); | 50 setChildrenInline(true); |
| 53 } | 51 } |
| 54 | 52 |
| 55 RenderInline* RenderInline::createAnonymous(Document* document) | 53 RenderInline* RenderInline::createAnonymous(Document* document) |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 return adjustedPositionRelativeToOffsetParent(topLeft).y(); | 683 return adjustedPositionRelativeToOffsetParent(topLeft).y(); |
| 686 } | 684 } |
| 687 | 685 |
| 688 static LayoutUnit computeMargin(const RenderInline* renderer, const Length& marg
in) | 686 static LayoutUnit computeMargin(const RenderInline* renderer, const Length& marg
in) |
| 689 { | 687 { |
| 690 if (margin.isAuto()) | 688 if (margin.isAuto()) |
| 691 return 0; | 689 return 0; |
| 692 if (margin.isFixed()) | 690 if (margin.isFixed()) |
| 693 return margin.value(); | 691 return margin.value(); |
| 694 if (margin.isPercent()) | 692 if (margin.isPercent()) |
| 695 return minimumValueForLength(margin, max<LayoutUnit>(0, renderer->contai
ningBlock()->availableLogicalWidth())); | 693 return minimumValueForLength(margin, std::max<LayoutUnit>(0, renderer->c
ontainingBlock()->availableLogicalWidth())); |
| 696 return 0; | 694 return 0; |
| 697 } | 695 } |
| 698 | 696 |
| 699 LayoutUnit RenderInline::marginLeft() const | 697 LayoutUnit RenderInline::marginLeft() const |
| 700 { | 698 { |
| 701 return computeMargin(this, style()->marginLeft()); | 699 return computeMargin(this, style()->marginLeft()); |
| 702 } | 700 } |
| 703 | 701 |
| 704 LayoutUnit RenderInline::marginRight() const | 702 LayoutUnit RenderInline::marginRight() const |
| 705 { | 703 { |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 if (!alwaysCreateLineBoxes()) | 966 if (!alwaysCreateLineBoxes()) |
| 969 return culledInlineVisualOverflowBoundingBox(); | 967 return culledInlineVisualOverflowBoundingBox(); |
| 970 | 968 |
| 971 if (!firstLineBox() || !lastLineBox()) | 969 if (!firstLineBox() || !lastLineBox()) |
| 972 return LayoutRect(); | 970 return LayoutRect(); |
| 973 | 971 |
| 974 // Return the width of the minimal left side and the maximal right side. | 972 // Return the width of the minimal left side and the maximal right side. |
| 975 LayoutUnit logicalLeftSide = LayoutUnit::max(); | 973 LayoutUnit logicalLeftSide = LayoutUnit::max(); |
| 976 LayoutUnit logicalRightSide = LayoutUnit::min(); | 974 LayoutUnit logicalRightSide = LayoutUnit::min(); |
| 977 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox())
{ | 975 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox())
{ |
| 978 logicalLeftSide = min(logicalLeftSide, curr->logicalLeftVisualOverflow()
); | 976 logicalLeftSide = std::min(logicalLeftSide, curr->logicalLeftVisualOverf
low()); |
| 979 logicalRightSide = max(logicalRightSide, curr->logicalRightVisualOverflo
w()); | 977 logicalRightSide = std::max(logicalRightSide, curr->logicalRightVisualOv
erflow()); |
| 980 } | 978 } |
| 981 | 979 |
| 982 RootInlineBox& firstRootBox = firstLineBox()->root(); | 980 RootInlineBox& firstRootBox = firstLineBox()->root(); |
| 983 RootInlineBox& lastRootBox = lastLineBox()->root(); | 981 RootInlineBox& lastRootBox = lastLineBox()->root(); |
| 984 | 982 |
| 985 LayoutUnit logicalTop = firstLineBox()->logicalTopVisualOverflow(firstRootBo
x.lineTop()); | 983 LayoutUnit logicalTop = firstLineBox()->logicalTopVisualOverflow(firstRootBo
x.lineTop()); |
| 986 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; | 984 LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide; |
| 987 LayoutUnit logicalHeight = lastLineBox()->logicalBottomVisualOverflow(lastRo
otBox.lineBottom()) - logicalTop; | 985 LayoutUnit logicalHeight = lastLineBox()->logicalBottomVisualOverflow(lastRo
otBox.lineBottom()) - logicalTop; |
| 988 | 986 |
| 989 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); | 987 LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight); |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 return; | 1408 return; |
| 1411 | 1409 |
| 1412 if (styleToUse->outlineStyleIsAuto() || styleToUse->outlineStyle() == BNONE) | 1410 if (styleToUse->outlineStyleIsAuto() || styleToUse->outlineStyle() == BNONE) |
| 1413 return; | 1411 return; |
| 1414 | 1412 |
| 1415 Vector<LayoutRect> rects; | 1413 Vector<LayoutRect> rects; |
| 1416 | 1414 |
| 1417 rects.append(LayoutRect()); | 1415 rects.append(LayoutRect()); |
| 1418 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox())
{ | 1416 for (InlineFlowBox* curr = firstLineBox(); curr; curr = curr->nextLineBox())
{ |
| 1419 RootInlineBox& root = curr->root(); | 1417 RootInlineBox& root = curr->root(); |
| 1420 LayoutUnit top = max<LayoutUnit>(root.lineTop(), curr->logicalTop()); | 1418 LayoutUnit top = std::max<LayoutUnit>(root.lineTop(), curr->logicalTop()
); |
| 1421 LayoutUnit bottom = min<LayoutUnit>(root.lineBottom(), curr->logicalBott
om()); | 1419 LayoutUnit bottom = std::min<LayoutUnit>(root.lineBottom(), curr->logica
lBottom()); |
| 1422 rects.append(LayoutRect(curr->x(), top, curr->logicalWidth(), bottom - t
op)); | 1420 rects.append(LayoutRect(curr->x(), top, curr->logicalWidth(), bottom - t
op)); |
| 1423 } | 1421 } |
| 1424 rects.append(LayoutRect()); | 1422 rects.append(LayoutRect()); |
| 1425 | 1423 |
| 1426 Color outlineColor = resolveColor(styleToUse, CSSPropertyOutlineColor); | 1424 Color outlineColor = resolveColor(styleToUse, CSSPropertyOutlineColor); |
| 1427 bool useTransparencyLayer = outlineColor.hasAlpha(); | 1425 bool useTransparencyLayer = outlineColor.hasAlpha(); |
| 1428 if (useTransparencyLayer) { | 1426 if (useTransparencyLayer) { |
| 1429 graphicsContext->beginTransparencyLayer(static_cast<float>(outlineColor.
alpha()) / 255); | 1427 graphicsContext->beginTransparencyLayer(static_cast<float>(outlineColor.
alpha()) / 255); |
| 1430 outlineColor = Color(outlineColor.red(), outlineColor.green(), outlineCo
lor.blue()); | 1428 outlineColor = Color(outlineColor.red(), outlineColor.green(), outlineCo
lor.blue()); |
| 1431 } | 1429 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 BSRight, | 1477 BSRight, |
| 1480 outlineColor, outlineStyle, | 1478 outlineColor, outlineStyle, |
| 1481 (lastline.isEmpty() || lastline.maxX() < thisline.maxX() || (thisline.ma
xX() - 1) <= lastline.x() ? outlineWidth : -outlineWidth), | 1479 (lastline.isEmpty() || lastline.maxX() < thisline.maxX() || (thisline.ma
xX() - 1) <= lastline.x() ? outlineWidth : -outlineWidth), |
| 1482 (nextline.isEmpty() || nextline.maxX() <= thisline.maxX() || (thisline.m
axX() - 1) <= nextline.x() ? outlineWidth : -outlineWidth), | 1480 (nextline.isEmpty() || nextline.maxX() <= thisline.maxX() || (thisline.m
axX() - 1) <= nextline.x() ? outlineWidth : -outlineWidth), |
| 1483 antialias); | 1481 antialias); |
| 1484 // upper edge | 1482 // upper edge |
| 1485 if (thisline.x() < lastline.x()) | 1483 if (thisline.x() < lastline.x()) |
| 1486 drawLineForBoxSide(graphicsContext, | 1484 drawLineForBoxSide(graphicsContext, |
| 1487 pixelSnappedBox.x() - outlineWidth, | 1485 pixelSnappedBox.x() - outlineWidth, |
| 1488 pixelSnappedBox.y() - outlineWidth, | 1486 pixelSnappedBox.y() - outlineWidth, |
| 1489 min(pixelSnappedBox.maxX() + outlineWidth, (lastline.isEmpty() ? 100
0000 : pixelSnappedLastLine.x())), | 1487 std::min(pixelSnappedBox.maxX() + outlineWidth, (lastline.isEmpty()
? 1000000 : pixelSnappedLastLine.x())), |
| 1490 pixelSnappedBox.y(), | 1488 pixelSnappedBox.y(), |
| 1491 BSTop, outlineColor, outlineStyle, | 1489 BSTop, outlineColor, outlineStyle, |
| 1492 outlineWidth, | 1490 outlineWidth, |
| 1493 (!lastline.isEmpty() && paintOffset.x() + lastline.x() + 1 < pixelSn
appedBox.maxX() + outlineWidth) ? -outlineWidth : outlineWidth, | 1491 (!lastline.isEmpty() && paintOffset.x() + lastline.x() + 1 < pixelSn
appedBox.maxX() + outlineWidth) ? -outlineWidth : outlineWidth, |
| 1494 antialias); | 1492 antialias); |
| 1495 | 1493 |
| 1496 if (lastline.maxX() < thisline.maxX()) | 1494 if (lastline.maxX() < thisline.maxX()) |
| 1497 drawLineForBoxSide(graphicsContext, | 1495 drawLineForBoxSide(graphicsContext, |
| 1498 max(lastline.isEmpty() ? -1000000 : pixelSnappedLastLine.maxX(), pix
elSnappedBox.x() - outlineWidth), | 1496 std::max(lastline.isEmpty() ? -1000000 : pixelSnappedLastLine.maxX()
, pixelSnappedBox.x() - outlineWidth), |
| 1499 pixelSnappedBox.y() - outlineWidth, | 1497 pixelSnappedBox.y() - outlineWidth, |
| 1500 pixelSnappedBox.maxX() + outlineWidth, | 1498 pixelSnappedBox.maxX() + outlineWidth, |
| 1501 pixelSnappedBox.y(), | 1499 pixelSnappedBox.y(), |
| 1502 BSTop, outlineColor, outlineStyle, | 1500 BSTop, outlineColor, outlineStyle, |
| 1503 (!lastline.isEmpty() && pixelSnappedBox.x() - outlineWidth < paintOf
fset.x() + lastline.maxX()) ? -outlineWidth : outlineWidth, | 1501 (!lastline.isEmpty() && pixelSnappedBox.x() - outlineWidth < paintOf
fset.x() + lastline.maxX()) ? -outlineWidth : outlineWidth, |
| 1504 outlineWidth, antialias); | 1502 outlineWidth, antialias); |
| 1505 | 1503 |
| 1506 if (thisline.x() == thisline.maxX()) | 1504 if (thisline.x() == thisline.maxX()) |
| 1507 drawLineForBoxSide(graphicsContext, | 1505 drawLineForBoxSide(graphicsContext, |
| 1508 pixelSnappedBox.x() - outlineWidth, | 1506 pixelSnappedBox.x() - outlineWidth, |
| 1509 pixelSnappedBox.y() - outlineWidth, | 1507 pixelSnappedBox.y() - outlineWidth, |
| 1510 pixelSnappedBox.maxX() + outlineWidth, | 1508 pixelSnappedBox.maxX() + outlineWidth, |
| 1511 pixelSnappedBox.y(), | 1509 pixelSnappedBox.y(), |
| 1512 BSTop, outlineColor, outlineStyle, | 1510 BSTop, outlineColor, outlineStyle, |
| 1513 outlineWidth, | 1511 outlineWidth, |
| 1514 outlineWidth, | 1512 outlineWidth, |
| 1515 antialias); | 1513 antialias); |
| 1516 | 1514 |
| 1517 // lower edge | 1515 // lower edge |
| 1518 if (thisline.x() < nextline.x()) | 1516 if (thisline.x() < nextline.x()) |
| 1519 drawLineForBoxSide(graphicsContext, | 1517 drawLineForBoxSide(graphicsContext, |
| 1520 pixelSnappedBox.x() - outlineWidth, | 1518 pixelSnappedBox.x() - outlineWidth, |
| 1521 pixelSnappedBox.maxY(), | 1519 pixelSnappedBox.maxY(), |
| 1522 min(pixelSnappedBox.maxX() + outlineWidth, !nextline.isEmpty() ? pix
elSnappedNextLine.x() + 1 : 1000000), | 1520 std::min(pixelSnappedBox.maxX() + outlineWidth, !nextline.isEmpty()
? pixelSnappedNextLine.x() + 1 : 1000000), |
| 1523 pixelSnappedBox.maxY() + outlineWidth, | 1521 pixelSnappedBox.maxY() + outlineWidth, |
| 1524 BSBottom, outlineColor, outlineStyle, | 1522 BSBottom, outlineColor, outlineStyle, |
| 1525 outlineWidth, | 1523 outlineWidth, |
| 1526 (!nextline.isEmpty() && paintOffset.x() + nextline.x() + 1 < pixelSn
appedBox.maxX() + outlineWidth) ? -outlineWidth : outlineWidth, | 1524 (!nextline.isEmpty() && paintOffset.x() + nextline.x() + 1 < pixelSn
appedBox.maxX() + outlineWidth) ? -outlineWidth : outlineWidth, |
| 1527 antialias); | 1525 antialias); |
| 1528 | 1526 |
| 1529 if (nextline.maxX() < thisline.maxX()) | 1527 if (nextline.maxX() < thisline.maxX()) |
| 1530 drawLineForBoxSide(graphicsContext, | 1528 drawLineForBoxSide(graphicsContext, |
| 1531 max(!nextline.isEmpty() ? pixelSnappedNextLine.maxX() : -1000000, pi
xelSnappedBox.x() - outlineWidth), | 1529 std::max(!nextline.isEmpty() ? pixelSnappedNextLine.maxX() : -100000
0, pixelSnappedBox.x() - outlineWidth), |
| 1532 pixelSnappedBox.maxY(), | 1530 pixelSnappedBox.maxY(), |
| 1533 pixelSnappedBox.maxX() + outlineWidth, | 1531 pixelSnappedBox.maxX() + outlineWidth, |
| 1534 pixelSnappedBox.maxY() + outlineWidth, | 1532 pixelSnappedBox.maxY() + outlineWidth, |
| 1535 BSBottom, outlineColor, outlineStyle, | 1533 BSBottom, outlineColor, outlineStyle, |
| 1536 (!nextline.isEmpty() && pixelSnappedBox.x() - outlineWidth < paintOf
fset.x() + nextline.maxX()) ? -outlineWidth : outlineWidth, | 1534 (!nextline.isEmpty() && pixelSnappedBox.x() - outlineWidth < paintOf
fset.x() + nextline.maxX()) ? -outlineWidth : outlineWidth, |
| 1537 outlineWidth, antialias); | 1535 outlineWidth, antialias); |
| 1538 | 1536 |
| 1539 if (thisline.x() == thisline.maxX()) | 1537 if (thisline.x() == thisline.maxX()) |
| 1540 drawLineForBoxSide(graphicsContext, | 1538 drawLineForBoxSide(graphicsContext, |
| 1541 pixelSnappedBox.x() - outlineWidth, | 1539 pixelSnappedBox.x() - outlineWidth, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1566 container = this; | 1564 container = this; |
| 1567 | 1565 |
| 1568 FloatPoint absPos = container->localToAbsolute(); | 1566 FloatPoint absPos = container->localToAbsolute(); |
| 1569 region.bounds.setX(absPos.x() + region.bounds.x()); | 1567 region.bounds.setX(absPos.x() + region.bounds.x()); |
| 1570 region.bounds.setY(absPos.y() + region.bounds.y()); | 1568 region.bounds.setY(absPos.y() + region.bounds.y()); |
| 1571 | 1569 |
| 1572 regions.append(region); | 1570 regions.append(region); |
| 1573 } | 1571 } |
| 1574 | 1572 |
| 1575 } // namespace WebCore | 1573 } // namespace WebCore |
| OLD | NEW |