| 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) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. |
| 7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 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 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0)); | 1211 quad[3] = FloatPoint(x2, y1 + std::max(-adjacentWidth1, 0)); |
| 1212 break; | 1212 break; |
| 1213 } | 1213 } |
| 1214 | 1214 |
| 1215 graphicsContext->drawConvexPolygon(4, quad, antialias); | 1215 graphicsContext->drawConvexPolygon(4, quad, antialias); |
| 1216 graphicsContext->setStrokeStyle(oldStrokeStyle); | 1216 graphicsContext->setStrokeStyle(oldStrokeStyle); |
| 1217 } | 1217 } |
| 1218 | 1218 |
| 1219 void RenderObject::paintFocusRing(PaintInfo& paintInfo, const LayoutPoint& paint
Offset, RenderStyle* style) | 1219 void RenderObject::paintFocusRing(PaintInfo& paintInfo, const LayoutPoint& paint
Offset, RenderStyle* style) |
| 1220 { | 1220 { |
| 1221 Vector<IntRect> focusRingRects; | 1221 Vector<LayoutRect> focusRingRects; |
| 1222 addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer()); | 1222 addFocusRingRects(focusRingRects, paintOffset, paintInfo.paintContainer()); |
| 1223 ASSERT(style->outlineStyleIsAuto()); | 1223 ASSERT(style->outlineStyleIsAuto()); |
| 1224 paintInfo.context->drawFocusRing(focusRingRects, style->outlineWidth(), styl
e->outlineOffset(), resolveColor(style, CSSPropertyOutlineColor)); | 1224 Vector<IntRect> focusRingIntRects; |
| 1225 for (size_t i = 0; i < focusRingRects.size(); ++i) |
| 1226 focusRingIntRects.append(pixelSnappedIntRect(focusRingRects[i])); |
| 1227 paintInfo.context->drawFocusRing(focusRingIntRects, style->outlineWidth(), s
tyle->outlineOffset(), resolveColor(style, CSSPropertyOutlineColor)); |
| 1225 } | 1228 } |
| 1226 | 1229 |
| 1227 void RenderObject::paintOutline(PaintInfo& paintInfo, const LayoutRect& paintRec
t) | 1230 void RenderObject::paintOutline(PaintInfo& paintInfo, const LayoutRect& paintRec
t) |
| 1228 { | 1231 { |
| 1229 RenderStyle* styleToUse = style(); | 1232 RenderStyle* styleToUse = style(); |
| 1230 if (!styleToUse->hasOutline()) | 1233 if (!styleToUse->hasOutline()) |
| 1231 return; | 1234 return; |
| 1232 | 1235 |
| 1233 LayoutUnit outlineWidth = styleToUse->outlineWidth(); | 1236 LayoutUnit outlineWidth = styleToUse->outlineWidth(); |
| 1234 | 1237 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 | 1288 |
| 1286 drawLineForBoxSide(graphicsContext, leftOuter, topOuter, leftInner, bottomOu
ter, BSLeft, outlineColor, outlineStyle, outlineWidth, outlineWidth); | 1289 drawLineForBoxSide(graphicsContext, leftOuter, topOuter, leftInner, bottomOu
ter, BSLeft, outlineColor, outlineStyle, outlineWidth, outlineWidth); |
| 1287 drawLineForBoxSide(graphicsContext, leftOuter, topOuter, rightOuter, topInne
r, BSTop, outlineColor, outlineStyle, outlineWidth, outlineWidth); | 1290 drawLineForBoxSide(graphicsContext, leftOuter, topOuter, rightOuter, topInne
r, BSTop, outlineColor, outlineStyle, outlineWidth, outlineWidth); |
| 1288 drawLineForBoxSide(graphicsContext, rightInner, topOuter, rightOuter, bottom
Outer, BSRight, outlineColor, outlineStyle, outlineWidth, outlineWidth); | 1291 drawLineForBoxSide(graphicsContext, rightInner, topOuter, rightOuter, bottom
Outer, BSRight, outlineColor, outlineStyle, outlineWidth, outlineWidth); |
| 1289 drawLineForBoxSide(graphicsContext, leftOuter, bottomInner, rightOuter, bott
omOuter, BSBottom, outlineColor, outlineStyle, outlineWidth, outlineWidth); | 1292 drawLineForBoxSide(graphicsContext, leftOuter, bottomInner, rightOuter, bott
omOuter, BSBottom, outlineColor, outlineStyle, outlineWidth, outlineWidth); |
| 1290 | 1293 |
| 1291 if (useTransparencyLayer) | 1294 if (useTransparencyLayer) |
| 1292 graphicsContext->endLayer(); | 1295 graphicsContext->endLayer(); |
| 1293 } | 1296 } |
| 1294 | 1297 |
| 1295 void RenderObject::addChildFocusRingRects(Vector<IntRect>& rects, const LayoutPo
int& additionalOffset, const RenderLayerModelObject* paintContainer) const | 1298 void RenderObject::addChildFocusRingRects(Vector<LayoutRect>& rects, const Layou
tPoint& additionalOffset, const RenderLayerModelObject* paintContainer) const |
| 1296 { | 1299 { |
| 1297 for (RenderObject* current = slowFirstChild(); current; current = current->n
extSibling()) { | 1300 for (RenderObject* current = slowFirstChild(); current; current = current->n
extSibling()) { |
| 1298 if (current->isText() || current->isListMarker()) | 1301 if (current->isText() || current->isListMarker()) |
| 1299 continue; | 1302 continue; |
| 1300 | 1303 |
| 1301 if (current->isBox()) { | 1304 if (current->isBox()) { |
| 1302 RenderBox* box = toRenderBox(current); | 1305 RenderBox* box = toRenderBox(current); |
| 1303 if (box->hasLayer()) { | 1306 if (box->hasLayer()) { |
| 1304 Vector<IntRect> layerFocusRingRects; | 1307 Vector<LayoutRect> layerFocusRingRects; |
| 1305 box->addFocusRingRects(layerFocusRingRects, LayoutPoint(), box); | 1308 box->addFocusRingRects(layerFocusRingRects, LayoutPoint(), box); |
| 1306 for (size_t i = 0; i < layerFocusRingRects.size(); ++i) { | 1309 for (size_t i = 0; i < layerFocusRingRects.size(); ++i) { |
| 1307 FloatQuad quadInBox = box->localToContainerQuad(FloatRect(la
yerFocusRingRects[i]), paintContainer); | 1310 FloatQuad quadInBox = box->localToContainerQuad(FloatQuad(la
yerFocusRingRects[i]), paintContainer); |
| 1308 FloatRect rect = quadInBox.boundingBox(); | 1311 LayoutRect rect = LayoutRect(quadInBox.boundingBox()); |
| 1309 // Floor the location instead of using pixelSnappedIntRect t
o match the !hasLayer() path. | 1312 if (!rect.isEmpty()) |
| 1310 // FIXME: roundedIntSize matches pixelSnappedIntRect in othe
r places of addFocusRingRects | 1313 rects.append(rect); |
| 1311 // because we always floor the offset. | |
| 1312 // This assumption is fragile and should be replaced by bett
er solution. | |
| 1313 rects.append(IntRect(flooredIntPoint(rect.location()), round
edIntSize(rect.size()))); | |
| 1314 } | 1314 } |
| 1315 } else { | 1315 } else { |
| 1316 FloatPoint pos(additionalOffset); | 1316 box->addFocusRingRects(rects, additionalOffset + box->locationOf
fset(), paintContainer); |
| 1317 pos.move(box->locationOffset()); | |
| 1318 box->addFocusRingRects(rects, flooredIntPoint(pos), paintContain
er); | |
| 1319 } | 1317 } |
| 1320 } else { | 1318 } else { |
| 1321 current->addFocusRingRects(rects, additionalOffset, paintContainer); | 1319 current->addFocusRingRects(rects, additionalOffset, paintContainer); |
| 1322 } | 1320 } |
| 1323 } | 1321 } |
| 1324 } | 1322 } |
| 1325 | 1323 |
| 1326 LayoutPoint RenderObject::positionFromPaintInvalidationContainer(const RenderLay
erModelObject* paintInvalidationContainer, const PaintInvalidationState* paintIn
validationState) const | 1324 LayoutPoint RenderObject::positionFromPaintInvalidationContainer(const RenderLay
erModelObject* paintInvalidationContainer, const PaintInvalidationState* paintIn
validationState) const |
| 1327 { | 1325 { |
| 1328 ASSERT(containerForPaintInvalidation() == paintInvalidationContainer); | 1326 ASSERT(containerForPaintInvalidation() == paintInvalidationContainer); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1359 return IntRect(); | 1357 return IntRect(); |
| 1360 | 1358 |
| 1361 LayoutRect result = rects[0]; | 1359 LayoutRect result = rects[0]; |
| 1362 for (size_t i = 1; i < n; ++i) | 1360 for (size_t i = 1; i < n; ++i) |
| 1363 result.unite(rects[i]); | 1361 result.unite(rects[i]); |
| 1364 return pixelSnappedIntRect(result); | 1362 return pixelSnappedIntRect(result); |
| 1365 } | 1363 } |
| 1366 | 1364 |
| 1367 void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads) | 1365 void RenderObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads) |
| 1368 { | 1366 { |
| 1369 Vector<IntRect> rects; | 1367 Vector<LayoutRect> rects; |
| 1370 const RenderLayerModelObject* container = containerForPaintInvalidation(); | 1368 const RenderLayerModelObject* container = containerForPaintInvalidation(); |
| 1371 addFocusRingRects(rects, LayoutPoint(localToContainerPoint(FloatPoint(), con
tainer)), container); | 1369 addFocusRingRects(rects, LayoutPoint(localToContainerPoint(FloatPoint(), con
tainer)), container); |
| 1372 size_t count = rects.size(); | 1370 size_t count = rects.size(); |
| 1373 for (size_t i = 0; i < count; ++i) | 1371 for (size_t i = 0; i < count; ++i) |
| 1374 quads.append(container->localToAbsoluteQuad(FloatQuad(rects[i]))); | 1372 quads.append(container->localToAbsoluteQuad(FloatQuad(rects[i]))); |
| 1375 } | 1373 } |
| 1376 | 1374 |
| 1377 FloatRect RenderObject::absoluteBoundingBoxRectForRange(const Range* range) | 1375 FloatRect RenderObject::absoluteBoundingBoxRectForRange(const Range* range) |
| 1378 { | 1376 { |
| 1379 if (!range || !range->startContainer()) | 1377 if (!range || !range->startContainer()) |
| (...skipping 2066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3446 { | 3444 { |
| 3447 if (object1) { | 3445 if (object1) { |
| 3448 const blink::RenderObject* root = object1; | 3446 const blink::RenderObject* root = object1; |
| 3449 while (root->parent()) | 3447 while (root->parent()) |
| 3450 root = root->parent(); | 3448 root = root->parent(); |
| 3451 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3449 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
| 3452 } | 3450 } |
| 3453 } | 3451 } |
| 3454 | 3452 |
| 3455 #endif | 3453 #endif |
| OLD | NEW |