Use enum class for the RunPostLayoutTasks enum
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Sep 2014 18:57:07 +0000 (18:57 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Sep 2014 18:57:07 +0000 (18:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=136640

Reviewed by Dean Jackson.

Use enum class for RunPostLayoutTasks fixing callers. Add an explanatory comment,
and add some spacing.

* dom/Document.cpp:
(WebCore::Document::updateLayoutIgnorePendingStylesheets):
* dom/Document.h:
* html/HTMLAppletElement.cpp:
(WebCore::HTMLAppletElement::renderWidgetForJSBindings):
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::renderWidgetForJSBindings):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::renderWidgetForJSBindings):
* testing/Internals.cpp:
(WebCore::Internals::updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173392 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/html/HTMLAppletElement.cpp
Source/WebCore/html/HTMLEmbedElement.cpp
Source/WebCore/html/HTMLObjectElement.cpp
Source/WebCore/testing/Internals.cpp

index 2a38e75..c14903c 100644 (file)
@@ -1,3 +1,25 @@
+2014-09-08  Simon Fraser  <simon.fraser@apple.com>
+
+        Use enum class for the RunPostLayoutTasks enum
+        https://bugs.webkit.org/show_bug.cgi?id=136640
+
+        Reviewed by Dean Jackson.
+
+        Use enum class for RunPostLayoutTasks fixing callers. Add an explanatory comment,
+        and add some spacing.
+
+        * dom/Document.cpp:
+        (WebCore::Document::updateLayoutIgnorePendingStylesheets):
+        * dom/Document.h:
+        * html/HTMLAppletElement.cpp:
+        (WebCore::HTMLAppletElement::renderWidgetForJSBindings):
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::renderWidgetForJSBindings):
+        * html/HTMLObjectElement.cpp:
+        (WebCore::HTMLObjectElement::renderWidgetForJSBindings):
+        * testing/Internals.cpp:
+        (WebCore::Internals::updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks):
+
 2014-09-08  peavo@outlook.com  <peavo@outlook.com>
 
         [WinCairo] Compile error.
index aaaf920..9b22f40 100644 (file)
@@ -1851,7 +1851,7 @@ void Document::updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks
 
     updateLayout();
 
-    if (runPostLayoutTasks == RunPostLayoutTasksSynchronously && view())
+    if (runPostLayoutTasks == RunPostLayoutTasks::Synchronously && view())
         view()->flushAnyPendingPostLayoutTasks();
 
     m_ignorePendingStylesheets = oldIgnore;
index 8b6e192..821dd8f 100644 (file)
@@ -591,12 +591,17 @@ public:
     void recalcStyle(Style::Change = Style::NoChange);
     WEBCORE_EXPORT void updateStyleIfNeeded();
     bool updateStyleIfNeededForNode(const Node&);
+
     WEBCORE_EXPORT void updateLayout();
-    enum RunPostLayoutTasks {
-        RunPostLayoutTasksAsynchronously,
-        RunPostLayoutTasksSynchronously,
+    
+    // updateLayoutIgnorePendingStylesheets() forces layout even if we are waiting for pending stylesheet loads,
+    // so calling this may cause a flash of unstyled content (FOUC).
+    enum class RunPostLayoutTasks {
+        Asynchronously,
+        Synchronously,
     };
-    WEBCORE_EXPORT void updateLayoutIgnorePendingStylesheets(RunPostLayoutTasks = RunPostLayoutTasksAsynchronously);
+    WEBCORE_EXPORT void updateLayoutIgnorePendingStylesheets(RunPostLayoutTasks = RunPostLayoutTasks::Asynchronously);
+
     PassRef<RenderStyle> styleForElementIgnoringPendingStylesheets(Element*);
 
     // Returns true if page box (margin boxes and page borders) is visible.
index bbb8a17..c654b53 100644 (file)
@@ -91,7 +91,7 @@ RenderWidget* HTMLAppletElement::renderWidgetForJSBindings() const
     // Needs to load the plugin immediatedly because this function is called
     // when JavaScript code accesses the plugin.
     // FIXME: <rdar://16893708> Check if dispatching events here is safe.
-    document().updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasksSynchronously);
+    document().updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks::Synchronously);
     return renderWidget();
 }
 
index 646f17e..881a642 100644 (file)
@@ -75,7 +75,7 @@ RenderWidget* HTMLEmbedElement::renderWidgetForJSBindings() const
         // Needs to load the plugin immediatedly because this function is called
         // when JavaScript code accesses the plugin.
         // FIXME: <rdar://16893708> Check if dispatching events here is safe.
-        document().updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasksSynchronously);
+        document().updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks::Synchronously);
     }
     return findWidgetRenderer(this);
 }
index 502effe..8b69890 100644 (file)
@@ -86,7 +86,7 @@ RenderWidget* HTMLObjectElement::renderWidgetForJSBindings() const
     // Needs to load the plugin immediatedly because this function is called
     // when JavaScript code accesses the plugin.
     // FIXME: <rdar://16893708> Check if dispatching events here is safe.
-    document().updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasksSynchronously);
+    document().updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks::Synchronously);
     return renderWidget(); // This will return 0 if the renderer is not a RenderWidget.
 }
 
index ac96f55..0a0267a 100644 (file)
@@ -1926,7 +1926,7 @@ void Internals::updateLayoutIgnorePendingStylesheetsAndRunPostLayoutTasks(Node*
         return;
     }
 
-    document->updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasksSynchronously);
+    document->updateLayoutIgnorePendingStylesheets(Document::RunPostLayoutTasks::Synchronously);
 }
 
 #if !PLATFORM(IOS)