| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 | 92 |
| 93 static const LayoutBoxModelObject* getRenderContainer(WebView* webView, cons
t WTF::AtomicString &elementId) | 93 static const LayoutBoxModelObject* getRenderContainer(WebView* webView, cons
t WTF::AtomicString &elementId) |
| 94 { | 94 { |
| 95 LayoutBox* rb = getLayoutBox(webView, elementId); | 95 LayoutBox* rb = getLayoutBox(webView, elementId); |
| 96 if (!rb) | 96 if (!rb) |
| 97 return nullptr; | 97 return nullptr; |
| 98 Layer* compositingLayer = rb->enclosingLayer()->enclosingLayerForPaintIn
validation(); | 98 Layer* compositingLayer = rb->enclosingLayer()->enclosingLayerForPaintIn
validation(); |
| 99 if (!compositingLayer) | 99 if (!compositingLayer) |
| 100 return nullptr; | 100 return nullptr; |
| 101 return compositingLayer->renderer(); | 101 return compositingLayer->layoutObject(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 static const LayoutBoxModelObject* getFrameRenderContainer(const char* frame
Id, WebView* webView, const WTF::AtomicString &elementId) | 104 static const LayoutBoxModelObject* getFrameRenderContainer(const char* frame
Id, WebView* webView, const WTF::AtomicString &elementId) |
| 105 { | 105 { |
| 106 LayoutBox* rb = getFrameElement(frameId, webView, elementId); | 106 LayoutBox* rb = getFrameElement(frameId, webView, elementId); |
| 107 if (!rb) | 107 if (!rb) |
| 108 return nullptr; | 108 return nullptr; |
| 109 Layer* compositingLayer = rb->enclosingLayer()->enclosingLayerForPaintIn
validation(); | 109 Layer* compositingLayer = rb->enclosingLayer()->enclosingLayerForPaintIn
validation(); |
| 110 if (!compositingLayer) | 110 if (!compositingLayer) |
| 111 return nullptr; | 111 return nullptr; |
| 112 return compositingLayer->renderer(); | 112 return compositingLayer->layoutObject(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 static const FloatRect rectFromQuad(const FloatQuad& quad) | 115 static const FloatRect rectFromQuad(const FloatQuad& quad) |
| 116 { | 116 { |
| 117 FloatRect rect; | 117 FloatRect rect; |
| 118 rect.setX(std::min(quad.p1().x(), std::min(quad.p2().x(), std::min(quad.
p3().x(), quad.p4().x())))); | 118 rect.setX(std::min(quad.p1().x(), std::min(quad.p2().x(), std::min(quad.
p3().x(), quad.p4().x())))); |
| 119 rect.setY(std::min(quad.p1().y(), std::min(quad.p2().y(), std::min(quad.
p3().y(), quad.p4().y())))); | 119 rect.setY(std::min(quad.p1().y(), std::min(quad.p2().y(), std::min(quad.
p3().y(), quad.p4().y())))); |
| 120 | 120 |
| 121 rect.setWidth(std::max(quad.p1().x(), std::max(quad.p2().x(), std::max(q
uad.p3().x(), quad.p4().x()))) - rect.x()); | 121 rect.setWidth(std::max(quad.p1().x(), std::max(quad.p2().x(), std::max(q
uad.p3().x(), quad.p4().x()))) - rect.x()); |
| 122 rect.setHeight(std::max(quad.p1().y(), std::max(quad.p2().y(), std::max(
quad.p3().y(), quad.p4().y()))) - rect.y()); | 122 rect.setHeight(std::max(quad.p1().y(), std::max(quad.p2().y(), std::max(
quad.p3().y(), quad.p4().y()))) - rect.y()); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 rgm.pushMappingsToAncestor(getLayoutBox(webView, "Col3"), nullptr); | 388 rgm.pushMappingsToAncestor(getLayoutBox(webView, "Col3"), nullptr); |
| 389 EXPECT_NEAR(8.0f + offset * 2.0f, rgm.mapToContainer(point, nullptr).x(), 0.
1f); | 389 EXPECT_NEAR(8.0f + offset * 2.0f, rgm.mapToContainer(point, nullptr).x(), 0.
1f); |
| 390 EXPECT_NEAR(8.0f, rgm.mapToContainer(point, nullptr).y(), 0.1f); | 390 EXPECT_NEAR(8.0f, rgm.mapToContainer(point, nullptr).y(), 0.1f); |
| 391 EXPECT_NEAR(8.0f + offset * 2.0f, rectFromQuad(rgm.mapToContainer(rect, null
ptr)).x(), 0.1f); | 391 EXPECT_NEAR(8.0f + offset * 2.0f, rectFromQuad(rgm.mapToContainer(rect, null
ptr)).x(), 0.1f); |
| 392 EXPECT_NEAR(8.0f, rectFromQuad(rgm.mapToContainer(rect, nullptr)).y(), 0.1f)
; | 392 EXPECT_NEAR(8.0f, rectFromQuad(rgm.mapToContainer(rect, nullptr)).y(), 0.1f)
; |
| 393 EXPECT_EQ(5.0f, rectFromQuad(rgm.mapToContainer(rect, nullptr)).width()); | 393 EXPECT_EQ(5.0f, rectFromQuad(rgm.mapToContainer(rect, nullptr)).width()); |
| 394 EXPECT_EQ(3.0f, rectFromQuad(rgm.mapToContainer(rect, nullptr)).height()); | 394 EXPECT_EQ(3.0f, rectFromQuad(rgm.mapToContainer(rect, nullptr)).height()); |
| 395 | 395 |
| 396 } | 396 } |
| 397 } // namespace :: | 397 } // namespace :: |
| OLD | NEW |