Title: [91955] trunk
Revision
91955
Author
[email protected]
Date
2011-07-28 16:33:38 -0700 (Thu, 28 Jul 2011)

Log Message

[CSSRegions]Add basic RenderRegion support
https://bugs.webkit.org/show_bug.cgi?id=64689

Patch by Mihnea Ovidenie <[email protected]> on 2011-07-28
Reviewed by David Hyatt.

Source/WebCore:

This patch introduces the RenderRegion object.
A RenderObject that takes its content from a "named" flow will become a RenderRegion, an element that is used to display the content from a RenderFlowThread.
A RenderRegion that is marked to take its content from a non existing flow, will have its content disconnected from the normal flow.

Tests: fast/regions/region-element-display-restriction.html
       fast/regions/region-element-dynamic-attach-flow.html
       fast/regions/region-element-dynamic-detach-flow.html
       fast/regions/render-region-renderer.html

* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* dom/Node.cpp:
(WebCore::Node::diff):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::createObject):
* rendering/RenderObject.h:
(WebCore::RenderObject::isRenderRegion):
* rendering/RenderRegion.cpp: Added.
(WebCore::RenderRegion::RenderRegion):
(WebCore::RenderRegion::~RenderRegion):
(WebCore::RenderRegion::layout):
(WebCore::RenderRegion::paint):
* rendering/RenderRegion.h: Added.
(WebCore::RenderRegion::isRenderRegion):
(WebCore::RenderRegion::renderName):
(WebCore::toRenderRegion):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::diff):

LayoutTests:

* fast/regions/region-element-display-restriction-expected.txt: Added.
* fast/regions/region-element-display-restriction.html: Added.
* fast/regions/region-element-dynamic-attach-flow-expected.txt: Added.
* fast/regions/region-element-dynamic-attach-flow.html: Added.
* fast/regions/region-element-dynamic-detach-flow-expected.txt: Added.
* fast/regions/region-element-dynamic-detach-flow.html: Added.
* fast/regions/render-region-renderer-expected.txt: Added.
* fast/regions/render-region-renderer.html: Added.
* fast/regions/script-tests/region-element-display-restriction.js: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (91954 => 91955)


--- trunk/LayoutTests/ChangeLog	2011-07-28 23:26:34 UTC (rev 91954)
+++ trunk/LayoutTests/ChangeLog	2011-07-28 23:33:38 UTC (rev 91955)
@@ -1,3 +1,20 @@
+2011-07-28  Mihnea Ovidenie  <[email protected]>
+
+        [CSSRegions]Add basic RenderRegion support
+        https://bugs.webkit.org/show_bug.cgi?id=64689
+
+        Reviewed by David Hyatt.
+
+        * fast/regions/region-element-display-restriction-expected.txt: Added.
+        * fast/regions/region-element-display-restriction.html: Added.
+        * fast/regions/region-element-dynamic-attach-flow-expected.txt: Added.
+        * fast/regions/region-element-dynamic-attach-flow.html: Added.
+        * fast/regions/region-element-dynamic-detach-flow-expected.txt: Added.
+        * fast/regions/region-element-dynamic-detach-flow.html: Added.
+        * fast/regions/render-region-renderer-expected.txt: Added.
+        * fast/regions/render-region-renderer.html: Added.
+        * fast/regions/script-tests/region-element-display-restriction.js: Added.
+
 2011-07-28  Adrienne Walker  <[email protected]>
 
         [chromium] chromium-win-xp test updates after r91945.

Added: trunk/LayoutTests/fast/regions/region-element-display-restriction-expected.txt (0 => 91955)


--- trunk/LayoutTests/fast/regions/region-element-display-restriction-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/region-element-display-restriction-expected.txt	2011-07-28 23:33:38 UTC (rev 91955)
@@ -0,0 +1,17 @@
+Test that only non-replaced block elements can be transformed into regions.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS createRegionElement("div", "none") is false
+PASS createRegionElement("div", "block") is true
+PASS createRegionElement("div", "inline-block") is true
+PASS createRegionElement("div", "run-in") is true
+PASS createRegionElement("div", "compact") is true
+PASS createRegionElement("div", "inline") is false
+PASS createRegionElement("div", "table") is false
+PASS createRegionElement("div", "inline-table") is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/regions/region-element-display-restriction.html (0 => 91955)


