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 10 matching lines...) Expand all Loading... |
21 */ | 21 */ |
22 | 22 |
23 #include "config.h" | 23 #include "config.h" |
24 #include "core/rendering/RenderInline.h" | 24 #include "core/rendering/RenderInline.h" |
25 | 25 |
26 #include "core/dom/Fullscreen.h" | 26 #include "core/dom/Fullscreen.h" |
27 #include "core/dom/StyleEngine.h" | 27 #include "core/dom/StyleEngine.h" |
28 #include "core/page/Chrome.h" | 28 #include "core/page/Chrome.h" |
29 #include "core/page/Page.h" | 29 #include "core/page/Page.h" |
30 #include "core/paint/BoxPainter.h" | 30 #include "core/paint/BoxPainter.h" |
| 31 #include "core/paint/ObjectPainter.h" |
31 #include "core/rendering/GraphicsContextAnnotator.h" | 32 #include "core/rendering/GraphicsContextAnnotator.h" |
32 #include "core/rendering/HitTestResult.h" | 33 #include "core/rendering/HitTestResult.h" |
33 #include "core/rendering/InlineTextBox.h" | 34 #include "core/rendering/InlineTextBox.h" |
34 #include "core/rendering/RenderBlock.h" | 35 #include "core/rendering/RenderBlock.h" |
35 #include "core/rendering/RenderFlowThread.h" | 36 #include "core/rendering/RenderFlowThread.h" |
36 #include "core/rendering/RenderFullScreen.h" | 37 #include "core/rendering/RenderFullScreen.h" |
37 #include "core/rendering/RenderGeometryMap.h" | 38 #include "core/rendering/RenderGeometryMap.h" |
38 #include "core/rendering/RenderLayer.h" | 39 #include "core/rendering/RenderLayer.h" |
39 #include "core/rendering/RenderTheme.h" | 40 #include "core/rendering/RenderTheme.h" |
40 #include "core/rendering/RenderView.h" | 41 #include "core/rendering/RenderView.h" |
(...skipping 1368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1409 | 1410 |
1410 void RenderInline::paintOutline(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) | 1411 void RenderInline::paintOutline(PaintInfo& paintInfo, const LayoutPoint& paintOf
fset) |
1411 { | 1412 { |
1412 RenderStyle* styleToUse = style(); | 1413 RenderStyle* styleToUse = style(); |
1413 if (!styleToUse->hasOutline()) | 1414 if (!styleToUse->hasOutline()) |
1414 return; | 1415 return; |
1415 | 1416 |
1416 if (styleToUse->outlineStyleIsAuto()) { | 1417 if (styleToUse->outlineStyleIsAuto()) { |
1417 if (RenderTheme::theme().shouldDrawDefaultFocusRing(this)) { | 1418 if (RenderTheme::theme().shouldDrawDefaultFocusRing(this)) { |
1418 // Only paint the focus ring by hand if the theme isn't able to draw
the focus ring. | 1419 // Only paint the focus ring by hand if the theme isn't able to draw
the focus ring. |
1419 paintFocusRing(paintInfo, paintOffset, styleToUse); | 1420 ObjectPainter(*this).paintFocusRing(paintInfo, paintOffset, styleToU
se); |
1420 } | 1421 } |
1421 return; | 1422 return; |
1422 } | 1423 } |
1423 | 1424 |
1424 if (styleToUse->outlineStyle() == BNONE) | 1425 if (styleToUse->outlineStyle() == BNONE) |
1425 return; | 1426 return; |
1426 | 1427 |
1427 Vector<LayoutRect> rects; | 1428 Vector<LayoutRect> rects; |
1428 | 1429 |
1429 rects.append(LayoutRect()); | 1430 rects.append(LayoutRect()); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 LayoutRect box(LayoutPoint(paintOffset.x() + thisline.x() - offset, paintOff
set.y() + thisline.y() - offset), | 1467 LayoutRect box(LayoutPoint(paintOffset.x() + thisline.x() - offset, paintOff
set.y() + thisline.y() - offset), |
1467 LayoutSize(thisline.width() + offset, thisline.height() + offset)); | 1468 LayoutSize(thisline.width() + offset, thisline.height() + offset)); |
1468 | 1469 |
1469 IntRect pixelSnappedBox = pixelSnappedIntRect(box); | 1470 IntRect pixelSnappedBox = pixelSnappedIntRect(box); |
1470 if (pixelSnappedBox.width() < 0 || pixelSnappedBox.height() < 0) | 1471 if (pixelSnappedBox.width() < 0 || pixelSnappedBox.height() < 0) |
1471 return; | 1472 return; |
1472 IntRect pixelSnappedLastLine = pixelSnappedIntRect(paintOffset.x() + lastlin
e.x(), 0, lastline.width(), 0); | 1473 IntRect pixelSnappedLastLine = pixelSnappedIntRect(paintOffset.x() + lastlin
e.x(), 0, lastline.width(), 0); |
1473 IntRect pixelSnappedNextLine = pixelSnappedIntRect(paintOffset.x() + nextlin
e.x(), 0, nextline.width(), 0); | 1474 IntRect pixelSnappedNextLine = pixelSnappedIntRect(paintOffset.x() + nextlin
e.x(), 0, nextline.width(), 0); |
1474 | 1475 |
1475 // left edge | 1476 // left edge |
1476 drawLineForBoxSide(graphicsContext, | 1477 ObjectPainter::drawLineForBoxSide(graphicsContext, |
1477 pixelSnappedBox.x() - outlineWidth, | 1478 pixelSnappedBox.x() - outlineWidth, |
1478 pixelSnappedBox.y() - (lastline.isEmpty() || thisline.x() < lastline.x()
|| (lastline.maxX() - 1) <= thisline.x() ? outlineWidth : 0), | 1479 pixelSnappedBox.y() - (lastline.isEmpty() || thisline.x() < lastline.x()
|| (lastline.maxX() - 1) <= thisline.x() ? outlineWidth : 0), |
1479 pixelSnappedBox.x(), | 1480 pixelSnappedBox.x(), |
1480 pixelSnappedBox.maxY() + (nextline.isEmpty() || thisline.x() <= nextline
.x() || (nextline.maxX() - 1) <= thisline.x() ? outlineWidth : 0), | 1481 pixelSnappedBox.maxY() + (nextline.isEmpty() || thisline.x() <= nextline
.x() || (nextline.maxX() - 1) <= thisline.x() ? outlineWidth : 0), |
1481 BSLeft, | 1482 BSLeft, |
1482 outlineColor, outlineStyle, | 1483 outlineColor, outlineStyle, |
1483 (lastline.isEmpty() || thisline.x() < lastline.x() || (lastline.maxX() -
1) <= thisline.x() ? outlineWidth : -outlineWidth), | 1484 (lastline.isEmpty() || thisline.x() < lastline.x() || (lastline.maxX() -
1) <= thisline.x() ? outlineWidth : -outlineWidth), |
1484 (nextline.isEmpty() || thisline.x() <= nextline.x() || (nextline.maxX()
- 1) <= thisline.x() ? outlineWidth : -outlineWidth), | 1485 (nextline.isEmpty() || thisline.x() <= nextline.x() || (nextline.maxX()
- 1) <= thisline.x() ? outlineWidth : -outlineWidth), |
1485 antialias); | 1486 antialias); |
1486 | 1487 |
1487 // right edge | 1488 // right edge |
1488 drawLineForBoxSide(graphicsContext, | 1489 ObjectPainter::drawLineForBoxSide(graphicsContext, |
1489 pixelSnappedBox.maxX(), | 1490 pixelSnappedBox.maxX(), |
1490 pixelSnappedBox.y() - (lastline.isEmpty() || lastline.maxX() < thisline.
maxX() || (thisline.maxX() - 1) <= lastline.x() ? outlineWidth : 0), | 1491 pixelSnappedBox.y() - (lastline.isEmpty() || lastline.maxX() < thisline.
maxX() || (thisline.maxX() - 1) <= lastline.x() ? outlineWidth : 0), |
1491 pixelSnappedBox.maxX() + outlineWidth, | 1492 pixelSnappedBox.maxX() + outlineWidth, |
1492 pixelSnappedBox.maxY() + (nextline.isEmpty() || nextline.maxX() <= thisl
ine.maxX() || (thisline.maxX() - 1) <= nextline.x() ? outlineWidth : 0), | 1493 pixelSnappedBox.maxY() + (nextline.isEmpty() || nextline.maxX() <= thisl
ine.maxX() || (thisline.maxX() - 1) <= nextline.x() ? outlineWidth : 0), |
1493 BSRight, | 1494 BSRight, |
1494 outlineColor, outlineStyle, | 1495 outlineColor, outlineStyle, |
1495 (lastline.isEmpty() || lastline.maxX() < thisline.maxX() || (thisline.ma
xX() - 1) <= lastline.x() ? outlineWidth : -outlineWidth), | 1496 (lastline.isEmpty() || lastline.maxX() < thisline.maxX() || (thisline.ma
xX() - 1) <= lastline.x() ? outlineWidth : -outlineWidth), |
1496 (nextline.isEmpty() || nextline.maxX() <= thisline.maxX() || (thisline.m
axX() - 1) <= nextline.x() ? outlineWidth : -outlineWidth), | 1497 (nextline.isEmpty() || nextline.maxX() <= thisline.maxX() || (thisline.m
axX() - 1) <= nextline.x() ? outlineWidth : -outlineWidth), |
1497 antialias); | 1498 antialias); |
1498 // upper edge | 1499 // upper edge |
1499 if (thisline.x() < lastline.x()) | 1500 if (thisline.x() < lastline.x()) |
1500 drawLineForBoxSide(graphicsContext, | 1501 ObjectPainter::drawLineForBoxSide(graphicsContext, |
1501 pixelSnappedBox.x() - outlineWidth, | 1502 pixelSnappedBox.x() - outlineWidth, |
1502 pixelSnappedBox.y() - outlineWidth, | 1503 pixelSnappedBox.y() - outlineWidth, |
1503 std::min(pixelSnappedBox.maxX() + outlineWidth, (lastline.isEmpty()
? 1000000 : pixelSnappedLastLine.x())), | 1504 std::min(pixelSnappedBox.maxX() + outlineWidth, (lastline.isEmpty()
? 1000000 : pixelSnappedLastLine.x())), |
1504 pixelSnappedBox.y(), | 1505 pixelSnappedBox.y(), |
1505 BSTop, outlineColor, outlineStyle, | 1506 BSTop, outlineColor, outlineStyle, |
1506 outlineWidth, | 1507 outlineWidth, |
1507 (!lastline.isEmpty() && paintOffset.x() + lastline.x() + 1 < pixelSn
appedBox.maxX() + outlineWidth) ? -outlineWidth : outlineWidth, | 1508 (!lastline.isEmpty() && paintOffset.x() + lastline.x() + 1 < pixelSn
appedBox.maxX() + outlineWidth) ? -outlineWidth : outlineWidth, |
1508 antialias); | 1509 antialias); |
1509 | 1510 |
1510 if (lastline.maxX() < thisline.maxX()) | 1511 if (lastline.maxX() < thisline.maxX()) |
1511 drawLineForBoxSide(graphicsContext, | 1512 ObjectPainter::drawLineForBoxSide(graphicsContext, |
1512 std::max(lastline.isEmpty() ? -1000000 : pixelSnappedLastLine.maxX()
, pixelSnappedBox.x() - outlineWidth), | 1513 std::max(lastline.isEmpty() ? -1000000 : pixelSnappedLastLine.maxX()
, pixelSnappedBox.x() - outlineWidth), |
1513 pixelSnappedBox.y() - outlineWidth, | 1514 pixelSnappedBox.y() - outlineWidth, |
1514 pixelSnappedBox.maxX() + outlineWidth, | 1515 pixelSnappedBox.maxX() + outlineWidth, |
1515 pixelSnappedBox.y(), | 1516 pixelSnappedBox.y(), |
1516 BSTop, outlineColor, outlineStyle, | 1517 BSTop, outlineColor, outlineStyle, |
1517 (!lastline.isEmpty() && pixelSnappedBox.x() - outlineWidth < paintOf
fset.x() + lastline.maxX()) ? -outlineWidth : outlineWidth, | 1518 (!lastline.isEmpty() && pixelSnappedBox.x() - outlineWidth < paintOf
fset.x() + lastline.maxX()) ? -outlineWidth : outlineWidth, |
1518 outlineWidth, antialias); | 1519 outlineWidth, antialias); |
1519 | 1520 |
1520 if (thisline.x() == thisline.maxX()) | 1521 if (thisline.x() == thisline.maxX()) |
1521 drawLineForBoxSide(graphicsContext, | 1522 ObjectPainter::drawLineForBoxSide(graphicsContext, |
1522 pixelSnappedBox.x() - outlineWidth, | 1523 pixelSnappedBox.x() - outlineWidth, |
1523 pixelSnappedBox.y() - outlineWidth, | 1524 pixelSnappedBox.y() - outlineWidth, |
1524 pixelSnappedBox.maxX() + outlineWidth, | 1525 pixelSnappedBox.maxX() + outlineWidth, |
1525 pixelSnappedBox.y(), | 1526 pixelSnappedBox.y(), |
1526 BSTop, outlineColor, outlineStyle, | 1527 BSTop, outlineColor, outlineStyle, |
1527 outlineWidth, | 1528 outlineWidth, |
1528 outlineWidth, | 1529 outlineWidth, |
1529 antialias); | 1530 antialias); |
1530 | 1531 |
1531 // lower edge | 1532 // lower edge |
1532 if (thisline.x() < nextline.x()) | 1533 if (thisline.x() < nextline.x()) |
1533 drawLineForBoxSide(graphicsContext, | 1534 ObjectPainter::drawLineForBoxSide(graphicsContext, |
1534 pixelSnappedBox.x() - outlineWidth, | 1535 pixelSnappedBox.x() - outlineWidth, |
1535 pixelSnappedBox.maxY(), | 1536 pixelSnappedBox.maxY(), |
1536 std::min(pixelSnappedBox.maxX() + outlineWidth, !nextline.isEmpty()
? pixelSnappedNextLine.x() + 1 : 1000000), | 1537 std::min(pixelSnappedBox.maxX() + outlineWidth, !nextline.isEmpty()
? pixelSnappedNextLine.x() + 1 : 1000000), |
1537 pixelSnappedBox.maxY() + outlineWidth, | 1538 pixelSnappedBox.maxY() + outlineWidth, |
1538 BSBottom, outlineColor, outlineStyle, | 1539 BSBottom, outlineColor, outlineStyle, |
1539 outlineWidth, | 1540 outlineWidth, |
1540 (!nextline.isEmpty() && paintOffset.x() + nextline.x() + 1 < pixelSn
appedBox.maxX() + outlineWidth) ? -outlineWidth : outlineWidth, | 1541 (!nextline.isEmpty() && paintOffset.x() + nextline.x() + 1 < pixelSn
appedBox.maxX() + outlineWidth) ? -outlineWidth : outlineWidth, |
1541 antialias); | 1542 antialias); |
1542 | 1543 |
1543 if (nextline.maxX() < thisline.maxX()) | 1544 if (nextline.maxX() < thisline.maxX()) |
1544 drawLineForBoxSide(graphicsContext, | 1545 ObjectPainter::drawLineForBoxSide(graphicsContext, |
1545 std::max(!nextline.isEmpty() ? pixelSnappedNextLine.maxX() : -100000
0, pixelSnappedBox.x() - outlineWidth), | 1546 std::max(!nextline.isEmpty() ? pixelSnappedNextLine.maxX() : -100000
0, pixelSnappedBox.x() - outlineWidth), |
1546 pixelSnappedBox.maxY(), | 1547 pixelSnappedBox.maxY(), |
1547 pixelSnappedBox.maxX() + outlineWidth, | 1548 pixelSnappedBox.maxX() + outlineWidth, |
1548 pixelSnappedBox.maxY() + outlineWidth, | 1549 pixelSnappedBox.maxY() + outlineWidth, |
1549 BSBottom, outlineColor, outlineStyle, | 1550 BSBottom, outlineColor, outlineStyle, |
1550 (!nextline.isEmpty() && pixelSnappedBox.x() - outlineWidth < paintOf
fset.x() + nextline.maxX()) ? -outlineWidth : outlineWidth, | 1551 (!nextline.isEmpty() && pixelSnappedBox.x() - outlineWidth < paintOf
fset.x() + nextline.maxX()) ? -outlineWidth : outlineWidth, |
1551 outlineWidth, antialias); | 1552 outlineWidth, antialias); |
1552 | 1553 |
1553 if (thisline.x() == thisline.maxX()) | 1554 if (thisline.x() == thisline.maxX()) |
1554 drawLineForBoxSide(graphicsContext, | 1555 ObjectPainter::drawLineForBoxSide(graphicsContext, |
1555 pixelSnappedBox.x() - outlineWidth, | 1556 pixelSnappedBox.x() - outlineWidth, |
1556 pixelSnappedBox.maxY(), | 1557 pixelSnappedBox.maxY(), |
1557 pixelSnappedBox.maxX() + outlineWidth, | 1558 pixelSnappedBox.maxX() + outlineWidth, |
1558 pixelSnappedBox.maxY() + outlineWidth, | 1559 pixelSnappedBox.maxY() + outlineWidth, |
1559 BSBottom, outlineColor, outlineStyle, | 1560 BSBottom, outlineColor, outlineStyle, |
1560 outlineWidth, | 1561 outlineWidth, |
1561 outlineWidth, | 1562 outlineWidth, |
1562 antialias); | 1563 antialias); |
1563 } | 1564 } |
1564 | 1565 |
(...skipping 15 matching lines...) Expand all Loading... |
1580 container = this; | 1581 container = this; |
1581 | 1582 |
1582 FloatPoint absPos = container->localToAbsolute(); | 1583 FloatPoint absPos = container->localToAbsolute(); |
1583 region.bounds.setX(absPos.x() + region.bounds.x()); | 1584 region.bounds.setX(absPos.x() + region.bounds.x()); |
1584 region.bounds.setY(absPos.y() + region.bounds.y()); | 1585 region.bounds.setY(absPos.y() + region.bounds.y()); |
1585 | 1586 |
1586 regions.append(region); | 1587 regions.append(region); |
1587 } | 1588 } |
1588 | 1589 |
1589 } // namespace blink | 1590 } // namespace blink |
OLD | NEW |