Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: Source/core/page/Page.cpp

Issue 66383005: Remove the concept of user stylesheets. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix WebFrameCSSCallbackTest tests Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/page/Page.h ('k') | Source/core/page/Settings.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All R ights Reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All R ights Reserved.
3 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 3 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 , m_backForwardClient(pageClients.backForwardClient) 109 , m_backForwardClient(pageClients.backForwardClient)
110 , m_editorClient(pageClients.editorClient) 110 , m_editorClient(pageClients.editorClient)
111 , m_validationMessageClient(0) 111 , m_validationMessageClient(0)
112 , m_sharedWorkerRepositoryClient(0) 112 , m_sharedWorkerRepositoryClient(0)
113 , m_subframeCount(0) 113 , m_subframeCount(0)
114 , m_openedByDOM(false) 114 , m_openedByDOM(false)
115 , m_tabKeyCyclesThroughElements(true) 115 , m_tabKeyCyclesThroughElements(true)
116 , m_defersLoading(false) 116 , m_defersLoading(false)
117 , m_pageScaleFactor(1) 117 , m_pageScaleFactor(1)
118 , m_deviceScaleFactor(1) 118 , m_deviceScaleFactor(1)
119 , m_didLoadUserStyleSheet(false)
120 , m_group(0) 119 , m_group(0)
121 , m_timerAlignmentInterval(DOMTimer::visiblePageAlignmentInterval()) 120 , m_timerAlignmentInterval(DOMTimer::visiblePageAlignmentInterval())
122 , m_visibilityState(PageVisibilityStateVisible) 121 , m_visibilityState(PageVisibilityStateVisible)
123 , m_isCursorVisible(true) 122 , m_isCursorVisible(true)
124 #ifndef NDEBUG 123 #ifndef NDEBUG
125 , m_isPainting(false) 124 , m_isPainting(false)
126 #endif 125 #endif
127 , m_console(PageConsole::create(this)) 126 , m_console(PageConsole::create(this))
128 { 127 {
129 ASSERT(m_editorClient); 128 ASSERT(m_editorClient);
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 void Page::setPagination(const Pagination& pagination) 379 void Page::setPagination(const Pagination& pagination)
381 { 380 {
382 if (m_pagination == pagination) 381 if (m_pagination == pagination)
383 return; 382 return;
384 383
385 m_pagination = pagination; 384 m_pagination = pagination;
386 385
387 setNeedsRecalcStyleInAllFrames(); 386 setNeedsRecalcStyleInAllFrames();
388 } 387 }
389 388
390 void Page::userStyleSheetLocationChanged()
391 {
392 // FIXME: Eventually we will move to a model of just being handed the sheet
393 // text instead of loading the URL ourselves.
394 KURL url = m_settings->userStyleSheetLocation();
395
396 m_didLoadUserStyleSheet = false;
397 m_userStyleSheet = String();
398
399 // Data URLs with base64-encoded UTF-8 style sheets are common. We can proce ss them
400 // synchronously and avoid using a loader.
401 if (url.protocolIsData() && url.string().startsWith("data:text/css;charset=u tf-8;base64,")) {
402 m_didLoadUserStyleSheet = true;
403
404 Vector<char> styleSheetAsUTF8;
405 if (base64Decode(decodeURLEscapeSequences(url.string().substring(35)), s tyleSheetAsUTF8, isSpaceOrNewline))
406 m_userStyleSheet = String::fromUTF8(styleSheetAsUTF8.data(), styleSh eetAsUTF8.size());
407 }
408
409 for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext() ) {
410 if (frame->document())
411 frame->document()->styleEngine()->updatePageUserSheet();
412 }
413 }
414
415 const String& Page::userStyleSheet() const
416 {
417 return m_userStyleSheet;
418 }
419
420 void Page::allVisitedStateChanged(PageGroup* group) 389 void Page::allVisitedStateChanged(PageGroup* group)
421 { 390 {
422 ASSERT(group); 391 ASSERT(group);
423 if (!allPages) 392 if (!allPages)
424 return; 393 return;
425 394
426 HashSet<Page*>::iterator pagesEnd = allPages->end(); 395 HashSet<Page*>::iterator pagesEnd = allPages->end();
427 for (HashSet<Page*>::iterator it = allPages->begin(); it != pagesEnd; ++it) { 396 for (HashSet<Page*>::iterator it = allPages->begin(); it != pagesEnd; ++it) {
428 Page* page = *it; 397 Page* page = *it;
429 if (page->m_group != group) 398 if (page->m_group != group)
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 , inspectorClient(0) 526 , inspectorClient(0)
558 , backForwardClient(0) 527 , backForwardClient(0)
559 { 528 {
560 } 529 }
561 530
562 Page::PageClients::~PageClients() 531 Page::PageClients::~PageClients()
563 { 532 {
564 } 533 }
565 534
566 } // namespace WebCore 535 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/Page.h ('k') | Source/core/page/Settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698