--- trunk/LayoutTests/fast/regions/region-element-display-restriction.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/region-element-display-restriction.html	2011-07-28 23:33:38 UTC (rev 91955)
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src=""
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/regions/region-element-dynamic-attach-flow-expected.txt (0 => 91955)


--- trunk/LayoutTests/fast/regions/region-element-dynamic-attach-flow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/region-element-dynamic-attach-flow-expected.txt	2011-07-28 23:33:38 UTC (rev 91955)
@@ -0,0 +1,3 @@
+Tests that changing the element into a region without an existing flow disconnects the element's content.
+
+PASS

Added: trunk/LayoutTests/fast/regions/region-element-dynamic-attach-flow.html (0 => 91955)


--- trunk/LayoutTests/fast/regions/region-element-dynamic-attach-flow.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/region-element-dynamic-attach-flow.html	2011-07-28 23:33:38 UTC (rev 91955)
@@ -0,0 +1,28 @@
+<!doctype html>
+<html>
+    <head>
+        <style>
+            .region
+            {
+                content: -webkit-from-flow('no_flow');
+            }
+        </style>
+    </head>
+    <body>
+        <p>Tests that changing the element into a region without an existing flow disconnects the element's content.</p>
+        <div id="region_without_flow">
+            <div id="region_content">This text should not be visible when the element becomes a region.</div>
+        </div>
+        <script>
+            if (window.layoutTestController)
+                layoutTestController.dumpAsText();
+            var region = document.getElementById("region_without_flow");
+            // The element is not a region yet, it has content.
+            var pass = region.innerText.length != 0;
+            // The element becomes a region, its content gets disconnected.
+            region.className = "region";
+            pass &= region.innerText.length == 0;
+            document.write("<p>" + pass ? "PASS" : "FAIL" + "</p>");
+        </script>
+    </body>
+</html>

Added: trunk/LayoutTests/fast/regions/region-element-dynamic-detach-flow-expected.txt (0 => 91955)


--- trunk/LayoutTests/fast/regions/region-element-dynamic-detach-flow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/region-element-dynamic-detach-flow-expected.txt	2011-07-28 23:33:38 UTC (rev 91955)
@@ -0,0 +1,4 @@
+Tests that changing a region element into a normal element makes the element's content available.
+
+This text should be visible when the element is no longer a region.
+PASS

Added: trunk/LayoutTests/fast/regions/region-element-dynamic-detach-flow.html (0 => 91955)


--- trunk/LayoutTests/fast/regions/region-element-dynamic-detach-flow.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/region-element-dynamic-detach-flow.html	2011-07-28 23:33:38 UTC (rev 91955)
@@ -0,0 +1,28 @@
+<!doctype html>
+<html>
+    <head>
+        <style>
+            .region
+            {
+                content: -webkit-from-flow("no-flow");
+            }
+        </style>
+    </head>
+    <body>
+        <p>Tests that changing a region element into a normal element makes the element's content available.</p>
+        <div class="region">
+            <div id="region_content">This text should be visible when the element is no longer a region.</div>
+        </div>
+        <script>
+            if (window.layoutTestController)
+                layoutTestController.dumpAsText();
+            var region = document.getElementsByClassName("region")[0];
+            // The element is a region without a connected flow, its content is not available.
+            var pass = region.innerText.length == 0;
+            // The element becomes a normal element, its content becomes available.
+            region.className = "";
+            pass &= region.innerText.length != 0;
+            document.write("<p>" + pass ? "PASS" : "FAIL" + "</p>");
+        </script>
+    </body>
+</html>

Added: trunk/LayoutTests/fast/regions/render-region-renderer-expected.txt (0 => 91955)


