Changeset 72321 in webkit


Ignore:
Timestamp:
Nov 18, 2010 12:01:10 PM (13 years ago)
Author:
rwlbuis@webkit.org
Message:

2010-11-18 Rob Buis <rwlbuis@gmail.com>

Reviewed by Simon Fraser.

Only inject fullscreen.css when in fullscreen
https://bugs.webkit.org/show_bug.cgi?id=49510

Refactor to only add fullscreen sheet rules when document is in fullscreen mode.

  • css/CSSStyleSelector.cpp: (WebCore::CSSStyleSelector::CSSStyleSelector): (WebCore::loadFullDefaultStyle): (WebCore::loadFullScreenRulesIfNeeded): (WebCore::CSSStyleSelector::styleForElement):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r72316 r72321  
     12010-11-18  Rob Buis  <rwlbuis@gmail.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Only inject fullscreen.css when in fullscreen
     6        https://bugs.webkit.org/show_bug.cgi?id=49510
     7
     8        Refactor to only add fullscreen sheet rules when document is in fullscreen mode.
     9
     10        * css/CSSStyleSelector.cpp:
     11        (WebCore::CSSStyleSelector::CSSStyleSelector):
     12        (WebCore::loadFullDefaultStyle):
     13        (WebCore::loadFullScreenRulesIfNeeded):
     14        (WebCore::CSSStyleSelector::styleForElement):
     15
    1162010-11-18  Steve Falkenburg  <sfalken@apple.com>
    217
  • trunk/WebCore/css/CSSStyleSelector.cpp

    r72141 r72321  
    390390
    391391static void loadFullDefaultStyle();
     392#if ENABLE(FULLSCREEN_API)
     393static void loadFullScreenRulesIfNeeded(Document*);
     394#endif
    392395static void loadSimpleDefaultStyle();
    393396// FIXME: It would be nice to use some mechanism that guarantees this is in sync with the real UA stylesheet.
     
    428431        if (!root || elementCanUseSimpleDefaultStyle(root))
    429432            loadSimpleDefaultStyle();
    430         else
     433        else {
    431434            loadFullDefaultStyle();
     435#if ENABLE(FULLSCREEN_API)
     436            loadFullScreenRulesIfNeeded(document);
     437#endif
     438        }
    432439    }
    433440
     
    535542    CSSStyleSheet* quirksSheet = parseUASheet(quirksRules);
    536543    defaultQuirksStyle->addRulesFromSheet(quirksSheet, screenEval());
    537    
     544}
     545
    538546#if ENABLE(FULLSCREEN_API)
     547static void loadFullScreenRulesIfNeeded(Document* document)
     548{
     549    if (!document->webkitFullScreen())
     550        return;
    539551    // Full-screen rules.
    540552    String fullscreenRules = String(fullscreenUserAgentStyleSheet, sizeof(fullscreenUserAgentStyleSheet)) + RenderTheme::defaultTheme()->extraDefaultStyleSheet();
     
    542554    defaultStyle->addRulesFromSheet(fullscreenSheet, screenEval());
    543555    defaultQuirksStyle->addRulesFromSheet(fullscreenSheet, screenEval());
     556}
    544557#endif
    545 }
    546558
    547559static void loadSimpleDefaultStyle()
     
    11421154    }
    11431155   
    1144     if (simpleDefaultStyleSheet && !elementCanUseSimpleDefaultStyle(e))
     1156    if (simpleDefaultStyleSheet && !elementCanUseSimpleDefaultStyle(e)) {
    11451157        loadFullDefaultStyle();
     1158#if ENABLE(FULLSCREEN_API)
     1159        loadFullScreenRulesIfNeeded(e->document());
     1160#endif
     1161    }
    11461162
    11471163#if ENABLE(SVG)
Note: See TracChangeset for help on using the changeset viewer.