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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 static const LayoutBoxModelObject* getLayoutContainer( | 99 static const LayoutBoxModelObject* getLayoutContainer( |
100 WebView* webView, | 100 WebView* webView, |
101 const WTF::AtomicString& elementId) { | 101 const WTF::AtomicString& elementId) { |
102 LayoutBox* rb = getLayoutBox(webView, elementId); | 102 LayoutBox* rb = getLayoutBox(webView, elementId); |
103 if (!rb) | 103 if (!rb) |
104 return nullptr; | 104 return nullptr; |
105 PaintLayer* compositingLayer = | 105 PaintLayer* compositingLayer = |
106 rb->enclosingLayer()->enclosingLayerForPaintInvalidation(); | 106 rb->enclosingLayer()->enclosingLayerForPaintInvalidation(); |
107 if (!compositingLayer) | 107 if (!compositingLayer) |
108 return nullptr; | 108 return nullptr; |
109 return compositingLayer->layoutObject(); | 109 return &compositingLayer->layoutObject(); |
110 } | 110 } |
111 | 111 |
112 static const LayoutBoxModelObject* getFrameLayoutContainer( | 112 static const LayoutBoxModelObject* getFrameLayoutContainer( |
113 const char* frameId, | 113 const char* frameId, |
114 WebView* webView, | 114 WebView* webView, |
115 const WTF::AtomicString& elementId) { | 115 const WTF::AtomicString& elementId) { |
116 LayoutBox* rb = getFrameElement(frameId, webView, elementId); | 116 LayoutBox* rb = getFrameElement(frameId, webView, elementId); |
117 if (!rb) | 117 if (!rb) |
118 return nullptr; | 118 return nullptr; |
119 PaintLayer* compositingLayer = | 119 PaintLayer* compositingLayer = |
120 rb->enclosingLayer()->enclosingLayerForPaintInvalidation(); | 120 rb->enclosingLayer()->enclosingLayerForPaintInvalidation(); |
121 if (!compositingLayer) | 121 if (!compositingLayer) |
122 return nullptr; | 122 return nullptr; |
123 return compositingLayer->layoutObject(); | 123 return &compositingLayer->layoutObject(); |
124 } | 124 } |
125 | 125 |
126 static const FloatRect rectFromQuad(const FloatQuad& quad) { | 126 static const FloatRect rectFromQuad(const FloatQuad& quad) { |
127 FloatRect rect; | 127 FloatRect rect; |
128 rect.setX(std::min( | 128 rect.setX(std::min( |
129 quad.p1().x(), | 129 quad.p1().x(), |
130 std::min(quad.p2().x(), std::min(quad.p3().x(), quad.p4().x())))); | 130 std::min(quad.p2().x(), std::min(quad.p3().x(), quad.p4().x())))); |
131 rect.setY(std::min( | 131 rect.setY(std::min( |
132 quad.p1().y(), | 132 quad.p1().y(), |
133 std::min(quad.p2().y(), std::min(quad.p3().y(), quad.p4().y())))); | 133 std::min(quad.p2().y(), std::min(quad.p3().y(), quad.p4().y())))); |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 EXPECT_EQ(FloatRect(263.0f, 154.0f, 10.0f, 8.0f), | 528 EXPECT_EQ(FloatRect(263.0f, 154.0f, 10.0f, 8.0f), |
529 rectFromQuad(rgm.mapToAncestor(rect, nullptr))); | 529 rectFromQuad(rgm.mapToAncestor(rect, nullptr))); |
530 | 530 |
531 rgm.pushMappingsToAncestor(floating, span); | 531 rgm.pushMappingsToAncestor(floating, span); |
532 EXPECT_EQ(rect, rectFromQuad(rgm.mapToAncestor(rect, container))); | 532 EXPECT_EQ(rect, rectFromQuad(rgm.mapToAncestor(rect, container))); |
533 EXPECT_EQ(FloatRect(63.0f, 54.0f, 10.0f, 8.0f), | 533 EXPECT_EQ(FloatRect(63.0f, 54.0f, 10.0f, 8.0f), |
534 rectFromQuad(rgm.mapToAncestor(rect, nullptr))); | 534 rectFromQuad(rgm.mapToAncestor(rect, nullptr))); |
535 } | 535 } |
536 | 536 |
537 } // namespace blink | 537 } // namespace blink |
OLD | NEW |