--- trunk/LayoutTests/fast/regions/render-region-renderer-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/render-region-renderer-expected.txt	2011-07-28 23:33:38 UTC (rev 91955)
@@ -0,0 +1,13 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x170
+  RenderBlock {HTML} at (0,0) size 800x170
+    RenderBody {BODY} at (8,8) size 784x154
+      RenderRegion {DIV} at (0,0) size 784x2 [border: (1px solid #FF0000)]
+      RenderRegion {DIV} at (0,2) size 52x52 [border: (1px solid #FF0000)]
+      RenderBlock {DIV} at (0,54) size 100x100
+        RenderRegion {DIV} at (0,0) size 52x52 [border: (1px solid #FF0000)]
+layer at (8,150) size 52x52
+  RenderRegion {DIV} at (8,150) size 52x52 [border: (1px solid #FF0000)]
+layer at (8,200) size 52x52
+  RenderRegion {DIV} at (8,200) size 52x52 [border: (1px solid #FF0000)]

Added: trunk/LayoutTests/fast/regions/render-region-renderer.html (0 => 91955)


--- trunk/LayoutTests/fast/regions/render-region-renderer.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/render-region-renderer.html	2011-07-28 23:33:38 UTC (rev 91955)
@@ -0,0 +1,72 @@
+<!doctype html>
+<html>
+<head>
+    <style>
+    .region
+    {
+        content: -webkit-from-flow("no-flow");
+    }
+
+    .border
+    {
+        border: 1px solid red;
+    }
+
+    .size
+    {
+        width:50px;
+        height:50px;
+    }
+
+    .sizePercent
+    {
+        width: 50%;
+        height: 50%;
+    }
+
+    .pos
+    {
+        top: 150px;
+        position: absolute;
+    }
+
+    .pos2
+    {
+        top: 200px;
+        position: absolute;
+    }
+
+    .pos3
+    {
+        top: 250px;
+        position: absolute;
+    }
+
+    .parent
+    {
+        width: 100px;
+        height: 100px;
+    }
+
+    .outline
+    {
+        outline: green dotted thick;
+    }
+
+    .notvisible
+    {
+        visibility: hidden;
+    }
+    </style>
+</head>
+<body>
+    <div class="region border">FAIL if you see the text inside the region.</div>
+    <div class="region border size">FAIL if you see the text inside the region.</div>
+    <div class="parent">
+        <div class="region border sizePercent">FAIL if you see the text inside the region.</div>
+    </div>
+    <div class="region border size pos">FAIL if you see the text inside the region.</div>
+    <div class="region border size pos2 outline">FAIL if you see the text inside the region.</div>
+    <div class="region border size pos3 notvisible">FAIL if you see the text inside the region.</div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/regions/script-tests/region-element-display-restriction.js (0 => 91955)


--- trunk/LayoutTests/fast/regions/script-tests/region-element-display-restriction.js	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/script-tests/region-element-display-restriction.js	2011-07-28 23:33:38 UTC (rev 91955)
@@ -0,0 +1,31 @@
+description("Test that only non-replaced block elements can be transformed into regions.");
+
+function createRegionElement(elementType, displayType)
+{
+    var element = document.createElement(elementType);
+    var textElement = document.createTextNode("inside element");
+    element.appendChild(textElement);
+    element.style.setProperty("display", displayType);
+    document.body.appendChild(element);
+
+    // Transform the element into a region.
+    element.style.setProperty("content", "-webkit-from-flow('no-flow')");
+
+    // The region element was created if the length of inner text is 0.
+    var regionCreated = element.innerText.length == 0;
+
+    document.body.removeChild(element);
+
+    return regionCreated;
+}
+
+shouldBeFalse('createRegionElement("div", "none")');
+shouldBeTrue('createRegionElement("div", "block")');
+shouldBeTrue('createRegionElement("div", "inline-block")');
+shouldBeTrue('createRegionElement("div", "run-in")');
+shouldBeTrue('createRegionElement("div", "compact")');
+shouldBeFalse('createRegionElement("div", "inline")');
+shouldBeFalse('createRegionElement("div", "table")');
+shouldBeFalse('createRegionElement("div", "inline-table")');
+
+successfullyParsed = true;

Modified: trunk/Source/WebCore/ChangeLog (91954 => 91955)


--- trunk/Source/WebCore/ChangeLog	2011-07-28 23:26:34 UTC (rev 91954)
+++ trunk/Source/WebCore/ChangeLog	2011-07-28 23:33:38 UTC (rev 91955)
@@ -1,3 +1,39 @@
+2011-07-28  Mihnea Ovidenie  <[email protected]>
+
+        [CSSRegions]Add basic RenderRegion support
+        https://bugs.webkit.org/show_bug.cgi?id=64689
+
+        Reviewed by David Hyatt.
+
+        This patch introduces the RenderRegion object.
+        A RenderObject that takes its content from a "named" flow will become a RenderRegion, an element that is used to display the content from a RenderFlowThread.
+        A RenderRegion that is marked to take its content from a non existing flow, will have its content disconnected from the normal flow.
+
+        Tests: fast/regions/region-element-display-restriction.html
+               fast/regions/region-element-dynamic-attach-flow.html
+               fast/regions/region-element-dynamic-detach-flow.html
+               fast/regions/render-region-renderer.html
+
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/Node.cpp:
+        (WebCore::Node::diff):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::createObject):
+        * rendering/RenderObject.h:
+        (WebCore::RenderObject::isRenderRegion):
+        * rendering/RenderRegion.cpp: Added.
+        (WebCore::RenderRegion::RenderRegion):
+        (WebCore::RenderRegion::~RenderRegion):
+        (WebCore::RenderRegion::layout):
+        (WebCore::RenderRegion::paint):
+        * rendering/RenderRegion.h: Added.
+        (WebCore::RenderRegion::isRenderRegion):
+        (WebCore::RenderRegion::renderName):
+        (WebCore::toRenderRegion):
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::diff):
+
 2011-07-28  Marco Peereboom  <[email protected]>
 
         [Soup] Cannot override default max-conns and max-conns-per-host Soup Session settings

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (91954 => 91955)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-07-28 23:26:34 UTC (rev 91954)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-07-28 23:33:38 UTC (rev 91955)
@@ -36366,6 +36366,14 @@
 				>
 			</File>
 			<File
+				RelativePath="..\rendering\RenderRegion.h"
+				>
+			</File>
+			<File
+				RelativePath="..\rendering\RenderRegion.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\rendering\RenderReplaced.cpp"
 				>
 				<FileConfiguration

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (91954 => 91955)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-07-28 23:26:34 UTC (rev 91954)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2011-07-28 23:33:38 UTC (rev 91955)
@@ -5459,6 +5459,8 @@
 		D3AA10F4123A98AA0092152B /* MediaQueryMatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = D3AA10F2123A98AA0092152B /* MediaQueryMatcher.h */; };
 		D3D4E972130C7CFE007BA540 /* HTMLSummaryElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3D4E970130C7CFE007BA540 /* HTMLSummaryElement.cpp */; };
 		D3D4E973130C7CFE007BA540 /* HTMLSummaryElement.h in Headers */ = {isa = PBXBuildFile; fileRef = D3D4E971130C7CFE007BA540 /* HTMLSummaryElement.h */; };
+		D70AD65713E1342B005B50B4 /* RenderRegion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D70AD65513E1342B005B50B4 /* RenderRegion.cpp */; };
+		D70AD65813E1342B005B50B4 /* RenderRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = D70AD65613E1342B005B50B4 /* RenderRegion.h */; };
 		D8B6152F1032495100C8554A /* Cookie.h in Headers */ = {isa = PBXBuildFile; fileRef = D8B6152E1032495100C8554A /* Cookie.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		DB23C2CB0A508D29002489EB /* IndentOutdentCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */; };
 		DB23C2CC0A508D29002489EB /* IndentOutdentCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */; };
@@ -12163,6 +12165,8 @@
 		D3AA10F2123A98AA0092152B /* MediaQueryMatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaQueryMatcher.h; sourceTree = "<group>"; };
 		D3D4E970130C7CFE007BA540 /* HTMLSummaryElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLSummaryElement.cpp; sourceTree = "<group>"; };
 		D3D4E971130C7CFE007BA540 /* HTMLSummaryElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLSummaryElement.h; sourceTree = "<group>"; };
+		D70AD65513E1342B005B50B4 /* RenderRegion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderRegion.cpp; sourceTree = "<group>"; };
+		D70AD65613E1342B005B50B4 /* RenderRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderRegion.h; sourceTree = "<group>"; };
 		D8B6152E1032495100C8554A /* Cookie.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Cookie.h; sourceTree = "<group>"; };
 		DB23C2C90A508D29002489EB /* IndentOutdentCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IndentOutdentCommand.cpp; sourceTree = "<group>"; };
 		DB23C2CA0A508D29002489EB /* IndentOutdentCommand.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IndentOutdentCommand.h; sourceTree = "<group>"; };
@@ -19550,6 +19554,8 @@
 				A43BF59B1149292800C643CA /* RenderProgress.h */,
 				5A574F22131DB93900471B88 /* RenderQuote.cpp */,
 				5A574F23131DB93900471B88 /* RenderQuote.h */,
+				D70AD65513E1342B005B50B4 /* RenderRegion.cpp */,
+				D70AD65613E1342B005B50B4 /* RenderRegion.h */,
 				A871DFDE0A15376B00B12A68 /* RenderReplaced.cpp */,
 				A871DFDF0A15376B00B12A68 /* RenderReplaced.h */,
 				BCA846D40DC67A350026C309 /* RenderReplica.cpp */,
@@ -23258,6 +23264,7 @@
 				977E2E0F12F0FC9C00C13379 /* XSSAuditor.h in Headers */,
 				FD537353137B651800008DCE /* ZeroPole.h in Headers */,
 				508CCA4F13CF106B003151F3 /* RenderFlowThread.h in Headers */,
+				D70AD65813E1342B005B50B4 /* RenderRegion.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -26045,6 +26052,7 @@
 				977E2E0E12F0FC9C00C13379 /* XSSAuditor.cpp in Sources */,
 				FD537352137B651800008DCE /* ZeroPole.cpp in Sources */,
 				508CCA5013CF106B003151F3 /* RenderFlowThread.cpp in Sources */,
+				D70AD65713E1342B005B50B4 /* RenderRegion.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: trunk/Source/WebCore/dom/Node.cpp (91954 => 91955)


--- trunk/Source/WebCore/dom/Node.cpp	2011-07-28 23:26:34 UTC (rev 91954)
+++ trunk/Source/WebCore/dom/Node.cpp	2011-07-28 23:33:38 UTC (rev 91955)
@@ -361,6 +361,11 @@
     // We need to reattach the node, so that it is moved to the correct RenderFlowThread.
     if ((s1 && s2) && (s1->flowThread() != s2->flowThread()))
         ch = Detach;
+
+    // When either the region thread or the region index has changed,
+    // we need to prepare a separate render region object.
+    if ((s1 && s2) && ((s1->regionThread() != s2->regionThread() || (s1->regionIndex() != s2->regionIndex()))))
+            ch = Detach;
 #endif
 
     return ch;

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (91954 => 91955)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2011-07-28 23:26:34 UTC (rev 91954)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2011-07-28 23:33:38 UTC (rev 91955)
@@ -49,6 +49,7 @@
 #include "RenderInline.h"
 #include "RenderLayer.h"
 #include "RenderListItem.h"
+#include "RenderRegion.h"
 #include "RenderRuby.h"
 #include "RenderRubyText.h"
 #include "RenderTableCell.h"
@@ -135,6 +136,11 @@
         case INLINE_BLOCK:
         case RUN_IN:
         case COMPACT:
+#if ENABLE(CSS_REGIONS)
+            // Only non-replaced block elements can become a region.
+            if (!style->regionThread().isEmpty())
+                return new (arena) RenderRegion(node);
+#endif
             return new (arena) RenderBlock(node);
         case LIST_ITEM:
             return new (arena) RenderListItem(node);

Modified: trunk/Source/WebCore/rendering/RenderObject.h (91954 => 91955)


--- trunk/Source/WebCore/rendering/RenderObject.h	2011-07-28 23:26:34 UTC (rev 91954)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2011-07-28 23:33:38 UTC (rev 91955)
@@ -431,6 +431,10 @@
     bool isReplaced() const { return m_replaced; } // a "replaced" element (see CSS)
     bool isHorizontalWritingMode() const { return m_horizontalWritingMode; }
 
+#if ENABLE(CSS_REGIONS)
+    virtual bool isRenderRegion() const { return false; }
+#endif
+
     bool hasLayer() const { return m_hasLayer; }
     
     bool hasBoxDecorations() const { return m_paintBackground; }

Added: trunk/Source/WebCore/rendering/RenderRegion.cpp (0 => 91955)


--- trunk/Source/WebCore/rendering/RenderRegion.cpp	                        (rev 0)
+++ trunk/Source/WebCore/rendering/RenderRegion.cpp	2011-07-28 23:33:38 UTC (rev 91955)
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2011 Adobe Systems Incorporated. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials
+ *    provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "RenderRegion.h"
+
+#include "GraphicsContext.h"
+#include "IntRect.h"
+#include "PaintInfo.h"
+#include "RenderView.h"
+
+#if ENABLE(CSS_REGIONS)
+
+namespace WebCore {
+
+RenderRegion::RenderRegion(Node* node)
+: RenderBox(node)
+{
+}
+
+RenderRegion::~RenderRegion()
+{
+}
+
+void RenderRegion::layout()
+{
+    ASSERT(needsLayout());
+
+    computeLogicalWidth();
+    computeLogicalHeight();
+
+    setNeedsLayout(false);
+}
+
+void RenderRegion::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
+{
+    if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseMask && paintInfo.phase != PaintPhaseOutline
+        && paintInfo.phase != PaintPhaseSelfOutline)
+        return;
+
+    if (!paintInfo.shouldPaintWithinRoot(this))
+        return;
+
+    if (style()->visibility() != VISIBLE)
+        return;
+
+    LayoutPoint adjustedPaintOffset = paintOffset + location();
+
+    if (hasBoxDecorations() && (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection))
+        paintBoxDecorations(paintInfo, adjustedPaintOffset);
+
+    if (paintInfo.phase == PaintPhaseMask) {
+        paintMask(paintInfo, adjustedPaintOffset);
+        return;
+    }
+
+    LayoutRect paintRect = LayoutRect(adjustedPaintOffset, size());
+    if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth())
+        paintOutline(paintInfo.context, paintRect);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(CSS_REGIONS)

Added: trunk/Source/WebCore/rendering/RenderRegion.h (0 => 91955)


--- trunk/Source/WebCore/rendering/RenderRegion.h	                        (rev 0)
+++ trunk/Source/WebCore/rendering/RenderRegion.h	2011-07-28 23:33:38 UTC (rev 91955)
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2011 Adobe Systems Incorporated. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials
+ *    provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “AS IS” AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef RenderRegion_h
+#define RenderRegion_h
+
+#if ENABLE(CSS_REGIONS)
+
+#include "RenderBox.h"
+
+namespace WebCore {
+
+class RenderRegion : public RenderBox {
+public:
+    explicit RenderRegion(Node*);
+    virtual ~RenderRegion();
+
+    virtual bool isRenderRegion() const { return true; }
+
+    virtual void layout();
+    virtual void paint(PaintInfo&, const LayoutPoint&);
+
+private:
+    virtual const char* renderName() const { return "RenderRegion"; }
+};
+
+inline RenderRegion* toRenderRegion(RenderObject* object)
+{
+    ASSERT(!object || object->isRenderRegion());
+    return static_cast<RenderRegion*>(object);
+}
+
+inline const RenderRegion* toRenderRegion(const RenderObject* object)
+{
+    ASSERT(!object || object->isRenderRegion());
+    return static_cast<const RenderRegion*>(object);
+}
+
+// This will catch anyone doing an unnecessary cast.
+void toRenderRegion(const RenderRegion*);
+
+} // namespace WebCore
+
+#endif // ENABLE(CSS_REGIONS)
+
+#endif // RenderRegion_h

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (91954 => 91955)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2011-07-28 23:26:34 UTC (rev 91954)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2011-07-28 23:33:38 UTC (rev 91955)
@@ -349,9 +349,7 @@
             return StyleDifferenceLayout;
 
 #if ENABLE(CSS_REGIONS)
-        if (rareNonInheritedData->m_regionThread != other->rareNonInheritedData->m_regionThread
-            || rareNonInheritedData->m_regionIndex != other->rareNonInheritedData->m_regionIndex
-            || rareNonInheritedData->m_regionOverflow != other->rareNonInheritedData->m_regionOverflow)
+        if (rareNonInheritedData->m_regionOverflow != other->rareNonInheritedData->m_regionOverflow)
             return StyleDifferenceLayout;
 #endif
         if (rareNonInheritedData->m_deprecatedFlexibleBox.get() != other->rareNonInheritedData->m_deprecatedFlexibleBox.get()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to