OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2378 obj = obj->node()->renderer(); | 2378 obj = obj->node()->renderer(); |
2379 | 2379 |
2380 // absoluteFocusRingBoundingBox will query the hierarchy below this element,
which for large webpages can be very slow. | 2380 // absoluteFocusRingBoundingBox will query the hierarchy below this element,
which for large webpages can be very slow. |
2381 // For a web area, which will have the most elements of any element, absolut
eQuads should be used. | 2381 // For a web area, which will have the most elements of any element, absolut
eQuads should be used. |
2382 // We should also use absoluteQuads for SVG elements, otherwise transforms w
on't be applied. | 2382 // We should also use absoluteQuads for SVG elements, otherwise transforms w
on't be applied. |
2383 | 2383 |
2384 LayoutRect result; | 2384 LayoutRect result; |
2385 if (obj->isText()) { | 2385 if (obj->isText()) { |
2386 Vector<FloatQuad> quads; | 2386 Vector<FloatQuad> quads; |
2387 toRenderText(obj)->absoluteQuads(quads, 0, RenderText::ClipToEllipsis); | 2387 toRenderText(obj)->absoluteQuads(quads, 0, RenderText::ClipToEllipsis); |
2388 result = boundingBoxForQuads(obj, quads); | 2388 result = LayoutRect(boundingBoxForQuads(obj, quads)); |
2389 } else if (isWebArea() || obj->isSVGRoot()) { | 2389 } else if (isWebArea() || obj->isSVGRoot()) { |
2390 result = obj->absoluteBoundingBoxRect(); | 2390 result = LayoutRect(obj->absoluteBoundingBoxRect()); |
2391 } else { | 2391 } else { |
2392 result = obj->absoluteFocusRingBoundingBoxRect(); | 2392 result = LayoutRect(obj->absoluteFocusRingBoundingBoxRect()); |
2393 } | 2393 } |
2394 | 2394 |
2395 Document* document = this->document(); | 2395 Document* document = this->document(); |
2396 if (document && document->isSVGDocument()) | 2396 if (document && document->isSVGDocument()) |
2397 offsetBoundingBoxForRemoteSVGElement(result); | 2397 offsetBoundingBoxForRemoteSVGElement(result); |
2398 if (document && document->frame() && document->frame()->pagePopupOwner()) { | 2398 if (document && document->frame() && document->frame()->pagePopupOwner()) { |
2399 IntPoint popupOrigin = document->view()->contentsToScreen(IntRect()).loc
ation(); | 2399 IntPoint popupOrigin = document->view()->contentsToScreen(IntRect()).loc
ation(); |
2400 IntPoint mainOrigin = axObjectCache()->rootObject()->documentFrameView()
->contentsToScreen(IntRect()).location(); | 2400 IntPoint mainOrigin = axObjectCache()->rootObject()->documentFrameView()
->contentsToScreen(IntRect()).location(); |
2401 result.moveBy(IntPoint(popupOrigin - mainOrigin)); | 2401 result.moveBy(IntPoint(popupOrigin - mainOrigin)); |
2402 } | 2402 } |
2403 | 2403 |
2404 // The size of the web area should be the content size, not the clipped size
. | 2404 // The size of the web area should be the content size, not the clipped size
. |
2405 if (isWebArea() && obj->frame()->view()) | 2405 if (isWebArea() && obj->frame()->view()) |
2406 result.setSize(LayoutSize(obj->frame()->view()->contentsSize())); | 2406 result.setSize(LayoutSize(obj->frame()->view()->contentsSize())); |
2407 | 2407 |
2408 // Checkboxes and radio buttons include their label as part of their rect. | 2408 // Checkboxes and radio buttons include their label as part of their rect. |
2409 if (isCheckboxOrRadio()) { | 2409 if (isCheckboxOrRadio()) { |
2410 HTMLLabelElement* label = labelForElement(toElement(m_renderer->node()))
; | 2410 HTMLLabelElement* label = labelForElement(toElement(m_renderer->node()))
; |
2411 if (label && label->renderer()) { | 2411 if (label && label->renderer()) { |
2412 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); | 2412 LayoutRect labelRect = axObjectCache()->getOrCreate(label)->elementR
ect(); |
2413 result.unite(labelRect); | 2413 result.unite(labelRect); |
2414 } | 2414 } |
2415 } | 2415 } |
2416 | 2416 |
2417 return result; | 2417 return result; |
2418 } | 2418 } |
2419 | 2419 |
2420 } // namespace blink | 2420 } // namespace blink |
OLD | NEW |